* wip : creating a Swift Package Manager package

* ios : tests ready

* cmake : add ggwave-spm and spm-publish targets

* cosmetics
This commit is contained in:
Georgi Gerganov
2021-01-30 12:38:01 +02:00
committed by GitHub
parent 555495f7cb
commit 2e34d46e02
15 changed files with 61 additions and 25 deletions

1
.gitignore vendored
View File

@@ -6,3 +6,4 @@ compile_commands.json
.vimspector.json
.*.swp
.ycm_extra_conf.py
.DS_Store

3
.gitmodules vendored
View File

@@ -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

View File

@@ -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})

View File

@@ -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)

View File

@@ -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)

View File

@@ -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()

1
bindings/ios Submodule

Submodule bindings/ios added at 8c9b385c66

View File

@@ -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

View File

@@ -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)

View File

@@ -5,16 +5,12 @@
#ifndef GF_H
#define GF_H
#include <stdint.h>
#include <string.h>
#include "poly.hpp"
#if !defined DEBUG && !defined __CC_ARM
#include <stdint.h>
#include <string.h>
#include <assert.h>
#else
#define assert(dummy)
#endif
namespace RS {

View File

@@ -5,14 +5,10 @@
#ifndef POLY_H
#define POLY_H
#include <stdint.h>
#include <string.h>
#if !defined DEBUG && !defined __CC_ARM
#include <assert.h>
#else
#define assert(dummy)
#endif
namespace RS {

View File

@@ -5,17 +5,13 @@
#ifndef RS_HPP
#define RS_HPP
#include <string.h>
#include <stdint.h>
#include "poly.hpp"
#include "gf.hpp"
#if !defined DEBUG && !defined __CC_ARM
#include <assert.h>
#else
#define assert(dummy)
#endif
#include <string.h>
#include <stdint.h>
#include <vector>
namespace RS {