#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#

 set(popcornfx_version v2.9.9)

ly_add_target(
    NAME PopcornFX.Static STATIC
    NAMESPACE Gem
    FILES_CMAKE
        popcornfx_autogen_files.cmake
        popcornfx_shared_files.cmake
        ../Assets/popcornfx_asset_files.cmake
    COMPILE_DEFINITIONS
        PRIVATE
            LMBR_USE_PK
            PK_USE_PHYSX
            PK_USE_EMOTIONFX
            PK_USE_STARTINGPOINTINPUT
    INCLUDE_DIRECTORIES
        PRIVATE
            Source
            .
        PUBLIC
            Include
    BUILD_DEPENDENCIES
        PUBLIC
            3rdParty::PopcornFX
            Gem::LmbrCentral
            Gem::AtomLyIntegration_CommonFeatures.Static
            Gem::ScriptCanvas
            Gem::StartingPointInput
            Gem::EMotionFXStaticLib
            Gem::PhysX.Static
            3rdParty::PopcornFX
            AZ::AtomCore
            Gem::Atom_Utils.Static
            Gem::Atom_RPI.Public
            Gem::Atom_RHI.Public
            Gem::Atom_RHI.Reflect
    AUTOGEN_RULES
        *.ScriptCanvasGrammar.xml,ScriptCanvasGrammar_Header.jinja,$path/$fileprefix.generated.h
        *.ScriptCanvasGrammar.xml,ScriptCanvasGrammar_Source.jinja,$path/$fileprefix.generated.cpp
        *.ScriptCanvasNodeable.xml,ScriptCanvasNodeable_Header.jinja,$path/$fileprefix.generated.h
        *.ScriptCanvasNodeable.xml,ScriptCanvasNodeable_Source.jinja,$path/$fileprefix.generated.cpp
)

ly_add_target(
    NAME PopcornFX ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE}
    NAMESPACE Gem
    OUTPUT_NAME Gem.PopcornFX.${popcornfx_version}
    FILES_CMAKE
        popcornfx_files.cmake
    INCLUDE_DIRECTORIES
        PRIVATE
            Source
            .
        PUBLIC
            Include
    COMPILE_DEFINITIONS
        PRIVATE
            LMBR_USE_PK
            PK_USE_PHYSX
            PK_USE_EMOTIONFX
            PK_USE_STARTINGPOINTINPUT
    BUILD_DEPENDENCIES
        PRIVATE
            Gem::ScriptCanvas
            Gem::StartingPointInput
            Gem::LmbrCentral
            3rdParty::PopcornFX
            Gem::PopcornFX.Static
            Gem::LyShine.Static
)

ly_create_alias(NAME PopcornFX.Clients NAMESPACE Gem TARGETS Gem::PopcornFX)
ly_create_alias(NAME PopcornFX.Servers NAMESPACE Gem TARGETS Gem::PopcornFX)

if(PAL_TRAIT_BUILD_HOST_TOOLS)
    ly_add_target(
        NAME PopcornFX.Editor MODULE
        NAMESPACE Gem
        OUTPUT_NAME Gem.PopcornFX.Editor.${popcornfx_version}
        FILES_CMAKE
            popcornfx_editor_files.cmake
        INCLUDE_DIRECTORIES
            PRIVATE
                Source
                .
            PUBLIC
                Include
        COMPILE_DEFINITIONS
            PRIVATE
                POPCORNFX_EDITOR
                LMBR_USE_PK
                PK_USE_PHYSX
                PK_USE_EMOTIONFX
                PK_USE_STARTINGPOINTINPUT
        BUILD_DEPENDENCIES
            PRIVATE
                Gem::ScriptCanvas
                Gem::StartingPointInput
                Gem::LmbrCentral
                3rdParty::PopcornFX
                Gem::PopcornFX.Static
                AZ::AssetBuilderSDK
                AZ::AzFramework
                AZ::AzToolsFramework
                Gem::LyShine.Static
    )

    ly_create_alias(NAME PopcornFX.Builders NAMESPACE Gem TARGETS Gem::PopcornFX.Editor)
    ly_create_alias(NAME PopcornFX.Tools NAMESPACE Gem TARGETS Gem::PopcornFX.Editor)
endif()
