Skip to content

Commit

Permalink
Adding macOS builds (#1)
Browse files Browse the repository at this point in the history
* Removed Ubuntu scripts and updated .gitignore to ignore local .DS_Store files.

* Added scripts/prepare-osx.sh and BUILD-osx.md.

* Some problems in BUILD-osx.md fixed.

* Additional fixes in BUILD-osx.md.

* For some reasons the last changes to BUILD-osx.md were not pushed.

* Further changes to BUILD-osx.md. The static versions of all 3 submodules are now built.

* Various changes. First running macOS version !!!

* Removed many temporary files and updated BUILD-osx.md.

* Some more cleanup work in BUILD-osx.md.

* Some orphan files removed.

* Updated from GrandOrgue/LoopAuditioneer.
All extra files needed to build LoopAuditioneer for macOS have been removed from the repository.

* Removed all files generated by the build process from repository.

* Separated drawing panel for loop overlay. Various fixes for wx 3.2+.

* Modified cmake root file

* Modified src cmake file

* Added fail messages

When external libraries fail in the local build or cannot be found a fatal error will now be issued.

* Update prepare-osx.sh

Added some tools that need to be installed and removed some already existing in the runner images.

* Updated BUILD-osx.md.

* Updated cmake_minimum_required to VERSION 3.10...3.28 to fix a compile error on macOS.

* First working macOS version (CLI).

* Updated BUILD.md and removed BUILD-osx.md.

* Prepared a few scripts for creating the macOS build.

* Updated build.yml

* Fixed a typo in build.yml.

* Updated build.yml.

* Corrected a typo in build.yml.

* Corrected folder for built application.

* Corrected bug in step "Create macOS application folder".

* Fixed typo in build.yml.

* Fixed another issue with build.yml.
Temporarily disabled the creation of the .dmg file.

* Update build.yml

* Update build.yml

* Removed pkg-config from prepare-osx.sh.
Updated path for artifact.

* Revert "Removed pkg-config from prepare-osx.sh."

This reverts commit 6ab47b2.

* Removed pkg-config from prepare-osx.sh.
Updated path for macOS artificat in build.yml.

* Update build.yml

* Update build.yml: path to artifact was still wrong.

* Updated build.yml.

* Updated build.yml.

* Update build.yml.

* Update build.yml.

* Updated build.yml. The program was burried in a deep directory structure.

* Change of file name of zip archive.

* Correction of two paths in build.yml.

* Another path change in build.yml.

* Temporarily disable Linux builds and release.

* Fixed path for _CodeSignature in build.yml.

* Optimize build.yml.

* 1st attempt to build the code signed app.

* Revert "1st attempt to build the code signed app."

This reverts commit 8afd924.

* I hope that this was the last version that worked.

* Added missing files again: Info.plist.in, SignMacOSApp.cmake.

* Code signed application built successful.
Updated build.yml to create downloadable zip archive.

* Correct version number implemented in Info.plist.
Temporarily disabled Linux builds re-enabled.

* Added build.yml code for macOS Intel build.

* Added macOS Intel version to populate release.

* Added macOS Intel version to populate release.

* Added macOS Intel version to populate release.

* Added macOS Intel version to populate release.

* Small correction to the upload action.

* Try a different runner for the macOS Intel version.

* macos-14-large (Intel) requires a paid account. Reset to macos-12

* Fixed .AppImage issue.

* Updated dependencies list (-autoconf, -libtool).

* Use macos-13 for macOS Intel build.

* Some clean-up work.

* Some more clean-up work.

* To prepare the creation of the .dmg file, reintroduce (CPACK_GENERATOR DragNDrop).

* Temporarily deactive a few jobs in build.yml.

* Use cpack instead of command line to create zip archive.

* Pack application into DMG file.

* Reactivate the temporarily deactivated jobs in build.yml.

* Updated build.yml -- artifacts renamed.

* Bundle wxWidgets libraries.

* I had forgotten to add dylibbundler to prepare-osx.sh.

* Updated (corrected) some file names in build.yml.

* Update build.yml

Fixed the naming of release files for mac builds so that they will be found.

---------

Co-authored-by: vpoguru <vpo.guru@gmail.com>
  • Loading branch information
larspalo and vpoguru authored Jun 19, 2024
1 parent b383173 commit a4f4c12
Show file tree
Hide file tree
Showing 11 changed files with 203 additions and 16 deletions.
65 changes: 63 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,61 @@ jobs:
name: LoopAuditioneer-${{github.ref_name}}-windows
path: ${{github.workspace}}/crossbuild/LoopAuditioneer*.zip

build-macos-x86:
runs-on: macos-13

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Get dependencies
run: ${{github.workspace}}/scripts/prepare-osx.sh

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build with CMake
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Package with CPack
working-directory: ${{github.workspace}}/build
run: cpack

- uses: actions/upload-artifact@v4
with:
name: LoopAuditioneer-${{github.ref_name}}-macos-x86
path: ${{ github.workspace }}/build/LoopAuditioneer*.dmg

build-macos-arm:
runs-on: macos-14

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Get dependencies
run: ${{github.workspace}}/scripts/prepare-osx.sh

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build with CMake
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Package with CPack
working-directory: ${{github.workspace}}/build
run: cpack

- uses: actions/upload-artifact@v4
with:
name: LoopAuditioneer-${{github.ref_name}}-macos-arm
path: ${{ github.workspace }}/build/LoopAuditioneer*.dmg

release:
if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
needs: [ build-linux, build-appimage, crossbuild-windows ]
needs: [ build-linux, build-appimage, crossbuild-windows, build-macos-x86, build-macos-arm ]
name: Create GitHub Release
runs-on: ubuntu-latest
steps:
Expand All @@ -128,6 +180,14 @@ jobs:
with:
name: LoopAuditioneer-${{github.ref_name}}-windows

- uses: actions/download-artifact@v4
with:
name: LoopAuditioneer-${{github.ref_name}}-macos-x86

- uses: actions/download-artifact@v4
with:
name: LoopAuditioneer-${{github.ref_name}}-macos-arm

- name: Remove Starting v From Tag
id: remove_v
run: |
Expand All @@ -144,4 +204,5 @@ jobs:
LoopAuditioneer-${{env.release_version}}-linux.x86_64.tar.gz
LoopAuditioneer-${{env.release_version}}.x86_64.AppImage
LoopAuditioneer-${{env.release_version}}-windows.x86_64.zip
LoopAuditioneer-${{env.release_version}}-macOS.x86_64.dmg
LoopAuditioneer-${{env.release_version}}-macOS.arm64.dmg
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
.cproject
build/
/_build/
**/.DS_Store
**/.lib/
23 changes: 22 additions & 1 deletion BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ make install
## AppImage

For an AppImage target you have to have some additional tools installed, the
prepare-ubuntu-appimage.sh in scripts/ directory have the details. The main
prepare-ubuntu-appimage.sh in scripts/ directory have the details. The main
difference to the normal build is that you have to drop Jack support which
results in this set of commands:

Expand Down Expand Up @@ -98,3 +98,24 @@ directory:
```
cpack
```

## Compiling LoopAuditioneer for macOS

Install [XCode](https://developer.apple.com/xcode) and the [XCode Command Line Tools](https://developer.apple.com/xcode/resources).

Install the required packages with [Homebrew](https://brew.sh):

```
brew install autoconf autoconf-archive autogen automake libtool pkg-config wxwidgets
```

Once all build dependencies are fulfilled, the build process is simple. Enter the following commands in the downloaded source code root directory:

```
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
```

If no errors occur, the binary will be created in the bin/ subdirectory of build/ and can be run directly from that directory.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Possibility to inspect and adjust cue position similar to looppoint overlay. (TODO)
- Possibility to adjust cue position on sample level detail. (TODO)
- Builds for macOs. (TODO)
- Builds for macOS.
- Config file setting for preferred pitch method.
- Config file setting for spectrum FFT size.
- Config file setting for spectrum window type.
Expand Down
43 changes: 36 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# LoopAuditioneer software
# Copyright (C) 2024 Lars Palo
# Copyright (C) 2024 Lars Palo
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -209,10 +209,7 @@ wxWidgets configuration : ${wxWidgets_CONFIGURATION}
set(CPACK_PACKAGE_NAME "LoopAuditioneer")
set(CPACK_PACKAGE_VENDOR "LoopAuditioneer")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "LoopAuditioneer - Software for loop and cue handling in .wav files")
set(
CPACK_PACKAGE_DESCRIPTION
"LoopAuditioneer"
)
set(CPACK_PACKAGE_DESCRIPTION "LoopAuditioneer")
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
Expand All @@ -221,14 +218,46 @@ set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE.txt")
set(CPACK_PACKAGE_CONTACT "larspalo@yahoo.se")
set(CPACK_PACKAGE_EXECUTABLES "LoopAuditioneeer" "LoopAuditioneeer")
set(CPACK_SOURCE_IGNORE_FILES "/\\\\.svn/" "/build/" "/crossbuild/")
if(WIN32)

if (APPLE)
# Configure and install Info.plist
configure_file(${CMAKE_SOURCE_DIR}/resources/Info.plist.in ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.app/Contents/Info.plist)
INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.app/Contents/Info.plist DESTINATION "${PROJECT_NAME}.app/Contents/")

# Create the macOS application bundle
add_custom_target(
macOSApplication
ALL
DEPENDS ${CMAKE_PROJECT_NAME} resources # run after building these targets
COMMAND "${CMAKE_COMMAND}" -E make_directory "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.app/Contents/MacOS"
COMMAND "${CMAKE_COMMAND}" -E make_directory "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.app/Contents/Resources"
COMMAND "${CMAKE_COMMAND}" -E make_directory "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.app/Contents/share"
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_BINARY_DIR}/bin/${CMAKE_PROJECT_NAME}"
"${CMAKE_BINARY_DIR}/${PROJECT_NAME}.app/Contents/MacOS/${CMAKE_PROJECT_NAME}"
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_SOURCE_DIR}/resources/LoopAuditioneer.icns"
"${CMAKE_BINARY_DIR}/${PROJECT_NAME}.app/Contents/Resources/LoopAuditioneer.icns"
COMMAND "${CMAKE_COMMAND}" -E copy_directory "${CMAKE_BINARY_DIR}/share" "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.app/Contents/share"
COMMAND "${CMAKE_COMMAND}" -DAPP_DIR="${CMAKE_BINARY_DIR}/${PROJECT_NAME}.app" -P "${CMAKE_SOURCE_DIR}/scripts/SignMacOSApp.cmake"
COMMAND "${CMAKE_COMMAND}" -DAPP_DIR="${CMAKE_BINARY_DIR}/${PROJECT_NAME}.app" -P "${CMAKE_SOURCE_DIR}/scripts/BundleWxWidgetLibraries.cmake"
)

