From a8a6b8ae302588201d2cb0f5e86a10e7f5e17706 Mon Sep 17 00:00:00 2001 From: TheBloke Date: Fri, 14 Apr 2023 17:19:03 +0100 Subject: [PATCH 1/3] Add support for building a Universal binary on macOS --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f2f1d5f..a3e87770 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) From ccde3f81112eff4f35e3000db7d81d36ffd9f9b0 Mon Sep 17 00:00:00 2001 From: TheBloke Date: Fri, 14 Apr 2023 17:28:44 +0100 Subject: [PATCH 2/3] Remove test debug lines --- CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a3e87770..f443f72b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,7 +65,6 @@ 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" @@ -80,7 +79,6 @@ 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) From 2c64c8972dc2f992ac9bbdde0cee4839115c37bb Mon Sep 17 00:00:00 2001 From: TheBloke Date: Fri, 14 Apr 2023 17:33:54 +0100 Subject: [PATCH 3/3] Remove Qt dir --- CMakeLists.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f443f72b..22e7ec42 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,9 @@ cmake_minimum_required(VERSION 3.16) if(APPLE) + # Build a Universal binary on macOS + # This requires that the found Qt library is compiled as Universal binaries. 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)