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

Improve recording utility #160

Merged
merged 77 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
6cd74cc
recordings:
Totto16 May 24, 2024
9c73774
recordings: fix a few errors in the json serialization
Totto16 May 24, 2024
28843cd
recordings: use better command parser to also specify json dump options
Totto16 May 24, 2024
27e04a8
meson improvements:
Totto16 May 25, 2024
47aacea
- add pkg-config files to install target
Totto16 May 25, 2024
7a90eb0
clean up meson file
Totto16 May 25, 2024
64fe4f6
RecordingReade: fix name shadowing
Totto16 May 25, 2024
cf7c2fa
fix overridden dependencies
Totto16 May 25, 2024
8a6343e
fix small refactoring error
Totto16 May 25, 2024
32eca5b
fix name shadowing once and for all
Totto16 May 25, 2024
b5f82da
fix clang-tidy warnings
Totto16 May 25, 2024
5b94097
try to force std::optional and std::expected in all cases
Totto16 May 25, 2024
f8bcb3f
adding '-stdlib=libc++' to arguments, so that detecting works as expe…
Totto16 May 25, 2024
b3f741e
circumvent the issue with clang + stdlibc++ for std::expected
Totto16 May 25, 2024
a5b172e
- clean up meson files
Totto16 May 25, 2024
938c264
Fix all include errors
Totto16 May 25, 2024
fcba29a
fix meson artifact upload path
Totto16 May 25, 2024
c5fe506
fix android build
Totto16 May 25, 2024
87cc95a
fix tests
Totto16 May 25, 2024
f21f4a8
fix switch / 3ds build
Totto16 May 25, 2024
593b912
bump used gradle build version
Totto16 May 25, 2024
f24103b
fix flatpak build
Totto16 May 25, 2024
866e373
fix mingw error, since "winsock2.h" has to bre included before "windo…
Totto16 May 25, 2024
85a12c8
fix installer generation, copy executable from correct place
Totto16 May 25, 2024
5f85e73
libs: fix installation of header files into correct folders
Totto16 May 25, 2024
bf36137
- format all meson files
Totto16 May 25, 2024
d859d93
- fix pkconfig generation for core, by removing libraries, this is ad…
Totto16 May 26, 2024
8aad3df
fix pkgconfig file genration for liboopetris_recordings
Totto16 May 26, 2024
23a29f0
dependencies: make tl- expected installable
Totto16 May 26, 2024
e321bd1
dependencies: make magic-enum installable
Totto16 May 26, 2024
f1de2a9
dependencies: make nlohmann_json installable
Totto16 May 26, 2024
58adee0
- add more noexcept methods for working with json
Totto16 May 26, 2024
985befa
fix utility executable for windows installer
Totto16 May 26, 2024
deab69d
add a few things regarding version to the core library, so taht it c…
Totto16 May 26, 2024
dcc1946
add wrapper readme
Totto16 May 26, 2024
7a00c8d
add node js wrapper
Totto16 May 26, 2024
22986de
properly support only building libs
Totto16 May 26, 2024
fe95873
use node-gyp-build, so that ww can ship prebuilt modules on npm / the…
Totto16 May 26, 2024
5a3182a
- fix some compilation error on node 14, since not using NAN::Set, wh…
Totto16 May 26, 2024
608f2d2
Add wrapper CI
Totto16 May 26, 2024
6babfdc
- adjust the Node.js wrapper README
Totto16 May 26, 2024
48ae763
CI: fix usage of sudo in wrapper CI
Totto16 May 26, 2024
284965e
fix formatting of some files
Totto16 May 26, 2024
9e9c156
CI: fix a few CI warnings, that are the result of some changes in thi…
Totto16 May 26, 2024
c7a3090
CI: wrapper, fix pkg-config path on windows
Totto16 May 26, 2024
f1a23c2
CI: wrapper - fix linux build
Totto16 May 26, 2024
3837d32
JS wrapper: fix mac build
Totto16 May 26, 2024
c1f6012
CI: wrapper, fix linux build
Totto16 May 26, 2024
8b76981
CI: wrapper - remove that **** Strawberry perl from the earth
Totto16 May 26, 2024
b17fb92
CI: wrapper - add verbose flag, to see failures
Totto16 May 26, 2024
37322df
fix a few clang-tidy errors
Totto16 May 26, 2024
bde46f2
only install needed things in lib_only mode
Totto16 May 26, 2024
bececd8
Wrapper, Js: nan.h only support node <= 21, 22 not yet, so remove it …
Totto16 May 26, 2024
06e20a4
Wrapper, JS: add support for node 22 back, since it seems to work, fi…
Totto16 May 26, 2024
bd175b2
CI: wrapper, try to fix it for windows
Totto16 May 26, 2024
dddc747
Wrapper, JS: make it windows comaptible:
Totto16 May 26, 2024
27e99e8
Wrapper, JS: use static build also on linux /mac os
Totto16 May 27, 2024
71303db
try to fix windows PKG_CONFIG_PATH
Totto16 May 27, 2024
163b8cd
Wrapper, JS: fix clang builds
Totto16 May 27, 2024
1bf4668
Wrapper, JS:
Totto16 May 27, 2024
27f92f3
CI: wrapper: fix mistype
Totto16 May 27, 2024
e602fea
use prebuildify 6.0.2
Totto16 May 27, 2024
92dafbe
fix flatpak build
Totto16 May 27, 2024
dedb9cb
fix switch / 3ds build
Totto16 May 27, 2024
3aebac0
CI: flatpak add verbose option, if enabled by github
Totto16 May 27, 2024
21b05ae
Wrapper, JS: bump version and upload all supported archs to selfhoste…
Totto16 May 27, 2024
9337379
- fix a few clang-tidy issues
Totto16 May 27, 2024
2e08e12
lobby: split api.hpp to separate cpp and hpp file
Totto16 May 27, 2024
b50d5ae
fix (hopefully) all clang-tidy errors
Totto16 May 27, 2024
5f19eef
SDL: move noexcept function to another name instead of main, since th…
Totto16 May 27, 2024
a162888
fix small bug in refactoring, that only shows in release mode
Totto16 May 27, 2024
3dfdd87
android: add option to build an universalApk
Totto16 May 27, 2024
2eb5f98
- android: handle exits correctly, since as stated in SDl2 docs, std:…
Totto16 May 27, 2024
d4b5c64
joystick, controller, fix mistake, so that controllers were not able …
Totto16 May 27, 2024
c7d9937
android: fix a bug in music handling,
Totto16 May 27, 2024
cc1fe4d
clang-tidy: fix all errors
Totto16 May 27, 2024
ba7b483
clang-tidy: fix all errors
Totto16 May 27, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/cpp-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
tidy-checks: ""
step-summary: true
file-annotations: true
ignore: subprojects|build|android|assets|recordings|docs|toolchains|platforms|src/thirdparty
ignore: subprojects|build|android|assets|recordings|docs|toolchains|platforms|wrapper|src/libs/core/hash-library

