From 66f0620949022d073260ad4d50d89a92091a875c Mon Sep 17 00:00:00 2001 From: algrimes Date: Tue, 18 Feb 2025 10:10:34 +0000 Subject: [PATCH] Experimental macos support. Closes #5 --- .github/workflows/build-macos.yml | 64 +++++++++++++++++++++++++++++++ .gitignore | 2 + CMakeLists.txt | 18 +++++++++ 3 files changed, 84 insertions(+) create mode 100644 .github/workflows/build-macos.yml create mode 100644 .gitignore create mode 100644 CMakeLists.txt diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml new file mode 100644 index 0000000..927685c --- /dev/null +++ b/.github/workflows/build-macos.yml @@ -0,0 +1,64 @@ +name: Build macOS Universal Binary + +on: + push: + branches: + - 'master' + release: + types: [published] # Trigger on published release + +jobs: + build-universal-macos: + runs-on: macos-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Install Dependencies + run: | + brew update + brew install cmake ninja + + - name: Configure Build for x86_64 + run: | + mkdir -p build_x86_64 + cd build_x86_64 + cmake .. -DCMAKE_BUILD_TYPE=Release -G "Ninja" \ + -DCMAKE_OSX_ARCHITECTURES="x86_64" + + - name: Build Project for x86_64 + run: | + cd build_x86_64 + cmake --build . + + - name: Configure Build for arm64 + run: | + mkdir -p build_arm64 + cd build_arm64 + cmake .. -DCMAKE_BUILD_TYPE=Release -G "Ninja" \ + -DCMAKE_OSX_ARCHITECTURES="arm64" + + - name: Build Project for arm64 + run: | + cd build_arm64 + cmake --build . + + - name: Combine the binaries into a universal binary + run: | + mkdir -p artifacts + lipo -create -output artifacts/sfo-macos-universal \ + build_x86_64/bin/sfo \ + build_arm64/bin/sfo + + - name: Verify Universal Binary + run: | + file artifacts/sfo-macos-universal + + - name: Upload Release Artifact + if: github.event_name == 'release' + uses: softprops/action-gh-release@v2 + with: + files: artifacts/sfo-macos-universal + name: sfo-macos-universal + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..06152da --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +artifacts/ +build_*/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..1c61c91 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.20) + +project(sfo + DESCRIPTION "PARAM.SFO Manager for PS4" + HOMEPAGE_URL https://github.com/hippe68/sfo + VERSION 1.03 + LANGUAGES C +) + +add_executable(${PROJECT_NAME} sfo.c) + +set_target_properties(${PROJECT_NAME} + PROPERTIES + C_STANDARD 17 + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" +) + +install(TARGETS sfo RUNTIME DESTINATION bin) \ No newline at end of file