120 lines
4.5 KiB
CMake
120 lines
4.5 KiB
CMake
cmake_minimum_required(VERSION 3.20)
|
|
|
|
project(polymech-cli
|
|
VERSION 0.1.0
|
|
DESCRIPTION "Polymech C++ CLI"
|
|
LANGUAGES CXX C
|
|
)
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/dist")
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_SOURCE_DIR}/dist")
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_SOURCE_DIR}/dist")
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_SOURCE_DIR}/dist")
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_SOURCE_DIR}/dist")
|
|
|
|
# ── C++ standard ─────────────────────────────────────────────────────────────
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
# ── Dependencies ─────────────────────────────────────────────────────────────
|
|
include(FetchContent)
|
|
|
|
FetchContent_Declare(
|
|
cli11
|
|
GIT_REPOSITORY https://github.com/CLIUtils/CLI11.git
|
|
GIT_TAG v2.4.2
|
|
GIT_SHALLOW TRUE
|
|
)
|
|
|
|
FetchContent_Declare(
|
|
tomlplusplus
|
|
GIT_REPOSITORY https://github.com/marzer/tomlplusplus.git
|
|
GIT_TAG v3.4.0
|
|
GIT_SHALLOW TRUE
|
|
)
|
|
|
|
FetchContent_Declare(
|
|
Catch2
|
|
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
|
GIT_TAG v3.7.1
|
|
GIT_SHALLOW TRUE
|
|
)
|
|
|
|
FetchContent_Declare(
|
|
asio
|
|
GIT_REPOSITORY https://github.com/chriskohlhoff/asio.git
|
|
GIT_TAG asio-1-28-0
|
|
GIT_SHALLOW TRUE
|
|
)
|
|
|
|
FetchContent_Declare(
|
|
concurrentqueue
|
|
GIT_REPOSITORY https://github.com/cameron314/concurrentqueue.git
|
|
GIT_TAG v1.0.4
|
|
GIT_SHALLOW TRUE
|
|
)
|
|
|
|
FetchContent_Declare(
|
|
taskflow
|
|
GIT_REPOSITORY https://github.com/taskflow/taskflow.git
|
|
GIT_TAG v3.6.0
|
|
GIT_SHALLOW TRUE
|
|
)
|
|
|
|
set(TF_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
|
set(TF_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
|
FetchContent_MakeAvailable(cli11 tomlplusplus Catch2 asio concurrentqueue taskflow)
|
|
|
|
# ── Packages ─────────────────────────────────────────────────────────────────
|
|
add_subdirectory(packages/logger)
|
|
add_subdirectory(packages/html)
|
|
add_subdirectory(packages/postgres)
|
|
add_subdirectory(packages/http)
|
|
add_subdirectory(packages/json)
|
|
add_subdirectory(packages/polymech)
|
|
add_subdirectory(packages/ipc)
|
|
add_subdirectory(packages/geo)
|
|
add_subdirectory(packages/gadm_reader)
|
|
add_subdirectory(packages/grid)
|
|
add_subdirectory(packages/search)
|
|
add_subdirectory(packages/enrichers)
|
|
|
|
# ── Sources ──────────────────────────────────────────────────────────────────
|
|
add_executable(${PROJECT_NAME}
|
|
src/main.cpp
|
|
src/cmd_gridsearch.cpp
|
|
src/cmd_gridsearch-uds.cpp
|
|
src/cmd_gridsearch-postgres.cpp
|
|
src/gridsearch_serialize.cpp
|
|
src/sys_metrics.cpp
|
|
)
|
|
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE CLI11::CLI11 tomlplusplus::tomlplusplus logger html postgres http json polymech ipc geo gadm_reader grid search enrichers)
|
|
|
|
target_include_directories(${PROJECT_NAME} PRIVATE
|
|
${asio_SOURCE_DIR}/asio/include
|
|
${taskflow_SOURCE_DIR}
|
|
${concurrentqueue_SOURCE_DIR}
|
|
)
|
|
|
|
# Define standalone ASIO (since it's not boost)
|
|
target_compile_definitions(${PROJECT_NAME} PRIVATE ASIO_STANDALONE=1 ASIO_NO_DEPRECATED=1)
|
|
|
|
|
|
# ── Compiler warnings ───────────────────────────────────────────────────────
|
|
if(MSVC)
|
|
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /permissive-)
|
|
else()
|
|
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic)
|
|
endif()
|
|
|
|
# ── Install ──────────────────────────────────────────────────────────────────
|
|
install(TARGETS ${PROJECT_NAME}
|
|
RUNTIME DESTINATION bin
|
|
)
|
|
|
|
# ── Tests ────────────────────────────────────────────────────────────────────
|
|
enable_testing()
|
|
add_subdirectory(tests)
|