Просмотр исходного кода

Added new "Polycode.props" file to default win32 c++ template

* This property sheet file contains common defaults for building a polycode project

* Now, a user can just load the Polycode.props file in a fresh visual studio project and get a lot closer to building with fewer manual steps

* Added "PolycodeDir" variable to Polycode.props that can be pointed at the installed polycode framework directory.

* This currently points to the same relative path that the old template did, need to find a clean way to let users override this.  Environment variable?  One of the manual steps when setting up a new project?  Some voodoo to find the current polycode install dir?

* The "VC++ Directories" config now live in Polycode.props, and are relative to the "PolycodeDir" variable.  The proper include and lib dirs will now inherit by default in a new project.  This wouldn't be possible if polycode was still installing to seperate Release/Debug dirs (maybe it is supposed to and the cmake defaults in git don't do this?)

* Added user variables for the static libraries needed for both Release and Debug targets.  All libraries are then rolled up in to a single "PolycodeLibsDebug" and "PolycoreLibsRelease" variable, which the user will need to manually add to their "Linker/Input" properties.  This is the only manual step required on a fresh visual studio project.

* The static library variables are as follows:

  * PolycodeLibs[Debug|Release]: Shortcut to all below libraries
  * PolycodeCoreLibs[Debug|Release]: The polycore library
  * PolycodeDependLibs[Debug|Release]: All dependency libraries (freetype, libpng, etc)
  * PolycodeWinLibs[Debug|Release]: All windows libraries needed by polycode (opengl, glu32, winsock, etc)

* Added "WIN32" and "_WINDOWS" preprocessor definitions to Polycode.props, so that all projects will pass those on.  Now, only "_DEBUG" and "NDEBUG" are left configured in the Debug|Release targets, and I assume the user can safely leave those out?

* Added "Windows" as the default subsystem to use for linking to Polycode.props

* Added the following other misc configs to Polycode.props, not sure if these should be there or if they just happened to be helpful common defaults in the current template solution:

  * Compile/Warning Level: Level3
  * Linker/Generate Debug Info: True

* Set all of the above configuration values to "inherit" in the project solution (as they would be in a vanilla project) and left behind only the existing tweaks unique to Debug|Release targets.

* TODO:

  * Better way to get PolycodeDir?

  * Verify whether or not the new polycode release will push to discrete Debug|Release dirs for the lib and include directories?

  * Custom post-build step to always push pak and dll files to project Debug|Release build dirs?  (This would cut down on forum posts from people who forget to do this, and could be disabled by anyone who wants to do this themselves or use an alternate dll etc)
Danny Warren 13 лет назад
Родитель
Сommit
3ca1c97881

+ 60 - 0
Assets/Templates/C++/Windows/Polycode.props

