Skip to content

Commit 7a14938

Browse files
committed
Build gtest from source in CI
1 parent 22d822a commit 7a14938

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
@@ -41,7 +41,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
4141
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_cxx_std_flag} -march=native -Wunused-parameter -Wextra -Wreorder -Wconversion -Wsign-conversion")
4242
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wold-style-cast -Wunused-variable")
4343
else() # We are using clang-cl
44-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_cxx_std_flag} /EHsc /MP /bigobj")
44+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_cxx_std_flag} /EHsc /MP /bigobj -Wno-unused-command-line-argument")
4545
set(CMAKE_EXE_LINKER_FLAGS /MANIFEST:NO)
4646
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
4747
add_definitions(-D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING)
@@ -71,6 +71,8 @@ if(DOWNLOAD_GTEST OR GTEST_SRC_DIR)
7171
message(FATAL_ERROR "Build step for googletest failed: ${result}")
7272
endif()
7373

74+
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
75+
7476
# Add googletest directly to our build. This defines
7577
# the gtest and gtest_main targets.
7678
add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/googletest-src

0 commit comments

Comments
 (0)