Skip to content

Commit 189c453

Browse files
authored
Merge pull request #22 from tomas-mraz/drawinfo_build_refactoring
drawinfo build refactoring
2 parents e5f9302 + 4fe36a0 commit 189c453

File tree

27 files changed

+521
-152
lines changed

27 files changed

+521
-152
lines changed

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# JetBrains IDE
2+
.idea/
3+
*.iml
4+
5+
# Applications
6+
*.app
7+
*.exe
8+
*.war
9+
*.syso
10+
*.so

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ require (
77
github.com/stretchr/testify v1.8.0 // indirect
88
github.com/veandco/go-sdl2 v0.4.5
99
github.com/vulkan-go/asche v0.0.0-20190912134304-d4b318b67e07
10-
github.com/vulkan-go/vulkan v0.0.0-20210402152248-956e3850d8f9
11-
github.com/xlab/android-go v0.0.0-20180723170811-ebf4d6dd1830
10+
github.com/vulkan-go/vulkan v0.0.0-20221127130951-d13440166fa0
11+
github.com/xlab/android-go v0.0.0-20221106204035-3cc54d5032fa
1212
github.com/xlab/catcher v0.0.0-20170222110830-4ce3d20cbee2
1313
github.com/xlab/closer v0.0.0-20190328110542-03326addb7c2
1414
github.com/xlab/ios-go v0.0.0-20170702230120-5c6163f67cd4

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ github.com/veandco/go-sdl2 v0.4.5 h1:GFIjMabK7y2XWpr9sGvN7RDKHt7vrA7XPTUW60eOw+Y
1414
github.com/veandco/go-sdl2 v0.4.5/go.mod h1:OROqMhHD43nT4/i9crJukyVecjPNYYuCofep6SNiAjY=
1515
github.com/vulkan-go/asche v0.0.0-20190912134304-d4b318b67e07 h1:QIXP1nx5b+YZt1cKDP5SR/89tRXrLxWslBBFBvH/+Y0=
1616
github.com/vulkan-go/asche v0.0.0-20190912134304-d4b318b67e07/go.mod h1:fIbNY6YffQRtdF22h26OXRprI/BGOWPKlxJWtNC78OA=
17-
github.com/vulkan-go/vulkan v0.0.0-20210402152248-956e3850d8f9 h1:WFujQpkMAAd8dqccEm10n8dly4yQ/R5d2+Us7GutowA=
18-
github.com/vulkan-go/vulkan v0.0.0-20210402152248-956e3850d8f9/go.mod h1:Y5Ti1uUBdKDsb0W8aPtIo9krs+29Y7p6Bc9yyy4AM6g=
19-
github.com/xlab/android-go v0.0.0-20180723170811-ebf4d6dd1830 h1:t4JWwVd06FAAZiTLSIGzNtOQYXkX90Y3bXWwAXvjepk=
20-
github.com/xlab/android-go v0.0.0-20180723170811-ebf4d6dd1830/go.mod h1:cX5Ob29gFddv5hlAJN3tmNcvHuNQwUXzIP06azWW1M8=
17+
github.com/vulkan-go/vulkan v0.0.0-20221127130951-d13440166fa0 h1:Ap4awTVoyePaU6/vJOFwVnmqgl1n554IWSSm4KWPy9A=
18+
github.com/vulkan-go/vulkan v0.0.0-20221127130951-d13440166fa0/go.mod h1:Y5Ti1uUBdKDsb0W8aPtIo9krs+29Y7p6Bc9yyy4AM6g=
19+
github.com/xlab/android-go v0.0.0-20221106204035-3cc54d5032fa h1:fJnl39vCautixum6jJL40AULKdF1r+2/IWzPHOcFCeM=
20+
github.com/xlab/android-go v0.0.0-20221106204035-3cc54d5032fa/go.mod h1:WNGsHAaW0HwZ/T5KZPDOHJHtX+lHUElskKRPVtQ1/xs=
2121
github.com/xlab/catcher v0.0.0-20170222110830-4ce3d20cbee2 h1:Zpa3je19AZ1GU/UIgDO+87Vwa0+awqbpKprjfBb+So8=
2222
github.com/xlab/catcher v0.0.0-20170222110830-4ce3d20cbee2/go.mod h1:wLwj0uiLs18rq5dVL7qeTy8ZQsraFHXqas1pUVTa+8A=
2323
github.com/xlab/closer v0.0.0-20190328110542-03326addb7c2 h1:LPYwXwwHigHHFX3SFa9W9zBIa5reyaLJos2e95eHh68=

vulkaninfo/vulkaninfo_android/Makefile

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,48 @@
1-
ANDROID_TOOLCHAIN_DIR ?= $(shell pwd)/toolchain
2-
ANDROID_API ?= 21
3-
ANDROID_SYSROOT = $(NDK)/platforms/android-$(ANDROID_API)/arch-arm
4-
5-
all: toolchain build apk
6-
7-
toolchain:
8-
$(NDK)/build/tools/make_standalone_toolchain.py \
9-
--api=$(ANDROID_API) --install-dir=$(ANDROID_TOOLCHAIN_DIR) \
10-
--arch=arm --stl libc++
11-
12-
build:
13-
mkdir -p android/jni/lib
14-
CC="$(ANDROID_TOOLCHAIN_DIR)/bin/arm-linux-androideabi-gcc" \
15-
CXX="$(ANDROID_TOOLCHAIN_DIR)/bin/arm-linux-androideabi-g++" \
16-
CGO_CFLAGS="-march=armv7-a" \
1+
HOST_TAG ?= linux-x86_64
2+
API_LEVEL ?= 26
3+
TOOLCHAIN ?= $(NDK)/toolchains/llvm/prebuilt/$(HOST_TAG)/bin
4+
5+
all: clean build apk
6+
echo "WORK DONE"
7+
8+
build: build32 build64 build-amd64
9+
echo "builded all"
10+
11+
build32:
12+
echo "compile for old phones with arm (32bit)"
13+
CC="$(TOOLCHAIN)/armv7a-linux-androideabi$(API_LEVEL)-clang" \
14+
CXX="$(TOOLCHAIN)/armv7a-linux-androideabi$(API_LEVEL)-clang++" \
1715
GOOS=android \
1816
GOARCH=arm \
19-
GOARM=7 \
2017
CGO_ENABLED=1 \
21-
go build -buildmode=c-shared -o android/jni/lib/libvulkaninfo.so
22-
23-
apk:
24-
cd android && make
18+
go build -buildmode=c-shared -o android/app/src/main/jniLibs/armeabi-v7a/libvulkaninfo.so
19+
20+
build64:
21+
echo "compile for arm64 (64bit)"
22+
CC="$(TOOLCHAIN)/aarch64-linux-android$(API_LEVEL)-clang" \
23+
CXX="$(TOOLCHAIN)/aarch64-linux-android$(API_LEVEL)-clang++" \
24+
GOOS=android \
25+
GOARCH=arm64 \
26+
CGO_ENABLED=1 \
27+
go build -buildmode=c-shared -o android/app/src/main/jniLibs/arm64-v8a/libvulkaninfo.so
28+
29+
build-amd64:
30+
echo "compile for emulator"
31+
CC="$(TOOLCHAIN)/x86_64-linux-android$(API_LEVEL)-clang" \
32+
CXX="$(TOOLCHAIN)/x86_64-linux-android$(API_LEVEL)-clang++" \
33+
GOOS=android \
34+
GOARCH=amd64 \
35+
CGO_ENABLED=1 \
36+
go build -buildmode=c-shared -o android/app/src/main/jniLibs/x86_64/libvulkaninfo.so
2537

2638
clean:
27-
cd android && make clean
39+
echo "delete generated files"
40+
rm -rf android/app/build
41+
rm -rf android/app/build-native
2842

29-
install:
30-
cd android && make install
43+
apk:
44+
echo "run gradle"
45+
cd android; ./gradlew -q clean assembleDebug > /dev/null 2>&1
3146

3247
listen:
3348
adb logcat -c
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#
2+
# https://help.github.com/articles/dealing-with-line-endings/
3+
#
4+
# These are explicitly windows files and should use crlf
5+
*.bat text eol=crlf
6+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Ignore Gradle project-specific cache directory
2+
.gradle
3+
4+
# Ignore Gradle build output directory
5+
build
6+
build-native
7+
local.properties

vulkaninfo/vulkaninfo_android/android/AndroidManifest.xml

Lines changed: 0 additions & 20 deletions
This file was deleted.

vulkaninfo/vulkaninfo_android/android/Makefile

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
# Mention the cmake version name.
3+
cmake_minimum_required(VERSION 3.4.1)
4+
5+
project( VulkanInfo )
6+
7+
# Application
8+
add_library(vulkaninfo SHARED IMPORTED)
9+
10+
set_target_properties( vulkaninfo
11+
PROPERTIES IMPORTED_LOCATION
12+
${CMAKE_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/libvulkaninfo.so
13+
)
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
plugins {
2+
id 'com.android.application'
3+
}
4+
5+
android {
6+
namespace 'org.golang.android.vulkan.info'
7+
compileSdk 26
8+
buildToolsVersion '33.0.0'
9+
ndkVersion '25.1.8937393'
10+
11+
defaultConfig {
12+
applicationId "org.golang.android.vulkan.info"
13+
minSdk 26
14+
targetSdk 26
15+
versionCode 1
16+
versionName "1.0"
17+
18+
externalNativeBuild {
19+
cmake {
20+
abiFilters.addAll('armeabi-v7a', 'arm64-v8a', 'x86_64')
21+
}
22+
}
23+
}
24+
25+
buildTypes {
26+
debug {
27+
debuggable true
28+
jniDebuggable true
29+
minifyEnabled false
30+
}
31+
32+
release {
33+
debuggable false
34+
jniDebuggable false
35+
minifyEnabled false
36+
}
37+
}
38+
39+
compileOptions {
40+
sourceCompatibility JavaVersion.VERSION_1_8
41+
targetCompatibility JavaVersion.VERSION_1_8
42+
}
43+
44+
sourceSets {
45+
main.assets.srcDirs = ['assets']
46+
main {
47+
res.srcDirs += [ '../../../app/android/res' ]
48+
}
49+
}
50+
externalNativeBuild {
51+
cmake {
52+
path 'CMakeLists.txt'
53+
buildStagingDirectory 'build-native'
54+
}
55+
}
56+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:versionCode="1"
4+
android:versionName="1.0">
5+
6+
<!-- Require Vulkan 1.0 -->
7+
<uses-feature android:name="android.hardware.vulkan.version" android:version="0x400003" android:required="true" />
8+
<uses-feature android:name="android.hardware.vulkan.level" android:version="0" android:required="true" />
9+
10+
<application android:label="@string/app_name"
11+
android:icon="@drawable/icon"
12+
android:hasCode="false">
13+
<activity android:name="android.app.NativeActivity"
14+
android:launchMode="singleTask"
15+
android:screenOrientation="portrait"
16+
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
17+
android:configChanges="orientation|keyboardHidden"
18+
android:exported="true">
19+
<meta-data android:name="android.app.lib_name" android:value="vulkaninfo" />
20+
<intent-filter>
21+
<action android:name="android.intent.action.MAIN" />
22+
<category android:name="android.intent.category.LAUNCHER" />
23+
</intent-filter>
24+
</activity>
25+
</application>
26+
</manifest>
Loading
Loading
Loading
Loading
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<string name="app_name">Vulkan Info</string> <!-- User visible app name on home screen -->
4+
</resources>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
plugins {
3+
id 'com.android.application' version '7.3.1' apply false
4+
id 'com.android.library' version '7.3.1' apply false
5+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
android.useAndroidX=true
2+
android.enableJetifier=true
3+
org.gradle.parallel=true
4+
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)