Created
April 16, 2023 09:57
-
-
Save TheBloke/b933a4a98e0ea7352b8f5c4574575d45 to your computer and use it in GitHub Desktop.
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
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) | |
endif() | |
project(gpt4all VERSION 0.1.0 LANGUAGES CXX) | |
set(CMAKE_AUTOMOC ON) | |
set(CMAKE_AUTORCC ON) | |
set(CMAKE_CXX_STANDARD_REQUIRED ON) | |
#find_package(Qt6 6.2 COMPONENTS Quick Svg REQUIRED) | |
set(GGML_BUILD_EXAMPLES ON CACHE BOOL "ggml: build examples" FORCE) | |
add_subdirectory(ggml) | |
set(COMPONENT_NAME_MAIN ${PROJECT_NAME}) | |
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install) | |
set(CPACK_GENERATOR "IFW") | |
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" | |
"${CMAKE_BINARY_DIR}/cmake/deploy-qt-linux.cmake" @ONLY) | |
set(CPACK_PRE_BUILD_SCRIPTS ${CMAKE_BINARY_DIR}/cmake/deploy-qt-linux.cmake) | |
set(CPACK_IFW_ROOT "~/Qt/Tools/QtInstallerFramework/4.5") | |
elseif(${CMAKE_SYSTEM_NAME} MATCHES Windows) | |
find_program(WINDEPLOYQT windeployqt HINTS ${_qt_bin_dir}) | |
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/deploy-qt-windows.cmake.in" | |
"${CMAKE_BINARY_DIR}/cmake/deploy-qt-windows.cmake" @ONLY) | |
set(CPACK_PRE_BUILD_SCRIPTS ${CMAKE_BINARY_DIR}/cmake/deploy-qt-windows.cmake) | |
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) | |
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) | |
set(CPACK_PRE_BUILD_SCRIPTS ${CMAKE_BINARY_DIR}/cmake/deploy-qt-mac.cmake) | |
set(CPACK_IFW_ROOT "~/Qt/Tools/QtInstallerFramework/4.5") | |
set(CPACK_IFW_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/icons/favicon.icns") | |
endif() | |
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) | |
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) | |
SET(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) | |
set(CPACK_PACKAGE_HOMEPAGE_URL "https://gpt4all.io") | |
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/icons/logo-48.png") | |
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE) | |
set(CPACK_RESOURCE_FILE_README ${CMAKE_CURRENT_SOURCE_DIR}/README.md) | |
set(CPACK_PACKAGE_EXECUTABLES "GPT4All Chat") | |
set(CPACK_CREATE_DESKTOP_LINKS "GPT4All Chat") | |
set(CPACK_IFW_PACKAGE_NAME "GPT4All Chat") | |
set(CPACK_IFW_PACKAGE_TITLE "GPT4All Chat Installer") | |
set(CPACK_IFW_PACKAGE_PUBLISHER "Adam Treat") | |
set(CPACK_IFW_PRODUCT_URL "https://github.com/manyoso/gpt4all-chat") | |
set(CPACK_IFW_PACKAGE_WIZARD_STYLE "Aero") | |
set(CPACK_IFW_PACKAGE_LOGO "${CMAKE_CURRENT_SOURCE_DIR}/icons/logo-48.png") | |
set(CPACK_IFW_PACKAGE_WINDOW_ICON "${CMAKE_CURRENT_SOURCE_DIR}/icons/logo-32.png") | |
set(CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST OFF) | |
set(CHAT_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") | |
include(CPack) | |
include(CPackIFW) | |
cpack_add_component(${COMPONENT_NAME_MAIN} DOWNLOADED) | |
cpack_ifw_configure_component(${COMPONENT_NAME_MAIN} ESSENTIAL FORCED_INSTALLATION) | |
cpack_ifw_configure_component(${COMPONENT_NAME_MAIN} VERSION ${CHAT_VERSION}) | |
cpack_ifw_configure_component(${COMPONENT_NAME_MAIN} LICENSES "GPL-3.0 LICENSE" ${CPACK_RESOURCE_FILE_LICENSE}) | |
cpack_ifw_configure_component(${COMPONENT_NAME_MAIN} SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/cmake/installerscript.qs") | |
cpack_ifw_configure_component(${COMPONENT_NAME_MAIN} REPLACES "gpt4all-chat") #Was used in very earliest prototypes | |
if(${CMAKE_SYSTEM_NAME} MATCHES Linux) | |
cpack_ifw_add_repository("GPT4AllRepository" URL "https://gpt4all.io/installer_repos/linux/repository") | |
elseif(${CMAKE_SYSTEM_NAME} MATCHES Windows) | |
#To sign the target on windows have to create a batch script add use it as a custom target and then use CPACK_IFW_EXTRA_TARGETS to set this extra target | |
cpack_ifw_add_repository("GPT4AllRepository" URL "https://gpt4all.io/installer_repos/windows/repository") | |
elseif(${CMAKE_SYSTEM_NAME} MATCHES Darwin) | |
#Use this in future https://cmake.org/cmake/help/latest/cpack_gen/ifw.html#variable:CPACK_IFW_PACKAGE_SIGNING_IDENTITY | |
cpack_ifw_add_repository("GPT4AllRepository" URL "https://gpt4all.io/installer_repos/mac/repository") | |
endif() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment