Skip to content

Commit b2271fa

Browse files
authored
Merge pull request #160 from OpenBrickProtocolFoundation/improve-recording-utility
Improve recording utility
2 parents 08bf553 + ba7b483 commit b2271fa

File tree

246 files changed

+10517
-1946
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

246 files changed

+10517
-1946
lines changed

.github/workflows/cpp-linter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
tidy-checks: ""
4949
step-summary: true
5050
file-annotations: true
51-
ignore: subprojects|build|android|assets|recordings|docs|toolchains|platforms|src/thirdparty
51+
ignore: subprojects|build|android|assets|recordings|docs|toolchains|platforms|wrapper|src/libs/core/hash-library
5252

5353
- name: Fail CI run if linter checks failed
5454
if: steps.linter.outputs.checks-failed != 0

.github/workflows/flatpak.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ jobs:
2121
with:
2222
bundle: oopetris.flatpak
2323
manifest-path: com.github.mgerhold.OOPetris.yml
24+
verbose: ${{ runner.debug == '1' && 'true' || 'false' }}

.github/workflows/meson.yml

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -177,32 +177,16 @@ jobs:
177177
if: matrix.config.os == 'macos'
178178
run: |
179179
brew update
180-
brew install ninja sdl2 sdl2_ttf sdl2_mixer sdl2_image
180+
brew install sdl2 sdl2_ttf sdl2_mixer sdl2_image
181181
182182
- name: Configure
183183
run: meson setup build -Dbuildtype=${{ matrix.config.buildtype }} -Ddefault_library=${{ matrix.config.library_type }} -Dclang_libcpp=${{ ( ( matrix.config.os == 'ubuntu' && matrix.config.use-clang == true && matrix.config.use-clang_stdlib ) || matrix.config.os == 'macos' ) && 'enabled' || 'disabled' }}
184184

185185
- name: Build
186186
run: meson compile -C build
187187

188-
- name: Upload artifacts - Linux
188+
- name: Upload artifacts
189189
uses: actions/upload-artifact@v4
190-
if: matrix.config.os == 'ubuntu'
191-
with:
192-
name: ${{ matrix.config.name }} Executable
193-
path: build/oopetris
194-
195-
- name: Upload artifacts - MacOS
196-
uses: actions/upload-artifact@v4
197-
if: matrix.config.os == 'macos'
198-
with:
199-
name: ${{ matrix.config.name }} Executable
200-
path: build/oopetris
201-
# TODO: create a proper installer: https://mesonbuild.com/Creating-OSX-packages.html
202-
203-
- name: Upload artifacts - Windows
204-
uses: actions/upload-artifact@v4
205-
if: matrix.config.os == 'windows'
206190
with:
207191
name: ${{ matrix.config.name }} Executable
208-
path: build/oopetris.exe
192+
path: build/src/executables/oopetris*