@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ImportGroup Label="PropertySheets" />
+  <PropertyGroup Label="UserMacros">
+    <PolycodeDir>$(SolutionDir)..\..</PolycodeDir>
+    <PolycodeCoreLibsDebug>Polycore_d.lib</PolycodeCoreLibsDebug>
+    <PolycodeCoreLibsRelease>Polycore.lib</PolycodeCoreLibsRelease>
+    <PolycodeDependLibsDebug>freetype_d.lib;liboggd.lib;libpng15_staticd.lib;libvorbisd.lib;libvorbisfiled.lib;lua5.1d.lib;OpenAL32d.lib;physfsd.lib;zlibd.lib;zlibstaticd.lib</PolycodeDependLibsDebug>
+    <PolycodeDependLibsRelease>freetype.lib;libogg.lib;libpng15_static.lib;libvorbis.lib;libvorbisfile.lib;lua5.1.lib;OpenAL32.lib;physfs.lib;zlib.lib;zlibstatic.lib</PolycodeDependLibsRelease>
+    <PolycodeWinLibsDebug>opengl32.lib;glu32.lib;winmm.lib;ws2_32.lib</PolycodeWinLibsDebug>
+    <PolycodeWinLibsRelease>opengl32.lib;glu32.lib;winmm.lib;ws2_32.lib</PolycodeWinLibsRelease>
+    <PolycodeLibsDebug>$(PolycodeCoreLibsDebug);$(PolycodeDependLibsDebug);$(PolycodeWinLibsDebug)</PolycodeLibsDebug>
+    <PolycodeLibsRelease>$(PolycodeCoreLibsRelease);$(PolycodeDependLibsRelease);$(PolycodeWinLibsRelease)</PolycodeLibsRelease>
+  </PropertyGroup>
+  <PropertyGroup>
+    <IncludePath>$(PolycodeDir)\Core\include;$(PolycodeDir)\Core\Dependencies\include;$(PolycodeDir)\Core\PolycodeView;$(PolycodeDir)\Core\Dependencies\include\AL;$(IncludePath)</IncludePath>
+  </PropertyGroup>
+  <PropertyGroup>
+    <LibraryPath>$(PolycodeDir)\Core\lib;$(PolycodeDir)\Core\Dependencies\lib;$(LibraryPath)</LibraryPath>
+  </PropertyGroup>
+  <ItemDefinitionGroup>
+    <ClCompile>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <WarningLevel>Level3</WarningLevel>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <BuildMacro Include="PolycodeDir">
+      <Value>$(PolycodeDir)</Value>
+    </BuildMacro>
+    <BuildMacro Include="PolycodeCoreLibsDebug">
+      <Value>$(PolycodeCoreLibsDebug)</Value>
+    </BuildMacro>
+    <BuildMacro Include="PolycodeCoreLibsRelease">
+      <Value>$(PolycodeCoreLibsRelease)</Value>
+    </BuildMacro>
+    <BuildMacro Include="PolycodeDependLibsDebug">
+      <Value>$(PolycodeDependLibsDebug)</Value>
+    </BuildMacro>
+    <BuildMacro Include="PolycodeDependLibsRelease">
+      <Value>$(PolycodeDependLibsRelease)</Value>
+    </BuildMacro>
+    <BuildMacro Include="PolycodeWinLibsDebug">
+      <Value>$(PolycodeWinLibsDebug)</Value>
+    </BuildMacro>
+    <BuildMacro Include="PolycodeWinLibsRelease">
+      <Value>$(PolycodeWinLibsRelease)</Value>
+    </BuildMacro>
+    <BuildMacro Include="PolycodeLibsDebug">
+      <Value>$(PolycodeLibsDebug)</Value>
+    </BuildMacro>
+    <BuildMacro Include="PolycodeLibsRelease">
+      <Value>$(PolycodeLibsRelease)</Value>
+    </BuildMacro>
+  </ItemGroup>
+</Project>

+ 6 - 12
Assets/Templates/C++/Windows/PolycodeTemplate.vcxproj

@@ -32,52 +32,46 @@
   </ImportGroup>
   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="Polycode.props" />
   </ImportGroup>
   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="Polycode.props" />
   </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <LinkIncremental>true</LinkIncremental>
-    <IncludePath>$(SolutionDir)..\..\Core\include;$(SolutionDir)..\..\Core\Dependencies\include;$(SolutionDir)..\..\Core\PolycodeView;$(SolutionDir)..\..\Core\Dependencies\include\AL;$(IncludePath)</IncludePath>
-    <LibraryPath>$(SolutionDir)..\..\Core\lib;$(SolutionDir)..\..\Core\Dependencies\lib;$(LibraryPath)</LibraryPath>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <LinkIncremental>false</LinkIncremental>
-    <IncludePath>$(SolutionDir)..\..\Core\Include;$(SolutionDir)..\..\Core\Dependencies\Include;$(SolutionDir)..\..\Core\Dependencies\Include\AL;$(IncludePath)</IncludePath>
-    <LibraryPath>$(SolutionDir)..\..\Core\lib;$(SolutionDir)..\..\Core\Dependencies\lib;$(LibraryPath)</LibraryPath>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <PrecompiledHeader>
       </PrecompiledHeader>
-      <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
     </ClCompile>
     <Link>
-      <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>winmm.lib;ws2_32.lib;opengl32.lib;glu32.lib;Polycore_d.lib;zlibd.lib;freetype_d.lib;liboggd.lib;libvorbisd.lib;libvorbisfiled.lib;OpenAL32d.lib;kernel32.lib;physfsd.lib;libpng15_staticd.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(PolycodeLibsDebug);%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <ClCompile>
-      <WarningLevel>Level3</WarningLevel>
       <PrecompiledHeader>
       </PrecompiledHeader>
       <Optimization>MaxSpeed</Optimization>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
-      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <Link>
-      <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>winmm.lib;ws2_32.lib;opengl32.lib;glu32.lib;Polycore.lib;zlib.lib;freetype.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;OpenAL32.lib;kernel32.lib;physfs.lib;libpng15_static.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(PolycodeLibsRelease);%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>