- name: Fail CI run if linter checks failed
if: steps.linter.outputs.checks-failed != 0
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/flatpak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ jobs:
with:
bundle: oopetris.flatpak
manifest-path: com.github.mgerhold.OOPetris.yml
verbose: ${{ runner.debug == '1' && 'true' || 'false' }}
22 changes: 3 additions & 19 deletions .github/workflows/meson.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,32 +177,16 @@ jobs:
if: matrix.config.os == 'macos'
run: |
brew update
brew install ninja sdl2 sdl2_ttf sdl2_mixer sdl2_image
brew install sdl2 sdl2_ttf sdl2_mixer sdl2_image

- name: Configure
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' }}

- name: Build
run: meson compile -C build

- name: Upload artifacts - Linux
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: matrix.config.os == 'ubuntu'
with:
name: ${{ matrix.config.name }} Executable
path: build/oopetris

- name: Upload artifacts - MacOS
uses: actions/upload-artifact@v4
if: matrix.config.os == 'macos'
with:
name: ${{ matrix.config.name }} Executable
path: build/oopetris
# TODO: create a proper installer: https://mesonbuild.com/Creating-OSX-packages.html

- name: Upload artifacts - Windows
uses: actions/upload-artifact@v4
if: matrix.config.os == 'windows'
with:
name: ${{ matrix.config.name }} Executable
path: build/oopetris.exe
path: build/src/executables/oopetris*
124 changes: 124 additions & 0 deletions .github/workflows/wrapper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: Wrapper CI

