diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 0000000..379e1e9 --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,22 @@ +name: android +on: + pull_request: + push: + branches: + - master + +jobs: + build: + runs-on: macOS-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - run: make init + - run: make heaps-world + - run: make build + - uses: actions/upload-artifact@v2 + with: + name: heapsapp-debug.apk + path: heaps-android-app/heapsapp/build/outputs/apk/debug/heapsapp-debug.apk diff --git a/.gitignore b/.gitignore index 5468d9e..3fe56f5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -/out/* +out +build diff --git a/.gitmodules b/.gitmodules index b503e12..02a6fcd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -14,3 +14,6 @@ [submodule "heaps-android-app"] path = heaps-android-app url = https://github.com/rtissera/heaps-android-app.git +[submodule "heaps"] + path = heaps + url = https://github.com/HeapsIO/heaps.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 5317444..df9ca26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,7 @@ include_directories(hashlink/src) file(GLOB libhl hashlink/src/std/*.c hashlink/src/alloc.c + hashlink/src/gc.c ) list(REMOVE_ITEM libhl ${CMAKE_CURRENT_SOURCE_DIR}/hashlink/src/std/debug.c) @@ -38,6 +39,7 @@ file(GLOB png hashlink/include/png/*.c) file(GLOB zlib hashlink/include/zlib/*.c) file(GLOB vorbis hashlink/include/vorbis/*.c) file(GLOB mikkt hashlink/include/mikktspace/*.c) +file(GLOB minimp3 hashlink/include/minimp3/*.c) add_library(fmt.hdll STATIC ${fmt} @@ -52,9 +54,10 @@ file(GLOB tj_include libjpeg-turbo/jni/vendor/libjpeg-turbo/libjpeg-turbo-*) target_link_libraries(fmt.hdll ${TJ_LIB}) target_compile_definitions(fmt.hdll PRIVATE PNG_ARM_NEON_OPT=0) #disable Neon support for now -target_include_directories(fmt.hdll PRIVATE +target_include_directories(fmt.hdll PRIVATE hashlink/include/png hashlink/include/mikktspace + hashlink/include/minimp3 hashlink/include/vorbis hashlink/include/zlib ${tj_include} diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4e7ea7f --- /dev/null +++ b/Makefile @@ -0,0 +1,30 @@ +.PHONY: all init build install clean heaps-world + +all: build install + +init: + brew install haxe + brew bundle install --file hashlink/Brewfile --no-lock + make -C hashlink + make install -C hashlink + haxelib setup /usr/local/lib/haxe/lib + brew cask install android-studio + ln -sf /Applications/Android\ Studio.app/Contents/plugins/android/lib/templates/gradle/wrapper/gradlew /usr/local/bin + chmod u+x /usr/local/bin/gradlew + +build: + gradlew buildDebug -p heaps-android-app + +install: + adb install heaps-android-app/heapsapp/build/outputs/apk/debug/heapsapp-debug.apk + +clean: + gradlew clean -p heaps-android-app + +heaps-world: heaps-world-hl heaps-world-pak + +heaps-world-hl: + cd heaps/samples && haxelib install --always ../../config/main.hxml && haxe -hl ../../out/main.c ../../config/main.hxml + +heaps-world-pak: + cd heaps/samples && haxe -hl ../../out/pak.hl ../../config/pak.hxml && hl ../../out/pak.hl -out ../../out/res diff --git a/README.md b/README.md new file mode 100644 index 0000000..36ef0d4 --- /dev/null +++ b/README.md @@ -0,0 +1,65 @@ +# Heaps Android +Forked from https://github.com/HeapsIO/heaps-android/ + +![android](https://github.com/qkdreyer/heaps-android/workflows/android/badge.svg?branch=master) + + +## Setup + +```sh +git clone https://github.com/qkdreyer/heaps-android +cd heaps-android +make init +``` + +## Usage + +```sh +make heaps-world +make build +make install +``` + +# Extra + +## Visual Studio Code + +`.vscode/tasks.json` +``` +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "Build & Run (Android)", + "dependsOn": [ + "Build (Android)", + "Run (Android)" + ], + "dependsOrder": "sequence", + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": [] + }, + { + "label": "Build (Android)", + "type": "shell", + "command": "make build", + "group": "build", + "problemMatcher": [] + }, + { + "label": "Run (Android)", + "type": "shell", + "command": "make install", + "group": "build", + "problemMatcher": [] + }, +] +} +``` diff --git a/config/base.hxml b/config/base.hxml new file mode 100644 index 0000000..3ea31c3 --- /dev/null +++ b/config/base.hxml @@ -0,0 +1,8 @@ +World.hx +-lib heaps +-lib hlsdl +-lib hxbit +-lib format +-lib hashlink +-D windowSize=1024x768 +-D resourcesPath=world_res diff --git a/config/main.hxml b/config/main.hxml new file mode 100644 index 0000000..e26dd9c --- /dev/null +++ b/config/main.hxml @@ -0,0 +1,2 @@ +../../config/base.hxml +-main World diff --git a/config/pak.hxml b/config/pak.hxml new file mode 100644 index 0000000..54bf658 --- /dev/null +++ b/config/pak.hxml @@ -0,0 +1,2 @@ +../../config/base.hxml +-main hxd.fmt.pak.Build diff --git a/hashlink b/hashlink index 0fd764d..70a1884 160000 --- a/hashlink +++ b/hashlink @@ -1 +1 @@ -Subproject commit 0fd764d7711ad170115f173a59c81a6bc1da8c4b +Subproject commit 70a1884cd3bd5921f85d780ce48324141ff6e452 diff --git a/heaps b/heaps new file mode 160000 index 0000000..50e0707 --- /dev/null +++ b/heaps @@ -0,0 +1 @@ +Subproject commit 50e0707ee5d5cd05a6672a25a857ef246e9c2b80 diff --git a/openal-nativetools/CMakeLists.txt b/openal-nativetools/CMakeLists.txt index 28f908e..4e4bc96 100644 --- a/openal-nativetools/CMakeLists.txt +++ b/openal-nativetools/CMakeLists.txt @@ -1307,8 +1307,8 @@ ADD_CUSTOM_TARGET(native-tools ]] -file(COPY ${OpenAL_SOURCE_DIR}/../openal-nativetools/bin2h.exe DESTINATION ${NATIVE_BIN_DIR}) -file(COPY ${OpenAL_SOURCE_DIR}/../openal-nativetools/bsincgen.exe DESTINATION ${NATIVE_BIN_DIR}) +file(COPY ${OpenAL_SOURCE_DIR}/../openal-nativetools/bin2h DESTINATION ${NATIVE_BIN_DIR}) +file(COPY ${OpenAL_SOURCE_DIR}/../openal-nativetools/bsincgen DESTINATION ${NATIVE_BIN_DIR}) option(ALSOFT_EMBED_HRTF_DATA "Embed the HRTF data files (increases library footprint)" ON) if(ALSOFT_EMBED_HRTF_DATA) @@ -1578,7 +1578,7 @@ ENDIF() IF(ALSOFT_UTILS) ADD_EXECUTABLE(openal-info utils/openal-info.c) TARGET_COMPILE_OPTIONS(openal-info PRIVATE ${C_FLAGS}) - TARGET_LINK_LIBRARIES(openal-info PRIVATE ${LINKER_FLAGS} OpenAL) + TARGET_LINK_LIBRARIES(openal-info PRIVATE ${LINKER_FLAGS} OpenAL OpenSLES log) SET(MAKEHRTF_SRCS utils/makehrtf.c) IF(NOT HAVE_GETOPT) @@ -1612,7 +1612,7 @@ IF(ALSOFT_TESTS) ADD_EXECUTABLE(altonegen examples/altonegen.c ${TEST_COMMON_OBJS}) TARGET_COMPILE_DEFINITIONS(altonegen PRIVATE ${CPP_DEFS}) TARGET_COMPILE_OPTIONS(altonegen PRIVATE ${C_FLAGS}) - TARGET_LINK_LIBRARIES(altonegen PRIVATE ${LINKER_FLAGS} common OpenAL ${MATH_LIB}) + TARGET_LINK_LIBRARIES(altonegen PRIVATE ${LINKER_FLAGS} common OpenAL OpenSLES log ${MATH_LIB}) IF(ALSOFT_INSTALL) INSTALL(TARGETS altonegen @@ -1630,7 +1630,7 @@ IF(ALSOFT_EXAMPLES) ADD_EXECUTABLE(alrecord examples/alrecord.c) TARGET_COMPILE_DEFINITIONS(alrecord PRIVATE ${CPP_DEFS}) TARGET_COMPILE_OPTIONS(alrecord PRIVATE ${C_FLAGS}) - TARGET_LINK_LIBRARIES(alrecord PRIVATE ${LINKER_FLAGS} common OpenAL) + TARGET_LINK_LIBRARIES(alrecord PRIVATE ${LINKER_FLAGS} common OpenAL OpenSLES log) IF(ALSOFT_INSTALL) INSTALL(TARGETS alrecord diff --git a/openal-nativetools/bin2h b/openal-nativetools/bin2h new file mode 100755 index 0000000..b328824 Binary files /dev/null and b/openal-nativetools/bin2h differ diff --git a/openal-nativetools/bsincgen b/openal-nativetools/bsincgen new file mode 100755 index 0000000..6362089 Binary files /dev/null and b/openal-nativetools/bsincgen differ