Replace master branch with local files
This commit is contained in:
commit
875a53f499
60 changed files with 21637 additions and 0 deletions
107
backend/CMakeLists.txt
Normal file
107
backend/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
cmake_minimum_required(VERSION 3.20)
|
||||
project(streaming-backend)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# Use pkg-config to find libraries
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
# Find dependencies
|
||||
find_package(Drogon CONFIG REQUIRED)
|
||||
find_package(PostgreSQL REQUIRED)
|
||||
|
||||
# Find Redis dependencies
|
||||
pkg_check_modules(HIREDIS REQUIRED hiredis)
|
||||
pkg_check_modules(REDIS_PLUS_PLUS redis++)
|
||||
|
||||
# Manual fallback for redis++
|
||||
if(NOT REDIS_PLUS_PLUS_FOUND)
|
||||
find_path(REDIS_PLUS_PLUS_INCLUDE_DIR sw/redis++/redis++.h
|
||||
PATHS /usr/local/include /usr/include
|
||||
)
|
||||
find_library(REDIS_PLUS_PLUS_LIBRARY redis++
|
||||
PATHS /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu
|
||||
)
|
||||
|
||||
if(REDIS_PLUS_PLUS_INCLUDE_DIR AND REDIS_PLUS_PLUS_LIBRARY)
|
||||
set(REDIS_PLUS_PLUS_FOUND TRUE)
|
||||
set(REDIS_PLUS_PLUS_INCLUDE_DIRS ${REDIS_PLUS_PLUS_INCLUDE_DIR})
|
||||
set(REDIS_PLUS_PLUS_LIBRARIES ${REDIS_PLUS_PLUS_LIBRARY})
|
||||
else()
|
||||
message(FATAL_ERROR "redis++ not found")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Find bcrypt library
|
||||
find_path(BCRYPT_INCLUDE_DIR bcrypt/BCrypt.hpp
|
||||
PATHS /usr/local/include /usr/include
|
||||
)
|
||||
find_library(BCRYPT_LIBRARY bcrypt
|
||||
PATHS /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu
|
||||
)
|
||||
|
||||
if(NOT BCRYPT_INCLUDE_DIR OR NOT BCRYPT_LIBRARY)
|
||||
message(FATAL_ERROR "bcrypt not found")
|
||||
endif()
|
||||
|
||||
# Find jwt-cpp (header-only)
|
||||
find_path(JWT_CPP_INCLUDE_DIR jwt-cpp/jwt.h
|
||||
PATHS /usr/local/include /usr/include
|
||||
)
|
||||
|
||||
if(NOT JWT_CPP_INCLUDE_DIR)
|
||||
message(FATAL_ERROR "jwt-cpp not found")
|
||||
endif()
|
||||
|
||||
# Source files
|
||||
set(SOURCES
|
||||
src/main.cpp
|
||||
src/controllers/StreamController.cpp
|
||||
src/controllers/UserController.cpp
|
||||
src/controllers/AdminController.cpp
|
||||
src/controllers/RealmController.cpp
|
||||
src/services/DatabaseService.cpp
|
||||
src/services/StatsService.cpp
|
||||
src/services/RedisHelper.cpp
|
||||
src/services/AuthService.cpp
|
||||
)
|
||||
|
||||
# Create executable
|
||||
add_executable(${PROJECT_NAME} ${SOURCES})
|
||||
|
||||
# Include directories
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
${BCRYPT_INCLUDE_DIR}
|
||||
${JWT_CPP_INCLUDE_DIR}
|
||||
SYSTEM PRIVATE
|
||||
${HIREDIS_INCLUDE_DIRS}
|
||||
${REDIS_PLUS_PLUS_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
# Link libraries
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
Drogon::Drogon
|
||||
PostgreSQL::PostgreSQL
|
||||
${REDIS_PLUS_PLUS_LIBRARIES}
|
||||
${HIREDIS_LIBRARIES}
|
||||
${BCRYPT_LIBRARY}
|
||||
pthread
|
||||
)
|
||||
|
||||
# Compile options
|
||||
target_compile_options(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
${HIREDIS_CFLAGS_OTHER}
|
||||
${REDIS_PLUS_PLUS_CFLAGS_OTHER}
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wpedantic
|
||||
-Wno-pedantic # Suppress pedantic warnings from third-party headers
|
||||
)
|
||||
# Build admin tool
|
||||
add_executable(admin-tool src/admin_tool.cpp)
|
||||
target_link_libraries(admin-tool PRIVATE Drogon::Drogon PostgreSQL::PostgreSQL)
|
||||
Loading…
Add table
Add a link
Reference in a new issue