Endgame-Analyzer/CMakeLists.txt

62 lines
2.0 KiB
CMake

cmake_minimum_required(VERSION 3.16)
project(endgame-analyzer CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wpedantic -Werror")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DGAME_STATE_NO_TABLEBASE_LOOKUP")
include_directories(
${PROJECT_SOURCE_DIR}/include
)
include(FetchContent)
FetchContent_Declare(cpr GIT_REPOSITORY https://github.com/libcpr/cpr.git
GIT_TAG 2553fc41450301cd09a9271c8d2c3e0cf3546b73)
FetchContent_MakeAvailable(cpr)
find_package(Boost 1.75 COMPONENTS program_options REQUIRED)
set(Boost_USE_STATIC_LIBS ON)
include_directories(.)
include_directories(${Boost_INCLUDE_DIR})
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)
add_executable(endgame-analyzer
src/main.cpp
${SOURCES}
)
target_link_libraries(endgame-analyzer cpr)
target_link_libraries(endgame-analyzer Boost::program_options)
target_link_libraries(endgame-analyzer readline)
#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG")
# This enables assertions in the RelWithDebInfo build type (assuming gcc or clang)
string(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")