Skip to content

Commit 189ce02

Browse files
committed
compile GLFW library statically on WINDOWS
1 parent c5af138 commit 189ce02

5 files changed

Lines changed: 239 additions & 14 deletions

File tree

src/Carnage3D.sln

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ Microsoft Visual Studio Solution File, Format Version 12.00
44
VisualStudioVersion = 15.0.28307.645
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Carnage3D", "Carnage3D.vcxproj", "{169827B7-D0C3-481E-900C-A57549CBD984}"
7+
ProjectSection(ProjectDependencies) = postProject
8+
{4A74163F-7D76-46EB-92BF-05C50173D846} = {4A74163F-7D76-46EB-92BF-05C50173D846}
9+
EndProjectSection
710
EndProject
811
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Box2D", "Box2D\Box2D.vcxproj", "{8701FDAE-68BB-4D20-851B-9E7B1B5DAE62}"
912
EndProject
13+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GLFW", "GLFW\GLFW.vcxproj", "{4A74163F-7D76-46EB-92BF-05C50173D846}"
14+
EndProject
1015
Global
1116
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1217
Debug|x64 = Debug|x64
@@ -31,6 +36,14 @@ Global
3136
{8701FDAE-68BB-4D20-851B-9E7B1B5DAE62}.Release|x64.Build.0 = Release|x64
3237
{8701FDAE-68BB-4D20-851B-9E7B1B5DAE62}.Release|x86.ActiveCfg = Release|Win32
3338
{8701FDAE-68BB-4D20-851B-9E7B1B5DAE62}.Release|x86.Build.0 = Release|Win32
39+
{4A74163F-7D76-46EB-92BF-05C50173D846}.Debug|x64.ActiveCfg = Debug|x64
40+
{4A74163F-7D76-46EB-92BF-05C50173D846}.Debug|x64.Build.0 = Debug|x64
41+
{4A74163F-7D76-46EB-92BF-05C50173D846}.Debug|x86.ActiveCfg = Debug|Win32
42+
{4A74163F-7D76-46EB-92BF-05C50173D846}.Debug|x86.Build.0 = Debug|Win32
43+
{4A74163F-7D76-46EB-92BF-05C50173D846}.Release|x64.ActiveCfg = Release|x64
44+
{4A74163F-7D76-46EB-92BF-05C50173D846}.Release|x64.Build.0 = Release|x64
45+
{4A74163F-7D76-46EB-92BF-05C50173D846}.Release|x86.ActiveCfg = Release|Win32
46+
{4A74163F-7D76-46EB-92BF-05C50173D846}.Release|x86.Build.0 = Release|Win32
3447
EndGlobalSection
3548
GlobalSection(SolutionProperties) = preSolution
3649
HideSolutionNode = FALSE

src/Carnage3D.vcxproj

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,16 @@
9090
<WarningLevel>Level3</WarningLevel>
9191
<Optimization>Disabled</Optimization>
9292
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
93-
<AdditionalIncludeDirectories>$(SDKDIR)\glew\include;$(SDKDIR)\GLFW\include;$(SDKDIR)\GLM\include;$(SolutionDir)..\third_party\Box2D;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
93+
<AdditionalIncludeDirectories>$(SDKDIR)\glew\include;$(SDKDIR)\GLM\include;$(SolutionDir)..\third_party\Box2D;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
9494
</ClCompile>
9595
<Link>
9696
<SubSystem>Console</SubSystem>
9797
<GenerateDebugInformation>true</GenerateDebugInformation>
98-
<AdditionalLibraryDirectories>$(SDKDIR)/GLFW/lib-vc2015;$(SDKDIR)/glew/lib/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
99-
<AdditionalDependencies>opengl32.lib;glfw3dll.lib;glew32.lib;%(AdditionalDependencies)</AdditionalDependencies>
98+
<AdditionalLibraryDirectories>$(SDKDIR)/glew/lib/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
99+
<AdditionalDependencies>opengl32.lib;glew32.lib;%(AdditionalDependencies)</AdditionalDependencies>
100100
</Link>
101101
<PostBuildEvent>
102-
<Command>copy "$(SDKDIR)\glew\lib\x86\glew32.dll" "$(TargetDir)"
103-
copy "$(SDKDIR)\glfw\lib-vc2015\glfw3.dll" "$(TargetDir)"</Command>
102+
<Command>copy "$(SDKDIR)\glew\lib\x86\glew32.dll" "$(TargetDir)"</Command>
104103
</PostBuildEvent>
105104
</ItemDefinitionGroup>
106105
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@@ -123,19 +122,18 @@ copy "$(SDKDIR)\glfw\lib-vc2015\glfw3.dll" "$(TargetDir)"</Command>
123122
<FunctionLevelLinking>true</FunctionLevelLinking>
124123
<IntrinsicFunctions>true</IntrinsicFunctions>
125124
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
126-
<AdditionalIncludeDirectories>$(SDKDIR)\glew\include;$(SDKDIR)\GLFW\include;$(SDKDIR)\GLM\include;$(SolutionDir)..\third_party\Box2D;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
125+
<AdditionalIncludeDirectories>$(SDKDIR)\glew\include;$(SDKDIR)\GLM\include;$(SolutionDir)..\third_party\Box2D;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
127126
</ClCompile>
128127
<Link>
129128
<SubSystem>Console</SubSystem>
130129
<EnableCOMDATFolding>true</EnableCOMDATFolding>
131130
<OptimizeReferences>true</OptimizeReferences>
132131
<GenerateDebugInformation>true</GenerateDebugInformation>
133-
<AdditionalLibraryDirectories>$(SDKDIR)/GLFW/lib-vc2015;$(SDKDIR)/glew/lib/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
134-
<AdditionalDependencies>opengl32.lib;glfw3dll.lib;glew32.lib;%(AdditionalDependencies)</AdditionalDependencies>
132+
<AdditionalLibraryDirectories>$(SDKDIR)/glew/lib/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
133+
<AdditionalDependencies>opengl32.lib;glew32.lib;%(AdditionalDependencies)</AdditionalDependencies>
135134
</Link>
136135
<PostBuildEvent>
137-
<Command>copy "$(SDKDIR)\glew\lib\x86\glew32.dll" "$(TargetDir)"
138-
copy "$(SDKDIR)\glfw\lib-vc2015\glfw3.dll" "$(TargetDir)"</Command>
136+
<Command>copy "$(SDKDIR)\glew\lib\x86\glew32.dll" "$(TargetDir)"</Command>
139137
</PostBuildEvent>
140138
</ItemDefinitionGroup>
141139
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -308,6 +306,9 @@ copy "$(SDKDIR)\glfw\lib-vc2015\glfw3.dll" "$(TargetDir)"</Command>
308306
<ProjectReference Include="Box2D\Box2D.vcxproj">
309307
<Project>{8701fdae-68bb-4d20-851b-9e7b1b5dae62}</Project>
310308
</ProjectReference>
309+
<ProjectReference Include="GLFW\GLFW.vcxproj">
310+
<Project>{4a74163f-7d76-46eb-92bf-05c50173d846}</Project>
311+
</ProjectReference>
311312
</ItemGroup>
312313
<ItemGroup>
313314
<None Include="..\gamedata\config\inputs.json.default" />

