cmake_minimum_required(VERSION 3.6) 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 ") #set(MEMORY_DEBUG_FLAGS "-fsanitize=address") set(LIBRARY_PATH "${CMAKE_SOURCE_DIR}/../libraries/") if (BUILD_INCLUDE_FILE) include(${BUILD_INCLUDE_FILE}) endif () set(CMAKE_PREFIX_PATH "/home/wolverindev/clib/qt/5.6.1/5.6/gcc_64/lib/cmake") set(LIBEVENT_PATH "${LIBRARY_PATH}/event/build/lib/") function(resolve_library VARIABLE FALLBACK PATHS) set( _PATHS ${PATHS} ${ARGN} ) # Merge them together 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() 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() 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 () find_package(TomMath REQUIRED) find_package(TomCrypt REQUIRED) find_package(Breakpad REQUIRED) find_package(Protobuf REQUIRED) find_package(Boringssl REQUIRED) find_package(ThreadPool REQUIRED) find_package(CXXTerminal REQUIRED) find_package(StringVariable REQUIRED) find_package(yaml-cpp REQUIRED) find_package(jsoncpp REQUIRED) find_package(Ed25519 REQUIRED) find_package(DataPipes REQUIRED) find_package(Opus REQUIRED) find_package(spdlog REQUIRED) find_package(Jemalloc REQUIRED) find_package(Protobuf REQUIRED) # LibEvent fucks up the CMAKE_FIND_LIBRARY_SUFFIXES variable function(find_event) set(LIBEVENT_STATIC_LINK TRUE) find_package(Libevent REQUIRED) endfunction() find_event() #FIXME: Use module for this include_directories(${ed25519_INCLUDE_DIR}) include_directories(${ThreadPool_INCLUDE_DIR}) include_directories(${DataPipes_INCLUDE_DIR}) include_directories(${LIBEVENT_INCLUDE_DIRS}) include_directories(${StringVariable_INCLUDE_DIR}) resolve_library(LIBRARY_PATH_NICE OFF "${LIBRARY_PATH}/libnice/linux_${BUILD_OS_ARCH}/lib/libnice.a") message("Found libnice at ${LIBRARY_PATH_NICE}") if (EXISTS "${LIBRARY_PATH}/glibc/linux_${BUILD_OS_ARCH}/lib/i386-linux-gnu/") set(GLIBC_LIB_DIR "${LIBRARY_PATH}/glibc/linux_${BUILD_OS_ARCH}/lib/i386-linux-gnu/") elseif(EXISTS "${LIBRARY_PATH}/glibc/linux_${BUILD_OS_ARCH}/lib/x86_64-linux-gnu/") set(GLIBC_LIB_DIR "${LIBRARY_PATH}/glibc/linux_${BUILD_OS_ARCH}/lib/x86_64-linux-gnu/") else() message(FATAL_ERROR "Failed to find glibc") endif () message("Found GLIBC lib dir at ${GLIBC_LIB_DIR}") set(LIBRARY_PATH_GLIBC "${GLIBC_LIB_DIR}/libgio-2.0.a;${GLIBC_LIB_DIR}/libgmodule-2.0.a;${GLIBC_LIB_DIR}/libgobject-2.0.a;${GLIBC_LIB_DIR}/libglib-2.0.a;${GLIBC_LIB_DIR}/libffi.a;resolv") add_definitions(-DINET -DINET6) add_subdirectory(shared/) add_subdirectory(server/) add_subdirectory(license/) add_subdirectory(MusicBot/) add_subdirectory(music/)