cmake_minimum_required(VERSION 3.6) project(TeaSpeak-Parent) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") 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/") 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 () resolve_library(LIBRARY_TOM_MATH OFF "${LIBRARY_PATH}/tommath/build/libtommathStatic.a") resolve_library(LIBRARY_TOM_CRYPT OFF "${LIBRARY_PATH}/tomcrypt/libtomcrypt.a") resolve_library(LIBRARY_PATH_BREAKPAD OFF "${LIBRARY_PATH}/breakpad/build/src/client/linux/libbreakpad_client.a") resolve_library(LIBRARY_PATH_PROTOBUF OFF "${LIBRARY_PATH}/protobuf/build/libprotobuf.a") resolve_library(LIBRARY_PATH_BORINGSSL_SSL OFF "${LIBRARY_PATH}/boringssl/build/ssl/libssl.so") resolve_library(LIBRARY_PATH_BORINGSSL_CRYPTO OFF "${LIBRARY_PATH}/boringssl/build/crypto/libcrypto.so") resolve_library(LIBRARY_PATH_THREAD_POOL OFF "${LIBRARY_PATH}/Thread-Pool/build/libThreadPoolStatic.a") resolve_library(LIBRARY_PATH_TERMINAL OFF "${LIBRARY_PATH}/CXXTerminal/build/libCXXTerminalStatic.a") resolve_library(LIBRARY_PATH_VARIBALES OFF "${LIBRARY_PATH}/StringVariable/build/libStringVariablesStatic.a") resolve_library(LIBRARY_PATH_YAML OFF "${LIBRARY_PATH}/yaml-cpp/build/libyaml-cpp.a") resolve_library(LIBRARY_PATH_JSON OFF "${LIBRARY_PATH}/jsoncpp/build/src/lib_json/libjsoncpp.a") resolve_library(LIBRARY_PATH_ED255 OFF "${LIBRARY_PATH}/ed25519/build/libed25519.a") resolve_library(LIBRARY_PATH_DATA_PIPES OFF "${LIBRARY_PATH}/DataPipes/build/libDataPipes.so" "${LIBRARY_PATH}/DataPipes/cmake-build-release/libDataPipes.so" "${LIBRARY_PATH}/DataPipes/cmake-build-debug/libDataPipes.so") resolve_library(LIBRARY_PATH_OPUS OFF "${LIBRARY_PATH}/opus/build/.libs/libopus.a") 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}/libglib-2.0.a;${GLIBC_LIB_DIR}/libgobject-2.0.a;${GLIBC_LIB_DIR}/libffi.a;resolv") add_definitions(-DINET -DINET6) add_subdirectory(shared/) add_subdirectory(client/) add_subdirectory(server/) add_subdirectory(license/) add_subdirectory(flooder/) add_subdirectory(MusicBot/) add_subdirectory(music/)