src/GLFW/GLFW.vcxproj

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|Win32">
9+
<Configuration>Release</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Debug|x64">
13+
<Configuration>Debug</Configuration>
14+
<Platform>x64</Platform>
15+
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|x64">
17+
<Configuration>Release</Configuration>
18+
<Platform>x64</Platform>
19+
</ProjectConfiguration>
20+
</ItemGroup>
21+
<ItemGroup>
22+
<ClCompile Include="context.c" />
23+
<ClCompile Include="egl_context.c" />
24+
<ClCompile Include="init.c" />
25+
<ClCompile Include="input.c" />
26+
<ClCompile Include="monitor.c" />
27+
<ClCompile Include="osmesa_context.c" />
28+
<ClCompile Include="vulkan.c" />
29+
<ClCompile Include="wgl_context.c" />
30+
<ClCompile Include="win32_init.c" />
31+
<ClCompile Include="win32_joystick.c" />
32+
<ClCompile Include="win32_monitor.c" />
33+
<ClCompile Include="win32_thread.c" />
34+
<ClCompile Include="win32_time.c" />
35+
<ClCompile Include="win32_window.c" />
36+
<ClCompile Include="window.c" />
37+
</ItemGroup>
38+
<ItemGroup>
39+
<ClInclude Include="egl_context.h" />
40+
<ClInclude Include="glfw3.h" />
41+
<ClInclude Include="glfw3native.h" />
42+
<ClInclude Include="glfw_config.h" />
43+
<ClInclude Include="internal.h" />
44+
<ClInclude Include="mappings.h" />
45+
<ClInclude Include="osmesa_context.h" />
46+
<ClInclude Include="wgl_context.h" />
47+
<ClInclude Include="win32_joystick.h" />
48+
<ClInclude Include="win32_platform.h" />
49+
</ItemGroup>
50+
<PropertyGroup Label="Globals">
51+
<VCProjectVersion>15.0</VCProjectVersion>
52+
<ProjectGuid>{4A74163F-7D76-46EB-92BF-05C50173D846}</ProjectGuid>
53+
<Keyword>Win32Proj</Keyword>
54+
<RootNamespace>GLFW</RootNamespace>
55+
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
56+
</PropertyGroup>
57+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
58+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
59+
<ConfigurationType>StaticLibrary</ConfigurationType>
60+
<UseDebugLibraries>true</UseDebugLibraries>
61+
<PlatformToolset>v140</PlatformToolset>
62+
<CharacterSet>NotSet</CharacterSet>
63+
</PropertyGroup>
64+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
65+
<ConfigurationType>StaticLibrary</ConfigurationType>
66+
<UseDebugLibraries>false</UseDebugLibraries>
67+
<PlatformToolset>v140</PlatformToolset>
68+
<WholeProgramOptimization>true</WholeProgramOptimization>
69+
<CharacterSet>NotSet</CharacterSet>
70+
</PropertyGroup>
71+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
72+
<ConfigurationType>StaticLibrary</ConfigurationType>
73+
<UseDebugLibraries>true</UseDebugLibraries>
74+
<PlatformToolset>v141</PlatformToolset>
75+
<CharacterSet>Unicode</CharacterSet>
76+
</PropertyGroup>
77+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
78+
<ConfigurationType>StaticLibrary</ConfigurationType>
79+
<UseDebugLibraries>false</UseDebugLibraries>
80+
<PlatformToolset>v141</PlatformToolset>
81+
<WholeProgramOptimization>true</WholeProgramOptimization>
82+
<CharacterSet>Unicode</CharacterSet>
83+
</PropertyGroup>
84+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
85+
<ImportGroup Label="ExtensionSettings">
86+
</ImportGroup>
87+
<ImportGroup Label="Shared">
88+
</ImportGroup>
89+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
90+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
91+
</ImportGroup>
92+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
93+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
94+
</ImportGroup>
95+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
96+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
97+
</ImportGroup>
98+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
99+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
100+
</ImportGroup>
101+
<PropertyGroup Label="UserMacros" />
102+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
103+
<LinkIncremental>true</LinkIncremental>
104+
</PropertyGroup>
105+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
106+
<LinkIncremental>true</LinkIncremental>
107+
</PropertyGroup>
108+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
109+
<LinkIncremental>false</LinkIncremental>
110+
</PropertyGroup>
111+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
112+
<LinkIncremental>false</LinkIncremental>
113+
</PropertyGroup>
114+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
115+
<ClCompile>
116+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
117+
<WarningLevel>Level3</WarningLevel>
118+
<Optimization>Disabled</Optimization>
119+
<SDLCheck>true</SDLCheck>
120+
<PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
121+
<ConformanceMode>true</ConformanceMode>
122+
<PrecompiledHeaderFile />
123+
</ClCompile>
124+
<Link>
125+
<SubSystem>Windows</SubSystem>
126+
<GenerateDebugInformation>true</GenerateDebugInformation>
127+
</Link>
128+
</ItemDefinitionGroup>
129+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
130+
<ClCompile>
131+
<PrecompiledHeader>Use</PrecompiledHeader>
132+
<WarningLevel>Level3</WarningLevel>
133+
<Optimization>Disabled</Optimization>
134+
<SDLCheck>true</SDLCheck>
135+
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
136+
<ConformanceMode>true</ConformanceMode>
137+
</ClCompile>
138+
<Link>
139+
<SubSystem>Windows</SubSystem>
140+
<GenerateDebugInformation>true</GenerateDebugInformation>
141+
</Link>
142+
</ItemDefinitionGroup>
143+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
144+
<ClCompile>
145+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
146+
<WarningLevel>Level3</WarningLevel>
147+
<Optimization>MaxSpeed</Optimization>
148+
<FunctionLevelLinking>true</FunctionLevelLinking>
149+
<IntrinsicFunctions>true</IntrinsicFunctions>
150+
<SDLCheck>true</SDLCheck>
151+
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
152+
<ConformanceMode>true</ConformanceMode>
153+
<PrecompiledHeaderFile />
154+
</ClCompile>
155+
<Link>
156+
<SubSystem>Windows</SubSystem>
157+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
158+
<OptimizeReferences>true</OptimizeReferences>
159+
<GenerateDebugInformation>true</GenerateDebugInformation>
160+
</Link>
161+
</ItemDefinitionGroup>
162+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
163+
<ClCompile>
164+
<PrecompiledHeader>Use</PrecompiledHeader>
165+
<WarningLevel>Level3</WarningLevel>
166+
<Optimization>MaxSpeed</Optimization>
167+
<FunctionLevelLinking>true</FunctionLevelLinking>
168+
<IntrinsicFunctions>true</IntrinsicFunctions>
169+
<SDLCheck>true</SDLCheck>
170+
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
171+
<ConformanceMode>true</ConformanceMode>
172+
</ClCompile>
173+
<Link>
174+
<SubSystem>Windows</SubSystem>
175+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
176+
<OptimizeReferences>true</OptimizeReferences>
177+
<GenerateDebugInformation>true</GenerateDebugInformation>
178+
</Link>
179+
</ItemDefinitionGroup>
180+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
181+
<ImportGroup Label="ExtensionTargets">
182+
</ImportGroup>
183+
</Project>

src/GLFW/GLFW.vcxproj.filters

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<ClCompile Include="context.c" />
5+
<ClCompile Include="egl_context.c" />
6+
<ClCompile Include="init.c" />
7+
<ClCompile Include="input.c" />
8+
<ClCompile Include="monitor.c" />
9+
<ClCompile Include="osmesa_context.c" />
10+
<ClCompile Include="vulkan.c" />
11+
<ClCompile Include="wgl_context.c" />
12+
<ClCompile Include="win32_init.c" />
13+
<ClCompile Include="win32_joystick.c" />
14+
<ClCompile Include="win32_monitor.c" />
15+
<ClCompile Include="win32_thread.c" />
16+
<ClCompile Include="win32_time.c" />
17+
<ClCompile Include="win32_window.c" />
18+
<ClCompile Include="window.c" />
19+
</ItemGroup>
20+
<ItemGroup>
21+
<ClInclude Include="egl_context.h" />
22+
<ClInclude Include="glfw_config.h" />
23+
<ClInclude Include="glfw3.h" />
24+
<ClInclude Include="glfw3native.h" />
25+
<ClInclude Include="internal.h" />
26+
<ClInclude Include="mappings.h" />
27+
<ClInclude Include="osmesa_context.h" />
28+
<ClInclude Include="wgl_context.h" />
29+
<ClInclude Include="win32_joystick.h" />
30+
<ClInclude Include="win32_platform.h" />
31+
</ItemGroup>
32+
</Project>

src/stdafx.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,7 @@ inline void SafeDeleteArray(TElement*& elementPointer)
6868
#include <GL/glew.h>
6969
#include <GL/gl.h>
7070

71-
#if OS_NAME == OS_WINDOWS
72-
#include <GLFW/glfw3.h>
73-
#else
7471
#include "GLFW/glfw3.h"
75-
#endif
7672

7773
// glm
7874
#define GLM_ENABLE_EXPERIMENTAL

0 commit comments

Comments
 (0)