Skip to content

Commit

Permalink
Merge pull request #50 from project-tsurugi/wip/i_622_cmake_env
Browse files Browse the repository at this point in the history
add ENABLE_ALTIMETER to CMakeLists.txt and related portions
  • Loading branch information
ban-nobuhiro authored Feb 7, 2024
2 parents 10d6860 + 376b145 commit 4cf3574
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ option(BUILD_SHARED_LIBS "build shared libraries instead of static" ON)
option(ENABLE_GOOGLE_PERFTOOLS "Enable Google Perftools" OFF)
option(PERFORMANCE_TOOLS "Enable tooling to measure engine performance" OFF)
option(TRACY_ENABLE "enable tracy profiler" OFF)
option(ENABLE_ALTIMETER "enable altimeter logging" OFF)

if (ENABLE_GOOGLE_PERFTOOLS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_GOOGLE_PERFTOOLS")
Expand Down Expand Up @@ -65,6 +66,10 @@ else()
message(FATAL_ERROR "unsupported RECOVERY_SORTER_KVSLIB value: ${RECOVERY_SORTER_KVSLIB_UPPERCASE}")
endif()
find_package(nlohmann_json 3.7.0 REQUIRED)
if (ENABLE_ALTIMETER)
find_package(altimeter REQUIRED)
find_package(fmt REQUIRED)
endif()

add_subdirectory(third_party) # should be before enable_testing()

Expand Down
5 changes: 5 additions & 0 deletions cmake/CompileOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,8 @@ endif()
if(BUILD_SHIRAKAMI_WP)
add_definitions(-DBUILD_SHIRAKAMI_WP)
endif()

if(ENABLE_ALTIMETER)
message("altimeter enabled")
add_definitions(-DENABLE_ALTIMETER)
endif()
6 changes: 6 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ target_link_libraries(${package_name}
PRIVATE nlohmann_json::nlohmann_json
)

if (ENABLE_ALTIMETER)
target_link_libraries(${package_name}
PRIVATE altimeter
)
endif()

set_compile_options(${package_name})

install_custom(${package_name} ${export_name})
Expand Down

0 comments on commit 4cf3574

Please sign in to comment.