2024-01-14 15:10:32 +01:00
|
|
|
cmake_minimum_required(VERSION 3.16)
|
2023-11-17 09:27:51 +01:00
|
|
|
project(endgame-analyzer CXX)
|
2023-08-05 11:55:55 +02:00
|
|
|
|
2024-02-03 13:21:58 +01:00
|
|
|
|
2024-01-14 18:04:27 +01:00
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
2023-09-19 19:25:27 +02:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wpedantic -Werror")
|
2023-08-06 15:02:50 +02:00
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
|
2023-11-14 13:19:33 +01:00
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DGAME_STATE_NO_TABLEBASE_LOOKUP")
|
2023-08-05 11:55:55 +02:00
|
|
|
|
2023-08-12 11:44:56 +02:00
|
|
|
include_directories(
|
|
|
|
${PROJECT_SOURCE_DIR}/include
|
|
|
|
)
|
|
|
|
|
2024-01-14 14:37:23 +01:00
|
|
|
include(FetchContent)
|
|
|
|
FetchContent_Declare(cpr GIT_REPOSITORY https://github.com/libcpr/cpr.git
|
|
|
|
GIT_TAG 2553fc41450301cd09a9271c8d2c3e0cf3546b73)
|
|
|
|
FetchContent_MakeAvailable(cpr)
|
2024-01-14 15:12:02 +01:00
|
|
|
find_package(Boost 1.75 COMPONENTS program_options unit_test_framework REQUIRED)
|
2023-11-17 09:27:51 +01:00
|
|
|
|
|
|
|
set(Boost_USE_STATIC_LIBS ON)
|
2023-08-05 11:55:55 +02:00
|
|
|
|
|
|
|
include_directories(.)
|
2023-08-12 11:44:56 +02:00
|
|
|
include_directories(${Boost_INCLUDE_DIR})
|
2023-08-05 11:55:55 +02:00
|
|
|
|
2024-02-05 19:17:26 +01:00
|
|
|
set(SOURCES
|
|
|
|
src/state_explorer.cpp
|
|
|
|
src/download.cpp
|
|
|
|
src/command_line_interface.cpp
|
|
|
|
src/parse_game.cpp
|
|
|
|
src/hanabi_types.cpp
|
|
|
|
src/game_interface.cpp
|
|
|
|
src/make_state.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
# Include git module from https://github.com/rpavlik/cmake-modules to
|
|
|
|
# dynamically include git revisions into the build.
|
|
|
|
# This re-generates the file version.cpp whenever the git HEAD changes.
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules/")
|
|
|
|
include(GetGitRevisionDescription)
|
|
|
|
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
|
|
|
|
git_describe(GIT_DESCRIPTION)
|
|
|
|
git_local_changes(GIT_LOCAL_CHANGES)
|
|
|
|
configure_file(
|
|
|
|
${CMAKE_SOURCE_DIR}/src/version.cpp.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/generated/version.cpp
|
|
|
|
)
|
|
|
|
list(APPEND SOURCES ${CMAKE_CURRENT_BINARY_DIR}/generated/version.cpp)
|
|
|
|
|
|
|
|
|
2023-11-17 09:27:51 +01:00
|
|
|
add_executable(endgame-analyzer
|
|
|
|
src/main.cpp
|
2024-02-05 19:17:26 +01:00
|
|
|
${SOURCES}
|
2023-11-17 09:27:51 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
add_executable(unit-tests
|
|
|
|
test/unit_test.cpp
|
2024-02-05 19:17:26 +01:00
|
|
|
${SOURCES}
|
2023-11-15 21:47:50 +01:00
|
|
|
)
|
2023-08-05 11:55:55 +02:00
|
|
|
|
2023-08-12 11:44:56 +02:00
|
|
|
target_link_libraries(endgame-analyzer cpr)
|
|
|
|
target_link_libraries(endgame-analyzer Boost::program_options)
|
2023-09-19 19:25:27 +02:00
|
|
|
target_link_libraries(endgame-analyzer readline)
|
2023-08-05 11:55:55 +02:00
|
|
|
|
2023-11-17 09:27:51 +01:00
|
|
|
target_link_libraries(unit-tests cpr)
|
|
|
|
target_link_libraries(unit-tests Boost::program_options)
|
|
|
|
target_link_libraries(unit-tests readline)
|
|
|
|
target_link_libraries(unit-tests ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
|
|
|
|
2023-08-08 16:27:25 +02:00
|
|
|
#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG")
|
2023-11-11 13:48:55 +01:00
|
|
|
# This enables assertions in the RelWithDebInfo build type (assuming gcc or clang)
|
|
|
|
string(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|