Game Features
This commit is contained in:
+21
-7
@@ -12,28 +12,42 @@ find_package(modulus CONFIG REQUIRED COMPONENTS boost_json openssl sqlite)
|
||||
find_package(ligo CONFIG REQUIRED)
|
||||
find_package(noto CONFIG REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
include(CheckCXXSourceCompiles)
|
||||
function(fpol_check_ligo)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ligo::ligo)
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
set(CMAKE_TRY_COMPILE_CONFIGURATION "${CMAKE_BUILD_TYPE}")
|
||||
check_cxx_source_compiles("#include <ligo/http.hpp>
|
||||
int main() { ligo::http::request request; request.headers[\"Accept\"] = \"application/json\"; decltype(&ligo::http::client::exchange) method = nullptr; (void)method; }" FPOL_HAS_LIGO_RAW_HTTP)
|
||||
endfunction()
|
||||
fpol_check_ligo()
|
||||
if(NOT FPOL_HAS_LIGO_RAW_HTTP)
|
||||
message(FATAL_ERROR "This app needs the updated Ligo HTTP API. Build with the sibling checkout using tools/build_workspace.py, or install the matching Ligo package revision.")
|
||||
endif()
|
||||
|
||||
add_library(fpol_core src/domain.cpp src/store.cpp)
|
||||
target_link_libraries(fpol_core PUBLIC modulus::modulus modulus::boost_json noto::noto Threads::Threads)
|
||||
add_library(fpol_core src/domain.cpp src/store.cpp src/database.cpp src/crypto.cpp src/application.cpp src/game.cpp src/results.cpp)
|
||||
target_link_libraries(fpol_core PUBLIC modulus::modulus modulus::boost_json noto::noto modulus::openssl Threads::Threads)
|
||||
add_executable(fpol_admin src/admin.cpp)
|
||||
target_link_libraries(fpol_admin PRIVATE fpol_core)
|
||||
add_executable(fpol_server src/main.cpp src/server.cpp)
|
||||
target_link_libraries(fpol_server PRIVATE fpol_core ligo::ligo)
|
||||
foreach(target fpol_core fpol_admin fpol_server)
|
||||
add_executable(fpol_ingest src/ingest_main.cpp src/ingestion.cpp)
|
||||
target_link_libraries(fpol_ingest PRIVATE fpol_core ligo::ligo)
|
||||
foreach(target fpol_core fpol_admin fpol_server fpol_ingest)
|
||||
target_compile_options(${target} PRIVATE $<$<CXX_COMPILER_ID:GNU,Clang>:-Wall;-Wextra;-Wpedantic>)
|
||||
endforeach()
|
||||
|
||||
if(BUILD_TESTING)
|
||||
find_package(Python3 REQUIRED COMPONENTS Interpreter)
|
||||
add_test(NAME product_fpol
|
||||
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_all.py $<TARGET_FILE:fpol_admin> $<TARGET_FILE:fpol_server>
|
||||
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_all.py $<TARGET_FILE:fpol_admin> $<TARGET_FILE:fpol_server> $<TARGET_FILE:fpol_ingest>
|
||||
)
|
||||
set_tests_properties(product_fpol PROPERTIES TIMEOUT 180)
|
||||
set_tests_properties(product_fpol PROPERTIES TIMEOUT 240)
|
||||
add_custom_target(check
|
||||
COMMAND ${CMAKE_CTEST_COMMAND} --test-dir ${CMAKE_BINARY_DIR} -R ^product_fpol$ --output-on-failure
|
||||
DEPENDS fpol_admin fpol_server
|
||||
DEPENDS fpol_admin fpol_server fpol_ingest
|
||||
USES_TERMINAL
|
||||
)
|
||||
endif()
|
||||
|
||||
install(TARGETS fpol_server fpol_admin RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
install(TARGETS fpol_server fpol_admin fpol_ingest RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
Reference in New Issue
Block a user