From bfd726ae7b8c51b431ae5678d4661c9d98893999 Mon Sep 17 00:00:00 2001 From: Danila Artyukhov Date: Tue, 4 Jun 2024 14:23:49 +0300 Subject: [PATCH 1/3] MacOs app build workflow --- .github/workflows/macos.yml | 62 +++++++++++++++++++++++++++++++++++++ CMakeLists.txt | 12 +++++++ 2 files changed, 74 insertions(+) create mode 100644 .github/workflows/macos.yml diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 00000000..89968a25 --- /dev/null +++ b/.github/workflows/macos.yml @@ -0,0 +1,62 @@ +name: MacOs DMG + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build-dmg: + runs-on: macos-latest + + steps: + - uses: actions/checkout@v2 + with: + submodules: 'true' + + - name: Install dependencies from brew + run: | + brew install glfw3 glew libpng openal-soft luajit libvorbis + + - name: Install specific version of GLM + run: | + curl -O https://raw.githubusercontent.com/Homebrew/homebrew-core/5c7655a866646aa4b857c002b8ae5465b9d26f65/Formula/g/glm.rb + brew install --formula glm.rb + + - name: Configure + run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DVOXELENGINE_BUILD_APPDIR=1 + + - name: Build + run: cmake --build build -t install + + - name: Create macOS app structure + run: | + mkdir -p VoxelEngine.app/Contents/MacOS + mkdir -p VoxelEngine.app/Contents/Resources + cp build/VoxelEngine VoxelEngine.app/Contents/MacOS/ + cp -r res VoxelEngine.app/Contents/Resources/ + echo "" > VoxelEngine.app/Contents/Info.plist + echo "" >> VoxelEngine.app/Contents/Info.plist + echo "" >> VoxelEngine.app/Contents/Info.plist + echo "" >> VoxelEngine.app/Contents/Info.plist + echo " CFBundleExecutable" >> VoxelEngine.app/Contents/Info.plist + echo " VoxelEngine" >> VoxelEngine.app/Contents/Info.plist + echo " CFBundleIdentifier" >> VoxelEngine.app/Contents/Info.plist + echo " com.yourcompany.VoxelEngine" >> VoxelEngine.app/Contents/Info.plist + echo " CFBundleName" >> VoxelEngine.app/Contents/Info.plist + echo " VoxelEngine" >> VoxelEngine.app/Contents/Info.plist + echo " CFBundleVersion" >> VoxelEngine.app/Contents/Info.plist + echo " 1.0" >> VoxelEngine.app/Contents/Info.plist + echo "" >> VoxelEngine.app/Contents/Info.plist + echo "" >> VoxelEngine.app/Contents/Info.plist + + - name: Create DMG + run: | + hdiutil create VoxelEngine.dmg -volname "VoxelEngine" -srcfolder VoxelEngine.app -ov -format UDZO + + - name: Upload DMG + uses: actions/upload-artifact@v2 + with: + name: VoxelEngineMacOs + path: VoxelEngine.dmg diff --git a/CMakeLists.txt b/CMakeLists.txt index 8340b928..2ec2faab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,6 +101,18 @@ if (WIN32) set(VORBISLIB vorbis vorbisfile) # not tested add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/libs/glfw) endif() +elseif(APPLE) + find_package(PkgConfig) + pkg_check_modules(LUAJIT REQUIRED luajit) + pkg_check_modules(VORBIS REQUIRED vorbis vorbisfile) + set(LUA_INCLUDE_DIR "/opt/homebrew/include/luajit-2.1") + set(LUA_LIBRARIES "/opt/homebrew/lib/libluajit-5.1.a") + message(STATUS "LUA Libraries: ${LUA_LIBRARIES}") + message(STATUS "LUA Include Dir: ${LUA_INCLUDE_DIR}") + find_package(PNG REQUIRED) + set(PNGLIB PNG::PNG) + set(VORBISLIB ${VORBIS_LDFLAGS}) + message(STATUS "Vorbis Lib: ${VORBIS_LDFLAGS}") else() find_package(PkgConfig) pkg_check_modules(LUAJIT REQUIRED luajit) From a5907302e57e4e1ffc83b3701dce35558084138e Mon Sep 17 00:00:00 2001 From: Danila Artyukhov Date: Tue, 4 Jun 2024 14:36:43 +0300 Subject: [PATCH 2/3] Update macos dmg build --- .github/workflows/macos.yml | 42 +++++++++++++---------------------- .github/workflows/release.yml | 20 ++++++++++++++++- 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 89968a25..85b4b203 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -1,10 +1,16 @@ -name: MacOs DMG +name: Macos Build on: push: branches: [ "main" ] pull_request: branches: [ "main" ] + workflow_call: + inputs: + upload_artifacts: + description: Should upload artifacts or not + type: boolean + default: false jobs: build-dmg: @@ -30,33 +36,17 @@ jobs: - name: Build run: cmake --build build -t install - - name: Create macOS app structure - run: | - mkdir -p VoxelEngine.app/Contents/MacOS - mkdir -p VoxelEngine.app/Contents/Resources - cp build/VoxelEngine VoxelEngine.app/Contents/MacOS/ - cp -r res VoxelEngine.app/Contents/Resources/ - echo "" > VoxelEngine.app/Contents/Info.plist - echo "" >> VoxelEngine.app/Contents/Info.plist - echo "" >> VoxelEngine.app/Contents/Info.plist - echo "" >> VoxelEngine.app/Contents/Info.plist - echo " CFBundleExecutable" >> VoxelEngine.app/Contents/Info.plist - echo " VoxelEngine" >> VoxelEngine.app/Contents/Info.plist - echo " CFBundleIdentifier" >> VoxelEngine.app/Contents/Info.plist - echo " com.yourcompany.VoxelEngine" >> VoxelEngine.app/Contents/Info.plist - echo " CFBundleName" >> VoxelEngine.app/Contents/Info.plist - echo " VoxelEngine" >> VoxelEngine.app/Contents/Info.plist - echo " CFBundleVersion" >> VoxelEngine.app/Contents/Info.plist - echo " 1.0" >> VoxelEngine.app/Contents/Info.plist - echo "" >> VoxelEngine.app/Contents/Info.plist - echo "" >> VoxelEngine.app/Contents/Info.plist - - name: Create DMG + if: ${{ inputs.upload_artifacts }} run: | - hdiutil create VoxelEngine.dmg -volname "VoxelEngine" -srcfolder VoxelEngine.app -ov -format UDZO + mkdir VoxelEngineDmgContent + cp -r build/res VoxelEngineDmgContent/ + cp -r build/VoxelEngine VoxelEngineDmgContent/ + hdiutil create VoxelEngineMacApp.dmg -volname "VoxelEngine" -srcfolder VoxelEngineDmgContent -ov -format UDZO - - name: Upload DMG - uses: actions/upload-artifact@v2 + - name: Upload artifacts + if: ${{ inputs.upload_artifacts }} + uses: actions/upload-artifact@v4 with: name: VoxelEngineMacOs - path: VoxelEngine.dmg + path: VoxelEngineMacApp.dmg \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a1186ce3..1863467a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,18 +14,35 @@ jobs: build_type: Release upload_artifacts: true + build_release_macos: + name: Build Release MacOS + uses: ./.github/workflows/macos.yml + with: + upload_artifacts: true + create_release: - needs: build_release + needs: [build_release, build_release_macos] runs-on: ubuntu-latest steps: - name: Download artifacts uses: actions/download-artifact@v4 with: name: VoxelEngine + + - name: Download artifacts (MacOS) + uses: actions/download-artifact@v4 + with: + name: VoxelEngineMacOs + - name: Pack artifacts run: | chmod +x VoxelEngine zip -r VoxelEngine.zip res VoxelEngine + + - name: Pack artifacts (MacOS DMG) + run: | + cp VoxelEngineMacApp.dmg VoxelEngine.dmg + - name: Grab and store version run: | tag_name=$(echo ${{ github.ref }} | grep -oE "v[^/]+$") @@ -41,3 +58,4 @@ jobs: prerelease: false files: | VoxelEngine.zip + VoxelEngine.dmg From db729cbfbb2ad28749c6689dddcbd14627583922 Mon Sep 17 00:00:00 2001 From: Danila Artyukhov Date: Tue, 4 Jun 2024 19:19:10 +0300 Subject: [PATCH 3/3] Enable macos artifact's default --- .github/workflows/macos.yml | 8 -------- .github/workflows/release.yml | 20 +------------------- 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 85b4b203..68f6acc2 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -5,12 +5,6 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] - workflow_call: - inputs: - upload_artifacts: - description: Should upload artifacts or not - type: boolean - default: false jobs: build-dmg: @@ -37,7 +31,6 @@ jobs: run: cmake --build build -t install - name: Create DMG - if: ${{ inputs.upload_artifacts }} run: | mkdir VoxelEngineDmgContent cp -r build/res VoxelEngineDmgContent/ @@ -45,7 +38,6 @@ jobs: hdiutil create VoxelEngineMacApp.dmg -volname "VoxelEngine" -srcfolder VoxelEngineDmgContent -ov -format UDZO - name: Upload artifacts - if: ${{ inputs.upload_artifacts }} uses: actions/upload-artifact@v4 with: name: VoxelEngineMacOs diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1863467a..a1186ce3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,35 +14,18 @@ jobs: build_type: Release upload_artifacts: true - build_release_macos: - name: Build Release MacOS - uses: ./.github/workflows/macos.yml - with: - upload_artifacts: true - create_release: - needs: [build_release, build_release_macos] + needs: build_release runs-on: ubuntu-latest steps: - name: Download artifacts uses: actions/download-artifact@v4 with: name: VoxelEngine - - - name: Download artifacts (MacOS) - uses: actions/download-artifact@v4 - with: - name: VoxelEngineMacOs - - name: Pack artifacts run: | chmod +x VoxelEngine zip -r VoxelEngine.zip res VoxelEngine - - - name: Pack artifacts (MacOS DMG) - run: | - cp VoxelEngineMacApp.dmg VoxelEngine.dmg - - name: Grab and store version run: | tag_name=$(echo ${{ github.ref }} | grep -oE "v[^/]+$") @@ -58,4 +41,3 @@ jobs: prerelease: false files: | VoxelEngine.zip - VoxelEngine.dmg