// Romeo - Documentation Tool executable
//------------------------------------------------------------------------------
{
    .ProjectName        = 'Romeo'
    .ProjectPath        = 'Romeo'
    .JulietIncludePath  = ' "-IJuliet/include"'
                        + ' "-IJuliet/src"'
                        + ' "-IExternal/imgui"'

    .ProjectDefPath     = '$_WORKING_DIR_$/$ProjectName$/$ProjectName$.def'

    // Unity
    //--------------------------------------------------------------------------
    Unity( '$ProjectName$-Unity' )
    {
        .UnityInputPath             = '$ProjectPath$/src/'
        .UnityOutputPath            = 'Intermediate/$ProjectPath$/'
        .UnityOutputPattern         = '$ProjectName$_Unity*.cpp'
        .UnityMaxFiles              = 5
        .UnityPBRoot                = ''
    }

    // Library
    //--------------------------------------------------------------------------
    ForEach( .BuildConfig in .BuildConfigs )
    {
        Using( .BuildConfig )

        .OutputBase + '\$Platform$-$BuildConfigName$'

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

            // Extra Compiler Options
            .CompilerOptions            + .JulietIncludePath

            #if __WINDOWS__
            .CompilerOptions            + ' -DJULIET_WIN32'
            #endif

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

        #if __WINDOWS__
            .ManifestFile = '$OutputBase$/$ProjectPath$/$ProjectName$$ExeExtension$.manifest.tmp'
        #endif

        // Executable
        //--------------------------------------------------------------------------
        Executable( '$ProjectName$-Exe-$Platform$-$BuildConfigName$' )
        {
            .Libraries                  = {
                                            'Romeo-Lib-$Platform$-$BuildConfigName$',
                                            'Juliet-Lib-$Platform$-$BuildConfigName$'
                                          }
            If ( .BuildConfigName != 'Release' )
            {
                ^Libraries              + { 'ImGui-Lib-$Platform$-$BuildConfigName$' }
            }

            .LinkerOutput               = '$BinPath$/$Platform$-$BuildConfigName$/$ProjectName$$ExeExtension$'

            #if __WINDOWS__
                .LinkerOptions              + .CommonWinLibs
                .LinkerOptions              + ' winhttp.lib'

                // Chose appropriate CRT
                .CRTLibs = .CRTLibs_Dynamic
                If ( .BuildConfigName == 'Debug' )
                {
                    ^CRTLibs = .CRTLibs_DynamicDebug
                }
                .LinkerOptions               + .CRTLibs

                // Romeo uses WINDOWS subsystem so it has no console window by default
                .SubSystem                   = ' /SUBSYSTEM:WINDOWS'
                // Even in debug we might want WINDOWS to keep it background, but console helps for printf
                If ( .BuildConfigName == 'Debug' )
                {
                    ^SubSystem                   = ' /SUBSYSTEM:CONSOLE' // We use console in debug
                }
                .LinkerOptions              + .SubSystem

                // Manifest
                .LinkerAssemblyResources    = .ManifestFile
                .LinkerOptions              + ' /MANIFEST:EMBED'
            #endif
        }

        Alias( '$ProjectName$-$Platform$-$BuildConfigName$' ) { .Targets = '$ProjectName$-Exe-$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
    }
}
