2019-10-25 19:51:40 -04:00
|
|
|
set(MODULE_NAME "teaclient_connection")
|
|
|
|
|
|
|
|
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -static-libasan -lasan -lubsan")
|
|
|
|
set(SOURCE_FILES
|
2020-02-13 16:16:34 -05:00
|
|
|
src/logger.cpp
|
|
|
|
src/EventLoop.cpp
|
|
|
|
src/hwuid.cpp
|
2020-02-08 10:50:48 -05:00
|
|
|
src/ring_buffer.cpp
|
2019-10-25 19:51:40 -04:00
|
|
|
|
2020-02-13 16:16:34 -05:00
|
|
|
src/connection/ft/FileTransferManager.cpp
|
|
|
|
src/connection/ft/FileTransferObject.cpp
|
2019-10-25 19:51:40 -04:00
|
|
|
|
2020-02-13 16:16:34 -05:00
|
|
|
src/audio/AudioSamples.cpp
|
|
|
|
src/audio/AudioMerger.cpp
|
|
|
|
src/audio/AudioOutput.cpp
|
|
|
|
src/audio/AudioInput.cpp
|
|
|
|
src/audio/AudioResampler.cpp
|
|
|
|
src/audio/AudioReframer.cpp
|
2019-10-25 19:51:40 -04:00
|
|
|
|
2020-02-13 16:16:34 -05:00
|
|
|
src/audio/filter/FilterVad.cpp
|
|
|
|
src/audio/filter/FilterThreshold.cpp
|
|
|
|
src/audio/filter/FilterState.cpp
|
2019-10-25 19:51:40 -04:00
|
|
|
|
2020-02-13 16:16:34 -05:00
|
|
|
src/audio/codec/Converter.cpp
|
|
|
|
src/audio/codec/OpusConverter.cpp
|
2020-02-08 10:50:48 -05:00
|
|
|
|
|
|
|
src/audio/driver/AudioDriver.cpp
|
2020-02-13 16:16:34 -05:00
|
|
|
)
|
2019-10-25 19:51:40 -04:00
|
|
|
|
|
|
|
set(NODEJS_SOURCE_FILES
|
2020-02-13 16:16:34 -05:00
|
|
|
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
|
2019-10-25 19:51:40 -04:00
|
|
|
)
|
|
|
|
|
2020-02-13 16:16:34 -05:00
|
|
|
if (SOUNDIO_BACKED)
|
|
|
|
find_package(soundio REQUIRED)
|
|
|
|
include_directories(${soundio_INCLUDE_DIR})
|
|
|
|
add_compile_definitions(SOUNDIO_STATIC_LIBRARY)
|
|
|
|
|
|
|
|
list(APPEND SOURCE_FILES
|
|
|
|
src/audio/driver/SoundIO.cpp
|
|
|
|
src/audio/driver/SoundIOPlayback.cpp
|
|
|
|
src/audio/driver/SoundIORecord.cpp
|
|
|
|
)
|
|
|
|
add_definitions(-DHAVE_SOUNDIO)
|
|
|
|
else()
|
|
|
|
add_definitions(-DHAVE_PORTAUDIO)
|
|
|
|
|
|
|
|
list(APPEND SOURCE_FILES
|
|
|
|
src/audio/driver/PortAudio.cpp
|
|
|
|
src/audio/driver/PortAudioRecord.cpp
|
|
|
|
src/audio/driver/PortAudioPlayback.cpp
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2019-10-25 19:51:40 -04:00
|
|
|
if (MSVC)
|
2020-02-13 16:16:34 -05:00
|
|
|
set(SOURCE_FILES ${SOURCE_FILES})
|
|
|
|
add_definitions(-DUSING_UV_SHARED)
|
2019-10-25 19:51:40 -04:00
|
|
|
else()
|
2020-02-13 16:16:34 -05:00
|
|
|
set(SOURCE_FILES ${SOURCE_FILES})
|
2019-10-25 19:51:40 -04:00
|
|
|
endif()
|
|
|
|
|
|
|
|
add_nodejs_module(${MODULE_NAME} ${SOURCE_FILES} ${NODEJS_SOURCE_FILES})
|
|
|
|
target_link_libraries(${MODULE_NAME} ${NODEJS_LIBRARIES})
|
|
|
|
#target_compile_options(${MODULE_NAME} PUBLIC "-fPIC")
|
|
|
|
|
2020-02-13 16:16:34 -05:00
|
|
|
find_package(PortAudio REQUIRED)
|
|
|
|
include_directories(${PortAudio_INCLUDE_DIR})
|
2020-02-08 14:45:04 -05:00
|
|
|
|
2019-10-25 19:51:40 -04:00
|
|
|
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})
|
|
|
|
|
2020-02-08 18:06:42 -05:00
|
|
|
set(_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
2019-10-25 19:51:40 -04:00
|
|
|
find_package(Libevent REQUIRED)
|
|
|
|
include_directories(${LIBEVENT_INCLUDE_DIRS})
|
2020-02-08 18:06:42 -05:00
|
|
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_CMAKE_FIND_LIBRARY_SUFFIXES})
|
2019-10-25 19:51:40 -04:00
|
|
|
|
|
|
|
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})
|
|
|
|
if (WIN32)
|
2020-02-13 16:16:34 -05:00
|
|
|
add_compile_options(/NODEFAULTLIB:ThreadPoolStatic)
|
|
|
|
add_definitions(-DWINDOWS) #Required by ThreadPool
|
|
|
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS) # Let windows allow strerror
|
|
|
|
add_definitions(-D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING) # For the FMT library
|
2019-10-25 19:51:40 -04:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
find_package(Soxr REQUIRED)
|
|
|
|
include_directories(${soxr_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
|
2020-02-13 16:16:34 -05:00
|
|
|
${TeaSpeak_SharedLib_LIBRARIES_STATIC}
|
2019-10-25 19:51:40 -04:00
|
|
|
|
2020-02-13 16:16:34 -05:00
|
|
|
${TomCrypt_LIBRARIES_STATIC}
|
|
|
|
${TomMath_LIBRARIES_STATIC}
|
2019-10-25 19:51:40 -04:00
|
|
|
|
2020-02-13 16:16:34 -05:00
|
|
|
${LIBEVENT_STATIC_LIBRARIES}
|
2019-10-25 19:51:40 -04:00
|
|
|
|
2020-02-13 16:16:34 -05:00
|
|
|
${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}
|
|
|
|
${fvad_LIBRARIES_STATIC}
|
|
|
|
${opus_LIBRARIES_STATIC}
|
2019-10-25 19:51:40 -04:00
|
|
|
|
2020-02-13 16:16:34 -05:00
|
|
|
${ed25519_LIBRARIES_STATIC}
|
2019-10-25 19:51:40 -04:00
|
|
|
|
2020-02-13 16:16:34 -05:00
|
|
|
spdlog::spdlog_header_only
|
|
|
|
Nan::Helpers
|
|
|
|
)
|
|
|
|
|
|
|
|
if (SOUNDIO_BACKED)
|
|
|
|
list(APPEND REQUIRED_LIBRARIES soundio::static)
|
|
|
|
else()
|
|
|
|
list(APPEND REQUIRED_LIBRARIES ${PortAudio_LIBRARIES_STATIC})
|
|
|
|
endif ()
|
2019-10-25 19:51:40 -04:00
|
|
|
|
|
|
|
if (WIN32)
|
2020-02-13 16:16:34 -05:00
|
|
|
set(REQUIRED_LIBRARIES ${REQUIRED_LIBRARIES} "Ws2_32.Lib")
|
2019-10-25 19:51:40 -04:00
|
|
|
else()
|
2020-02-13 16:16:34 -05:00
|
|
|
set(REQUIRED_LIBRARIES ${REQUIRED_LIBRARIES}
|
|
|
|
libstdc++fs.a
|
|
|
|
asound
|
|
|
|
jack.a
|
|
|
|
pthread
|
|
|
|
)
|
2019-10-25 19:51:40 -04:00
|
|
|
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)
|
2020-02-08 14:45:04 -05:00
|
|
|
target_link_libraries(Audio-Test ${REQUIRED_LIBRARIES})
|
2019-10-25 19:51:40 -04:00
|
|
|
|
2019-11-09 16:16:08 -05:00
|
|
|
add_executable(Audio-Test-2 ${SOURCE_FILES} test/audio/sio.cpp)
|
2020-02-08 14:45:04 -05:00
|
|
|
target_link_libraries(Audio-Test-2 ${REQUIRED_LIBRARIES})
|
2019-11-09 16:16:08 -05:00
|
|
|
|
2019-10-25 19:51:40 -04:00
|
|
|
add_executable(HW-UID-Test src/hwuid.cpp)
|
|
|
|
target_link_libraries(HW-UID-Test
|
2020-02-13 16:16:34 -05:00
|
|
|
${REQUIRED_LIBRARIES}
|
|
|
|
)
|