Skip to content

Commit 33a200f

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

File tree

14 files changed

+145
-8
lines changed

14 files changed

+145
-8
lines changed

.github/workflows/android.yml

Lines changed: 22 additions & 0 deletions
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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
/out/*
1+
out
2+
build

.gitmodules

Lines changed: 3 additions & 0 deletions
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

Lines changed: 4 additions & 1 deletion
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

Lines changed: 30 additions & 0 deletions
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

Lines changed: 65 additions & 0 deletions
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

Lines changed: 8 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
../../config/base.hxml
2+
-main World

config/pak.hxml

Lines changed: 2 additions & 0 deletions
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

0 commit comments

Comments
 (0)