Skip to content

Commit 33a200f

Browse files
committed
refactor: add README + Makefile + ci
fix #1
1 parent 0d4f4b6 commit 33a200f

14 files changed

+145
-8
lines changed

.github/workflows/android.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: android
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build:
10+
runs-on: macOS-latest
11+
timeout-minutes: 30
12+
steps:
13+
- uses: actions/checkout@v2
14+
with:
15+
submodules: true
16+
- run: make init
17+
- run: make heaps-world
18+
- run: make build
19+
- uses: actions/upload-artifact@v2
20+
with:
21+
name: heapsapp-debug.apk
22+
path: heaps-android-app/heapsapp/build/outputs/apk/debug/heapsapp-debug.apk

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
/out/*
1+
out
2+
build

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@
1414
[submodule "heaps-android-app"]
1515
path = heaps-android-app
1616
url = https://github.com/rtissera/heaps-android-app.git
17+
[submodule "heaps"]
18+
path = heaps
19+
url = https://github.com/HeapsIO/heaps.git

CMakeLists.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ include_directories(hashlink/src)
99
file(GLOB libhl
1010
hashlink/src/std/*.c
1111
hashlink/src/alloc.c
12+
hashlink/src/gc.c
1213
)
1314
list(REMOVE_ITEM libhl ${CMAKE_CURRENT_SOURCE_DIR}/hashlink/src/std/debug.c)
1415

@@ -38,6 +39,7 @@ file(GLOB png hashlink/include/png/*.c)
3839
file(GLOB zlib hashlink/include/zlib/*.c)
3940
file(GLOB vorbis hashlink/include/vorbis/*.c)
4041
file(GLOB mikkt hashlink/include/mikktspace/*.c)
42+
file(GLOB minimp3 hashlink/include/minimp3/*.c)
4143

4244
add_library(fmt.hdll STATIC
4345
${fmt}
@@ -52,9 +54,10 @@ file(GLOB tj_include libjpeg-turbo/jni/vendor/libjpeg-turbo/libjpeg-turbo-*)
5254
target_link_libraries(fmt.hdll ${TJ_LIB})
5355
target_compile_definitions(fmt.hdll PRIVATE PNG_ARM_NEON_OPT=0) #disable Neon support for now
5456

55-
target_include_directories(fmt.hdll PRIVATE
57+
target_include_directories(fmt.hdll PRIVATE
5658
hashlink/include/png
5759
hashlink/include/mikktspace
60+
hashlink/include/minimp3
5861
hashlink/include/vorbis
5962
hashlink/include/zlib
6063
${tj_include}

Makefile

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
.PHONY: all init build install clean heaps-world
2+
3+
all: build install
4+
5+
init:
6+
brew install haxe
7+
brew bundle install --file hashlink/Brewfile --no-lock
8+
make -C hashlink
9+
make install -C hashlink
10+
haxelib setup /usr/local/lib/haxe/lib
11+
brew cask install android-studio
12+
ln -sf /Applications/Android\ Studio.app/Contents/plugins/android/lib/templates/gradle/wrapper/gradlew /usr/local/bin
13+
chmod u+x /usr/local/bin/gradlew
14+
15+
build:
16+
gradlew buildDebug -p heaps-android-app
17+
18+
install:
19+
adb install heaps-android-app/heapsapp/build/outputs/apk/debug/heapsapp-debug.apk
20+
21+
clean:
22+
gradlew clean -p heaps-android-app
23+
24+
heaps-world: heaps-world-hl heaps-world-pak
25+
26+
heaps-world-hl:
27+
cd heaps/samples && haxelib install --always ../../config/main.hxml && haxe -hl ../../out/main.c ../../config/main.hxml
28+
29+
heaps-world-pak:
30+
cd heaps/samples && haxe -hl ../../out/pak.hl ../../config/pak.hxml && hl ../../out/pak.hl -out ../../out/res

README.md

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Heaps Android
2+
Forked from https://github.com/HeapsIO/heaps-android/
3+
4+
![android](https://github.com/qkdreyer/heaps-android/workflows/android/badge.svg?branch=master)
5+
<!---
6+
TODO add asciinema
7+
-->
8+
9+
## Setup
10+
11+
```sh
12+
git clone https://github.com/qkdreyer/heaps-android
13+
cd heaps-android
14+
make init
15+
```
16+
17+
## Usage
18+
19+
```sh
20+
make heaps-world
21+
make build
22+
make install
23+
```
24+
25+
# Extra
26+
27+
## Visual Studio Code
28+
29+
`.vscode/tasks.json`
30+
```
31+
{
32+
// See https://go.microsoft.com/fwlink/?LinkId=733558
33+
// for the documentation about the tasks.json format
34+
"version": "2.0.0",
35+
"tasks": [
36+
{
37+
"label": "Build & Run (Android)",
38+
"dependsOn": [
39+
"Build (Android)",
40+
"Run (Android)"
41+
],
42+
"dependsOrder": "sequence",
43+
"group": {
44+
"kind": "build",
45+
"isDefault": true
46+
},
47+
"problemMatcher": []
48+
},
49+
{
50+
"label": "Build (Android)",
51+
"type": "shell",
52+
"command": "make build",
53+
"group": "build",
54+
"problemMatcher": []
55+
},
56+
{
57+
"label": "Run (Android)",
58+
"type": "shell",
59+
"command": "make install",
60+
"group": "build",
61+
"problemMatcher": []
62+
},
63+
]
64+
}
65+
```

config/base.hxml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
World.hx
2+
-lib heaps
3+
-lib hlsdl
4+
-lib hxbit
5+
-lib format
6+
-lib hashlink
7+
-D windowSize=1024x768
8+
-D resourcesPath=world_res

config/main.hxml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
../../config/base.hxml
2+
-main World

config/pak.hxml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
../../config/base.hxml
2+
-main hxd.fmt.pak.Build

hashlink

Submodule hashlink updated 140 files

heaps

Submodule heaps added at 50e0707

openal-nativetools/CMakeLists.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -1307,8 +1307,8 @@ ADD_CUSTOM_TARGET(native-tools
13071307
13081308
]]
13091309

1310-
file(COPY ${OpenAL_SOURCE_DIR}/../openal-nativetools/bin2h.exe DESTINATION ${NATIVE_BIN_DIR})
1311-
file(COPY ${OpenAL_SOURCE_DIR}/../openal-nativetools/bsincgen.exe DESTINATION ${NATIVE_BIN_DIR})
1310+
file(COPY ${OpenAL_SOURCE_DIR}/../openal-nativetools/bin2h DESTINATION ${NATIVE_BIN_DIR})
1311+
file(COPY ${OpenAL_SOURCE_DIR}/../openal-nativetools/bsincgen DESTINATION ${NATIVE_BIN_DIR})
13121312

13131313
option(ALSOFT_EMBED_HRTF_DATA "Embed the HRTF data files (increases library footprint)" ON)
13141314
if(ALSOFT_EMBED_HRTF_DATA)
@@ -1578,7 +1578,7 @@ ENDIF()
15781578
IF(ALSOFT_UTILS)
15791579
ADD_EXECUTABLE(openal-info utils/openal-info.c)
15801580
TARGET_COMPILE_OPTIONS(openal-info PRIVATE ${C_FLAGS})
1581-
TARGET_LINK_LIBRARIES(openal-info PRIVATE ${LINKER_FLAGS} OpenAL)
1581+
TARGET_LINK_LIBRARIES(openal-info PRIVATE ${LINKER_FLAGS} OpenAL OpenSLES log)
15821582

15831583
SET(MAKEHRTF_SRCS utils/makehrtf.c)
15841584
IF(NOT HAVE_GETOPT)
@@ -1612,7 +1612,7 @@ IF(ALSOFT_TESTS)
16121612
ADD_EXECUTABLE(altonegen examples/altonegen.c ${TEST_COMMON_OBJS})
16131613
TARGET_COMPILE_DEFINITIONS(altonegen PRIVATE ${CPP_DEFS})
16141614
TARGET_COMPILE_OPTIONS(altonegen PRIVATE ${C_FLAGS})
1615-
TARGET_LINK_LIBRARIES(altonegen PRIVATE ${LINKER_FLAGS} common OpenAL ${MATH_LIB})
1615+
TARGET_LINK_LIBRARIES(altonegen PRIVATE ${LINKER_FLAGS} common OpenAL OpenSLES log ${MATH_LIB})
16161616

16171617
IF(ALSOFT_INSTALL)
16181618
INSTALL(TARGETS altonegen
@@ -1630,7 +1630,7 @@ IF(ALSOFT_EXAMPLES)
16301630
ADD_EXECUTABLE(alrecord examples/alrecord.c)
16311631
TARGET_COMPILE_DEFINITIONS(alrecord PRIVATE ${CPP_DEFS})
16321632
TARGET_COMPILE_OPTIONS(alrecord PRIVATE ${C_FLAGS})
1633-
TARGET_LINK_LIBRARIES(alrecord PRIVATE ${LINKER_FLAGS} common OpenAL)
1633+
TARGET_LINK_LIBRARIES(alrecord PRIVATE ${LINKER_FLAGS} common OpenAL OpenSLES log)
16341634

16351635
IF(ALSOFT_INSTALL)
16361636
INSTALL(TARGETS alrecord

openal-nativetools/bin2h

16.9 KB
Binary file not shown.

openal-nativetools/bsincgen

21.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)