// Game - Lib/Dll
//------------------------------------------------------------------------------
{
    .ProjectName        = 'Game'
    .ProjectPath        = 'Game'

    .GAME_DLL_NAME = '$ProjectName$'
    #if exists( GAME_BUILD_ID )
    {
        #import GAME_BUILD_ID
        ^GAME_DLL_NAME + '-$GAME_BUILD_ID$'
    }
    #endif

    // Library
    //--------------------------------------------------------------------------
    ForEach( .BuildConfig in .BuildConfigs )
    {
        Using( .BuildConfig )
        .OutputBase + '\$Platform$-$BuildConfigName$'

        // Unity
        //--------------------------------------------------------------------------
        Unity( '$ProjectName$-Unity-$Platform$-$BuildConfigName$' )
        {
            .UnityInputPath             = '$ProjectPath$/'
            .UnityOutputPath            = '$OutputBase$/$ProjectPath$/'
            .UnityOutputPattern         = '$ProjectName$_Unity*.cpp'
        }

        // Library
        //--------------------------------------------------------------------------
        ObjectList( '$ProjectName$-Objs-$Platform$-$BuildConfigName$' )
        {
            // Input (Unity)
            .CompilerInputUnity         = '$ProjectName$-Unity-$Platform$-$BuildConfigName$'

            // Extra Compiler Options
            .CompilerOptions            + ' "-IJuliet/include"'
                                        + ' "-IGame"'
            .CompilerOptions            + ' -DJULIET_EXPORT'

            #if __WINDOWS__
                .CompilerOptions        + ' -DJULIET_WIN32'
            #endif
            .CompilerOutputPath         = '$OutputBase$/$ProjectPath$/'
        }

        DLL( '$ProjectName$-Lib-$Platform$-$BuildConfigName$' )
        {
            .Libraries      = { '$ProjectName$-Objs-$Platform$-$BuildConfigName$',
                                'Juliet-Lib-$Platform$-$BuildConfigName$' } // Link Juliet (Lib or Import Lib)

            #if exists( GAME_DLL_NAME )
                .LinkerOutput   = '$BinPath$/$Platform$-$BuildConfigName$/$GAME_DLL_NAME$.dll'
            #else
                .LinkerOutput   = '$BinPath$/$Platform$-$BuildConfigName$/$ProjectName$.dll'
            #endif
            
            #if __WINDOWS__
                .LinkerOptions              + ' /DLL'
                .LinkerOptions              + .CommonWinLibs

                .CRTLibs = .CRTLibs_Dynamic
                If ( .BuildConfigName == 'Debug' )
                {
                    ^CRTLibs = .CRTLibs_DynamicDebug
                }
                .LinkerOptions              + .CRTLibs
            #endif
        }

        Alias( '$ProjectName$-$Platform$-$BuildConfigName$' ) { .Targets = '$ProjectName$-Lib-$Platform$-$BuildConfigName$' }
        ^'Targets_$Platform$_$BuildConfigName$' + { '$ProjectName$-$Platform$-$BuildConfigName$' }

        #if __WINDOWS__
            .ProjectConfig              = [ Using( .'Project_$Platform$_$BuildConfigName$' ) .Target = '$ProjectName$-$Platform$-$BuildConfigName$' ]
            ^ProjectConfigs             + .ProjectConfig
        #endif
    }

    VCXProject( '$ProjectName$' )
    {
        .ProjectOutput              = '$ProjectPath$/$ProjectName$.vcxproj'
        .ProjectBasePath            = '$ProjectPath$/'
        .ProjectInputPaths          = .ProjectBasePath
        .ProjectConfigs             = .ProjectConfigs
    }
}