diff --git a/.github/release-please-manifest.json b/.github/release-please-manifest.json index 18550d5..2e9c48c 100644 --- a/.github/release-please-manifest.json +++ b/.github/release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.0.4" + ".": "2.0.5" } diff --git a/.github/workflows/cmake-multiple-platform.yml b/.github/workflows/cmake-multiple-platform.yml index a785acc..61f8a64 100644 --- a/.github/workflows/cmake-multiple-platform.yml +++ b/.github/workflows/cmake-multiple-platform.yml @@ -64,6 +64,11 @@ jobs: arch: x86_64 container: registry.gitlab.steamos.cloud/steamrt/sniper/sdk:latest setup_env: gcc14 + - os: macos-latest + platform: osx-arm64 + arch: arm64 + container: null + setup_env: clang runs-on: ${{ matrix.os }} container: ${{ matrix.container }} steps: @@ -88,8 +93,16 @@ jobs: ln -sf /usr/bin/gcc-14 /usr/bin/gcc && ln -sf /usr/bin/g++-14 /usr/bin/g++ # for ACT add nodejs + # macOS-specific setup + - name: Setup macOS build environment + if: matrix.setup_env == 'clang' + shell: bash -el {0} + run: | + # Install ninja via homebrew if not present + brew list ninja &>/dev/null || brew install ninja + - name: Setup CMake - if: matrix.setup_env == 'msvc' + if: matrix.setup_env == 'msvc' || matrix.setup_env == 'clang' uses: lukka/get-cmake@latest - name: Cache build dependencies @@ -145,6 +158,8 @@ jobs: platform: win-64 - os: ubuntu-latest platform: linux-64 + - os: macos-latest + platform: osx-arm64 runs-on: ${{ matrix.os }} outputs: url: ${{ steps.release.outputs.url }} @@ -185,8 +200,8 @@ jobs: version="${version#v}" # Remove leading 'v' sed "s/REPLACE_VERSION/$version/g" "conda/meta.yaml.example" > "conda/meta.yaml" - # Ensure build.sh is executable on Linux - if [[ "$RUNNER_OS" == "Linux" ]]; then + # Ensure build.sh is executable on Unix systems + if [[ "$RUNNER_OS" == "Linux" ]] || [[ "$RUNNER_OS" == "macOS" ]]; then chmod +x "conda/build.sh" fi @@ -266,7 +281,7 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - mkdir -p build/repo/{linux-64,win-64,noarch} + mkdir -p build/repo/{linux-64,win-64,osx-arm64,noarch} gh api /repos/${{ github.repository }}/releases?per_page=10 \ | jq -r '.[] | .assets[] | .browser_download_url' \ | grep -E "(\.tar\.bz2|\.conda)$" > urls.txt @@ -274,10 +289,12 @@ jobs: # separate by platform grep linux-64 urls.txt > linux.txt || true grep win-64 urls.txt > win.txt || true + grep osx-arm64 urls.txt > osx.txt || true grep -v -E "(linux-64|win-64)" urls.txt > noarch.txt || true [ -s linux.txt ] && aria2c -x4 -s4 -j4 -i linux.txt -d build/repo/linux-64/ --continue [ -s win.txt ] && aria2c -x4 -s4 -j4 -i win.txt -d build/repo/win-64/ --continue + [ -s osx.txt ] && aria2c -x4 -s4 -j4 -i osx.txt -d build/repo/osx-arm64/ --continue [ -s noarch.txt ]&& aria2c -x4 -s4 -j4 -i noarch.txt -d build/repo/noarch/ --continue - name: Download conda packages @@ -354,6 +371,7 @@ jobs:
🐧 Linux (64-bit) 🪟 Windows (64-bit) + 🍎 macOS (ARM64) 📦 NoArch
diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fa8473..03c167a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [2.0.5](https://github.com/untrustedmodders/plugify-module-python3/compare/v2.0.4...v2.0.5) (2025-09-27) + + +### Bug Fixes + +* add mac build ([38fd07f](https://github.com/untrustedmodders/plugify-module-python3/commit/38fd07f6116fc72d9782989412237babf6068154)) +* update plugify ([77938d7](https://github.com/untrustedmodders/plugify-module-python3/commit/77938d7088d23059e66c18f5f0c2cb12eb01abb0)) +* update plugify ([11f396f](https://github.com/untrustedmodders/plugify-module-python3/commit/11f396f9819630d3cedfe1a89d6a124c81c8c62a)) + ## [2.0.4](https://github.com/untrustedmodders/plugify-module-python3/compare/v2.0.3...v2.0.4) (2025-09-15) diff --git a/CMakeLists.txt b/CMakeLists.txt index cb88698..576a3f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,6 +50,7 @@ if(LINUX) set(PLUGIFY_USE_STATIC_STDLIB ON CACHE INTERNAL "") set(PLUGIFY_USE_ABI0 OFF CACHE INTERNAL "") endif() +set(PLUGIFY_USE_SANITIZER ON CACHE INTERNAL "") add_subdirectory(external/plugify) # @@ -68,22 +69,28 @@ endif() target_link_libraries(${PROJECT_NAME} PRIVATE ${PY3LM_LINK_LIBRARIES}) -include(GenerateExportHeader) -generate_export_header(${PROJECT_NAME} EXPORT_MACRO_NAME PY3LM_EXPORT EXPORT_FILE_NAME ${CMAKE_BINARY_DIR}/exports/module_export.h) -target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_BINARY_DIR}/exports) - if(MSVC) - target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX) + target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX /Zc:preprocessor $<$:/Zi>) else() - target_compile_options(${PROJECT_NAME} PRIVATE -Wextra -Wconversion -Werror -Wshadow -Wpedantic) + target_compile_options(${PROJECT_NAME} PRIVATE -Wextra -Wconversion -Werror -Wshadow -Wpedantic $<$:-g1>) endif() + if(APPLE) target_link_options(${PROJECT_NAME} PRIVATE "-Wl,-exported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/sym/exported_symbols.lds") elseif(UNIX) target_link_options(${PROJECT_NAME} PRIVATE "-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/sym/version_script.lds") endif() +if(PLUGIFY_HAS_SANITIZER) + target_compile_options(${PROJECT_NAME} PRIVATE $<$: -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined>) + target_link_libraries(${PROJECT_NAME} PRIVATE $<$: -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined>) +endif() + +include(GenerateExportHeader) +generate_export_header(${PROJECT_NAME} EXPORT_MACRO_NAME PY3LM_EXPORT EXPORT_FILE_NAME ${CMAKE_BINARY_DIR}/exports/module_export.h) +target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_BINARY_DIR}/exports) + # # Python 3.12 # diff --git a/CMakePresets.json b/CMakePresets.json index c246927..d3ffa90 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,40 +1,40 @@ { - "version": 3, - "cmakeMinimumRequired": { - "major": 3, - "minor": 14, - "patch": 0 - }, - "configurePresets": [ - { - "name": "default", - "displayName": "Default Config", - "description": "Default build using Ninja generator", - "generator": "Ninja", - "binaryDir": "${sourceDir}/build/${hostSystemName}/${presetName}", - "hidden": true - }, - { - "name": "Debug", - "displayName": "Debug", - "inherits": "default", - "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" } - }, - { - "name": "Release", - "displayName": "Release", - "inherits": "default", - "cacheVariables": { "CMAKE_BUILD_TYPE": "RelWithDebInfo" } - } - ], - "buildPresets": [ - { - "name": "Debug", - "configurePreset": "Debug" - }, - { - "name": "Release", - "configurePreset": "Release" - } - ] -} \ No newline at end of file + "version": 3, + "cmakeMinimumRequired": { + "major": 3, + "minor": 14, + "patch": 0 + }, + "configurePresets": [ + { + "name": "default", + "displayName": "Default Config", + "description": "Default build using Ninja generator", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build/${hostSystemName}/${presetName}", + "hidden": true + }, + { + "name": "Debug", + "displayName": "Debug", + "inherits": "default", + "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" } + }, + { + "name": "Release", + "displayName": "Release", + "inherits": "default", + "cacheVariables": { "CMAKE_BUILD_TYPE": "Release" } + } + ], + "buildPresets": [ + { + "name": "Debug", + "configurePreset": "Debug" + }, + { + "name": "Release", + "configurePreset": "Release" + } + ] +} diff --git a/conda/build.sh b/conda/build.sh index 45bba49..a0885eb 100644 --- a/conda/build.sh +++ b/conda/build.sh @@ -1,8 +1,18 @@ #!/bin/bash -# build.sh - For Linux builds +# build.sh - For Unix builds set -ex +# Detect the platform and set the appropriate library extension +if [[ "$OSTYPE" == "darwin"* ]]; then + LIB_EXT="dylib" +elif [[ "$OSTYPE" == "linux-gnu"* ]]; then + LIB_EXT="so" +else + echo "Unsupported platform: $OSTYPE" + exit 1 +fi + # Create the target directories mkdir -p $PREFIX/bin mkdir -p $PREFIX/lib @@ -10,13 +20,13 @@ mkdir -p $PREFIX/python3.12 mkdir -p $PREFIX # Copy the shared library and module file -cp bin/libplugify-module-python3.so $PREFIX/bin/ +cp bin/libplugify-module-python3.$LIB_EXT $PREFIX/bin/ cp -r lib/* $PREFIX/lib/ cp -r python3.12/* $PREFIX/python3.12/ cp plugify-module-python3.pmodule $PREFIX/ # Set proper permissions -chmod 755 $PREFIX/bin/libplugify-module-python3.so +chmod 755 $PREFIX/bin/libplugify-module-python3.$LIB_EXT chmod -R 755 $PREFIX/lib chmod -R 755 $PREFIX/python3.12 chmod 644 $PREFIX/plugify-module-python3.pmodule diff --git a/conda/meta.yaml.example b/conda/meta.yaml.example index 21715ac..b7265a2 100644 --- a/conda/meta.yaml.example +++ b/conda/meta.yaml.example @@ -22,17 +22,53 @@ build: - "*/libpython3.12.so*" # [linux] - "*/plugify.dll" # [win] - "*/python312.dll" # [win] + + # Linux system libraries + - "*/ld-linux*.so.*" # [linux] + - "*/libc.so.*" # [linux] + - "*/libm.so.*" # [linux] + - "*/libdl.so.*" # [linux] + - "*/libpthread.so.*" # [linux] + - "*/librt.so.*" # [linux] + - "*/libplugify.so*" # [linux] + - "*/libpython3.12.so*" # [linux] + # macOS system libraries and frameworks + - "/usr/lib/libc++.1.dylib" # [osx] + - "/usr/lib/libSystem.B.dylib" # [osx] + - "/usr/lib/libc++abi.dylib" # [osx] + - "/usr/lib/libutil.dylib" # [osx] + - "/System/Library/Frameworks/*" # [osx] + - "*/libplugify.dylib" # [osx] + - "*/libplugify.*.dylib" # [osx] + - "@rpath/libplugify.dylib" # [osx] + - "@loader_path/libplugify.dylib" # [osx] + - "*/libpython3.12.dylib" # [osx] + - "*/libpython3.12.*.dylib" # [osx] + - "@rpath/libpython3.12.dylib" # [osx] + - "@loader_path/libpython3.12.dylib" # [osx] + # Windows libraries + - "*/plugify.dll" # [win] + - "*/python312.dll" # [win] requirements: run: - __glibc >=2.17 # [linux64] + - __osx >=11.0 # [osx and arm64] test: commands: + # Linux tests - test -f $PREFIX/bin/libplugify-module-python3.so # [linux] - test -d $PREFIX/lib # [linux] - test -d $PREFIX/python3.12 # [linux] - test -f $PREFIX/plugify-module-python3.pmodule # [linux] + # macOS tests + - test -f $PREFIX/bin/libplugify-module-python3.dylib # [osx] + - test -d $PREFIX/lib # [osx] + - test -d $PREFIX/python3.12 # [osx] + - test -f $PREFIX/plugify-module-python3.pmodule # [osx] + - otool -L $PREFIX/bin/libplugify-module-python3.dylib # [osx] + # Windows tests - if not exist %PREFIX%\\bin\\plugify-module-python3.dll exit 1 # [win] - if not exist %PREFIX%\\lib exit 1 # [win] - if not exist %PREFIX%\\python3.12 exit 1 # [win] diff --git a/external/plugify b/external/plugify index 672952c..a12add3 160000 --- a/external/plugify +++ b/external/plugify @@ -1 +1 @@ -Subproject commit 672952c8932b86f1a53a66d92c54a2ab85fa2815 +Subproject commit a12add30600a9c05fe54dba01472447d61c30b26 diff --git a/src/module.cpp b/src/module.cpp index 76d5d69..7f64cb8 100644 --- a/src/module.cpp +++ b/src/module.cpp @@ -112,7 +112,7 @@ namespace py3lm { if ((seqCh1 & 0b11000000) != 0b10000000 || (seqCh2 & 0b11000000) != 0b10000000) { return { -2, u'\0' }; } - const char16_t ch = (c8toc16(seqCh0 & 0b00001111) << 12) | (c8toc16(seqCh1 & 0b00111111) << 6) | c8toc16(seqCh2 & 0b00111111); + const char16_t ch = static_cast((c8toc16(seqCh0 & 0b00001111) << 12) | (c8toc16(seqCh1 & 0b00111111) << 6) | c8toc16(seqCh2 & 0b00111111)); if (0xD800 <= static_cast(ch) && static_cast(ch) < 0xE000) { return { -1, u'\0' }; } @@ -126,7 +126,7 @@ namespace py3lm { if ((seqCh1 & 0b11000000) != 0b10000000) { return { -2, u'\0' }; } - const char16_t ch = (c8toc16(seqCh0 & 0b00011111) << 6) | c8toc16(seqCh1 & 0b00111111); + const char16_t ch = static_cast((c8toc16(seqCh0 & 0b00011111) << 6) | c8toc16(seqCh1 & 0b00111111)); return { 2, ch }; } if ((seqCh0 & 0b10000000) == 0b00000000) { @@ -1985,7 +1985,7 @@ namespace py3lm { struct ArgsScope { Parameters params; - std::vector> storage; // used to store array temp memory + std::inplace_vector, Signature::kMaxFuncArgs> storage; // used to store array temp memory explicit ArgsScope(size_t size) : params(size) { storage.reserve(size); diff --git a/src/module.hpp b/src/module.hpp index a396d6a..94484af 100644 --- a/src/module.hpp +++ b/src/module.hpp @@ -169,7 +169,7 @@ namespace py3lm { PyObject* start = nullptr; PyObject* end = nullptr; }; - std::unordered_map _pluginsMap; + std::map _pluginsMap; std::vector _pythonMethods; PyObject* _PluginTypeObject = nullptr; PyObject* _PluginInfoTypeObject = nullptr; diff --git a/version.txt b/version.txt index 2165f8f..e010258 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -2.0.4 +2.0.5