Build tests and tools with Hunter
parent
48ec3ef458
commit
5087348a37
|
@ -0,0 +1,26 @@
|
|||
FROM ubuntu:20.04
|
||||
|
||||
ARG TOOLCHAIN_NAME=gcc-9-cxx17-fpic
|
||||
ARG BUILD_TYPE=RelWithDebInfo
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
cmake \
|
||||
gcc-9 \
|
||||
g++-9 \
|
||||
ca-certificates \
|
||||
make
|
||||
|
||||
WORKDIR /root/assimp
|
||||
COPY ./cmake ./cmake
|
||||
COPY ./cmake-modules ./cmake-modules
|
||||
COPY ./code ./code
|
||||
COPY ./include ./include
|
||||
COPY ./samples ./samples
|
||||
COPY ./test ./test
|
||||
COPY ./tools ./tools
|
||||
COPY ./*.in ./
|
||||
COPY CMakeLists.txt ./
|
||||
|
||||
RUN cmake -DBUILD_SHARED_LIBS=OFF -DASSIMP_BUILD_ASSIMP_TOOLS=ON -DASSIMP_BUILD_SAMPLES=OFF -DASSIMP_BUILD_TESTS=ON -DASSIMP_INSTALL_PDB=OFF -DASSIMP_IGNORE_GIT_HASH=ON -DASSIMP_HUNTER_ENABLED=ON -H. -B_builds/${TOOLCHAIN_NAME}-${BUILD_TYPE} -DCMAKE_TOOLCHAIN_FILE=./cmake/polly/${TOOLCHAIN_NAME}.cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
|
||||
|
||||
RUN make -C _builds/${TOOLCHAIN_NAME}-${BUILD_TYPE} -j 4
|
|
@ -39,12 +39,18 @@
|
|||
cmake_minimum_required( VERSION 3.0 )
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
${Assimp_SOURCE_DIR}/contrib/gtest/include
|
||||
${Assimp_SOURCE_DIR}/contrib/gtest/
|
||||
${Assimp_SOURCE_DIR}/test/unit
|
||||
${Assimp_SOURCE_DIR}/include
|
||||
${Assimp_SOURCE_DIR}/code
|
||||
)
|
||||
|
||||
if(NOT ASSIMP_HUNTER_ENABLED)
|
||||
INCLUDE_DIRECTORIES(
|
||||
${Assimp_SOURCE_DIR}/contrib/gtest/include
|
||||
${Assimp_SOURCE_DIR}/contrib/gtest/
|
||||
)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING")
|
||||
endif()
|
||||
|
@ -197,7 +203,6 @@ SOURCE_GROUP( UnitTests\\Math FILES ${MATH} )
|
|||
SOURCE_GROUP( UnitTests\\PostProcess FILES ${POST_PROCESSES})
|
||||
|
||||
add_executable( unit
|
||||
../contrib/gtest/src/gtest-all.cc
|
||||
unit/CCompilerTest.c
|
||||
unit/Main.cpp
|
||||
../code/Common/Version.cpp
|
||||
|
@ -208,6 +213,14 @@ add_executable( unit
|
|||
${POST_PROCESSES}
|
||||
)
|
||||
|
||||
if(ASSIMP_HUNTER_ENABLED)
|
||||
hunter_add_package(GTest)
|
||||
find_package(GTest CONFIG REQUIRED)
|
||||
target_link_libraries(unit GTest::gtest_main GTest::gmock)
|
||||
else()
|
||||
target_sources(unit PUBLIC ../contrib/gtest/src/gtest-all.cc)
|
||||
endif()
|
||||
|
||||
TARGET_USE_COMMON_OUTPUT_DIRECTORY(unit)
|
||||
|
||||
add_definitions(-DASSIMP_TEST_MODELS_DIR="${CMAKE_CURRENT_LIST_DIR}/models")
|
||||
|
@ -222,7 +235,7 @@ ELSE()
|
|||
ENDIF()
|
||||
|
||||
IF(MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
ENDIF()
|
||||
|
||||
target_link_libraries( unit assimp ${platform_libs} )
|
||||
|
@ -230,4 +243,3 @@ target_link_libraries( unit assimp ${platform_libs} )
|
|||
add_subdirectory(headercheck)
|
||||
|
||||
add_test( unittests unit )
|
||||
|
||||
|
|
Loading…
Reference in New Issue