Skip to content

Commit 93a0935

Browse files
committed
Build gtest from source in CI
1 parent ec7e1d7 commit 93a0935

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

.appveyor.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ install:
2020
- conda config --set always_yes yes --set changeps1 no
2121
- conda update -q conda
2222
- conda info -a
23-
- conda install gtest cmake -c conda-forge
23+
- conda install cmake -c conda-forge
2424
- conda install xtensor=0.21.4 -c conda-forge
2525
- conda install m2w64-openblas -c msys2
2626
# Patch OpenBLASConfig.cmake
2727
- ps: (Get-Content $Env:MINICONDA\Library\mingw-w64\lib\cmake\openblas\OpenBLASConfig.cmake).replace('mingw64', 'mingw-w64') | Set-Content $Env:MINICONDA\Library\mingw-w64\lib\cmake\openblas\OpenBLASConfig.cmake
2828
- ps: (Get-Content $Env:MINICONDA\Library\mingw-w64\lib\cmake\openblas\OpenBLASConfig.cmake).replace('mingw32', 'mingw-w64') | Set-Content $Env:MINICONDA\Library\mingw-w64\lib\cmake\openblas\OpenBLASConfig.cmake
2929
- ps: (Get-Content $Env:MINICONDA\Library\mingw-w64\lib\cmake\openblas\OpenBLASConfig.cmake).replace('bin', 'lib') | Set-Content $Env:MINICONDA\Library\mingw-w64\lib\cmake\openblas\OpenBLASConfig.cmake
3030
- ps: (Get-Content $Env:MINICONDA\Library\mingw-w64\lib\cmake\openblas\OpenBLASConfig.cmake).replace('dll', 'dll.a') | Set-Content $Env:MINICONDA\Library\mingw-w64\lib\cmake\openblas\OpenBLASConfig.cmake
31-
- cmake -G "NMake Makefiles" -DOpenBLAS_DIR=%MINICONDA%\Library\mingw-w64\lib\cmake\openblas -DCMAKE_INSTALL_PREFIX=%MINICONDA%\Library -DBUILD_TESTS=ON .
31+
- cmake -G "NMake Makefiles" -DOpenBLAS_DIR=%MINICONDA%\Library\mingw-w64\lib\cmake\openblas -DCMAKE_INSTALL_PREFIX=%MINICONDA%\Library -DBUILD_TESTS=ON -DDOWNLOAD_GTEST=ON .
3232
- nmake test_xtensor_blas
3333
- cd test
3434

azure-pipelines.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ jobs:
3939
# Note: conda activate doesn't work here, because it creates a new shell!
4040
- script: |
4141
conda install cmake==3.14.0 ^
42-
gtest==1.10.0 ^
4342
mkl-devel ^
4443
ninja ^
4544
xtensor=0.21.4 ^
@@ -66,6 +65,7 @@ jobs:
6665
-DCMAKE_C_COMPILER=clang-cl ^
6766
-DCMAKE_CXX_COMPILER=clang-cl ^
6867
-DBUILD_TESTS=ON ^
68+
-DDOWNLOAD_GTEST=ON ^
6969
$(Build.SourcesDirectory)
7070
displayName: "Configure xtensor-blas"
7171
workingDirectory: $(Build.BinariesDirectory)

test/CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
6969
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_cxx_std_flag} -march=native -Wunused-parameter -Wextra -Wreorder -Wconversion -Wsign-conversion")
7070
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wold-style-cast -Wunused-variable")
7171
else() # We are using clang-cl
72-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_cxx_std_flag} /EHsc /MP /bigobj")
72+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_cxx_std_flag} /EHsc /MP /bigobj -Wno-unused-command-line-argument")
7373
set(CMAKE_EXE_LINKER_FLAGS /MANIFEST:NO)
7474
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
7575
add_definitions(-D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING)
@@ -99,6 +99,8 @@ if(DOWNLOAD_GTEST OR GTEST_SRC_DIR)
9999
message(FATAL_ERROR "Build step for googletest failed: ${result}")
100100
endif()
101101

102+
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
103+
102104
# Add googletest directly to our build. This defines
103105
# the gtest and gtest_main targets.
104106
add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/googletest-src

0 commit comments

Comments
 (0)