on:
push:
branches: ["main"]
pull_request:
workflow_dispatch:

jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}-${{ matrix.config.os-version }}

strategy:
fail-fast: false
matrix:
config:
- name: Windows
os: windows
os-version: 2022

- name: Linux
os: ubuntu
os-version: 24.04

- name: MacOS
os: macos
os-version: 13

- name: MacOS (Arm64)
os: macos
os-version: 14


steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"

- name: Setup MSVC (Windows)
if: matrix.config.os == 'windows'
uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: x64
toolset: 14.39

- name: Setup GCC (Linux)
if: matrix.config.os == 'ubuntu'
uses: egor-tensin/setup-gcc@v1
with:
version: 14
platform: x64

- name: Setup Clang (MacOS)
if: matrix.config.os == 'macos'
run: |
brew update
brew install llvm@18
echo "$(brew --prefix)/opt/llvm/bin" >> $GITHUB_PATH
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"
echo "CPPFLAGS=-I$(brew --prefix)/opt/llvm/include" >> "$GITHUB_ENV"
echo "CC=clang" >> "$GITHUB_ENV"
echo "CXX=clang++" >> "$GITHUB_ENV"
echo "OBJC=clang" >> "$GITHUB_ENV"
echo "CC_LD=lld" >> "$GITHUB_ENV"
echo "CXX_LD=lld" >> "$GITHUB_ENV"
echo "OBJC_LD=lld" >> "$GITHUB_ENV"

- name: Setup meson (MacOS)
if: matrix.config.os == 'macos'
run: |
brew update
brew install meson

# NOTE: meson has no dependencies, so --break-system-packages doesn't really break anything!
- name: Setup meson
if: matrix.config.os != 'macos'
run: |
pip install meson --break-system-packages

- name: Install dependencies (Linux)
if: matrix.config.os == 'ubuntu'
run: |
sudo apt-get update
sudo apt-get install ninja-build -y
sudo pip install meson --break-system-packages

- name: Fix pkg-config (Windows)
if: matrix.config.os == 'windows'
run: |
Remove-Item -Path C:\Strawberry\ -Recurse
choco install pkgconfiglite
echo "PKG_CONFIG_PATH=C:/lib/pkgconfig" | Out-File -FilePath $env:GITHUB_ENV -Append

- name: Configure
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' || '' }}

- name: Build and install Libs
if: matrix.config.os != 'ubuntu'
run: meson install -C build

- name: Build and install Libs (Linux)
if: matrix.config.os == 'ubuntu'
run: sudo meson install -C build

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Build package
run: |
cd wrapper/javascript
npm install -D
npm run build --verbose
npm run test
npm pack

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.config.name }} Node.js Wrapper
path: wrapper/javascript/oopetris*.tgz

85 changes: 1 addition & 84 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ project(
version: '0.5.6',
)

oopetris_author = 'Coder2k'
oopetris_name = 'OOPetris'

subdir('tools/options')

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

subdir('tools/install')

if meson.is_cross_build() and host_machine.system() == 'android'

library(
'oopetris',
main_files,
dependencies: [liboopetris_graphics_dep, graphic_application_deps],
override_options: {
'warning_level': '3',
'werror': true,
},
)

elif meson.is_cross_build() and host_machine.system() == 'switch'
switch_options = [
app_name,
main_files,
[liboopetris_graphics_dep, graphic_application_deps],
]
subdir('platforms/switch')
elif meson.is_cross_build() and host_machine.system() == '3ds'
_3ds_options = [
app_name,
main_files,
[liboopetris_graphics_dep, graphic_application_deps],
]
subdir('platforms/3ds')
else

if host_machine.system() == 'windows'
subdir('platforms/windows')
endif