# CPACK configuration
set(CPACK_SYSTEM_NAME "macOS")
set(CPACK_GENERATOR DragNDrop)
set(CPACK_DMG_FORMAT "UDZO")
set(CPACK_DMG_VOLUME_NAME "LoopAuditioneer")
set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/resources/LoopAuditioneer.icns")

elseif(WIN32)
set(CPACK_SYSTEM_NAME "windows")
set(CPACK_GENERATOR ZIP)
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")

elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(CPACK_SYSTEM_NAME "linux")
set(CPACK_GENERATOR TGZ)
endif()

set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}.${CMAKE_SYSTEM_PROCESSOR}")
include(CPack)

Expand Down
26 changes: 26 additions & 0 deletions resources/Info.plist.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>com.github.GrandOrgue.LoopAuditioneer</string>
<key>CFBundleName</key>
<string>LoopAuditioneer</string>
<key>CFBundleDisplayName</key>
<string>LoopAuditioneer v@PROGRAM_VERSION@</string>
<key>CFBundleVersion</key>
<string>@PROGRAM_VERSION@</string>
<key>CFBundleShortVersionString</key>
<string>@PROGRAM_VERSION@</string>
<key>CFBundleExecutable</key>
<string>LoopAuditioneer</string>
<key>CFBundleIconFile</key>
<string>LoopAuditioneer.icns</string>
<key>CFBundlePackageType</key>
<string>AAPL</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright 2011-2024 Lars Palo</string>
</dict>
</plist>
Binary file added resources/LoopAuditioneer.icns
Binary file not shown.
25 changes: 25 additions & 0 deletions scripts/BundleWxWidgetLibraries.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Script to bundle wxWidget libraries

