Skip to content

Commit 2e34d46

Browse files
authored
iOS SDK (#15)
* wip : creating a Swift Package Manager package * ios : tests ready * cmake : add ggwave-spm and spm-publish targets * cosmetics
1 parent 555495f commit 2e34d46

File tree

15 files changed

+61
-25
lines changed

15 files changed

+61
-25
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ compile_commands.json
66
.vimspector.json
77
.*.swp
88
.ycm_extra_conf.py
9+
.DS_Store

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
[submodule "examples/third-party/ggsock"]
55
path = examples/third-party/ggsock
66
url = https://github.com/ggerganov/ggsock
7+
[submodule "bindings/ios"]
8+
path = bindings/ios
9+
url = https://github.com/ggerganov/ggwave-spm

CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ cmake_minimum_required (VERSION 3.0)
22
project(ggwave VERSION 0.1.5)
33

44
# configure project version
5-
configure_file(${CMAKE_SOURCE_DIR}/README.md.tmpl ${CMAKE_SOURCE_DIR}/README.md @ONLY)
6-
configure_file(${CMAKE_SOURCE_DIR}/bindings/python/setup.py.tmpl ${CMAKE_SOURCE_DIR}/bindings/python/setup.py @ONLY)
5+
configure_file(${CMAKE_SOURCE_DIR}/README-tmpl.md ${CMAKE_SOURCE_DIR}/README.md @ONLY)
6+
configure_file(${CMAKE_SOURCE_DIR}/bindings/python/setup-tmpl.py ${CMAKE_SOURCE_DIR}/bindings/python/setup.py @ONLY)
77
configure_file(${CMAKE_SOURCE_DIR}/bindings/javascript/package-tmpl.json ${CMAKE_SOURCE_DIR}/bindings/javascript/package.json @ONLY)
8+
configure_file(${CMAKE_SOURCE_DIR}/bindings/ios/Makefile-tmpl ${CMAKE_SOURCE_DIR}/bindings/ios/Makefile @ONLY)
89

910
set(CMAKE_EXPORT_COMPILE_COMMANDS "on")
1011
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
@@ -39,6 +40,7 @@ option(GGWAVE_SANITIZE_UNDEFINED "ggwave: enable undefined sanitizer" OFF)
3940

4041
option(GGWAVE_SUPPORT_SDL2 "ggwave: support for libSDL2" ${GGWAVE_SUPPORT_SDL2_DEFAULT})
4142
option(GGWAVE_SUPPORT_PYTHON "ggwave: support for python" OFF)
43+
option(GGWAVE_SUPPORT_SWIFT "ggwave: support for swift" OFF)
4244

4345
option(GGWAVE_BUILD_TESTS "ggwave: build examples" ${GGWAVE_STANDALONE})
4446
option(GGWAVE_BUILD_EXAMPLES "ggwave: build examples" ${GGWAVE_STANDALONE})

README.md.tmpl renamed to README-tmpl.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ npm install ggwave
158158

159159
More info: https://www.npmjs.com/package/ggwave
160160

161+
### iOS
162+
163+
Available as a Swift Package: https://github.com/ggerganov/ggwave-spm
164+
161165
## Installing the Waver application
162166

163167
[![Get it from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-black.svg)](https://snapcraft.io/waver)

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ npm install ggwave
158158

159159
More info: https://www.npmjs.com/package/ggwave
160160

161+
### iOS
162+
163+
Available as a Swift Package: https://github.com/ggerganov/ggwave-spm
164+
161165
## Installing the Waver application
162166

163167
[![Get it from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-black.svg)](https://snapcraft.io/waver)

bindings/CMakeLists.txt

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if (EMSCRIPTEN)
1212
VERBATIM
1313
)
1414

15-
add_custom_target(npm-publish
15+
add_custom_target(publish-npm
1616
DEPENDS javascript/publish.log
1717
)
1818
endif()
@@ -53,8 +53,41 @@ if (GGWAVE_SUPPORT_PYTHON)
5353
VERBATIM
5454
)
5555

56-
add_custom_target(pypi-publish
56+
add_custom_target(publish-pypi
5757
DEPENDS python/dist
5858
)
5959
endif()
6060

61+
if (GGWAVE_SUPPORT_SWIFT)
62+
file(GLOB_RECURSE GGWAVE_SOURCES "../include/*" "../src/*")
63+
64+
add_custom_command(
65+
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/ios/.build
66+
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ios/Makefile
67+
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ios/Package.swift
68+
DEPENDS ${GGWAVE_SOURCES}
69+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ios
70+
COMMAND make clean
71+
COMMAND make build-submodule
72+
COMMENT "Compiling Swift package"
73+
VERBATIM
74+
)
75+
76+
add_custom_target(ggwave-spm ALL
77+
DEPENDS ios/.build
78+
)
79+
80+
add_custom_command(
81+
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/ios/publish
82+
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ios/publish-trigger
83+
DEPENDS ${GGWAVE_SOURCES}
84+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ios
85+
COMMAND make publish
86+
COMMENT "Publishing Swift package v${PROJECT_VERSION}"
87+
VERBATIM
88+
)
89+
90+
add_custom_target(publish-spm
91+
DEPENDS ios/publish
92+
)
93+
endif()

bindings/ios

Submodule ios added at 8c9b385

examples/ggwave-wasm/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
set(TARGET ggwave-wasm)
22

3-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/build_timestamp.h.tmpl ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET}/build_timestamp.h @ONLY)
3+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/build_timestamp-tmpl.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET}/build_timestamp.h @ONLY)
44

55
add_executable(${TARGET}
66
main.cpp
File renamed without changes.

0 commit comments

Comments
 (0)