2023-04-08 23:28:39 -04:00
|
|
|
cmake_minimum_required(VERSION 3.16)
|
|
|
|
|
2023-04-12 22:12:01 -04:00
|
|
|
project(gpt4all VERSION 0.1 LANGUAGES CXX)
|
2023-04-08 23:28:39 -04:00
|
|
|
|
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
set(CMAKE_AUTORCC ON)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
|
2023-04-09 22:22:48 -04:00
|
|
|
find_package(Qt6 6.2 COMPONENTS Quick Svg REQUIRED)
|
2023-04-08 23:28:39 -04:00
|
|
|
|
|
|
|
set(GGML_BUILD_EXAMPLES ON CACHE BOOL "ggml: build examples" FORCE)
|
|
|
|
add_subdirectory(ggml)
|
|
|
|
|
|
|
|
qt_add_executable(chat
|
|
|
|
main.cpp
|
|
|
|
gptj.h gptj.cpp
|
|
|
|
llm.h llm.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
qt_add_qml_module(chat
|
|
|
|
URI gpt4all-chat
|
|
|
|
VERSION 1.0
|
|
|
|
QML_FILES main.qml
|
2023-04-10 23:34:34 -04:00
|
|
|
RESOURCES
|
|
|
|
icons/send_message.svg
|
|
|
|
icons/stop_generating.svg
|
|
|
|
icons/regenerate.svg
|
|
|
|
icons/logo.svg
|
2023-04-11 08:54:57 -04:00
|
|
|
icons/copy.svg
|
2023-04-12 22:12:01 -04:00
|
|
|
icons/logo-16.png
|
|
|
|
icons/logo-32.png
|
|
|
|
icons/logo-48.png
|
2023-04-08 23:28:39 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
set_target_properties(chat PROPERTIES
|
|
|
|
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
|
|
|
|
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
|
|
|
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
|
|
|
MACOSX_BUNDLE TRUE
|
|
|
|
WIN32_EXECUTABLE TRUE
|
|
|
|
)
|
|
|
|
|
|
|
|
target_compile_definitions(chat
|
|
|
|
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
|
|
|
|
target_link_libraries(chat
|
|
|
|
PRIVATE Qt6::Quick Qt6::Svg)
|
|
|
|
target_link_libraries(chat
|
|
|
|
PRIVATE ggml ggml_utils)
|
2023-04-10 15:03:00 -04:00
|
|
|
|
2023-04-12 22:12:01 -04:00
|
|
|
set(COMPONENT_NAME_MAIN ${PROJECT_NAME})
|
2023-04-10 15:03:00 -04:00
|
|
|
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install)
|
|
|
|
install(TARGETS chat DESTINATION bin COMPONENT ${COMPONENT_NAME_MAIN})
|
|
|
|
|
|
|
|
set(CPACK_GENERATOR "IFW")
|
|
|
|
|
2023-04-10 16:33:14 -04:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES Linux)
|
2023-04-10 23:34:34 -04:00
|
|
|
set(LINUXDEPLOYQT "/home/atreat/dev/linuxdeployqt/build/tools/linuxdeployqt/linuxdeployqt")
|
2023-04-10 16:33:14 -04:00
|
|
|
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)
|
2023-04-10 15:03:00 -04:00
|
|
|
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")
|
2023-04-12 15:31:21 -04:00
|
|
|
set(CPACK_IFW_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/icons/favicon.ico")
|
2023-04-10 16:33:14 -04:00
|
|
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES Darwin)
|
2023-04-10 17:13:22 -04:00
|
|
|
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")
|
2023-04-12 15:31:21 -04:00
|
|
|
set(CPACK_IFW_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/icons/favicon.icns")
|
2023-04-10 16:33:14 -04:00
|
|
|
endif()
|
2023-04-10 15:03:00 -04:00
|
|
|
|
|
|
|
set(CPACK_PACKAGE_VERSION_MAJOR "0")
|
|
|
|
set(CPACK_PACKAGE_VERSION_MINOR "1")
|
|
|
|
SET(CPACK_PACKAGE_VERSION_PATCH "0")
|
2023-04-11 12:16:49 -04:00
|
|
|
set(CPACK_PACKAGE_HOMEPAGE_URL "https://gpt4all.io")
|
2023-04-12 15:31:21 -04:00
|
|
|
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/icons/logo-48.png")
|
2023-04-11 12:16:49 -04:00
|
|
|
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")
|
2023-04-10 15:03:00 -04:00
|
|
|
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")
|
2023-04-12 22:12:01 -04:00
|
|
|
set(CPACK_IFW_PACKAGE_LOGO "${CMAKE_CURRENT_SOURCE_DIR}/icons/logo-48.png")
|
2023-04-12 15:31:21 -04:00
|
|
|
set(CPACK_IFW_PACKAGE_WINDOW_ICON "${CMAKE_CURRENT_SOURCE_DIR}/icons/logo-32.png")
|
2023-04-10 15:03:00 -04:00
|
|
|
set(CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST OFF)
|
2023-04-11 12:16:49 -04:00
|
|
|
|
2023-04-10 15:03:00 -04:00
|
|
|
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} LICENSES "GPL-3.0 LICENSE" ${CPACK_RESOURCE_FILE_LICENSE})
|
2023-04-12 16:42:17 -04:00
|
|
|
cpack_ifw_configure_component(${COMPONENT_NAME_MAIN} SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/cmake/installerscript.qs")
|
2023-04-10 15:03:00 -04:00
|
|
|
|
2023-04-10 23:34:34 -04:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES Linux)
|
2023-04-11 14:36:50 -04:00
|
|
|
cpack_ifw_add_repository("GPT4AllRepository" URL "https://gpt4all.io/installer_repos/linux/repository")
|
2023-04-10 23:34:34 -04:00
|
|
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES Windows)
|
2023-04-11 14:36:50 -04:00
|
|
|
cpack_ifw_add_repository("GPT4AllRepository" URL "https://gpt4all.io/installer_repos/windows/repository")
|
2023-04-10 23:34:34 -04:00
|
|
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES Darwin)
|
2023-04-11 14:36:50 -04:00
|
|
|
cpack_ifw_add_repository("GPT4AllRepository" URL "https://gpt4all.io/installer_repos/mac/repository")
|
2023-04-10 23:34:34 -04:00
|
|
|
endif()
|