<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <LinkIncremental Condition="'$(Configuration)'=='Debug'">true</LinkIncremental>
    <LinkIncremental Condition="'$(Configuration)'=='Release'">false</LinkIncremental>
  </PropertyGroup>
  <ItemDefinitionGroup>
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>

      <!-- Use latest version of the C++ draft -->
      <LanguageStandard>stdcpplatest</LanguageStandard>

      <!-- Always multiprocessor, never minimal rebuild -->
      <MultiProcessorCompilation>true</MultiProcessorCompilation>
      <MinimalRebuild>false</MinimalRebuild>

      <!-- We should use %(RelativeDir) here but for some reason it's an _absolute_ dir. WTF. -->
      <ObjectFileName>$(IntDir)/%(Directory)/</ObjectFileName>

      <AdditionalIncludeDirectories>
          $(LolDir)\src;
          $(LolDir)\src\3rdparty\bullet3\src;
          $(LolDir)\tools\lolunit;
          $(PegtlIncludes);
          $(ImguiIncludes);
          $(BtPhysIncludes);
          %(AdditionalIncludeDirectories)
      </AdditionalIncludeDirectories>

      <AdditionalIncludeDirectories Condition="'$(Platform)'=='Win32' Or '$(Platform)'=='x64'">
          $(GlIncludes);
          $(SdlIncludes);
          $(FfmpegIncludes);
          $(AssimpIncludes);
          $(XinputIncludes);
          %(AdditionalIncludeDirectories)
      </AdditionalIncludeDirectories>

      <PreprocessorDefinitions>
          NOMINMAX;
          _CRT_SECURE_NO_WARNINGS;
          B3_USE_CLEW;
          LUA_ANSI;
          %(PreprocessorDefinitions)
      </PreprocessorDefinitions>

      <!-- Escape backslashes for C++, but replace \ with / on the PS4
           because the SCE VSI seems to have trouble with backslashes -->
      <PreprocessorDefinitions Condition="'$(Platform)'!='Orbis'">LOL_CONFIG_PROJECTDIR="$(ProjectDir.Replace('\','\\'))";%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <PreprocessorDefinitions Condition="'$(Platform)'!='Orbis'">LOL_CONFIG_SOLUTIONDIR="$(SolutionDir.Replace('\','\\'))";%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <PreprocessorDefinitions Condition="'$(Platform)'=='Orbis'">LOL_CONFIG_PROJECTDIR="$(ProjectDir.Replace('\','/'))";%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <PreprocessorDefinitions Condition="'$(Platform)'=='Orbis'">LOL_CONFIG_SOLUTIONDIR="$(SolutionDir.Replace('\','/'))";%(PreprocessorDefinitions)</PreprocessorDefinitions>

      <PreprocessorDefinitions Condition="'$(Platform)'=='Win32'">WIN32;$(Win32Defines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <PreprocessorDefinitions Condition="'$(Platform)'=='x64'">WIN32;$(Win32Defines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <PreprocessorDefinitions Condition="'$(Platform)'=='Orbis'">$(OrbisDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ClCompile>
    <ClCompile Condition="'$(Configuration)'=='Debug'">
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <Optimization>Disabled</Optimization>
      <RuntimeLibrary Condition="'$(Platform)'=='Win32' Or '$(Platform)'=='x64'">MultiThreadedDebugDLL</RuntimeLibrary>
      <PreprocessorDefinitions>_DEBUG;LOL_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ClCompile>
    <ClCompile Condition="'$(Configuration)'=='Release'">
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <!-- For Microsoft tools -->
      <Optimization>MaxSpeed</Optimization>
      <!-- For PlayStation tools -->
      <OptimizationLevel>Level2</OptimizationLevel>

      <RuntimeLibrary Condition="'$(Platform)'=='Win32' Or '$(Platform)'=='x64'">MultiThreadedDLL</RuntimeLibrary>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <PreprocessorDefinitions>NDEBUG;LOL_RELEASE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ClCompile>

    <Link>
      <!-- FIXME: not for the static library! -->
      <AdditionalDependencies Condition="'$(Platform)'=='Win32' Or '$(Platform)'=='x64'">kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;$(SdlDeps);$(FfmpegDeps);$(AssimpDeps);$(LibGccDeps);$(GdiDeps);$(XinputDeps);$(GlDeps);%(AdditionalDependencies)</AdditionalDependencies>
      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
      <AdditionalLibraryDirectories Condition="'$(Platform)'=='Win32' Or '$(Platform)'=='x64'">$(LibGccLibs);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <AdditionalLibraryDirectories Condition="'$(Platform)'=='Win32' Or '$(Platform)'=='x64'">$(SdlLibs);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <AdditionalLibraryDirectories Condition="'$(Platform)'=='Win32' Or '$(Platform)'=='x64'">$(FfmpegLibs);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <AdditionalLibraryDirectories Condition="'$(Platform)'=='Win32' Or '$(Platform)'=='x64'">$(AssimpLibs);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <AdditionalLibraryDirectories Condition="'$(Platform)'=='Win32' Or '$(Platform)'=='x64'">$(GlLibs);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <AdditionalLibraryDirectories Condition="'$(Platform)'=='Win32' Or '$(Platform)'=='x64'">$(XinputLibs);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <AdditionalLibraryDirectories Condition="'$(Platform)'=='Orbis'">$(OrbisLibs);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <AdditionalDependencies Condition="'$(Platform)'=='Orbis'">$(OrbisDeps);%(AdditionalDependencies)</AdditionalDependencies>
    </Link>
    <Link Condition="'$(Platform)'=='Win32' Or '$(Platform)'=='x64'">
      <SubSystem Condition="'$(enable_sdl)'!='no'">Windows</SubSystem>
      <SubSystem Condition="'$(enable_sdl)'=='no'">Console</SubSystem>
    </Link>
    <Link Condition="'$(Configuration)'=='Debug'">
      <GenerateDebugInformation>true</GenerateDebugInformation>
    </Link>
    <Link Condition="'$(Configuration)'=='Release'">
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <OptimizeReferences>true</OptimizeReferences>
    </Link>

    <!-- Post-build hook to run commands -->
    <PostBuildEvent Condition="'$(Platform)'=='Win32' Or '$(Platform)'=='x64'">
      <Command Condition="'$(enable_sdl)'!='no'">
        rem do nothing
      </Command>
    </PostBuildEvent>

  </ItemDefinitionGroup>
</Project>