oopetris_exe = executable(
'oopetris',
main_files,
dependencies: [liboopetris_graphics_dep, graphic_application_deps],
override_options: {
'warning_level': '3',
'werror': true,
},
install: true,
win_subsystem: 'windows',
)

oopetris_recordings_utility_exe = executable(
'oopetris_recordings_utility',
recordings_main_files,
dependencies: liboopetris_recordings_dep,
override_options: {
'warning_level': '3',
'werror': true,
},
install: true,
win_subsystem: 'console',
)

if build_installer
if host_machine.system() == 'windows'

makensis = find_program('makensis')

nsis_script = meson.project_source_root() / 'tools' / 'installer' / 'setup.nsi'

run_target(
'windows_installer',
command: [
makensis,
'-DVERSION=' + meson.project_version(),
'-DNAME=' + oopetris_name,
'-DAUTHOR=' + oopetris_author,
'-DPROJECT_SOURCE_DIR=' + meson.project_source_root(),
'-DPROJECT_BUILD_DIR=' + meson.project_build_root(),
nsis_script,
],
depends: [oopetris_exe, oopetris_recordings_utility_exe],
)

endif
endif

endif
subdir('src/executables')

if get_option('tests')
subdir('tests')
Expand Down
8 changes: 8 additions & 0 deletions meson.options
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,11 @@ option(
value: false,
description: 'whether or not tests should be built',
)

option(
'only_build_libs',
type: 'boolean',
value: false,
description: 'if you only want to build the libs, enable this',
)

40 changes: 38 additions & 2 deletions platforms/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ static boolean isValidVersion(String version) {
return true;
}

/**
* Internal helper function
*/
static List<String> getSupportedABIs() {
return ["armeabi-v7a", "arm64-v8a", "x86", "x86_64"];
}

/**
* Read the Android ABI from user input.
* supported ANDROID_ABIs are 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'
Expand All @@ -80,7 +87,7 @@ static boolean isValidVersion(String version) {
List getAndroidABIs() {
String property = project.findProperty('ANDROID_ABI')

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

List<String> AbiFilters = new ArrayList<String>()
if (property == null) {
Expand Down Expand Up @@ -193,8 +200,37 @@ String getVersion() {

}

/**
* Detect if we need to build an universal apk
* 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
* @return Boolean
*/
Boolean shouldBuildUniversalApk(List<String> abisToUse) {
String property = project.findProperty('BUILD_UNIVERSAL_APK')


if (property != null) {
return true
}

List<String> supportedABIs = getSupportedABIs()

// return true, if all abis, we support are specified
for (abi in supportedABIs) {
if (!abisToUse.contains(abi)) {
return false;
}
}

return true;


}


List<String> abisToUse = getAndroidABIs()
String versionString = getVersion()
Boolean buildUniversalApk = shouldBuildUniversalApk(abisToUse)

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

Expand Down
7 changes: 4 additions & 3 deletions platforms/android/app/jni/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := liboopetris_core
LIB_PATH := $(BUILD_PATH)/src
LIB_PATH := $(BUILD_PATH)/src/libs/core
LOCAL_SRC_FILES := $(LIB_PATH)/liboopetris_core.so
include $(PREBUILT_SHARED_LIBRARY)


include $(CLEAR_VARS)
LOCAL_MODULE := liboopetris_recordings
LIB_PATH := $(BUILD_PATH)/src
LIB_PATH := $(BUILD_PATH)/src/libs/recordings
LOCAL_SRC_FILES := $(LIB_PATH)/liboopetris_recordings.so
include $(PREBUILT_SHARED_LIBRARY)

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

include $(CLEAR_VARS)
LOCAL_MODULE := liboopetris
LOCAL_SRC_FILES := $(BUILD_PATH)/liboopetris.so
LIB_PATH := $(BUILD_PATH)/src/executables
LOCAL_SRC_FILES := $(LIB_PATH)/liboopetris.so
include $(PREBUILT_SHARED_LIBRARY)


Expand Down
2 changes: 1 addition & 1 deletion platforms/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.4.0'
classpath 'com.android.tools.build:gradle:8.4.1'

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