-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from vpoguru/master
Added builds for macOS
- Loading branch information
Showing
8 changed files
with
183 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ | |
.cproject | ||
build/ | ||
/_build/ | ||
**/.DS_Store | ||
**/.lib/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -215,7 +215,9 @@ target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC | |
|
||
# Strip binary for release builds | ||
if(CMAKE_BUILD_TYPE STREQUAL "Release") | ||
if(CMAKE_CROSSCOMPILING AND WIN32) | ||
if(APPLE) | ||
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND strip ${CMAKE_PROJECT_NAME} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
elseif(CMAKE_CROSSCOMPILING AND WIN32) | ||
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND strip --strip-all ${CMAKE_PROJECT_NAME}.exe WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
else() | ||
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND strip --strip-all ${CMAKE_PROJECT_NAME} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
|
@@ -228,17 +230,25 @@ if(NOT EXISTS "${RESOURCE_DIR}/help") | |
endif() | ||
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND zip -r ${RESOURCE_DIR}/help/help.zip . WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/help) | ||
|
||
# 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) | ||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt DESTINATION .) | ||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/AUTHORS DESTINATION .) | ||
# 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) | ||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt DESTINATION .) | ||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/AUTHORS DESTINATION .) | ||
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() | ||
|
||
# packaging | ||
# Packaging | ||
set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}") | ||
set(CPACK_PACKAGE_VENDOR "${CMAKE_PROJECT_NAME}") | ||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${CMAKE_PROJECT_DESCRIPTION}") | ||
|
@@ -254,14 +264,47 @@ set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt") | |
set(CPACK_PACKAGE_CONTACT "[email protected]") | ||
set(CPACK_PACKAGE_EXECUTABLES "${CMAKE_PROJECT_NAME}" "${CMAKE_PROJECT_NAME}") | ||
set(CPACK_SOURCE_IGNORE_FILES ".gitignore" "/build/") | ||
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 | ||
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/GoOdf.icns" | ||
"${CMAKE_BINARY_DIR}/${PROJECT_NAME}.app/Contents/Resources/GoOdf.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 "GoOdf") | ||
set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/resources/GoOdf.icns") | ||
|
||
elseif(WIN32) | ||
set(CPACK_SYSTEM_NAME "windows") | ||
set(CPACK_GENERATOR ZIP) | ||
set(CMAKE_SYSTEM_PROCESSOR "x86_64") | ||
|
||
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) | ||
|
||
|
@@ -284,4 +327,3 @@ wxWidgets configuration : ${wxWidgets_CONFIGURATION} | |
============================================================================ | ||
") | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.GoOdf</string> | ||
<key>CFBundleName</key> | ||
<string>GoOdf</string> | ||
<key>CFBundleDisplayName</key> | ||
<string>GoOdf v@PROGRAM_VERSION@</string> | ||
<key>CFBundleVersion</key> | ||
<string>@PROGRAM_VERSION@</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>@PROGRAM_VERSION@</string> | ||
<key>CFBundleExecutable</key> | ||
<string>GoOdf</string> | ||
<key>CFBundleIconFile</key> | ||
<string>GoOdf.icns</string> | ||
<key>CFBundlePackageType</key> | ||
<string>AAPL</string> | ||
<key>NSPrincipalClass</key> | ||
<string>NSApplication</string> | ||
<key>NSHumanReadableCopyright</key> | ||
<string>Copyright 2024 Lars Palo</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}/GoOdf.app") | ||
|
||
if(EXISTS "${APP_DIR}") | ||
execute_process( | ||
COMMAND dylibbundler | ||
--bundle-deps | ||
--overwrite-files | ||
--fix-file "${APP_DIR}/Contents/MacOS/GoOdf" | ||
--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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}/GoOdf.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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |