// Juliet - Lib/Dll
//------------------------------------------------------------------------------
{
    .ProjectName        = 'Juliet'
    .ProjectPath        = 'Juliet'
    .JulietIncludePath = ' "-IJuliet/include"'
                       + ' "-IJuliet/src"'
                       + ' "-IExternal/imgui"'
                       + ' "-IExternal/imgui/backends"'


    // 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            + .JulietIncludePath
            .CompilerOptions            + ' -DJULIET_EXPORT'
                
            #if __WINDOWS__
                .CompilerOptions            + ' -DJULIET_WIN32'
            #endif

            // Output
            .CompilerOutputPath         = '$OutputBase$/$ProjectPath$/'
        }

        // --- DLL BUILD ---
        DLL( '$ProjectName$-Lib-$Platform$-$BuildConfigName$' )
        {
            .Libraries      = { '$ProjectName$-Objs-$Platform$-$BuildConfigName$' }
            If ( .BuildConfigName != 'Release' )
            {
                ^Libraries      + { 'ImGui-Lib-$Platform$-$BuildConfigName$' }
            }

            .LinkerOutput   = '$BinPath$/$Platform$-$BuildConfigName$/$ProjectName$.dll' // Output .dll to Bin
            
            #if __WINDOWS__
                .LinkerOptions          + ' /DLL' 
                .LinkerOptions          + .CommonWinLibs
                                        + ' imm32.lib'
                                        + ' shell32.lib'
                                        + ' dwmapi.lib'
                                        + ' d3dcompiler.lib'


                .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
    }
}