diff --git a/.gitignore b/.gitignore index 634e5f8..0b7e197 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ compile_commands.json .vimspector.json .*.swp .ycm_extra_conf.py +.DS_Store diff --git a/.gitmodules b/.gitmodules index 3f23be7..9b96980 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "examples/third-party/ggsock"] path = examples/third-party/ggsock url = https://github.com/ggerganov/ggsock +[submodule "bindings/ios"] + path = bindings/ios + url = https://github.com/ggerganov/ggwave-spm diff --git a/CMakeLists.txt b/CMakeLists.txt index b9b71ff..601f3d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,9 +2,10 @@ cmake_minimum_required (VERSION 3.0) project(ggwave VERSION 0.1.5) # configure project version -configure_file(${CMAKE_SOURCE_DIR}/README.md.tmpl ${CMAKE_SOURCE_DIR}/README.md @ONLY) -configure_file(${CMAKE_SOURCE_DIR}/bindings/python/setup.py.tmpl ${CMAKE_SOURCE_DIR}/bindings/python/setup.py @ONLY) +configure_file(${CMAKE_SOURCE_DIR}/README-tmpl.md ${CMAKE_SOURCE_DIR}/README.md @ONLY) +configure_file(${CMAKE_SOURCE_DIR}/bindings/python/setup-tmpl.py ${CMAKE_SOURCE_DIR}/bindings/python/setup.py @ONLY) configure_file(${CMAKE_SOURCE_DIR}/bindings/javascript/package-tmpl.json ${CMAKE_SOURCE_DIR}/bindings/javascript/package.json @ONLY) +configure_file(${CMAKE_SOURCE_DIR}/bindings/ios/Makefile-tmpl ${CMAKE_SOURCE_DIR}/bindings/ios/Makefile @ONLY) set(CMAKE_EXPORT_COMPILE_COMMANDS "on") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) @@ -39,6 +40,7 @@ option(GGWAVE_SANITIZE_UNDEFINED "ggwave: enable undefined sanitizer" OFF) option(GGWAVE_SUPPORT_SDL2 "ggwave: support for libSDL2" ${GGWAVE_SUPPORT_SDL2_DEFAULT}) option(GGWAVE_SUPPORT_PYTHON "ggwave: support for python" OFF) +option(GGWAVE_SUPPORT_SWIFT "ggwave: support for swift" OFF) option(GGWAVE_BUILD_TESTS "ggwave: build examples" ${GGWAVE_STANDALONE}) option(GGWAVE_BUILD_EXAMPLES "ggwave: build examples" ${GGWAVE_STANDALONE}) diff --git a/README.md.tmpl b/README-tmpl.md similarity index 99% rename from README.md.tmpl rename to README-tmpl.md index b4f7ea6..2cdd6a2 100644 --- a/README.md.tmpl +++ b/README-tmpl.md @@ -158,6 +158,10 @@ npm install ggwave More info: https://www.npmjs.com/package/ggwave +### iOS + +Available as a Swift Package: https://github.com/ggerganov/ggwave-spm + ## Installing the Waver application [![Get it from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-black.svg)](https://snapcraft.io/waver) diff --git a/README.md b/README.md index 8285e38..293b337 100644 --- a/README.md +++ b/README.md @@ -158,6 +158,10 @@ npm install ggwave More info: https://www.npmjs.com/package/ggwave +### iOS + +Available as a Swift Package: https://github.com/ggerganov/ggwave-spm + ## Installing the Waver application [![Get it from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-black.svg)](https://snapcraft.io/waver) diff --git a/bindings/CMakeLists.txt b/bindings/CMakeLists.txt index 5671cb1..a054cfa 100644 --- a/bindings/CMakeLists.txt +++ b/bindings/CMakeLists.txt @@ -12,7 +12,7 @@ if (EMSCRIPTEN) VERBATIM ) - add_custom_target(npm-publish + add_custom_target(publish-npm DEPENDS javascript/publish.log ) endif() @@ -53,8 +53,41 @@ if (GGWAVE_SUPPORT_PYTHON) VERBATIM ) - add_custom_target(pypi-publish + add_custom_target(publish-pypi DEPENDS python/dist ) endif() +if (GGWAVE_SUPPORT_SWIFT) + file(GLOB_RECURSE GGWAVE_SOURCES "../include/*" "../src/*") + + add_custom_command( + OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/ios/.build + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ios/Makefile + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ios/Package.swift + DEPENDS ${GGWAVE_SOURCES} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ios + COMMAND make clean + COMMAND make build-submodule + COMMENT "Compiling Swift package" + VERBATIM + ) + + add_custom_target(ggwave-spm ALL + DEPENDS ios/.build + ) + + add_custom_command( + OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/ios/publish + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ios/publish-trigger + DEPENDS ${GGWAVE_SOURCES} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ios + COMMAND make publish + COMMENT "Publishing Swift package v${PROJECT_VERSION}" + VERBATIM + ) + + add_custom_target(publish-spm + DEPENDS ios/publish + ) +endif() diff --git a/bindings/ios b/bindings/ios new file mode 160000 index 0000000..8c9b385 --- /dev/null +++ b/bindings/ios @@ -0,0 +1 @@ +Subproject commit 8c9b385c66a0337a329bbf4f617f133bbec7bfce diff --git a/bindings/python/setup.py.tmpl b/bindings/python/setup-tmpl.py similarity index 100% rename from bindings/python/setup.py.tmpl rename to bindings/python/setup-tmpl.py diff --git a/examples/ggwave-wasm/CMakeLists.txt b/examples/ggwave-wasm/CMakeLists.txt index 18937da..d89ffe7 100644 --- a/examples/ggwave-wasm/CMakeLists.txt +++ b/examples/ggwave-wasm/CMakeLists.txt @@ -1,6 +1,6 @@ set(TARGET ggwave-wasm) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/build_timestamp.h.tmpl ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET}/build_timestamp.h @ONLY) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/build_timestamp-tmpl.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET}/build_timestamp.h @ONLY) add_executable(${TARGET} main.cpp diff --git a/examples/ggwave-wasm/build_timestamp.h.tmpl b/examples/ggwave-wasm/build_timestamp-tmpl.h similarity index 100% rename from examples/ggwave-wasm/build_timestamp.h.tmpl rename to examples/ggwave-wasm/build_timestamp-tmpl.h diff --git a/examples/waver/CMakeLists.txt b/examples/waver/CMakeLists.txt index 10e0895..68eb365 100644 --- a/examples/waver/CMakeLists.txt +++ b/examples/waver/CMakeLists.txt @@ -23,7 +23,7 @@ if (EMSCRIPTEN) --preload-file ${CMAKE_CURRENT_SOURCE_DIR}/../assets/fonts@/ \ ") - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/build_timestamp.h.tmpl ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET}/build_timestamp.h @ONLY) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/build_timestamp-tmpl.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET}/build_timestamp.h @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/index-tmpl.html ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET}/index.html @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/style.css ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET}/style.css COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/background-0.png ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET}/background-0.png COPYONLY) diff --git a/examples/waver/build_timestamp.h.tmpl b/examples/waver/build_timestamp-tmpl.h similarity index 100% rename from examples/waver/build_timestamp.h.tmpl rename to examples/waver/build_timestamp-tmpl.h diff --git a/src/reed-solomon/gf.hpp b/src/reed-solomon/gf.hpp index 8abcfb1..14a2831 100644 --- a/src/reed-solomon/gf.hpp +++ b/src/reed-solomon/gf.hpp @@ -5,16 +5,12 @@ #ifndef GF_H #define GF_H -#include -#include + #include "poly.hpp" -#if !defined DEBUG && !defined __CC_ARM +#include +#include #include -#else -#define assert(dummy) -#endif - namespace RS { diff --git a/src/reed-solomon/poly.hpp b/src/reed-solomon/poly.hpp index 0e9913a..9e1b65f 100644 --- a/src/reed-solomon/poly.hpp +++ b/src/reed-solomon/poly.hpp @@ -5,14 +5,10 @@ #ifndef POLY_H #define POLY_H + #include #include - -#if !defined DEBUG && !defined __CC_ARM #include -#else -#define assert(dummy) -#endif namespace RS { diff --git a/src/reed-solomon/rs.hpp b/src/reed-solomon/rs.hpp index cfe4b4b..202cdd5 100644 --- a/src/reed-solomon/rs.hpp +++ b/src/reed-solomon/rs.hpp @@ -5,17 +5,13 @@ #ifndef RS_HPP #define RS_HPP -#include -#include + #include "poly.hpp" #include "gf.hpp" -#if !defined DEBUG && !defined __CC_ARM #include -#else -#define assert(dummy) -#endif - +#include +#include #include namespace RS {