Add support for building a Universal binary on macOS

This commit is contained in:
TheBloke 2023-04-14 17:19:03 +01:00
parent 1a372a11c2
commit 9fbaeaaeb6

View File

@ -1,5 +1,12 @@
cmake_minimum_required(VERSION 3.16)
if(APPLE)
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
# Specify location of Universal QT installation
# can be removed if default install is Universal (won't be the case with Homebrew installed QT)
set(Qt6_DIR "~/Qt/6.5.0/macos/lib/cmake/Qt6")
endif()
project(gpt4all VERSION 0.1.0 LANGUAGES CXX)
set(CMAKE_AUTOMOC ON)
@ -58,6 +65,7 @@ install(TARGETS chat DESTINATION bin COMPONENT ${COMPONENT_NAME_MAIN})
set(CPACK_GENERATOR "IFW")
message("Before if")
if(${CMAKE_SYSTEM_NAME} MATCHES Linux)
set(LINUXDEPLOYQT "/home/atreat/dev/linuxdeployqt/build/tools/linuxdeployqt/linuxdeployqt")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/deploy-qt-linux.cmake.in"
@ -72,6 +80,7 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES Windows)
set(CPACK_IFW_ROOT "C:/Qt/Tools/QtInstallerFramework/4.5")
set(CPACK_IFW_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/icons/favicon.ico")
elseif(${CMAKE_SYSTEM_NAME} MATCHES Darwin)
message("Yes Darwin")
find_program(MACDEPLOYQT macdeployqt HINTS ${_qt_bin_dir})
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/deploy-qt-mac.cmake.in"
"${CMAKE_BINARY_DIR}/cmake/deploy-qt-mac.cmake" @ONLY)