set(APP_DIR "${CMAKE_BINARY_DIR}/LoopAuditioneer.app")

if(EXISTS "${APP_DIR}")
execute_process(
COMMAND dylibbundler
--bundle-deps
--overwrite-files
--fix-file "${APP_DIR}/Contents/MacOS/LoopAuditioneer"
--dest-dir "${APP_DIR}/Contents/Resources/"
--install-path "@executable_path/../Resources/"
RESULT_VARIABLE result
OUTPUT_VARIABLE output
ERROR_VARIABLE error_output
)

if(NOT ${result} EQUAL 0)
message(FATAL_ERROR "dylibbundler failed: ${error_output}")
else()
message(STATUS "dylibbundler output: ${output}")
endif()
else()
message(FATAL_ERROR "Application bundle not found: ${APP_DIR}")
endif()
11 changes: 11 additions & 0 deletions scripts/SignMacOSApp.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Script for macOS code signing

set(APP_DIR "${CMAKE_BINARY_DIR}/LoopAuditioneer.app")

if(EXISTS "${APP_DIR}")
execute_process(COMMAND codesign --force --sign - "${APP_DIR}")
message("Checking code signature...")
execute_process(COMMAND codesign --verify --deep "${APP_DIR}")
else()
message(FATAL_ERROR "Application bundle not found: ${APP_DIR}")
endif()
4 changes: 4 additions & 0 deletions scripts/prepare-osx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

