Skip to content

Commit

Permalink
Merge pull request #3 from Totto16/improvements
Browse files Browse the repository at this point in the history
Improvements
  • Loading branch information
Totto16 authored Oct 15, 2024
2 parents 0c0baa4 + f001645 commit 01b3759
Show file tree
Hide file tree
Showing 11 changed files with 7,194 additions and 6,791 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ jobs:
echo "CXX_LD=lld" >> "$GITHUB_ENV"
echo "OBJC_LD=lld" >> "$GITHUB_ENV"
- name: Unbreak Python in GHA (MacOS 13 image)
if: matrix.config.os == 'macos' && matrix.config.os-version == 13
run: |
# TODO: remove this, after it works again
# A workaround for "The `brew link` step did not complete successfully" error.
# See e.g. https://github.com/Homebrew/homebrew-core/issues/165793#issuecomment-1991817938
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
sudo rm -rf /Library/Frameworks/Python.framework/
brew install --force python3 && brew unlink python3 && brew unlink python3 && brew link --overwrite python3
- name: Setup meson (MacOS)
if: matrix.config.os == 'macos'
run: |
Expand Down Expand Up @@ -104,7 +114,7 @@ jobs:
- name: Build and Install OOPetris
run: |
cd oopetris
meson setup build -Dbuildtype=release -Ddefault_library=shared -Dclang_libcpp=${{ matrix.config.os == 'macos' && 'enabled' || 'disabled' }} -Donly_build_libs=true ${{ matrix.config.os == 'windows' && '-Db_vscrt=from_buildtype' || '' }}
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' || '' }}
${{ matrix.config.os == 'ubuntu' && 'sudo' || '' }} meson install -C build
${{ matrix.config.os == 'ubuntu' && 'sudo ldconfig' || '' }}
Expand Down
20 changes: 17 additions & 3 deletions binding.gyp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# type: ignore
{
"variables": {
"oopetris_compiler": "<!(pkg-config oopetris-recordings --variable=compiler)",
},
"targets": [
{
"target_name": "oopetris",
Expand Down Expand Up @@ -40,6 +43,15 @@
}
},
],
[
'OS == "linux" and oopetris_compiler == "gcc"',
{
"cflags_cc": [
"-static-libgcc", # to build with a static libgcc (libgcc_s)
"-static-libstdc++", # to build with a static libstdc++
]
},
],
[
'OS != "win"',
{
Expand All @@ -58,28 +70,30 @@
],
],
"defines": ["V8_DEPRECATION_WARNINGS=1"],
"sources": ["src/cpp/wrapper.cpp"],
"sources": ["src/cpp/wrapper.cpp", "src/cpp/convert.cpp"],
"include_dirs": [
"<!@(node -e \"require('nan')\")",
"<!@(pkg-config oopetris-recordings --cflags-only-I | sed s/-I//g)",
],
"library_dirs": [
"<!@(pkg-config oopetris-recordings --libs-only-L | sed s/-L//g)",
],
"msvs_settings": { ## settinsg cflags_cc doesn't really work onw windows, so using this
"msvs_settings": { # setting cflags_cc doesn't really work onw windows, so using this
"VCCLCompilerTool": {
"AdditionalOptions": [
"/std:c++latest",
"/W4",
"/EHsc",
"/O2",
"/utf-8", # since fmt.h has some warnings without that
"/wd4100", # since nan.h -> node.h has some warnings regarding that
"<!@(pkg-config oopetris-recordings --cflags)",
]
},
"VCLinkerTool": {
"AdditionalDependencies": [
"<!@(pkg-config oopetris-recordings --libs-only-l | sed s/-l/lib/g |sed 's/\\s/.a /g')", # adjust to the default setting, namely lib<name>.a via some sed magic
# adjust to the default setting, namely lib<name>.a via some sed magic
'<!@(pkg-config oopetris-recordings --libs-only-l | sed s/-l/lib/g | sed "s/\\s/.a /g")',
],
},
},
Expand Down
19 changes: 10 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "oopetris",
"version": "1.0.1",
"version": "1.0.2",
"description": "Node js wrapper for oopetris",
"gypfile": true,
"main": "./dist/index.js",
Expand All @@ -17,8 +17,8 @@
"scripts": {
"install": "node-gyp-build",
"build": "npm run build:gyp && npm run compile",
"build:gyp": "prebuildify -t 18.20.4 -t 20.17.0 -t 21.7.3 -t 22.9.0 --strip",
"build:debug": "prebuildify -t 18.20.4 -t 20.17.0 -t 21.7.3 -t 22.9.0 --debug",
"build:gyp": "prebuildify -t 18.20.4 -t 20.18.0 -t 21.7.3 -t 22.9.0 --strip",
"build:debug": "prebuildify -t 18.20.4 -t 20.18.0 -t 21.7.3 -t 22.9.0 --debug",
"compile": "npm run build:tsc",
"build:tsc": "tsc",
"test": "npx jest",
Expand Down Expand Up @@ -53,10 +53,10 @@
"devDependencies": {
"@types/jest": "^29.5.13",
"jest": "^29.7.0",
"nan": "^2.20.0",
"nan": "^2.22.0",
"prebuildify": "^6.0.2",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"typescript": "^5.6.2"
"typescript": "^5.6.3"
}
}
Loading

0 comments on commit 01b3759

Please sign in to comment.