Improved build helper scripts for the server

This commit is contained in:
WolverinDEV 2020-01-24 14:02:19 +01:00
parent a651eb879e
commit 45a32496ba
5 changed files with 108 additions and 85 deletions

View File

@ -5,12 +5,16 @@ 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)
set(CMAKE_VERBOSE_MAKEFILE 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/")
@ -41,20 +45,40 @@ 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")
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(Libevent 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)
#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}")
@ -66,7 +90,7 @@ 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")
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/)

View File

@ -132,22 +132,22 @@ set(SERVER_SOURCE_FILES
src/weblist/TeamSpeakWebClient.cpp
src/manager/ConversationManager.cpp
)
if(COMPILE_WEB_CLIENT)
)
if (COMPILE_WEB_CLIENT)
add_definitions(-DCOMPILE_WEB_CLIENT)
set(SERVER_SOURCE_FILES
${SERVER_SOURCE_FILES}
${SERVER_SOURCE_FILES}
src/server/WebServer.cpp
src/client/web/WebClient.cpp
# src/server/web/WebRTCServer.cpp
src/client/web/WSWebClient.cpp
src/client/web/SampleHandler.cpp
src/client/SpeakingClientHandshake.cpp
src/client/web/VoiceBridge.cpp
)
endif()
src/server/WebServer.cpp
src/client/web/WebClient.cpp
# src/server/web/WebRTCServer.cpp
src/client/web/WSWebClient.cpp
src/client/web/SampleHandler.cpp
src/client/SpeakingClientHandshake.cpp
src/client/web/VoiceBridge.cpp
)
endif ()
add_executable(PermHelper helpers/permgen.cpp)
target_link_libraries(PermHelper
@ -186,7 +186,7 @@ target_link_libraries(PermHelper
${LIBRARY_PATH_BORINGSSL_CRYPTO}
dl
jemalloc
)
)
add_executable(PermMapHelper helpers/PermMapGen.cpp)
target_link_libraries(PermMapHelper
@ -231,35 +231,34 @@ target_link_libraries(PermMapHelper
SET(CPACK_PACKAGE_VERSION_MAJOR "1")
SET(CPACK_PACKAGE_VERSION_MINOR "4")
SET(CPACK_PACKAGE_VERSION_PATCH "4")
if(BUILD_TYPE_NAME EQUAL OFF)
SET(CPACK_PACKAGE_VERSION_DATA "beta")
elseif(BUILD_TYPE_NAME STREQUAL "")
SET(CPACK_PACKAGE_VERSION_DATA "")
else()
SET(CPACK_PACKAGE_VERSION_DATA "-${BUILD_TYPE_NAME}")
endif()
if(BUILD_TYPE EQUAL OFF)
if (BUILD_TYPE_NAME EQUAL OFF)
SET(CPACK_PACKAGE_VERSION_DATA "beta")
elseif (BUILD_TYPE_NAME STREQUAL "")
SET(CPACK_PACKAGE_VERSION_DATA "")
else ()
SET(CPACK_PACKAGE_VERSION_DATA "-${BUILD_TYPE_NAME}")
endif ()
if (BUILD_TYPE EQUAL OFF)
SET(BUILD_TYPE "1")
endif()
endif ()
set_source_files_properties(src/build.cpp PROPERTIES
COMPILE_FLAGS "-DBUILD_MAJOR=${CPACK_PACKAGE_VERSION_MAJOR} -DBUILD_MINOR=${CPACK_PACKAGE_VERSION_MINOR} -DBUILD_PATCH=${CPACK_PACKAGE_VERSION_PATCH} -DBUILD_DATA=\"${CPACK_PACKAGE_VERSION_DATA}\" -DBUILD_TYPE=${BUILD_TYPE} -DBUILD_COUNT=0")
file(WRITE repro/env/buildVersion.txt "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}${CPACK_PACKAGE_VERSION_DATA}")
add_executable(TeaSpeakServer ${SERVER_SOURCE_FILES})
target_link_libraries(TeaSpeakServer
${LIBRARY_PATH_THREAD_POOL} #Static
threadpool::static #Static
TeaSpeak #Static
TeaLicenseHelper #Static
TeaMusic #Static
${LIBRARY_PATH_TERMINAL} #Static
${LIBRARY_PATH_VARIBALES}
${LIBRARY_PATH_YAML}
CXXTerminal::static #Static
${StringVariable_LIBRARIES_STATIC}
${YAML_CPP_LIBRARIES}
pthread
stdc++fs
${LIBEVENT_PATH}/libevent.a
${LIBEVENT_PATH}/libevent_pthreads.a
${LIBRARY_PATH_OPUS}
${LIBRARY_PATH_JSON}
event_static event_pthreads
opus::static
yaml-cpp
${LIBRARY_PATH_PROTOBUF}
#We're forsed to use boringssl caused by the fact that boringssl is already within webrtc!
@ -267,43 +266,43 @@ target_link_libraries(TeaSpeakServer
#Require a so
sqlite3
${LIBRARY_PATH_BREAKPAD}
${LIBRARY_PATH_PROTOBUF}
breakpad::static
protobuf::libprotobuf
jemalloc::shared
#${LIBWEBRTC_LIBRARIES} #ATTENTIAN! WebRTC does not work with crypto! (Already contains a crypto version)
${LIBRARY_TOM_CRYPT}
${LIBRARY_TOM_MATH}
tomcrypt::static
tommath::static
mysqlclient.a
jsoncpp_lib
${ed25519_LIBRARIES_STATIC}
)
${LIBRARY_PATH_ED255}
)
if(${COMPILE_WEB_CLIENT})
if (${COMPILE_WEB_CLIENT})
find_package(UsrSCTP REQUIRED)
target_link_libraries(TeaSpeakServer
${LIBRARY_PATH_DATA_PIPES}
${LIBRARY_PATH_NICE}
${LIBRARY_PATH_GLIBC}
)
${DataPipes_LIBRARIES_SHARED}
${LIBRARY_PATH_NICE}
${LIBRARY_PATH_GLIBC}
)
#target_link_options(TeaSpeakServer PUBLIC "-Wl,--no-as-needed" "${LIBRARY_PATH_DATA_PIPES}" "${LIBRARY_PATH_NICE}" "-Wl,--as-needed")
endif()
endif ()
include_directories(${LIBRARY_PATH}/boringssl/include/)
target_link_libraries(TeaSpeakServer
${LIBRARY_PATH_BORINGSSL_SSL}
${LIBRARY_PATH_BORINGSSL_CRYPTO}
openssl::ssl::shared
openssl::crypto::shared
dl
z
)
)
set(DISABLE_JEMALLOC ON)
if(NOT DISABLE_JEMALLOC)
if (NOT DISABLE_JEMALLOC)
target_link_libraries(TeaSpeakServer
jemalloc
)
jemalloc
)
add_definitions(-DHAVE_JEMALLOC)
endif()
endif ()
#Fix RPATH
#patchelf --set-rpath ./libs/ TeaSpeakServer

