working version

This commit is contained in:
Torsten Schulz
2024-07-24 16:22:57 +02:00
parent 6742b813c4
commit e8655dc79b

View File

@@ -1,12 +1,11 @@
cmake_minimum_required(VERSION 3.5)
project(singlechat.wt LANGUAGES CXX)
add_compile_options(-Wno-deprecated-declarations)
add_compile_options(-Wno-deprecated-declarations)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_COMPILER "/usr/bin/g++-12")
set(CMAKE_PREFIX_PATH "/usr")
# Set default build type if not specified
if(NOT CMAKE_BUILD_TYPE)
@@ -22,16 +21,13 @@ endif()
add_executable(${PROJECT_NAME}
src/main.cpp
src/broadcast.h src/broadcast.cpp
src/app.h src/app.cpp
docroot/text.xml
docroot/ads.txt
docroot/links.csv
src/broadcast.cpp
src/app.cpp
)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
find_package(Threads REQUIRED)
target_link_libraries(${PROJECT_NAME}
wt
wthttp
@@ -41,31 +37,36 @@ target_link_libraries(${PROJECT_NAME}
)
find_package(Boost COMPONENTS system filesystem REQUIRED)
if(UNIX)
# Ubuntu-spezifische Include-Verzeichnisse
find_package(PkgConfig)
pkg_check_modules(XML2 libxml-2.0)
if(XML2_FOUND)
target_include_directories(${PROJECT_NAME} PRIVATE /usr/include/GraphicsMagick ${XML2_INCLUDE_DIRS})
endif()
elseif(EXISTS "/etc/os-release" AND ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux"))
# Tumbleweed-spezifische Include-Verzeichnisse
target_include_directories(${PROJECT_NAME} PRIVATE /usr/include/GraphicsMagick)
endif()
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} GraphicsMagick++ GraphicsMagick)
endif()
include(GNUInstallDirs)
if(UNIX)
find_package(PkgConfig)
pkg_check_modules(XML2 libxml-2.0)
if(XML2_FOUND)
target_include_directories(${PROJECT_NAME} PRIVATE ${XML2_INCLUDE_DIRS})
endif()
endif()
if(UNIX)
find_package(PkgConfig)
pkg_check_modules(XML2 libxml-2.0)
if(XML2_FOUND)
target_include_directories(${PROJECT_NAME} PRIVATE ${XML2_INCLUDE_DIRS} /usr/include/GraphicsMagick)
endif()
endif()
include(GNUInstallDirs)
install(TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION /opt/ypchat/bin
)
# Install docroot directory and handle logs setup
install(DIRECTORY docroot/
DESTINATION /opt/ypchat/docroot
)
install(CODE "file(MAKE_DIRECTORY /opt/ypchat/logs)")
install(CODE "execute_process(COMMAND chmod 777 /opt/ypchat/logs)")