.github/workflows/wrapper.yml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: Wrapper CI
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
jobs:
10+
build:
11+
name: ${{ matrix.config.name }}
12+
runs-on: ${{ matrix.config.os }}-${{ matrix.config.os-version }}
13+
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
config:
18+
- name: Windows
19+
os: windows
20+
os-version: 2022
21+
22+
- name: Linux
23+
os: ubuntu
24+
os-version: 24.04
25+
26+
- name: MacOS
27+
os: macos
28+
os-version: 13
29+
30+
- name: MacOS (Arm64)
31+
os: macos
32+
os-version: 14
33+
34+
35+
steps:
36+
- uses: actions/checkout@v4
37+
with:
38+
fetch-depth: "0"
39+
40+
- name: Setup MSVC (Windows)
41+
if: matrix.config.os == 'windows'
42+
uses: TheMrMilchmann/setup-msvc-dev@v3
43+
with:
44+
arch: x64
45+
toolset: 14.39
46+
47+
- name: Setup GCC (Linux)
48+
if: matrix.config.os == 'ubuntu'
49+
uses: egor-tensin/setup-gcc@v1
50+
with:
51+
version: 14
52+
platform: x64
53+
54+
- name: Setup Clang (MacOS)
55+
if: matrix.config.os == 'macos'
56+
run: |
57+
brew update
58+
brew install llvm@18
59+
echo "$(brew --prefix)/opt/llvm/bin" >> $GITHUB_PATH
60+
echo "LDFLAGS=-L$(brew --prefix)/opt/llvm/lib -L$(brew --prefix)/opt/llvm/lib/c++ -Wl,-rpath,$(brew --prefix)/opt/llvm/lib/c++" >> "$GITHUB_ENV"
61+
echo "CPPFLAGS=-I$(brew --prefix)/opt/llvm/include" >> "$GITHUB_ENV"
62+
echo "CC=clang" >> "$GITHUB_ENV"
63+
echo "CXX=clang++" >> "$GITHUB_ENV"
64+
echo "OBJC=clang" >> "$GITHUB_ENV"
65+
echo "CC_LD=lld" >> "$GITHUB_ENV"
66+
echo "CXX_LD=lld" >> "$GITHUB_ENV"
67+
echo "OBJC_LD=lld" >> "$GITHUB_ENV"
68+
69+
- name: Setup meson (MacOS)
70+
if: matrix.config.os == 'macos'
71+
run: |
72+
brew update
73+
brew install meson
74+
75+
# NOTE: meson has no dependencies, so --break-system-packages doesn't really break anything!
76+
- name: Setup meson
77+
if: matrix.config.os != 'macos'
78+
run: |
79+
pip install meson --break-system-packages
80+
81+
- name: Install dependencies (Linux)
82+
if: matrix.config.os == 'ubuntu'
83+
run: |
84+
sudo apt-get update
85+
sudo apt-get install ninja-build -y
86+
sudo pip install meson --break-system-packages
87+
88+
- name: Fix pkg-config (Windows)
89+
if: matrix.config.os == 'windows'
90+
run: |
91+
Remove-Item -Path C:\Strawberry\ -Recurse
92+
choco install pkgconfiglite
93+
echo "PKG_CONFIG_PATH=C:/lib/pkgconfig" | Out-File -FilePath $env:GITHUB_ENV -Append
94+
95+
- name: Configure
96+
run: meson setup build -Dbuildtype=release -Ddefault_library=static -Dclang_libcpp=${{ matrix.config.os == 'macos' && 'enabled' || 'disabled' }} -Donly_build_libs=true ${{ matrix.config.os == 'windows' && '-Db_vscrt=static_from_buildtype' || '' }}
97+
98+
- name: Build and install Libs
99+
if: matrix.config.os != 'ubuntu'
100+
run: meson install -C build
101+
102+
- name: Build and install Libs (Linux)
103+
if: matrix.config.os == 'ubuntu'
104+
run: sudo meson install -C build
105+
106+
- name: Install Node.js
107+
uses: actions/setup-node@v4
108+
with:
109+
node-version: 20
110+
111+
- name: Build package
112+
run: |
113+
cd wrapper/javascript
114+
npm install -D
115+
npm run build --verbose
116+
npm run test
117+
npm pack
118+
119+
- name: Upload artifacts
120+
uses: actions/upload-artifact@v4
121+
with:
122+
name: ${{ matrix.config.name }} Node.js Wrapper
123+
path: wrapper/javascript/oopetris*.tgz
124+

meson.build

Lines changed: 1 addition & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ project(
1414
version: '0.5.6',
1515
)
1616

17-
oopetris_author = 'Coder2k'
18-
oopetris_name = 'OOPetris'
19-
2017
subdir('tools/options')
2118

2219
subdir('tools/dependencies')
@@ -25,87 +22,7 @@ subdir('src')
2522

2623
subdir('tools/install')
2724

28-
if meson.is_cross_build() and host_machine.system() == 'android'
29-
30-
library(
31-
'oopetris',
32-
main_files,
33-
dependencies: [liboopetris_graphics_dep, graphic_application_deps],
34-
override_options: {
35-
'warning_level': '3',
36-
'werror': true,
37-
},
38-
)
39-
40-
elif meson.is_cross_build() and host_machine.system() == 'switch'
41-
switch_options = [
42-
app_name,
43-
main_files,
44-
[liboopetris_graphics_dep, graphic_application_deps],
45-
]
46-
subdir('platforms/switch')
47-
elif meson.is_cross_build() and host_machine.system() == '3ds'
48-
_3ds_options = [
49-
app_name,
50-
main_files,
51-
[liboopetris_graphics_dep, graphic_application_deps],
52-
]
53-
subdir('platforms/3ds')
54-
else
55-
56-
if host_machine.system() == 'windows'
57-
subdir('platforms/windows')
58-
endif
59-
60-
oopetris_exe = executable(
61-
'oopetris',
62-
main_files,
63-
dependencies: [liboopetris_graphics_dep, graphic_application_deps],
64-
override_options: {
65-
'warning_level': '3',
66-
'werror': true,
67-
},
68-
install: true,
69-
win_subsystem: 'windows',
70-
)
71-
72-
oopetris_recordings_utility_exe = executable(
73-
'oopetris_recordings_utility',
74-
recordings_main_files,
75-
dependencies: liboopetris_recordings_dep,
76-
override_options: {
77-
'warning_level': '3',
78-
'werror': true,
79-
},
80-
install: true,
81-
win_subsystem: 'console',
82-
)
83-
84-
if build_installer
85-
if host_machine.system() == 'windows'
86-
87-
makensis = find_program('makensis')
88-
89-
nsis_script = meson.project_source_root() / 'tools' / 'installer' / 'setup.nsi'
90-
91-
run_target(
92-
'windows_installer',
93-
command: [
94-
makensis,
95-
'-DVERSION=' + meson.project_version(),
96-
'-DNAME=' + oopetris_name,
97-
'-DAUTHOR=' + oopetris_author,
98-
'-DPROJECT_SOURCE_DIR=' + meson.project_source_root(),
99-
'-DPROJECT_BUILD_DIR=' + meson.project_build_root(),
100-
nsis_script,
101-
],
102-
depends: [oopetris_exe, oopetris_recordings_utility_exe],
103-
)
104-
105-
endif
106-
endif
107-
108-
endif
25+
subdir('src/executables')
10926

