Teaspeak-Server/CMakeLists.txt

108 lines
3.2 KiB
CMake
Raw Normal View History

cmake_minimum_required(VERSION 3.6)
2019-11-11 15:37:28 -05:00
project(TeaSpeak-Parent)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/Modules")
set(TEASPEAK_SERVER ON)
#end now
#set(MEMORY_DEBUG_FLAGS " -fsanitize=leak -fsanitize=address -fstack-protector-all ")
2021-03-11 08:41:19 -05:00
#set(MEMORY_DEBUG_FLAGS "-fsanitize=address -fstack-protector-all")
2020-12-29 12:26:09 -05:00
#set(MEMORY_DEBUG_FLAGS "-fstack-protector-all")
2021-01-30 07:29:33 -05:00
#set(MEMORY_DEBUG_FLAGS " -fsanitize=address -static-libasan")
2020-01-24 15:05:10 -05:00
if (NOT BUILD_OS_ARCH)
set(BUILD_OS_ARCH $ENV{build_os_arch})
endif ()
if (NOT BUILD_OS_ARCH)
set(BUILD_OS_ARCH $ENV{build_os_arch})
endif ()
set(LIBRARY_PATH "${CMAKE_SOURCE_DIR}/../libraries/")
if (BUILD_INCLUDE_FILE)
include(${BUILD_INCLUDE_FILE})
endif ()
set(LIBEVENT_PATH "${LIBRARY_PATH}/event/build/lib/")
function(resolve_library VARIABLE FALLBACK PATHS)
2020-01-23 20:50:00 -05:00
set( _PATHS ${PATHS} ${ARGN} ) # Merge them together
2020-01-23 20:50:00 -05:00
foreach(PATH IN ITEMS ${_PATHS})
message(STATUS "Try to use path ${PATH} for ${VARIABLE}")
if(EXISTS ${PATH})
message(STATUS "Setting ${VARIABLE} to ${PATH}")
set(${VARIABLE} ${PATH} PARENT_SCOPE)
return()
endif()
endforeach()
2020-01-23 20:50:00 -05:00
if(FALLBACK)
message(WARNING "Failed to resolve library path for ${VARIABLE}. Using default ${VARIABLE}")
else()
message(FATAL_ERROR "Failed to find requited library. Variable: ${VARIABLE} Paths: ${_PATHS}")
endif()
endfunction()
find_package(TomMath REQUIRED)
find_package(TomCrypt REQUIRED)
find_package(Breakpad REQUIRED)
find_package(Protobuf REQUIRED)
2020-03-02 12:45:53 -05:00
find_package(Crypto REQUIRED)
find_package(ThreadPool REQUIRED)
find_package(CXXTerminal REQUIRED)
find_package(StringVariable REQUIRED)
find_package(yaml-cpp REQUIRED)
find_package(jsoncpp REQUIRED)
find_package(DataPipes REQUIRED)
find_package(Opus REQUIRED)
find_package(spdlog REQUIRED)
find_package(Jemalloc REQUIRED)
find_package(Protobuf REQUIRED)
2020-07-31 11:35:14 -04:00
message("${zstd_DIR}")
find_package(zstd REQUIRED)
2020-01-30 07:37:14 -05:00
include_directories(${StringVariable_INCLUDE_DIR})
add_subdirectory(music/)
2020-01-30 06:06:39 -05:00
2020-01-24 11:06:52 -05:00
# LibEvent fucks up the CMAKE_FIND_LIBRARY_SUFFIXES variable
2020-01-30 06:06:39 -05:00
macro(find_event static)
set(_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
if (${static})
set(LIBEVENT_STATIC_LINK TRUE)
message("Use static libevent")
endif ()
find_package(Libevent 2.2 REQUIRED COMPONENTS core pthreads)
if (NOT Libevent_FOUND)
message(FATAL_ERROR "Failed to find libevent (Variable: ${LIBEVENT_FOUND})")
endif ()
message("Libevent version: ${Libevent_FOUND}")
endmacro()
find_event(TRUE)
2020-01-24 09:46:28 -05:00
2020-02-16 06:17:13 -05:00
check_include_file(mysql/mysql.h HAVE_MYSQL_MYSQL_H)
if(HAVE_MYSQL_MYSQL_H)
add_definitions(-DHAVE_MYSQL_MYSQL_H)
endif()
check_include_file(mysql.h HAVE_MYSQL_H)
if(HAVE_MYSQL_H)
add_definitions(-DHAVE_MYSQL_H)
endif()
2020-01-24 09:46:28 -05:00
#FIXME: Use module for this
2020-01-24 11:19:57 -05:00
include_directories(${breakpad_INCLUDE_DIR})
2020-01-24 09:46:28 -05:00
include_directories(${ThreadPool_INCLUDE_DIR})
include_directories(${DataPipes_INCLUDE_DIR})
include_directories(${LIBEVENT_INCLUDE_DIRS})
include_directories(${StringVariable_INCLUDE_DIR})
add_definitions(-DINET -DINET6)
2020-02-15 08:03:46 -05:00
add_subdirectory(shared/)
add_subdirectory(server/)
add_subdirectory(license/)
2020-05-03 08:06:34 -04:00
add_subdirectory(MusicBot/)
add_subdirectory(file/)