-
-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add native build for Apple M1 / M2 (arm64) architecture (#755)
- Loading branch information
Showing
4 changed files
with
129 additions
and
7 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
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 |
---|---|---|
|
@@ -30,10 +30,11 @@ macro(DeployApple TARGET) | |
install(CODE "set(MYQT_PLUGINS_DIR \"${MYQT_PLUGINS_DIR}\")" COMPONENT "HyperHDR") | ||
install(CODE "set(MY_DEPENDENCY_PATHS \"${TARGET_FILE}\")" COMPONENT "HyperHDR") | ||
install(CODE "set(MY_SYSTEM_LIBS_SKIP \"${SYSTEM_LIBS_SKIP}\")" COMPONENT "HyperHDR") | ||
install(CODE "set(Scope_Qt_VERSION ${Qt_VERSION})" COMPONENT "HyperHDR") | ||
install(CODE [[ | ||
#OpenSSL | ||
if(EXISTS "/usr/local/opt/[email protected]/lib" AND IS_DIRECTORY "/usr/local/opt/[email protected]/lib") | ||
message( STATUS "Including OpenSSL libraries") | ||
if(Scope_Qt_VERSION EQUAL 5 AND EXISTS "/usr/local/opt/[email protected]/lib" AND IS_DIRECTORY "/usr/local/opt/[email protected]/lib") | ||
message("Including OpenSSL@1.1 libraries") | ||
file(GLOB filesSSL "/usr/local/opt/[email protected]/lib/*") | ||
foreach(openssl_lib ${filesSSL}) | ||
string(FIND ${openssl_lib} "dylib" _indexSSL) | ||
|
@@ -51,6 +52,31 @@ macro(DeployApple TARGET) | |
) | ||
endif() | ||
endforeach() | ||
elseif(NOT (Scope_Qt_VERSION EQUAL 5) AND EXISTS "/opt/homebrew/opt/openssl/lib" AND IS_DIRECTORY "/opt/homebrew/opt/openssl/lib") | ||
if (EXISTS "/opt/homebrew/opt/openssl/lib/libssl.3.dylib") | ||
message("Including OpenSSL@3 libraries") | ||
elseif (EXISTS "/opt/homebrew/opt/openssl/lib/libssl.dylib") | ||
message("Including [email protected] libraries") | ||
else() | ||
message(WARNING "Including unknown version of OpenSSL libraries") | ||
endif() | ||
file(GLOB filesSSL "/opt/homebrew/opt/openssl/lib/*") | ||
foreach(openssl_lib ${filesSSL}) | ||
string(FIND ${openssl_lib} "dylib" _indexSSL) | ||
if (${_indexSSL} GREATER -1) | ||
file(INSTALL | ||
DESTINATION "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/Frameworks" | ||
TYPE SHARED_LIBRARY | ||
FILES "${openssl_lib}" | ||
) | ||
else() | ||
file(INSTALL | ||
DESTINATION "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/lib" | ||
TYPE SHARED_LIBRARY | ||
FILES "${openssl_lib}" | ||
) | ||
endif() | ||
endforeach() | ||
else() | ||
message( WARNING "OpenSSL NOT found (https instance will not work)") | ||
endif() | ||
|
@@ -131,6 +157,30 @@ macro(DeployApple TARGET) | |
|
||
include(BundleUtilities) | ||
fixup_bundle("${CMAKE_INSTALL_PREFIX}/hyperhdr.app" "${MYQT_PLUGINS}" "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/lib") | ||
|
||
EXECUTE_PROCESS( COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE OS_ARCHITECTURE ) | ||
message( "Detected architecture: '${OS_ARCHITECTURE}'") | ||
if(OS_ARCHITECTURE STREQUAL "arm64") | ||
file(GLOB libSignFramework "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/Frameworks/*.dylib") | ||
list (APPEND libSignFramework "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/MacOS/hyperhdr") | ||
foreach(PLUGIN "platforms" "sqldrivers" "imageformats") | ||
file(GLOB libPlugins "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/plugins/${PLUGIN}/*.dylib") | ||
list (APPEND libSignFramework ${libPlugins}) | ||
endforeach() | ||
list (APPEND libSignFramework "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/Frameworks/QtCore.framework/Versions/A/QtCore") | ||
list (APPEND libSignFramework "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/Frameworks/QtDBus.framework/Versions/A/QtDBus") | ||
list (APPEND libSignFramework "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/Frameworks/QtGui.framework/Versions/A/QtGui") | ||
list (APPEND libSignFramework "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/Frameworks/QtSql.framework/Versions/A/QtSql") | ||
list (APPEND libSignFramework "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/Frameworks/QtNetwork.framework/Versions/A/QtNetwork") | ||
list (APPEND libSignFramework "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/Frameworks/QtPdf.framework/Versions/A/QtPdf") | ||
list (APPEND libSignFramework "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/Frameworks/QtSvg.framework/Versions/A/QtSvg") | ||
list (APPEND libSignFramework "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/Frameworks/QtSerialPort.framework/Versions/A/QtSerialPort") | ||
list (APPEND libSignFramework "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/Frameworks/QtWidgets.framework/Versions/A/QtWidgets") | ||
foreach(_fileToSign ${libSignFramework}) | ||
message("Fixing: ${_fileToSign}") | ||
execute_process(COMMAND bash -c "codesign --force -s - ${_fileToSign}") | ||
endforeach() | ||
endif() | ||
|
||
file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/lib") | ||
file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/share") | ||
|