Skip to content

Commit 382dea2

Browse files
Added guard:ehcont for 64bit windows (#99)
- Added security flag guard:ehcont for MSVC. - Updated wininit script to use Visual Studio 2019 as default generator. - Re-enabled vcpkg tests now that rapidjson has been updated.
1 parent eaccf16 commit 382dea2

File tree

3 files changed

+127
-122
lines changed

3 files changed

+127
-122
lines changed

Build/AzureDevOps/azure-pipelines.yml

+121-121
Original file line numberDiff line numberDiff line change
@@ -62,85 +62,85 @@ jobs:
6262
testResultsFiles: built\Out\windows_$(buildPlatform)\$(buildConfiguration)\GLTFSDK.Test\GLTFSDK.Test.log
6363
condition: and(succeeded(), in(variables['buildPlatform'], 'Win32', 'x64'))
6464

65-
# - job: WindowsVcPkg_VS2019
66-
67-
# pool:
68-
# vmImage: 'windows-2019'
69-
70-
# strategy:
71-
# matrix:
72-
# Win32-Release:
73-
# buildPlatform: Win32
74-
# buildConfiguration: Release
75-
# vcpkgTriplet: x86-windows
76-
# Win32-Debug:
77-
# buildPlatform: Win32
78-
# buildConfiguration: Debug
79-
# vcpkgTriplet: x86-windows
80-
# x64-Release:
81-
# buildPlatform: x64
82-
# buildConfiguration: Release
83-
# vcpkgTriplet: x64-windows
84-
# x64-Debug:
85-
# buildPlatform: x64
86-
# buildConfiguration: Debug
87-
# vcpkgTriplet: x64-windows
88-
# ARM-Release:
89-
# buildPlatform: ARM
90-
# buildConfiguration: Release
91-
# vcpkgTriplet: arm-windows
92-
# ARM-Debug:
93-
# buildPlatform: ARM
94-
# buildConfiguration: Debug
95-
# vcpkgTriplet: arm-windows
96-
# ARM64-Release:
97-
# buildPlatform: ARM64
98-
# buildConfiguration: Release
99-
# vcpkgTriplet: arm64-windows
100-
# ARM64-Debug:
101-
# buildPlatform: ARM64
102-
# buildConfiguration: Debug
103-
# vcpkgTriplet: arm64-windows
104-
105-
# workspace:
106-
# clean: all
107-
108-
# variables:
109-
# vcpkgRoot: "C:/vcpkg/scripts/buildsystems/vcpkg.cmake"
110-
111-
# steps:
112-
# - powershell: vcpkg install --triplet "$(vcpkgTriplet)" rapidjson gtest
113-
# displayName: Install packages with VcPkg
114-
115-
# - task: CMake@1
116-
# inputs:
117-
# workingDirectory: 'built\Int\cmake_$(buildPlatform)'
118-
# cmakeArgs: '..\..\.. -G "Visual Studio 16 2019" -A "$(buildPlatform)" -DCMAKE_TOOLCHAIN_FILE="$(vcpkgRoot)" -DVCPKG_TARGET_TRIPLET="$(vcpkgTriplet)"'
119-
120-
# - task: CMake@1
121-
# inputs:
122-
# workingDirectory: 'built\Int\cmake_$(buildPlatform)'
123-
# cmakeArgs: '--build . --target install --config $(buildConfiguration) -- /m'
124-
125-
# # copy googletest related dll files
126-
# - task: CopyFiles@2
127-
# inputs:
128-
# sourceFolder: 'built\Int\cmake_$(buildPlatform)\GLTFSDK.Test\$(buildConfiguration)'
129-
# contents: 'gtest*.dll'
130-
# targetFolder: 'built\Out\windows_$(buildPlatform)\$(buildConfiguration)\GLTFSDK.Test'
131-
# overWrite: true
132-
# condition: in(variables['buildPlatform'], 'Win32', 'x64')
133-
134-
# - script: .\GLTFSDK.Test.exe --gtest_output=xml:GLTFSDK.Test.log
135-
# workingDirectory: built\Out\windows_$(buildPlatform)\$(buildConfiguration)\GLTFSDK.Test
136-
# displayName: Running Unit Tests
137-
# condition: and(succeeded(), in(variables['buildPlatform'], 'Win32', 'x64'))
138-
139-
# - task: PublishTestResults@2
140-
# inputs:
141-
# testResultsFormat: 'JUnit'
142-
# testResultsFiles: built\Out\windows_$(buildPlatform)\$(buildConfiguration)\GLTFSDK.Test\GLTFSDK.Test.log
143-
# condition: and(succeeded(), in(variables['buildPlatform'], 'Win32', 'x64'))
65+
- job: WindowsVcPkg_VS2019
66+
67+
pool:
68+
vmImage: 'windows-2019'
69+
70+
strategy:
71+
matrix:
72+
Win32-Release:
73+
buildPlatform: Win32
74+
buildConfiguration: Release
75+
vcpkgTriplet: x86-windows
76+
Win32-Debug:
77+
buildPlatform: Win32
78+
buildConfiguration: Debug
79+
vcpkgTriplet: x86-windows
80+
x64-Release:
81+
buildPlatform: x64
82+
buildConfiguration: Release
83+
vcpkgTriplet: x64-windows
84+
x64-Debug:
85+
buildPlatform: x64
86+
buildConfiguration: Debug
87+
vcpkgTriplet: x64-windows
88+
ARM-Release:
89+
buildPlatform: ARM
90+
buildConfiguration: Release
91+
vcpkgTriplet: arm-windows
92+
ARM-Debug:
93+
buildPlatform: ARM
94+
buildConfiguration: Debug
95+
vcpkgTriplet: arm-windows
96+
ARM64-Release:
97+
buildPlatform: ARM64
98+
buildConfiguration: Release
99+
vcpkgTriplet: arm64-windows
100+
ARM64-Debug:
101+
buildPlatform: ARM64
102+
buildConfiguration: Debug
103+
vcpkgTriplet: arm64-windows
104+
105+
workspace:
106+
clean: all
107+
108+
variables:
109+
vcpkgRoot: "C:/vcpkg/scripts/buildsystems/vcpkg.cmake"
110+
111+
steps:
112+
- powershell: vcpkg install --triplet "$(vcpkgTriplet)" rapidjson gtest
113+
displayName: Install packages with VcPkg
114+
115+
- task: CMake@1
116+
inputs:
117+
workingDirectory: 'built\Int\cmake_$(buildPlatform)'
118+
cmakeArgs: '..\..\.. -G "Visual Studio 16 2019" -A "$(buildPlatform)" -DCMAKE_TOOLCHAIN_FILE="$(vcpkgRoot)" -DVCPKG_TARGET_TRIPLET="$(vcpkgTriplet)"'
119+
120+
- task: CMake@1
121+
inputs:
122+
workingDirectory: 'built\Int\cmake_$(buildPlatform)'
123+
cmakeArgs: '--build . --target install --config $(buildConfiguration) -- /m'
124+
125+
# copy googletest related dll files
126+
- task: CopyFiles@2
127+
inputs:
128+
sourceFolder: 'built\Int\cmake_$(buildPlatform)\GLTFSDK.Test\$(buildConfiguration)'
129+
contents: 'gtest*.dll'
130+
targetFolder: 'built\Out\windows_$(buildPlatform)\$(buildConfiguration)\GLTFSDK.Test'
131+
overWrite: true
132+
condition: in(variables['buildPlatform'], 'Win32', 'x64')
133+
134+
- script: .\GLTFSDK.Test.exe --gtest_output=xml:GLTFSDK.Test.log
135+
workingDirectory: built\Out\windows_$(buildPlatform)\$(buildConfiguration)\GLTFSDK.Test
136+
displayName: Running Unit Tests
137+
condition: and(succeeded(), in(variables['buildPlatform'], 'Win32', 'x64'))
138+
139+
- task: PublishTestResults@2
140+
inputs:
141+
testResultsFormat: 'JUnit'
142+
testResultsFiles: built\Out\windows_$(buildPlatform)\$(buildConfiguration)\GLTFSDK.Test\GLTFSDK.Test.log
143+
condition: and(succeeded(), in(variables['buildPlatform'], 'Win32', 'x64'))
144144

145145
- job: MacOS
146146

@@ -180,50 +180,50 @@ jobs:
180180
testResultsFormat: 'JUnit'
181181
testResultsFiles: built/Out/$(buildPlatform)/$(buildConfiguration)/GLTFSDK.Test/GLTFSDK.Test.log
182182

183-
# - job: MacOSVcPkg
183+
- job: MacOSVcPkg
184184

185-
# pool:
186-
# vmImage: 'macOS-10.15'
185+
pool:
186+
vmImage: 'macOS-10.15'
187187

188-
# strategy:
189-
# matrix:
190-
# macOS-Release:
191-
# buildPlatform: macOS
192-
# buildConfiguration: Release
193-
# vcpkgTriplet: x64-osx
194-
# macOS-Debug:
195-
# buildPlatform: macOS
196-
# buildConfiguration: Debug
197-
# vcpkgTriplet: x64-osx
198-
199-
# workspace:
200-
# clean: all
201-
202-
# steps:
203-
# - task: Bash@3
204-
# inputs:
205-
# targetType: 'inline'
206-
# script: vcpkg install --triplet "$(vcpkgTriplet)" rapidjson gtest
207-
# displayName: Install packages with VcPkg
208-
209-
# - task: CMake@1
210-
# inputs:
211-
# workingDirectory: 'built/Int/cmake_$(buildPlatform)'
212-
# cmakeArgs: '../../.. -G Xcode -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake'
213-
214-
# - task: CMake@1
215-
# inputs:
216-
# workingDirectory: 'built/Int/cmake_$(buildPlatform)'
217-
# cmakeArgs: '--build . --target install --config $(buildConfiguration)'
218-
219-
# - script: ./GLTFSDK.Test --gtest_output=xml:GLTFSDK.Test.log
220-
# workingDirectory: built/Out/$(buildPlatform)/$(buildConfiguration)/GLTFSDK.Test
221-
# displayName: Running Unit Tests
222-
223-
# - task: PublishTestResults@2
224-
# inputs:
225-
# testResultsFormat: 'JUnit'
226-
# testResultsFiles: built/Out/$(buildPlatform)/$(buildConfiguration)/GLTFSDK.Test/GLTFSDK.Test.log
188+
strategy:
189+
matrix:
190+
macOS-Release:
191+
buildPlatform: macOS
192+
buildConfiguration: Release
193+
vcpkgTriplet: x64-osx
194+
macOS-Debug:
195+
buildPlatform: macOS
196+
buildConfiguration: Debug
197+
vcpkgTriplet: x64-osx
198+
199+
workspace:
200+
clean: all
201+
202+
steps:
203+
- task: Bash@3
204+
inputs:
205+
targetType: 'inline'
206+
script: vcpkg install --triplet "$(vcpkgTriplet)" rapidjson gtest
207+
displayName: Install packages with VcPkg
208+
209+
- task: CMake@1
210+
inputs:
211+
workingDirectory: 'built/Int/cmake_$(buildPlatform)'
212+
cmakeArgs: '../../.. -G Xcode -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake'
213+
214+
- task: CMake@1
215+
inputs:
216+
workingDirectory: 'built/Int/cmake_$(buildPlatform)'
217+
cmakeArgs: '--build . --target install --config $(buildConfiguration)'
218+
219+
- script: ./GLTFSDK.Test --gtest_output=xml:GLTFSDK.Test.log
220+
workingDirectory: built/Out/$(buildPlatform)/$(buildConfiguration)/GLTFSDK.Test
221+
displayName: Running Unit Tests
222+
223+
- task: PublishTestResults@2
224+
inputs:
225+
testResultsFormat: 'JUnit'
226+
testResultsFiles: built/Out/$(buildPlatform)/$(buildConfiguration)/GLTFSDK.Test/GLTFSDK.Test.log
227227

228228
- job: iOS
229229

Build/Scripts/wininit.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function GeneratePlatform($platform, $path)
4242
try
4343
{
4444
$argList = @(
45-
"-G", "Visual Studio 15 2017",
45+
"-G", "Visual Studio 16 2019",
4646
"-A", "$platform"
4747
)
4848

GLTFSDK/CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ if (MSVC)
2828
# Set warning level to 4 (/W4)
2929
target_compile_options(GLTFSDK PRIVATE "/Zi;/W4;/EHsc")
3030

31+
if((MSVC_VERSION GREATER 1920) AND (CMAKE_SIZEOF_VOID_P EQUAL 8))
32+
target_compile_options(GLTFSDK PRIVATE "$<$<CONFIG:RELEASE>:/guard:ehcont>")
33+
target_link_options(GLTFSDK PRIVATE "$<$<CONFIG:RELEASE>:/guard:ehcont>")
34+
endif()
35+
3136
# Make sure that all PDB files on Windows are installed to the output folder with the libraries. By default, only the debug build does this.
3237
set_target_properties(GLTFSDK PROPERTIES COMPILE_PDB_NAME "GLTFSDK" COMPILE_PDB_OUTPUT_DIRECTORY "${LIBRARY_OUTPUT_DIRECTORY}")
3338
endif()

0 commit comments

Comments
 (0)