set -e
brew install autoconf-archive autogen automake dylibbundler wxwidgets
18 changes: 13 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# LoopAuditioneer software
# Copyright (C) 2021-2024 Lars Palo
# Copyright (C) 2021-2024 Lars Palo
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -178,10 +178,18 @@ if(UNIX AND NOT APPLE)
configure_file(${CMAKE_SOURCE_DIR}/resources/${CMAKE_PROJECT_NAME}.desktop.in ${CMAKE_BINARY_DIR}/share/${CMAKE_PROJECT_NAME}/applications/${CMAKE_PROJECT_NAME}.desktop COPYONLY)
endif()

# installation rules
install(TARGETS ${CMAKE_PROJECT_NAME} DESTINATION bin)
install(DIRECTORY ${CMAKE_BINARY_DIR}/share/icons/ DESTINATION share/icons FILES_MATCHING PATTERN "*.png")
install(FILES ${CMAKE_BINARY_DIR}/share/${CMAKE_PROJECT_NAME}/help/help.zip DESTINATION share/${CMAKE_PROJECT_NAME}/help)
# Installation rules
if (APPLE)
install(DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.app DESTINATION .)
# Explicitly set the executable permission
install(PROGRAMS "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.app/Contents/MacOS/${CMAKE_PROJECT_NAME}"
DESTINATION "${PROJECT_NAME}.app/Contents/MacOS"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
else()
install(TARGETS ${CMAKE_PROJECT_NAME} DESTINATION bin)
install(DIRECTORY ${CMAKE_BINARY_DIR}/share/icons/ DESTINATION share/icons FILES_MATCHING PATTERN "*.png")
install(FILES ${CMAKE_BINARY_DIR}/share/${CMAKE_PROJECT_NAME}/help/help.zip DESTINATION share/${CMAKE_PROJECT_NAME}/help)
endif()
if(UNIX AND NOT APPLE)
install(FILES ${CMAKE_BINARY_DIR}/share/${CMAKE_PROJECT_NAME}/applications/${CMAKE_PROJECT_NAME}.desktop DESTINATION share/${CMAKE_PROJECT_NAME}/applications)
endif()

0 comments on commit a4f4c12

Please sign in to comment.