cmake_minimum_required(VERSION 3.10) project(CrowHTMX) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(TARGET_NAME shadowrun-server ) set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) # Allow selection of build type if not set if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE) endif() # Supported build types set(SUPPORTED_BUILD_TYPES Debug Release RelWithDebInfo MinSizeRel) if(NOT CMAKE_BUILD_TYPE IN_LIST SUPPORTED_BUILD_TYPES) message(FATAL_ERROR "Unsupported build type: ${CMAKE_BUILD_TYPE}") endif() # Copy 'static' and 'templates' directories to build directory file(GLOB_RECURSE ASSETS_FILES "${CMAKE_SOURCE_DIR}/assets/*") file(GLOB_RECURSE FRONTEND_FILES "${CMAKE_SOURCE_DIR}/frontend/build/*") foreach(file IN LISTS ASSETS_FILES) file(RELATIVE_PATH rel_path "${CMAKE_SOURCE_DIR}" "${file}") configure_file("${file}" "${CMAKE_BINARY_DIR}/${rel_path}" COPYONLY) endforeach() foreach(file IN LISTS FRONTEND_FILES) file(RELATIVE_PATH rel_path "${CMAKE_SOURCE_DIR}" "${file}") configure_file("${file}" "${CMAKE_BINARY_DIR}/${rel_path}" COPYONLY) endforeach() include_directories( modules/cpp-libraries/include/ source source/shadowrun source/database source/login ) add_executable(${TARGET_NAME} modules/cpp-libraries/src/sqlite3.c modules/cpp-libraries/src/monocypher.c source/main.cpp source/utils.hpp source/utils.cpp source/json_settings.cpp source/json_settings.h source/database/database.cpp source/database/database.hpp # Shadowrun source/shadowrun/ShadowrunApi.cpp source/shadowrun/ShadowrunApi.hpp source/shadowrun/ShadowrunDb.cpp source/shadowrun/ShadowrunDb.hpp # login source/login/login.cpp source/login/login.hpp source/login/loginDb.cpp source/login/Session.cpp source/login/SessionHandler.cpp ) # warnings to ignore target_compile_options(${TARGET_NAME} PRIVATE $<$: -Wno-deprecated-literal-operator -Wno-deprecated-declarations > ) # relase compiler options target_compile_options(${TARGET_NAME} PRIVATE $<$:-O3> $<$:-flto=auto> ) # relase linker options target_link_options(${TARGET_NAME} PRIVATE $<$:-flto=auto> ) if(NOT DEFINED APP_VERSION) set(APP_VERSION "0.0.0") endif() target_compile_definitions(${TARGET_NAME} PRIVATE APPLICATION_NAME="${TARGET_NAME}" APP_VERSION="${APP_VERSION}" SQLITE_THREADSAFE=1 # build sqlite with thread safty ASIO_STANDALONE # use asio without boost CROW_ENABLE_COMPRESSION # enable compression part of crow ) target_link_libraries(${TARGET_NAME} pthread z # zlib, used by crow for compression ) # Optional: Print build type at configuration time message(STATUS "Configuring build type: ${CMAKE_BUILD_TYPE}")