192 lines
6.3 KiB
CMake
192 lines
6.3 KiB
CMake
|
set(MODULE_NAME "teaclient_connection")
|
||
|
|
||
|
|
||
|
include_directories(/home/wolverindev/TeaSpeak/TeaSpeak/shared/src)
|
||
|
|
||
|
|
||
|
function(resolve_codecs)
|
||
|
# if(EXISTS "${CMAKE_MODULE_DIR}/libraries/generated/opus/include" AND EXISTS ${OPUS_LIBRARY_PATH})
|
||
|
# set(HAVE_OPUS ON)
|
||
|
#
|
||
|
# add_definitions(-DHAVE_OPUS)
|
||
|
# include_directories(${CMAKE_MODULE_DIR}/libraries/generated/opus/include)
|
||
|
# target_link_libraries(${MODULE_NAME} ${OPUS_LIBRARY_PATH})
|
||
|
# else()
|
||
|
# message(WARNING "Missing opus libraries. Building without opus support!\n" "Build opus with the build script given within the libraries foulder")
|
||
|
# endif()
|
||
|
add_definitions(-DHAVE_CODEC_OPUS)
|
||
|
endfunction()
|
||
|
resolve_codecs()
|
||
|
|
||
|
set(SOURCE_FILES
|
||
|
src/logger.cpp
|
||
|
src/EventLoop.cpp
|
||
|
|
||
|
src/connection/ft/FileTransferManager.cpp
|
||
|
src/connection/ft/FileTransferObject.cpp
|
||
|
|
||
|
src/audio/AudioSamples.cpp
|
||
|
src/audio/AudioDevice.cpp
|
||
|
src/audio/AudioMerger.cpp
|
||
|
src/audio/AudioOutput.cpp
|
||
|
src/audio/AudioInput.cpp
|
||
|
src/audio/AudioResampler.cpp
|
||
|
src/audio/AudioReframer.cpp
|
||
|
|
||
|
src/audio/filter/FilterVad.cpp
|
||
|
src/audio/filter/FilterThreshold.cpp
|
||
|
src/audio/filter/FilterState.cpp
|
||
|
|
||
|
src/audio/codec/Converter.cpp
|
||
|
src/audio/codec/OpusConverter.cpp
|
||
|
)
|
||
|
|
||
|
set(NODEJS_SOURCE_FILES
|
||
|
src/bindings.cpp
|
||
|
|
||
|
src/connection/ServerConnection.cpp
|
||
|
src/connection/Socket.cpp
|
||
|
src/connection/ProtocolHandler.cpp
|
||
|
src/connection/ProtocolHandlerPOW.cpp
|
||
|
src/connection/ProtocolHandlerCrypto.cpp
|
||
|
src/connection/ProtocolHandlerPackets.cpp
|
||
|
src/connection/ProtocolHandlerCommands.cpp
|
||
|
src/connection/audio/AudioSender.cpp
|
||
|
src/connection/audio/AudioEventLoop.cpp
|
||
|
|
||
|
src/connection/audio/VoiceConnection.cpp
|
||
|
src/connection/audio/VoiceClient.cpp
|
||
|
|
||
|
src/audio/js/AudioPlayer.cpp
|
||
|
src/audio/js/AudioOutputStream.cpp
|
||
|
|
||
|
src/audio/js/AudioRecorder.cpp
|
||
|
src/audio/js/AudioConsumer.cpp
|
||
|
src/audio/js/AudioFilter.cpp
|
||
|
)
|
||
|
|
||
|
if (MSVC)
|
||
|
set(SOURCE_FILES ${SOURCE_FILES})
|
||
|
add_definitions(-DUSING_UV_SHARED)
|
||
|
else()
|
||
|
set(SOURCE_FILES ${SOURCE_FILES})
|
||
|
endif()
|
||
|
|
||
|
add_nodejs_module(${MODULE_NAME} ${SOURCE_FILES} ${NODEJS_SOURCE_FILES})
|
||
|
target_link_libraries(${MODULE_NAME} ${NODEJS_LIBRARIES})
|
||
|
if(WIN32)
|
||
|
find_package(TomMath REQUIRED)
|
||
|
include_directories(${TomMath_INCLUDE_DIR})
|
||
|
|
||
|
find_package(TomCrypt REQUIRED)
|
||
|
include_directories(${TomCrypt_INCLUDE_DIR})
|
||
|
|
||
|
find_package(DataPipes REQUIRED)
|
||
|
include_directories(${DataPipes_INCLUDE_DIR})
|
||
|
|
||
|
find_package(LibEvent REQUIRED)
|
||
|
include_directories(${LIBEVENT_INCLUDE_DIRS})
|
||
|
|
||
|
find_package(TeaSpeak_SharedLib REQUIRED)
|
||
|
include_directories(${TeaSpeak_SharedLib_INCLUDE_DIR})
|
||
|
|
||
|
find_package(StringVariable REQUIRED)
|
||
|
include_directories(${StringVariable_INCLUDE_DIR})
|
||
|
|
||
|
find_package(ed25519 REQUIRED)
|
||
|
include_directories(${ed25519_INCLUDE_DIR})
|
||
|
|
||
|
find_package(ThreadPool REQUIRED)
|
||
|
include_directories(${ThreadPool_INCLUDE_DIR})
|
||
|
add_definitions(-DWINDOWS) #Required by ThreadPool
|
||
|
|
||
|
find_package(soxr REQUIRED)
|
||
|
include_directories(${soxr_INCLUDE_DIR})
|
||
|
|
||
|
find_package(PortAudio REQUIRED)
|
||
|
include_directories(${PortAudio_INCLUDE_DIR})
|
||
|
|
||
|
find_package(fvad REQUIRED)
|
||
|
include_directories(${fvad_INCLUDE_DIR})
|
||
|
|
||
|
find_package(opus REQUIRED)
|
||
|
include_directories(${opus_INCLUDE_DIR})
|
||
|
|
||
|
find_package(spdlog REQUIRED)
|
||
|
|
||
|
set(REQUIRED_LIBRARIES
|
||
|
${TeaSpeak_SharedLib_LIBRARIES_STATIC}
|
||
|
|
||
|
${TomCrypt_LIBRARIES_STATIC}
|
||
|
${TomMath_LIBRARIES_STATIC}
|
||
|
|
||
|
${LIBEVENT_STATIC_LIBRARIES}
|
||
|
Ws2_32.Lib
|
||
|
|
||
|
${StringVariable_LIBRARIES_STATIC}
|
||
|
${DataPipes_LIBRARIES_STATIC} #Needs to be static because something causes ca bad function call when loaded in electron
|
||
|
${ThreadPool_LIBRARIES_STATIC}
|
||
|
${soxr_LIBRARIES_STATIC}
|
||
|
${PortAudio_LIBRARIES_STATIC}
|
||
|
${fvad_LIBRARIES_STATIC}
|
||
|
${opus_LIBRARIES_STATIC}
|
||
|
|
||
|
${ed25519_LIBRARIES_STATIC}
|
||
|
|
||
|
spdlog::spdlog
|
||
|
)
|
||
|
else()
|
||
|
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_JDBC OFF "${LIBRARY_PATH}/mysqlconnector/build/jdbc/driver/libmysqlcppconn.so.7")
|
||
|
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.a"
|
||
|
"${LIBRARY_PATH}/DataPipes/cmake-build-release/libDataPipes.a"
|
||
|
"${LIBRARY_PATH}/DataPipes/cmake-build-debug/libDataPipes.a"
|
||
|
)
|
||
|
resolve_library(LIBRARY_PATH_OPUS OFF "${LIBRARY_PATH}/opus/build/.libs/libopus.a")
|
||
|
|
||
|
set(REQUIRED_LIBRARIES
|
||
|
/home/wolverindev/TeaSpeak/TeaSpeak/cmake-build-debug/shared/libTeaSpeak.a
|
||
|
|
||
|
${LIBRARY_TOM_CRYPT}
|
||
|
${LIBRARY_TOM_MATH}
|
||
|
|
||
|
${LIBEVENT_PATH}/libevent.a
|
||
|
${LIBEVENT_PATH}/libevent_pthreads.a
|
||
|
|
||
|
${LIBRARY_PATH_DATA_PIPES} #Needs to be static because something causes ca bad function call when loaded in electron
|
||
|
${LIBRARY_PATH_THREAD_POOL}
|
||
|
|
||
|
${LIBRARY_PATH_ED255}
|
||
|
|
||
|
fvad.a
|
||
|
/home/wolverindev/Development-WebApp/TeaClient/native/codec/libraries/generated/opus/lib/libopus.a
|
||
|
portaudio.a
|
||
|
soxr.a
|
||
|
|
||
|
asound
|
||
|
jack
|
||
|
|
||
|
pthread
|
||
|
)
|
||
|
target_link_libraries(${MODULE_NAME} ${REQUIRED_LIBRARIES})
|
||
|
include_directories(${LIBRARY_PATH}/tomcrypt/src/headers)
|
||
|
endif()
|
||
|
|
||
|
add_definitions(-DNO_OPEN_SSL)
|
||
|
target_link_libraries(${MODULE_NAME} ${REQUIRED_LIBRARIES})
|
||
|
target_compile_definitions(${MODULE_NAME} PUBLIC -DNODEJS_API)
|
||
|
|
||
|
add_executable(Audio-Test ${SOURCE_FILES} test/audio/main.cpp)
|
||
|
target_link_libraries(Audio-Test ${REQUIRED_LIBRARIES})
|