Merge pull request #1 from RadWolfie/opt-unit-test

CMake: Make unit test optional & nv2a_vsh_emulator public for external project usage
This commit is contained in:
Erik Abair 2022-06-24 19:26:30 -07:00 committed by GitHub
commit 71b2265efc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,14 +4,17 @@ project(nv2a_vsh_cpu)
set(CMAKE_VERBOSE_MAKEFILE TRUE)
enable_testing()
set(CMAKE_CXX_STANDARD 17)
include(CMakePushCheckState)
set(_CMAKE_PROCESSING_LANGUAGE "C")
include(CheckSymbolExists)
include (ExternalProject)
include(FindPkgConfig)
option(nv2a_vsh_cpu_UNIT_TEST "Enable nv2a_vsh_cpu's various unit tests" ON)
# Unit Test's requirement ----------------------------
if (nv2a_vsh_cpu_UNIT_TEST)
include(FindPkgConfig)
find_package(
Boost 1.74
COMPONENTS
@ -21,6 +24,7 @@ find_package(
set(GENERATED_FILES_DIR "${CMAKE_BINARY_DIR}/generated")
include_directories("${Boost_INCLUDE_DIR}" "${GENERATED_FILES_DIR}")
endif()
set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -O0")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
@ -59,7 +63,7 @@ add_library(
target_include_directories(
nv2a_vsh_emulator
PRIVATE
PUBLIC
src
)
@ -71,7 +75,9 @@ target_link_libraries(
add_dependencies(nv2a_vsh_emulator nv2a_vsh_cpu nv2a_vsh_disassembler)
# Tests ----------------------------------------------
# Unit Tests -----------------------------------------
if (nv2a_vsh_cpu_UNIT_TEST)
enable_testing()
add_executable(
operations_tests
test/operations/test_main.cpp
@ -130,3 +136,4 @@ target_link_libraries(
)
add_test(NAME emulator_tests COMMAND emulator_tests)
add_dependencies(emulator_tests nv2a_vsh_emulator)
endif()