85 lines
2.7 KiB
CMake
85 lines
2.7 KiB
CMake
cmake_minimum_required(VERSION 3.10)
|
|
project(CrowHTMX)
|
|
|
|
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 src src/htmx src/shadowrun src/database src/login)
|
|
|
|
add_executable(${TARGET_NAME}
|
|
src/main.cpp
|
|
src/utils.hpp
|
|
src/utils.cpp
|
|
src/htmx/HtmxTable.cpp
|
|
src/htmx/HtmxTable.h
|
|
src/systemd.cpp
|
|
src/systemd.h
|
|
src/json.hpp
|
|
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/json.hpp
|
|
|
|
src/database/database.cpp
|
|
src/database/database.hpp
|
|
src/database/sqlite_orm.h
|
|
|
|
# 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
|
|
|
|
)
|
|
|
|
target_compile_definitions(${TARGET_NAME} PRIVATE APPLICATION_NAME="${TARGET_NAME}")
|
|
|
|
target_link_libraries(${TARGET_NAME} pthread sqlite3 sodium)
|
|
|
|
# Optional: Print build type at configuration time
|
|
message(STATUS "Configuring build type: ${CMAKE_BUILD_TYPE}") |