mirror of
https://github.com/ggerganov/ggwave.git
synced 2026-02-07 01:11:22 +08:00
* inital implementation * remove file * ggwave-cli : txProtocol -> txProtocolId * ggwave : add custom protocol enum values * r2t2 : use cutom protocols * r2t2 : build only on Unix systems * r2t2 : remove thread * r2t2-rx : wip * r2t2 : wasm build ready + various fixes * r2t2 : error message * Update README.md * Update README.md * Update README.md * Update README.md * r2t2 : length 16 * r2t2 : use slow protocol by default * r2t2 : add timestamp * r2t2 : update html * r2t2 : update github link * r2t2 : more robust tx * r2t2 : add option to use beep command * emscripten : cannot use requestAnimationFrame when capturing audio This causes the queued audio buffer to grow indefinitely when the page is not focused, causing the process to run out of memory. * r2t2 : disable beep option * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * r2t2 : add example to README
118 lines
2.4 KiB
CMake
118 lines
2.4 KiB
CMake
# dependencies
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
if (GGWAVE_SUPPORT_SDL2)
|
|
# SDL2
|
|
|
|
if (EMSCRIPTEN)
|
|
set(CMAKE_CXX_FLAGS " \
|
|
--bind \
|
|
-s TOTAL_MEMORY=67108864 \
|
|
-s USE_SDL=2 \
|
|
-s ASSERTIONS=1 \
|
|
-s DISABLE_EXCEPTION_CATCHING=0 \
|
|
-s 'EXTRA_EXPORTED_RUNTIME_METHODS=[\"writeArrayToMemory\"]' \
|
|
")
|
|
|
|
unset(SDL2_INCLUDE_DIRS)
|
|
unset(SDL2_LIBRARIES)
|
|
endif()
|
|
|
|
if (NOT EMSCRIPTEN)
|
|
find_package(SDL2)
|
|
|
|
if (NOT USE_FINDSDL2 AND NOT SDL2_FOUND)
|
|
message(WARNING "Unable to find SDL2 library. It is either not installed or CMake cannot find it."
|
|
" In the latter case, setting the USE_FINDSDL2 variable might help:\n"
|
|
" $ cmake -D USE_FINDSDL2 .."
|
|
)
|
|
|
|
message(FATAL_ERROR "Aborting")
|
|
endif()
|
|
|
|
string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES)
|
|
|
|
message(STATUS "SDL2_INCLUDE_DIRS = ${SDL2_INCLUDE_DIRS}")
|
|
message(STATUS "SDL2_LIBRARIES = ${SDL2_LIBRARIES}")
|
|
endif()
|
|
endif()
|
|
|
|
# third-party
|
|
|
|
add_subdirectory(third-party)
|
|
|
|
# helper libraries
|
|
|
|
add_library(ggwave-common
|
|
ggwave-common.cpp
|
|
)
|
|
|
|
target_link_libraries(ggwave-common PRIVATE
|
|
${CMAKE_DL_LIBS}
|
|
)
|
|
|
|
if (MINGW)
|
|
target_link_libraries(ggwave-common PUBLIC
|
|
stdc++
|
|
)
|
|
endif()
|
|
|
|
if (GGWAVE_SUPPORT_SDL2)
|
|
# ggwave-common-sdl2
|
|
|
|
add_library(ggwave-common-sdl2
|
|
ggwave-common-sdl2.cpp
|
|
)
|
|
|
|
target_include_directories(ggwave-common-sdl2 PUBLIC
|
|
${SDL2_INCLUDE_DIRS}
|
|
)
|
|
|
|
target_link_libraries(ggwave-common-sdl2 PRIVATE
|
|
ggwave
|
|
imgui-sdl2
|
|
${SDL2_LIBRARIES}
|
|
)
|
|
endif()
|
|
|
|
# examples
|
|
|
|
if (EMSCRIPTEN)
|
|
add_subdirectory(ggwave-js)
|
|
else()
|
|
add_subdirectory(ggwave-to-file)
|
|
endif()
|
|
|
|
if (UNIX AND NOT APPLE)
|
|
add_subdirectory(r2t2)
|
|
endif()
|
|
|
|
if (GGWAVE_SUPPORT_SDL2)
|
|
if (EMSCRIPTEN)
|
|
# emscripten sdl2 examples
|
|
|
|
add_subdirectory(ggwave-wasm)
|
|
else()
|
|
# non-emscripten sdl2 examples
|
|
|
|
add_subdirectory(ggwave-rx)
|
|
add_subdirectory(ggwave-cli)
|
|
endif()
|
|
|
|
add_subdirectory(waver)
|
|
add_subdirectory(spectrogram)
|
|
endif()
|
|
|
|
install(TARGETS ggwave-common
|
|
LIBRARY DESTINATION lib
|
|
ARCHIVE DESTINATION lib/static
|
|
)
|
|
|
|
if (GGWAVE_SUPPORT_SDL2)
|
|
install(TARGETS ggwave-common-sdl2
|
|
LIBRARY DESTINATION lib
|
|
ARCHIVE DESTINATION lib/static
|
|
)
|
|
endif()
|