11027
if get_option('tests')
11128
subdir('tests')

meson.options

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,11 @@ option(
1818
value: false,
1919
description: 'whether or not tests should be built',
2020
)
21+
22+
option(
23+
'only_build_libs',
24+
type: 'boolean',
25+
value: false,
26+
description: 'if you only want to build the libs, enable this',
27+
)
28+

platforms/android/app/build.gradle

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ static boolean isValidVersion(String version) {
7272
return true;
7373
}
7474

75+
/**
76+
* Internal helper function
77+
*/
78+
static List<String> getSupportedABIs() {
79+
return ["armeabi-v7a", "arm64-v8a", "x86", "x86_64"];
80+
}
81+
7582
/**
7683
* Read the Android ABI from user input.
7784
* supported ANDROID_ABIs are 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'
@@ -80,7 +87,7 @@ static boolean isValidVersion(String version) {
8087
List getAndroidABIs() {
8188
String property = project.findProperty('ANDROID_ABI')
8289

83-
List<String> supportedABIs = ["armeabi-v7a", "arm64-v8a", "x86", "x86_64"];
90+
List<String> supportedABIs = getSupportedABIs()
8491

8592
List<String> AbiFilters = new ArrayList<String>()
8693
if (property == null) {
@@ -193,8 +200,37 @@ String getVersion() {
193200

194201
}
195202

203+
/**
204+
* Detect if we need to build an universal apk
205+
* this first checks, if this is manually request by the cli args, than it checks, if all supported ABIs are given, if that is the case, enable it too
206+
* @return Boolean
207+
*/
208+
Boolean shouldBuildUniversalApk(List<String> abisToUse) {
209+
String property = project.findProperty('BUILD_UNIVERSAL_APK')
210+
211+
212+
if (property != null) {
213+
return true
214+
}
215+
216+
List<String> supportedABIs = getSupportedABIs()
217+
218+
// return true, if all abis, we support are specified
219+
for (abi in supportedABIs) {
220+
if (!abisToUse.contains(abi)) {
221+
return false;
222+
}
223+
}
224+
225+
return true;
226+
227+
228+
}
229+
230+
196231
List<String> abisToUse = getAndroidABIs()
197232
String versionString = getVersion()
233+
Boolean buildUniversalApk = shouldBuildUniversalApk(abisToUse)
198234

199235
System.out.printf("DEBUG: Using abis: %s%n", abisToUse.join(", "))
200236
System.out.printf("DEBUG: Using version: %s%n", versionString)
@@ -271,7 +307,7 @@ android {
271307
// Specifies a list of ABIs for Gradle to create APKs for.
272308
include(*abisToUse)
273309
// Specifies that you don't want to also generate a universal APK that includes all ABIs.
274-
universalApk false
310+
universalApk(buildUniversalApk)
275311
}
276312
}
277313

platforms/android/app/jni/Android.mk

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ include $(PREBUILT_SHARED_LIBRARY)
8484

8585
include $(CLEAR_VARS)
8686
LOCAL_MODULE := liboopetris_core
87-
LIB_PATH := $(BUILD_PATH)/src
87+
LIB_PATH := $(BUILD_PATH)/src/libs/core
8888
LOCAL_SRC_FILES := $(LIB_PATH)/liboopetris_core.so
8989
include $(PREBUILT_SHARED_LIBRARY)
9090

9191

9292
include $(CLEAR_VARS)
9393
LOCAL_MODULE := liboopetris_recordings
94-
LIB_PATH := $(BUILD_PATH)/src
94+
LIB_PATH := $(BUILD_PATH)/src/libs/recordings
9595
LOCAL_SRC_FILES := $(LIB_PATH)/liboopetris_recordings.so
9696
include $(PREBUILT_SHARED_LIBRARY)
9797

@@ -105,7 +105,8 @@ include $(PREBUILT_SHARED_LIBRARY)
105105

106106
include $(CLEAR_VARS)
107107
LOCAL_MODULE := liboopetris
108-
LOCAL_SRC_FILES := $(BUILD_PATH)/liboopetris.so
108+
LIB_PATH := $(BUILD_PATH)/src/executables
109+
LOCAL_SRC_FILES := $(LIB_PATH)/liboopetris.so
109110
include $(PREBUILT_SHARED_LIBRARY)
110111

111112

platforms/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
google()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:8.4.0'
9+
classpath 'com.android.tools.build:gradle:8.4.1'
1010

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

0 commit comments

Comments
 (0)