2018-08-04 19:12:23 +02:00
|
|
|
cmake_minimum_required(VERSION 3.9)
|
2018-04-24 15:24:05 +02:00
|
|
|
project(TeaWeb-Native)
|
|
|
|
|
2020-03-31 02:11:55 +02:00
|
|
|
set (CMAKE_CXX_STANDARD 17)
|
|
|
|
|
|
|
|
|
|
|
|
function(import_opus)
|
|
|
|
# Native SIMD isn't supported yet by most browsers (only experimental)
|
|
|
|
# But since opus already detects if emscripten is able to handle SIMD we have no need to disable this explicitly
|
|
|
|
|
|
|
|
# Disable the math.h warning spam:
|
|
|
|
# #warning "Don't have the functions lrint() and lrintf ()."
|
|
|
|
# #warning "Replacing these functions with a standard C cast."
|
|
|
|
set(CMAKE_C_FLAGS "-Wno-#warnings")
|
|
|
|
set(OPUS_STACK_PROTECTOR OFF CACHE BOOL "" FORCE)
|
|
|
|
add_subdirectory(libraries/opus/)
|
|
|
|
endfunction()
|
|
|
|
import_opus()
|
|
|
|
|
2019-02-17 16:08:10 +01:00
|
|
|
set(CMAKE_CXX_FLAGS "-O3 --llvm-lto 1 --memory-init-file 0 -s WASM=1 -s ASSERTIONS=1") # -s ALLOW_MEMORY_GROWTH=1 -O3
|
2020-03-31 01:27:59 +02:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "-s EXPORTED_FUNCTIONS='[\"_malloc\", \"_free\"]' -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]' -s ENVIRONMENT='worker' --pre-js ${CMAKE_SOURCE_DIR}/init.js") #
|
2018-04-24 15:24:05 +02:00
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/generated/")
|
|
|
|
|
2018-12-26 15:53:47 +01:00
|
|
|
add_executable(TeaWeb-Worker-Codec-Opus src/opus.cpp)
|
2020-03-31 02:11:55 +02:00
|
|
|
target_link_libraries(TeaWeb-Worker-Codec-Opus opus)
|