generated from LizardByte/template-base
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
02ea25d
commit 22abcdf
Showing
5 changed files
with
77 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
cmake_minimum_required(VERSION 3.13) | ||
# https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md#foundational-c-support | ||
|
||
project(test_moonlight) | ||
|
||
include_directories("${CMAKE_SOURCE_DIR}") | ||
|
||
enable_testing() | ||
|
||
# Add GoogleTest directory to the project | ||
set(GTEST_SOURCE_DIR "${CMAKE_SOURCE_DIR}/third-party/googletest") | ||
set(INSTALL_GTEST OFF) | ||
set(INSTALL_GMOCK OFF) | ||
add_subdirectory("${GTEST_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/googletest") | ||
include_directories("${GTEST_SOURCE_DIR}/googletest/include" "${GTEST_SOURCE_DIR}") | ||
|
||
# coverage | ||
# https://gcovr.com/en/stable/guide/compiling.html#compiler-options | ||
set(CMAKE_CXX_FLAGS "-fprofile-arcs -ftest-coverage -ggdb -O0") | ||
set(CMAKE_C_FLAGS "-fprofile-arcs -ftest-coverage -ggdb -O0") | ||
|
||
# if windows | ||
if (WIN32) | ||
# For Windows: Prevent overriding the parent project's compiler/linker settings | ||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) # cmake-lint: disable=C0103 | ||
endif () | ||
|
||
file(GLOB_RECURSE TEST_SOURCES CONFIGURE_DEPENDS | ||
${CMAKE_SOURCE_DIR}/tests/*.h | ||
${CMAKE_SOURCE_DIR}/tests/*.cpp) | ||
|
||
# remove main.cpp from the list of sources | ||
# TODO | ||
# list(REMOVE_ITEM MOONLIGHT_SOURCES ${CMAKE_SOURCE_DIR}/src/main.cpp) | ||
|
||
add_executable(${PROJECT_NAME} | ||
${TEST_SOURCES} | ||
${MOONLIGHT_SOURCES}) | ||
|
||
foreach(dep ${MOONLIGHT_TARGET_DEPENDENCIES}) | ||
add_dependencies(${PROJECT_NAME} ${dep}) # compile these before Moonlight | ||
endforeach() | ||
|
||
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 20) | ||
target_link_libraries(${PROJECT_NAME} | ||
${MOONLIGHT_EXTERNAL_LIBRARIES} | ||
gtest | ||
gtest_main) # if we use this we don't need our own main function | ||
target_compile_definitions(${PROJECT_NAME} PUBLIC ${MOONLIGHT_DEFINITIONS} ${TEST_DEFINITIONS}) | ||
target_compile_options(${PROJECT_NAME} PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${MOONLIGHT_COMPILE_OPTIONS}>) | ||
target_link_options(${PROJECT_NAME} PRIVATE) | ||
|
||
add_test(NAME ${PROJECT_NAME} COMMAND moonlight_test) |
Submodule googletest
added at
b514bd