Skip to content

Commit

Permalink
refactor: add README + Makefile + ci
Browse files Browse the repository at this point in the history
fix #1
  • Loading branch information
qkdreyer committed Jun 15, 2020
1 parent 0d4f4b6 commit 33a200f
Show file tree
Hide file tree
Showing 14 changed files with 145 additions and 8 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/out/*
out
build
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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}
Expand All @@ -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}
Expand Down
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)
<!---
TODO add asciinema
-->

## 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": []
},
]
}
```
8 changes: 8 additions & 0 deletions config/base.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
World.hx
-lib heaps
-lib hlsdl
-lib hxbit
-lib format
-lib hashlink
-D windowSize=1024x768
-D resourcesPath=world_res
2 changes: 2 additions & 0 deletions config/main.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
../../config/base.hxml
-main World
2 changes: 2 additions & 0 deletions config/pak.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
../../config/base.hxml
-main hxd.fmt.pak.Build
2 changes: 1 addition & 1 deletion hashlink
Submodule hashlink updated 140 files
1 change: 1 addition & 0 deletions heaps
Submodule heaps added at 50e070
10 changes: 5 additions & 5 deletions openal-nativetools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Binary file added openal-nativetools/bin2h
Binary file not shown.
Binary file added openal-nativetools/bsincgen
Binary file not shown.

0 comments on commit 33a200f

Please sign in to comment.