Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: add README + Makefile + ci #2

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0d4f4b6
Add heaps-android-app submodule and fix CMakeLists.txt for libjpeg-tu…
rtissera Oct 25, 2018
33a200f
refactor: add README + Makefile + ci
qkdreyer Jun 14, 2020
b7f41cd
chore: clean up
qkdreyer Jun 15, 2020
5831436
ci: build artifact
qkdreyer Jun 15, 2020
c7f0084
Create Dependabot config file
dependabot-preview[bot] Jun 17, 2020
9059f01
Merge pull request #1 from qkdreyer/dependabot/add-v2-config-file
qkdreyer Jun 17, 2020
c916671
ci: add gitsubmodule dependabot package ecosystem
qkdreyer Jun 17, 2020
930b855
build: add jni
qkdreyer Jun 18, 2020
dbb01f4
ci: add windows workflow
qkdreyer Jun 18, 2020
1fef60e
fix: correct typo + inverse make init order
qkdreyer Jun 18, 2020
272fc91
build(windows): install android-sdk
qkdreyer Jun 18, 2020
7ab19a2
build(windows): install openal + ffmpeg
qkdreyer Jun 18, 2020
fd64fd7
Bump heaps-android-app from `698bf85` to `8d41fc0`
dependabot[bot] Jun 17, 2020
d7467c8
build: improve makefile
qkdreyer Jun 24, 2020
b17fb22
build(windows): fix gen-local
qkdreyer Jun 24, 2020
61f2100
build: improve init
qkdreyer Jun 24, 2020
47621ea
build(macOS): fix gradlew permission
qkdreyer Jun 24, 2020
b4fa8bd
build(macOS): remove ndk.dir
qkdreyer Jun 24, 2020
17975ee
build(deps): bump heaps from `50e0707` to `1d8c304`
dependabot[bot] Jun 24, 2020
8b26d37
build(deps): bump hashlink from `70a1884` to `bea1af6`
dependabot[bot] Jun 19, 2020
cd38541
build(deps): bump heaps from `1d8c304` to `3a6b19e`
dependabot[bot] Jul 2, 2020
17bdbf9
chore: update README
qkdreyer Jul 8, 2020
e5c16f3
build(windows): add no-progress arg to choco
qkdreyer Jul 8, 2020
b5dc3ba
refactor: add heaps-android-app
qkdreyer Jul 8, 2020
48801fe
chore: cleanup
qkdreyer Jul 8, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
time: '04:00'
open-pull-requests-limit: 10
- package-ecosystem: gitsubmodule
directory: "/"
schedule:
interval: daily
time: '04:00'
open-pull-requests-limit: 10
22 changes: 22 additions & 0 deletions .github/workflows/android-macOS.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: android-macOS
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 demo
- 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
22 changes: 22 additions & 0 deletions .github/workflows/android-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: android-windows
on:
pull_request:
push:
branches:
- master

jobs:
build:
runs-on: windows-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
with:
submodules: true
- run: make init
- run: make demo
- 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
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@
[submodule "openal-soft"]
path = openal-soft
url = https://github.com/kcat/openal-soft.git
[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
14 changes: 9 additions & 5 deletions 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 All @@ -27,8 +28,9 @@ target_link_libraries(hl log)

set(TJ_LIB ${CMAKE_CURRENT_SOURCE_DIR}/libjpeg-turbo/obj/local/${ANDROID_ABI}/libjpeg-turbo.a)
add_custom_target(turbojpeg
${ANDROID_NDK}/ndk-build APP_ABI=${ANDROID_ABI} APP_PLATFORM=${ANDROID_PLATFORM}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/libjpeg-turbo
${ANDROID_NDK}/ndk-build APP_ABI=${ANDROID_ABI} APP_PLATFORM=${ANDROID_PLATFORM}
NDK_PROJECT_PATH=./libjpeg-turbo
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
BYPRODUCTS ${TJ_LIB}
)

Expand All @@ -37,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 @@ -51,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 All @@ -65,7 +69,7 @@ add_subdirectory(sdl2)
file(GLOB sdl hashlink/libs/sdl/*.c)
add_library(sdl.hdll STATIC ${sdl})
target_include_directories(sdl.hdll PUBLIC sdl2/include)
target_link_libraries(sdl.hdll SDL2 EGL GLESv3)
target_link_libraries(sdl.hdll SDL2 SDL2main EGL GLESv3)

# OpenAL

Expand All @@ -83,6 +87,6 @@ add_library(ui.hdll STATIC ${ui})

# Heaps Application

add_library(heapsapp SHARED out/main.c )
add_library(heapsapp SHARED out/main.c jni.c)
target_include_directories(heapsapp PRIVATE out)
target_link_libraries(heapsapp hl sdl.hdll fmt.hdll openal.hdll ui.hdll)
47 changes: 47 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.PHONY: all init build install clean demo

all: build install

init:
ifeq ($(OS),Windows_NT)
powershell ./hashlink.ps1 1.11.0
choco install --no-progress haxe openal ffmpeg android-sdk android-ndk
else ifeq ($(shell uname -s),Darwin)
brew install haxe
brew bundle install --file hashlink/Brewfile --no-lock
brew cask install android-studio
chmod u+x /Applications/Android\ Studio.app/Contents/plugins/android/lib/templates/gradle/wrapper/gradlew
endif
make -C hashlink
make install -C hashlink
haxelib setup /usr/local/lib/haxe/lib
make gen-local

build:
CMD=assembleDebug make gradle

install:
adb install heaps-android-app/heapsapp/build/outputs/apk/debug/heapsapp-debug.apk

clean:
CMD=clean make gradle

ifeq ($(OS),Windows_NT)
gradle:
cd heaps-android-app && gradlew.bat $(CMD)
gen-local:
(echo sdk.dir=C:\\Android\\android-sdk&& echo ndk.dir=C:\\Android\\android-ndk-r21d) > heaps-android-app/local.properties
else ifeq ($(shell uname -s),Darwin)
gradle:
/Applications/Android\ Studio.app/Contents/plugins/android/lib/templates/gradle/wrapper/gradlew $(CMD) -p heaps-android-app
gen-local:
echo "sdk.dir=$(HOME)/Library/Android/sdk" > heaps-android-app/local.properties
endif

demo: demo-hl demo-pak

demo-hl:
cd heaps/samples && haxelib install --always ../../config/main.hxml && haxe -hl ../../out/main.c ../../config/main.hxml

demo-pak:
cd heaps/samples && haxe -hl ../../out/pak.hl ../../config/pak.hxml && hl ../../out/pak.hl -out ../../out/res
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Heaps Android

![android](https://github.com/HeapsIO/heaps-android/workflows/android/badge.svg?branch=master)

## Setup

```sh
git clone --recursive https://github.com/HeapsIO/heaps-android
cd heaps-android
make init
```

## Usage

```sh
make demo
make # make build && make install
```
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
4 changes: 4 additions & 0 deletions hashlink.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Invoke-WebRequest https://github.com/HaxeFoundation/hashlink/releases/latest/download/hl-$args[0]-win.zip -OutFile hl.zip
Expand-Archive hl.zip -DestinationPath .
Move-Item hl-* $HOME/hashlink
Remove-Item hl.zip
1 change: 1 addition & 0 deletions heaps
Submodule heaps added at 3a6b19
1 change: 1 addition & 0 deletions heaps-android-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# heaps-android-app
28 changes: 28 additions & 0 deletions heaps-android-app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'


// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}

}

allprojects {
repositories {
google()
jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
14 changes: 14 additions & 0 deletions heaps-android-app/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

Binary file not shown.
5 changes: 5 additions & 0 deletions heaps-android-app/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading