server-admin-panel/CMakeLists.txt

107 lines
3.1 KiB
CMake

cmake_minimum_required(VERSION 3.10)
project(CrowHTMX)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(TARGET_NAME lf-server-admin-panel )
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 STATIC_FILES "${CMAKE_SOURCE_DIR}/static/*")
file(GLOB_RECURSE TEMPLATE_FILES "${CMAKE_SOURCE_DIR}/templates/*")
foreach(file IN LISTS STATIC_FILES)
file(RELATIVE_PATH rel_path "${CMAKE_SOURCE_DIR}" "${file}")
configure_file("${file}" "${CMAKE_BINARY_DIR}/${rel_path}" COPYONLY)
endforeach()
foreach(file IN LISTS TEMPLATE_FILES)
file(RELATIVE_PATH rel_path "${CMAKE_SOURCE_DIR}" "${file}")
configure_file("${file}" "${CMAKE_BINARY_DIR}/${rel_path}" COPYONLY)
endforeach()
# Use Crow from system include (installed via yay -S crow + asio)
include_directories(
/usr/include
modules/cpp-libraries/src/
src
src/htmx
src/shadowrun
src/database
src/login
)
add_executable(${TARGET_NAME}
# sqlite3
modules/cpp-libraries/src/sqlite3.c
modules/cpp-libraries/src/sqlite3.h
modules/cpp-libraries/src/json.hpp
modules/cpp-libraries/src/magic_enum.hpp
modules/cpp-libraries/src/sqlite_orm.h
src/main.cpp
src/utils.hpp
src/utils.cpp
src/htmx/HtmxTable.cpp
src/htmx/HtmxTable.h
src/systemd.cpp
src/systemd.h
src/htmx/HtmxTableRow.cpp
src/htmx/HtmxTableRow.h
src/htmx/HtmxObject.cpp
src/htmx/HtmxObject.h
src/htmx_helper.cpp
src/htmx_helper.h
src/json_settings.cpp
src/json_settings.h
src/database/database.cpp
src/database/database.hpp
# Shadowrun
src/shadowrun/HtmxShItemList.cpp
src/shadowrun/HtmxShItemList.hpp
src/shadowrun/HtmxShAttributeList.cpp
src/shadowrun/HtmxShAttributeList.hpp
src/shadowrun/HtmxShCondition.cpp
src/shadowrun/HtmxShCondition.hpp
src/shadowrun/ShadowrunCharacterForm.hpp
src/shadowrun/ShadowrunCharacterForm.cpp
src/shadowrun/ShadowrunApi.cpp
src/shadowrun/ShadowrunApi.hpp
src/shadowrun/ShadowrunDb.cpp
src/shadowrun/ShadowrunDb.hpp
# login
src/login/login.cpp
src/login/login.hpp
)
# warnings to ignore
target_compile_options(${TARGET_NAME} PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:
-Wno-deprecated-literal-operator
-Wno-deprecated-declarations
>
)
target_compile_definitions(${TARGET_NAME} PRIVATE APPLICATION_NAME="${TARGET_NAME}")
target_link_libraries(${TARGET_NAME} pthread sodium)
# Optional: Print build type at configuration time
message(STATUS "Configuring build type: ${CMAKE_BUILD_TYPE}")