Skip to content

Commit 43c0ae3

Browse files
committed
Support running MSVC build on AppVeyour
1 parent 10799ab commit 43c0ae3

File tree

4 files changed

+88
-5
lines changed

4 files changed

+88
-5
lines changed

appveyor.yml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
version: '{build}'
2+
3+
os: Visual Studio 2015
4+
5+
environment:
6+
matrix:
7+
- Toolset: v140
8+
- Toolset: v120
9+
- Toolset: v110
10+
- Toolset: v100
11+
12+
platform:
13+
- Win32
14+
- x64
15+
16+
configuration:
17+
# - Release
18+
- Debug
19+
20+
build:
21+
verbosity: minimal
22+
23+
artifacts:
24+
- path: '_build/Testing/Temporary/*'
25+
name: test_results
26+
27+
before_build:
28+
- ps: |
29+
Write-Output "Configuration: $env:CONFIGURATION"
30+
Write-Output "Platform: $env:PLATFORM"
31+
$generator = switch ($env:TOOLSET)
32+
{
33+
"v140" {"Visual Studio 14 2015"}
34+
"v120" {"Visual Studio 12 2013"}
35+
"v110" {"Visual Studio 11 2012"}
36+
"v100" {"Visual Studio 10 2010"}
37+
}
38+
if ($env:PLATFORM -eq "x64")
39+
{
40+
$generator = "$generator Win64"
41+
}
42+
43+
build_script:
44+
- ps: |
45+
if (($env:TOOLSET -eq "v100") -and ($env:PLATFORM -eq "x64"))
46+
{
47+
return
48+
}
49+
md _build -Force | Out-Null
50+
cd _build
51+
52+
& cmake -G "$generator" -DCMAKE_CONFIGURATION_TYPES="Debug;Release" -Dgtest_build_tests=ON -Dgtest_build_samples=ON -Dgmock_build_tests=ON ..
53+
if ($LastExitCode -ne 0) {
54+
throw "Exec: $ErrorMessage"
55+
}
56+
& cmake --build . --config $env:CONFIGURATION
57+
if ($LastExitCode -ne 0) {
58+
throw "Exec: $ErrorMessage"
59+
}
60+
61+
test_script:
62+
- ps: |
63+
if (($env:Toolset -eq "v100") -and ($env:PLATFORM -eq "x64"))
64+
{
65+
return
66+
}
67+
68+
& ctest -C $env:CONFIGURATION --output-on-failure
69+
if ($LastExitCode -ne 0) {
70+
throw "Exec: $ErrorMessage"
71+
}

googletest/cmake/internal_utils.cmake

+14-2
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ macro(config_compiler_and_linker)
8080
# http://stackoverflow.com/questions/3232669 explains the issue.
8181
set(cxx_base_flags "${cxx_base_flags} -wd4702")
8282
endif()
83+
if (NOT (MSVC_VERSION GREATER 1900)) # 1900 is Visual Studio 2015
84+
# BigObj required for tests.
85+
set(cxx_base_flags "${cxx_base_flags} -bigobj")
86+
endif()
8387

8488
set(cxx_base_flags "${cxx_base_flags} -D_UNICODE -DUNICODE -DWIN32 -D_WIN32")
8589
set(cxx_base_flags "${cxx_base_flags} -DSTRICT -DWIN32_LEAN_AND_MEAN")
@@ -235,8 +239,16 @@ function(py_test name)
235239
# directly bind it from cmake. ${CTEST_CONFIGURATION_TYPE} is known
236240
# only at ctest runtime (by calling ctest -c <Configuration>), so
237241
# we have to escape $ to delay variable substitution here.
238-
add_test(${name}
239-
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py
242+
if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1)
243+
add_test(
244+
NAME ${name}
245+
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py
246+
--build_dir=${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>)
247+
else (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1)
248+
add_test(
249+
${name}
250+
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py
240251
--build_dir=${CMAKE_CURRENT_BINARY_DIR}/\${CTEST_CONFIGURATION_TYPE})
252+
endif (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1)
241253
endif()
242254
endfunction()

googletest/test/gtest_list_tests_unittest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
TypedTest/0\. # TypeParam = (VeryLo{245}|class VeryLo{239})\.\.\.
7272
TestA
7373
TestB
74-
TypedTest/1\. # TypeParam = int\s*\*
74+
TypedTest/1\. # TypeParam = int\s*\*( __ptr64)?
7575
TestA
7676
TestB
7777
TypedTest/2\. # TypeParam = .*MyArray<bool,\s*42>
@@ -80,7 +80,7 @@
8080
My/TypeParamTest/0\. # TypeParam = (VeryLo{245}|class VeryLo{239})\.\.\.
8181
TestA
8282
TestB
83-
My/TypeParamTest/1\. # TypeParam = int\s*\*
83+
My/TypeParamTest/1\. # TypeParam = int\s*\*( __ptr64)?
8484
TestA
8585
TestB
8686
My/TypeParamTest/2\. # TypeParam = .*MyArray<bool,\s*42>

travis.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ cmake -Dgtest_build_samples=ON \
1212
-DCMAKE_CXX_FLAGS=$CXX_FLAGS \
1313
../../$GTEST_TARGET
1414
make
15-
make test
15+
CTEST_OUTPUT_ON_FAILURE=1 make test

0 commit comments

Comments
 (0)