View File

@ -540,10 +540,10 @@ namespace ts {
CommandResult handleCommandMusicBotPlayerInfo(Command&); //TODO: Use cached permission values
CommandResult handleCommandMusicBotPlayerAction(Command&); //TODO: Use cached permission values
CommandResult handleCommandMusicBotQueueList(Command&); //TODO: Use cached permission values
CommandResult handleCommandMusicBotQueueAdd(Command&); //TODO: Use cached permission values
CommandResult handleCommandMusicBotQueueRemove(Command&); //TODO: Use cached permission values
CommandResult handleCommandMusicBotQueueReorder(Command&); //TODO: Use cached permission values
command_result handleCommandMusicBotQueueList(Command&); //TODO: Use cached permission values
command_result handleCommandMusicBotQueueAdd(Command&); //TODO: Use cached permission values
command_result handleCommandMusicBotQueueRemove(Command&); //TODO: Use cached permission values
command_result handleCommandMusicBotQueueReorder(Command&); //TODO: Use cached permission values
CommandResult handleCommandMusicBotPlaylistAssign(Command&);

View File

@ -330,10 +330,10 @@ CommandResult ConnectedClient::handleCommand(Command &cmd) {
else if (command == "musicbotsetsubscription") return this->handleCommandMusicBotSetSubscription(cmd);
else if (command == "musicbotplayerinfo") return this->handleCommandMusicBotPlayerInfo(cmd);
else if (command == "musicbotplayeraction") return this->handleCommandMusicBotPlayerAction(cmd);
else if (command == "musicbotqueuelist") return this->handleCommandMusicBotQueueList(cmd);
else if (command == "musicbotqueueadd") return this->handleCommandMusicBotQueueAdd(cmd);
else if (command == "musicbotqueueremove") return this->handleCommandMusicBotQueueRemove(cmd);
else if (command == "musicbotqueuereorder") return this->handleCommandMusicBotQueueReorder(cmd);
else if (command == "musicbotqueuelist") return this->handleCommandMusicBotQueueList(cmd).as_command_result();
else if (command == "musicbotqueueadd") return this->handleCommandMusicBotQueueAdd(cmd).as_command_result();
else if (command == "musicbotqueueremove") return this->handleCommandMusicBotQueueRemove(cmd).as_command_result();
else if (command == "musicbotqueuereorder") return this->handleCommandMusicBotQueueReorder(cmd).as_command_result();
else if (command == "musicbotplaylistassign") return this->handleCommandMusicBotPlaylistAssign(cmd);
else if (command == "help") return this->handleCommandHelp(cmd);
@ -5738,7 +5738,7 @@ CommandResult ConnectedClient::handleCommandVersion(Command &) {
res["version"] = build::version()->string(false);
res["build_count"] = build::buildCount();
res["build"] = duration_cast<seconds>(build::version()->timestamp.time_since_epoch()).count();
#ifdef WINDOWS
#ifdef WIN32
res["platform"] = "Windows";
#else
res["platform"] = "Linux";
@ -7114,8 +7114,8 @@ CommandResult ConnectedClient::handleCommandPlaylistSongRemove(ts::Command &cmd)
return CommandResult::Success;
}
CommandResult ConnectedClient::handleCommandMusicBotQueueList(Command& cmd) {
return CommandResult::NotImplemented; //FIXME
command_result ConnectedClient::handleCommandMusicBotQueueList(Command& cmd) {
return command_result{error::not_implemented}; //FIXME
/*
CMD_REQ_SERVER;
@ -7195,8 +7195,8 @@ CommandResult ConnectedClient::handleCommandMusicBotQueueList(Command& cmd) {
*/
}
CommandResult ConnectedClient::handleCommandMusicBotQueueAdd(Command& cmd) {
return CommandResult::NotImplemented; //FIXME
command_result ConnectedClient::handleCommandMusicBotQueueAdd(Command& cmd) {
return command_result{error::not_implemented}; //FIXME
/*
CMD_REQ_SERVER;
@ -7231,8 +7231,8 @@ CommandResult ConnectedClient::handleCommandMusicBotQueueAdd(Command& cmd) {
*/
}
CommandResult ConnectedClient::handleCommandMusicBotQueueRemove(Command& cmd) {
return CommandResult::NotImplemented; //FIXME
command_result ConnectedClient::handleCommandMusicBotQueueRemove(Command& cmd) {
return command_result{error::not_implemented}; //FIXME
/*
CMD_REQ_SERVER;
@ -7263,8 +7263,8 @@ CommandResult ConnectedClient::handleCommandMusicBotQueueRemove(Command& cmd) {
*/
}
CommandResult ConnectedClient::handleCommandMusicBotQueueReorder(Command& cmd) {
return CommandResult::NotImplemented; //FIXME
command_result ConnectedClient::handleCommandMusicBotQueueReorder(Command& cmd) {
return command_result{error::not_implemented}; //FIXME
/*
CMD_REQ_SERVER;

2
shared

@ -1 +1 @@
Subproject commit b85c51951cd01b3535b9dd782908d02cac8f1455
Subproject commit 73f292f9517c82260a5d1b6e3beee3cfcf0a6f5f