Skip to content

Commit

Permalink
Merge pull request #200 from bigladder/add-unit-tests
Browse files Browse the repository at this point in the history
Convert unit tests to googletest
  • Loading branch information
nealkruis authored Feb 26, 2024
2 parents 4609465 + 10663ef commit f90302f
Show file tree
Hide file tree
Showing 33 changed files with 3,423 additions and 3,537 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ add_subdirectory(vendor)
add_subdirectory(src)

if (${PROJECT_NAME}_BUILD_TESTING)
add_subdirectory(test)
add_subdirectory(test)
if (${PROJECT_NAME}_COVERAGE)
coverage_evaluate()
endif ()
Expand Down
26 changes: 13 additions & 13 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,36 +32,36 @@ set(library_sources
option(${PROJECT_NAME}_STATIC_LIB "Make ${PROJECT_NAME} a static library" ON)

if (${PROJECT_NAME}_STATIC_LIB)
add_library(libHPWHsim STATIC ${library_sources}) # TODO: Change name to ${PROJECT_NAME}
set_target_properties(libHPWHsim PROPERTIES COMPILE_FLAGS "-D${PROJECT_NAME}_STATIC_DEFINE")
add_library(${PROJECT_NAME} STATIC ${library_sources}) # TODO: Change name to ${PROJECT_NAME}
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-D${PROJECT_NAME}_STATIC_DEFINE")
else ()
set(CMAKE_MACOSX_RPATH 1)
add_library(libHPWHsim SHARED ${library_sources})
add_library(${PROJECT_NAME} SHARED ${library_sources})
endif ()

target_include_directories(libHPWHsim PUBLIC ${PROJECT_SOURCE_DIR}/src ${PROJECT_BINARY_DIR}/src)
target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_BINARY_DIR}/src ${PROJECT_SOURCE_DIR}/src)

target_link_libraries(libHPWHsim PRIVATE ${PROJECT_NAME}_common_interface PUBLIC btwxt)
target_compile_features(libHPWHsim PRIVATE cxx_std_17)
target_link_libraries(${PROJECT_NAME} PRIVATE ${PROJECT_NAME}_common_interface PUBLIC btwxt)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)

include(GenerateExportHeader)
generate_export_header(libHPWHsim)
generate_export_header(${PROJECT_NAME})


add_dependencies(libHPWHsim ${PROJECT_NAME}_version_header)
add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}_version_header)

set_target_properties(libHPWHsim PROPERTIES OUTPUT_NAME HPWHsim)
set_target_properties(libHPWHsim PROPERTIES PDB_NAME libHPWHsim)
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME})
set_target_properties(${PROJECT_NAME} PROPERTIES PDB_NAME ${PROJECT_NAME})

# If MSVC_RUNTIME_LIBRARY is not by a parent project use the default.
# It's not clear why this is needed, since documentation indicates it
# should be happening with the CMP0091 policy set to NEW.
get_target_property(RTL libHPWHsim MSVC_RUNTIME_LIBRARY)
get_target_property(RTL ${PROJECT_NAME} MSVC_RUNTIME_LIBRARY)
if ("${RTL}" STREQUAL "RTL-NOTFOUND")
set_target_properties(libHPWHsim PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
set_target_properties(${PROJECT_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
endif ()

if (${PROJECT_NAME}_COVERAGE)
add_coverage(libHPWHsim)
add_coverage(${PROJECT_NAME})
endif ()

Loading

0 comments on commit f90302f

Please sign in to comment.