2024-09-11 14:59:42 -04:00
cmake_minimum_required ( VERSION 3.25 ) # for try_compile SOURCE_FROM_VAR
2023-04-08 23:28:39 -04:00
2024-09-11 14:59:42 -04:00
set ( APP_VERSION_MAJOR 3 )
2024-09-18 14:18:36 -04:00
set ( APP_VERSION_MINOR 3 )
set ( APP_VERSION_PATCH 0 )
2024-09-11 14:59:42 -04:00
set ( APP_VERSION_BASE "${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}.${APP_VERSION_PATCH}" )
2024-09-18 15:19:00 -04:00
set ( APP_VERSION "${APP_VERSION_BASE}-dev0" )
2024-09-11 14:59:42 -04:00
project ( gpt4all VERSION ${ APP_VERSION_BASE } LANGUAGES CXX C )
2023-05-25 15:22:45 -04:00
2023-04-14 12:19:03 -04:00
if ( APPLE )
2023-04-20 06:35:17 -04:00
option ( BUILD_UNIVERSAL "Build a Universal binary on macOS" OFF )
if ( BUILD_UNIVERSAL )
# 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 )
else ( )
# Build for the host architecture on macOS
set ( CMAKE_OSX_ARCHITECTURES "${CMAKE_HOST_SYSTEM_PROCESSOR}" CACHE STRING "" FORCE )
endif ( )
2023-04-14 12:19:03 -04:00
endif ( )
2024-09-11 14:59:42 -04:00
option ( GPT4ALL_LOCALHOST "Build installer for localhost repo" OFF )
option ( GPT4ALL_OFFLINE_INSTALLER "Build an offline installer" OFF )
option ( GPT4ALL_SIGN_INSTALL "Sign installed binaries and installers (requires signing identities)" OFF )
set ( CMAKE_EXPORT_COMPILE_COMMANDS ON )
set ( CMAKE_CXX_STANDARD 23 )
set ( CMAKE_CXX_STANDARD_REQUIRED ON )
# conftests
function ( check_cpp_feature FEATURE_NAME MIN_VALUE )
message ( CHECK_START "Checking for ${FEATURE_NAME} >= ${MIN_VALUE}" )
string ( CONCAT SRC
" #include <version>\n"
" #if !defined(${FEATURE_NAME}) || ${FEATURE_NAME} < ${MIN_VALUE}\n"
" # error \"${FEATURE_NAME} is not defined or less than ${MIN_VALUE}\"\n"
" #endif\n"
" i n t main ( ) { r e t u r n 0 ; } \ n "
)
try_compile ( HAS_FEATURE SOURCE_FROM_VAR "test_${FEATURE_NAME}.cpp" SRC )
if ( NOT HAS_FEATURE )
message ( CHECK_FAIL "fail" )
message ( FATAL_ERROR
" T h e C + + c o m p i l e r \ n \ " $ { C M A K E _ C X X _ C O M P I L E R } \ " \ n "
" i s t o o o l d t o s u p p o r t $ { F E A T U R E _ N A M E } > = $ { M I N _ V A L U E } . \ n "
" P l e a s e s p e c i f y a n e w e r c o m p i l e r v i a - D C M A K E _ C _ C O M P I L E R / - D C M A K E _ C X X _ C O M P I L E R . "
)
endif ( )
message ( CHECK_PASS "pass" )
endfunction ( )
# check for monadic operations in std::optional (e.g. transform)
check_cpp_feature ( "__cpp_lib_optional" "202110L" )
2023-04-16 19:20:43 -04:00
2024-07-01 17:40:02 -04:00
list ( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/Modules" )
2023-04-16 19:20:43 -04:00
# Include the binary directory for the generated header file
include_directories ( "${CMAKE_CURRENT_BINARY_DIR}" )
2023-04-08 23:28:39 -04:00
set ( CMAKE_AUTOMOC ON )
set ( CMAKE_AUTORCC ON )
2023-05-08 08:23:00 -04:00
# Generate a header file with the version number
configure_file (
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / c m a k e / c o n f i g . h . i n "
" $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c o n f i g . h "
)
2024-09-09 17:13:39 -04:00
find_package ( Qt6 6.4 COMPONENTS Core HttpServer LinguistTools Pdf Quick QuickDialogs2 Sql Svg REQUIRED )
2023-04-21 23:23:57 -04:00
# Get the Qt6Core target properties
get_target_property ( Qt6Core_INCLUDE_DIRS Qt6::Core INTERFACE_INCLUDE_DIRECTORIES )
get_target_property ( Qt6Core_LIBRARY_RELEASE Qt6::Core LOCATION_RELEASE )
# Find the qmake binary
find_program ( QMAKE_EXECUTABLE NAMES qmake qmake6 PATHS ${ Qt6Core_INCLUDE_DIRS } /../.. NO_DEFAULT_PATH )
# Get the Qt 6 root directory
get_filename_component ( Qt6_ROOT_DIR "${Qt6Core_LIBRARY_RELEASE}" DIRECTORY )
get_filename_component ( Qt6_ROOT_DIR "${Qt6_ROOT_DIR}/.." ABSOLUTE )
message ( STATUS "qmake binary: ${QMAKE_EXECUTABLE}" )
message ( STATUS "Qt 6 root directory: ${Qt6_ROOT_DIR}" )
2023-04-08 23:28:39 -04:00
2023-04-26 22:59:37 -04:00
set ( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${ CMAKE_BINARY_DIR } /bin )
2024-09-09 10:48:57 -04:00
set ( FMT_INSTALL OFF )
set ( BUILD_SHARED_LIBS_SAVED "${BUILD_SHARED_LIBS}" )
set ( BUILD_SHARED_LIBS OFF )
add_subdirectory ( deps/fmt )
set ( BUILD_SHARED_LIBS "${BUILD_SHARED_LIBS_SAVED}" )
2023-05-31 17:04:01 -04:00
add_subdirectory ( ../gpt4all-backend llmodel )
2024-06-25 17:22:51 -04:00
set ( CHAT_EXE_RESOURCES )
# Metal shader library
if ( APPLE )
2024-08-27 17:22:40 -04:00
list ( APPEND CHAT_EXE_RESOURCES "${GGML_METALLIB}" )
2023-06-09 16:48:46 -04:00
endif ( )
2024-06-25 17:22:51 -04:00
# App icon
2024-05-09 13:42:46 -04:00
if ( WIN32 )
2024-06-25 17:22:51 -04:00
list ( APPEND CHAT_EXE_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/resources/gpt4all.rc" )
2024-05-09 13:42:46 -04:00
elseif ( APPLE )
# The MACOSX_BUNDLE_ICON_FILE variable is added to the Info.plist
# generated by CMake. This variable contains the .icns file name,
# without the path.
set ( MACOSX_BUNDLE_ICON_FILE gpt4all.icns )
# And the following tells CMake where to find and install the file itself.
set ( APP_ICON_RESOURCE "${CMAKE_CURRENT_SOURCE_DIR}/resources/gpt4all.icns" )
set_source_files_properties ( ${ APP_ICON_RESOURCE } PROPERTIES
M A C O S X _ P A C K A G E _ L O C A T I O N " R e s o u r c e s " )
2024-06-25 17:22:51 -04:00
list ( APPEND CHAT_EXE_RESOURCES "${APP_ICON_RESOURCE}" )
2024-05-09 13:42:46 -04:00
endif ( )
2024-06-25 17:22:51 -04:00
# Embedding model
set ( LOCAL_EMBEDDING_MODEL "nomic-embed-text-v1.5.f16.gguf" )
set ( LOCAL_EMBEDDING_MODEL_MD5 "a5401e7f7e46ed9fcaed5b60a281d547" )
set ( LOCAL_EMBEDDING_MODEL_PATH "${CMAKE_BINARY_DIR}/resources/${LOCAL_EMBEDDING_MODEL}" )
set ( LOCAL_EMBEDDING_MODEL_URL "https://gpt4all.io/models/gguf/${LOCAL_EMBEDDING_MODEL}" )
message ( STATUS "Downloading embedding model from ${LOCAL_EMBEDDING_MODEL_URL} ..." )
file ( DOWNLOAD
" $ { L O C A L _ E M B E D D I N G _ M O D E L _ U R L } "
" $ { L O C A L _ E M B E D D I N G _ M O D E L _ P A T H } "
E X P E C T E D _ H A S H " M D 5 = $ { L O C A L _ E M B E D D I N G _ M O D E L _ M D 5 } "
)
message ( STATUS "Embedding model downloaded to ${LOCAL_EMBEDDING_MODEL_PATH}" )
if ( APPLE )
list ( APPEND CHAT_EXE_RESOURCES "${LOCAL_EMBEDDING_MODEL_PATH}" )
endif ( )
2024-03-29 16:21:40 -04:00
2024-08-30 12:11:32 -04:00
set ( QAPPLICATION_CLASS QGuiApplication )
add_subdirectory ( deps/SingleApplication )
2024-08-27 17:22:40 -04:00
add_subdirectory ( src )
target_sources ( chat PRIVATE ${ APP_ICON_RESOURCE } ${ CHAT_EXE_RESOURCES } )
2023-04-08 23:28:39 -04:00
2024-08-27 17:22:40 -04:00
qt_target_qml_sources ( chat
2023-04-10 23:34:34 -04:00
R E S O U R C E S
2024-06-24 18:49:23 -04:00
i c o n s / a n t e n n a _ 1 . s v g
i c o n s / a n t e n n a _ 2 . s v g
i c o n s / a n t e n n a _ 3 . s v g
2024-06-26 22:00:48 -04:00
i c o n s / c a r e t _ d o w n . s v g
i c o n s / c a r e t _ r i g h t . s v g
2024-06-24 18:49:23 -04:00
i c o n s / c h a n g e l o g . s v g
2024-07-01 18:24:04 -04:00
i c o n s / c h a t . s v g
i c o n s / c h e c k . s v g
2023-07-06 10:53:43 -04:00
i c o n s / c l o s e . s v g
2023-04-11 08:54:57 -04:00
i c o n s / c o p y . s v g
2023-05-23 14:51:14 -04:00
i c o n s / d b . s v g
2024-06-24 18:49:23 -04:00
i c o n s / d i s c o r d . s v g
2023-07-09 15:51:59 -04:00
i c o n s / d o w n l o a d . s v g
2023-04-14 14:44:28 -04:00
i c o n s / e d i t . s v g
2024-07-01 18:24:04 -04:00
i c o n s / e j e c t . s v g
2024-06-24 18:49:23 -04:00
i c o n s / e m a i l . s v g
i c o n s / f i l e - m d . s v g
i c o n s / f i l e - p d f . s v g
i c o n s / f i l e - t x t . s v g
2024-07-01 18:24:04 -04:00
i c o n s / f i l e . s v g
2024-06-24 18:49:23 -04:00
i c o n s / g i t h u b . s v g
i c o n s / g l o b e . s v g
2024-07-01 18:24:04 -04:00
i c o n s / g p t 4 a l l - 3 2 . p n g
i c o n s / g p t 4 a l l - 4 8 . p n g
i c o n s / g p t 4 a l l . s v g
i c o n s / g p t 4 a l l _ t r a n s p a r e n t . s v g
2024-06-24 18:49:23 -04:00
i c o n s / h o m e . s v g
2023-07-01 11:34:21 -04:00
i c o n s / i m a g e . s v g
2024-06-24 18:49:23 -04:00
i c o n s / i n f o . s v g
2024-07-01 18:24:04 -04:00
i c o n s / l e f t _ p a n e l _ c l o s e d . s v g
i c o n s / l e f t _ p a n e l _ o p e n . s v g
2024-06-24 18:49:23 -04:00
i c o n s / l o c a l - d o c s . s v g
i c o n s / m o d e l s . s v g
2024-07-01 18:24:04 -04:00
i c o n s / n e t w o r k . s v g
2024-06-24 18:49:23 -04:00
i c o n s / n o m i c _ l o g o . s v g
i c o n s / n o t e s . s v g
2024-07-10 15:45:20 -04:00
i c o n s / p l u s . s v g
2024-07-01 18:24:04 -04:00
i c o n s / r e c y c l e . s v g
i c o n s / r e g e n e r a t e . s v g
2024-06-24 18:49:23 -04:00
i c o n s / s e a r c h . s v g
2024-07-01 18:24:04 -04:00
i c o n s / s e n d _ m e s s a g e . s v g
i c o n s / s e t t i n g s . s v g
2024-07-10 15:45:20 -04:00
i c o n s / s t a c k . s v g
2024-07-01 18:24:04 -04:00
i c o n s / s t o p _ g e n e r a t i n g . s v g
2023-04-14 14:44:28 -04:00
i c o n s / t h u m b s _ d o w n . s v g
2024-07-01 18:24:04 -04:00
i c o n s / t h u m b s _ u p . s v g
i c o n s / t r a s h . s v g
2024-06-24 18:49:23 -04:00
i c o n s / t w i t t e r . s v g
2024-06-29 18:00:52 -04:00
i c o n s / u p _ d o w n . s v g
2024-06-24 18:49:23 -04:00
i c o n s / y o u . s v g
2023-04-08 23:28:39 -04:00
)
2024-08-12 11:00:49 -04:00
qt_add_translations ( chat
T S _ F I L E S
$ { C M A K E _ S O U R C E _ D I R } / t r a n s l a t i o n s / g p t 4 a l l _ e n _ U S . t s
$ { C M A K E _ S O U R C E _ D I R } / t r a n s l a t i o n s / g p t 4 a l l _ e s _ M X . t s
$ { C M A K E _ S O U R C E _ D I R } / t r a n s l a t i o n s / g p t 4 a l l _ z h _ C N . t s
$ { C M A K E _ S O U R C E _ D I R } / t r a n s l a t i o n s / g p t 4 a l l _ z h _ T W . t s
$ { C M A K E _ S O U R C E _ D I R } / t r a n s l a t i o n s / g p t 4 a l l _ r o _ R O . t s
$ { C M A K E _ S O U R C E _ D I R } / t r a n s l a t i o n s / g p t 4 a l l _ i t _ I T . t s
$ { C M A K E _ S O U R C E _ D I R } / t r a n s l a t i o n s / g p t 4 a l l _ p t _ B R . t s
)
2024-07-11 13:02:54 -04:00
2023-04-08 23:28:39 -04:00
set_target_properties ( chat PROPERTIES
W I N 3 2 _ E X E C U T A B L E T R U E
)
2024-06-28 14:21:18 -04:00
macro ( REPORT_MISSING_SIGNING_CONTEXT )
message ( FATAL_ERROR [=[
S i g n i n g r e q u e s t e d b u t n o i d e n t i t y c o n f i g u r e d .
P l e a s e s e t t h e c o r r e c t e n v v a r i a b l e o r p r o v i d e t h e M A C _ S I G N I N G _ I D E N T I T Y a r g u m e n t o n t h e c o m m a n d l i n e
] = ] )
endmacro ( )
2024-06-25 17:22:51 -04:00
if ( APPLE )
2023-04-23 23:42:55 -04:00
set_target_properties ( chat PROPERTIES
2024-06-25 17:22:51 -04:00
M A C O S X _ B U N D L E T R U E
M A C O S X _ B U N D L E _ G U I _ I D E N T I F I E R g p t 4 a l l
M A C O S X _ B U N D L E _ B U N D L E _ V E R S I O N $ { P R O J E C T _ V E R S I O N }
M A C O S X _ B U N D L E _ S H O R T _ V E R S I O N _ S T R I N G $ { P R O J E C T _ V E R S I O N _ M A J O R } . $ { P R O J E C T _ V E R S I O N _ M I N O R }
R E S O U R C E " $ { C H A T _ E X E _ R E S O U R C E S } "
2023-04-23 23:42:55 -04:00
O U T P U T _ N A M E g p t 4 a l l
)
2024-05-15 18:12:32 -04:00
add_dependencies ( chat ggml-metal )
2024-06-28 14:21:18 -04:00
if ( NOT MAC_SIGNING_IDENTITY )
if ( NOT DEFINED ENV{MAC_SIGNING_CERT_NAME} AND GPT4ALL_SIGN_INSTALL )
REPORT_MISSING_SIGNING_CONTEXT ( )
endif ( )
set ( MAC_SIGNING_IDENTITY $ENV{ MAC_SIGNING_CERT_NAME } )
endif ( )
if ( NOT MAC_SIGNING_TID )
if ( NOT DEFINED ENV{MAC_NOTARIZATION_TID} AND GPT4ALL_SIGN_INSTALL )
REPORT_MISSING_SIGNING_CONTEXT ( )
endif ( )
set ( MAC_SIGNING_TID $ENV{ MAC_NOTARIZATION_TID } )
endif ( )
# Setup MacOS signing for individual binaries
set_target_properties ( chat PROPERTIES
X C O D E _ A T T R I B U T E _ C O D E _ S I G N _ S T Y L E " M a n u a l "
X C O D E _ A T T R I B U T E _ D E V E L O P M E N T _ T E A M $ { M A C _ S I G N I N G _ T I D }
X C O D E _ A T T R I B U T E _ C O D E _ S I G N _ I D E N T I T Y $ { M A C _ S I G N I N G _ I D E N T I T Y }
X C O D E _ A T T R I B U T E _ C O D E _ S I G N I N G _ R E Q U I R E D T r u e
X C O D E _ A T T R I B U T E _ O T H E R _ C O D E _ S I G N _ F L A G S " - - t i m e s t a m p = h t t p : / / t i m e s t a m p . a p p l e . c o m / t s 0 1 - - o p t i o n s = r u n t i m e , l i b r a r y "
)
2023-06-09 16:48:46 -04:00
endif ( )
2023-04-08 23:28:39 -04:00
target_compile_definitions ( chat
P R I V A T E $ < $ < O R : $ < C O N F I G : D e b u g > , $ < C O N F I G : R e l W i t h D e b I n f o > > : Q T _ Q M L _ D E B U G > )
2024-06-24 18:49:23 -04:00
2024-08-27 17:22:40 -04:00
target_include_directories ( chat PRIVATE src )
2024-06-24 18:49:23 -04:00
# usearch uses the identifier 'slots' which conflicts with Qt's 'slots' keyword
target_compile_definitions ( chat PRIVATE QT_NO_SIGNALS_SLOTS_KEYWORDS )
2024-08-27 17:22:40 -04:00
target_include_directories ( chat PRIVATE deps/usearch/include
d e p s / u s e a r c h / f p 1 6 / i n c l u d e )
2024-06-24 18:49:23 -04:00
2024-09-09 17:13:39 -04:00
target_link_libraries ( chat
P R I V A T E Q t 6 : : C o r e Q t 6 : : H t t p S e r v e r Q t 6 : : P d f Q t 6 : : Q u i c k Q t 6 : : S q l Q t 6 : : S v g )
2023-04-08 23:28:39 -04:00
target_link_libraries ( chat
2024-09-09 10:48:57 -04:00
P R I V A T E l l m o d e l S i n g l e A p p l i c a t i o n f m t : : f m t )
2023-04-10 15:03:00 -04:00
2024-06-24 18:49:23 -04:00
# -- install --
2023-04-21 23:23:57 -04:00
set ( COMPONENT_NAME_MAIN ${ PROJECT_NAME } )
2024-03-17 14:25:45 -04:00
if ( CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT )
set ( CMAKE_INSTALL_PREFIX ${ CMAKE_BINARY_DIR } /install CACHE PATH "..." FORCE )
endif ( )
2023-04-21 23:23:57 -04:00
2023-04-10 15:03:00 -04:00
install ( TARGETS chat DESTINATION bin COMPONENT ${ COMPONENT_NAME_MAIN } )
2024-05-15 15:27:50 -04:00
install (
T A R G E T S l l m o d e l
L I B R A R Y D E S T I N A T I O N l i b C O M P O N E N T $ { C O M P O N E N T _ N A M E _ M A I N } # .so/.dylib
R U N T I M E D E S T I N A T I O N b i n C O M P O N E N T $ { C O M P O N E N T _ N A M E _ M A I N } # .dll
)
2023-04-10 15:03:00 -04:00
2023-06-05 09:56:52 -04:00
# We should probably iterate through the list of the cmake for backend, but these need to be installed
# to the this component's dir for the finicky qt installer to work
2024-05-15 15:27:50 -04:00
if ( LLMODEL_KOMPUTE )
set ( MODEL_IMPL_TARGETS
l l a m a m o d e l - m a i n l i n e - k o m p u t e
l l a m a m o d e l - m a i n l i n e - k o m p u t e - a v x o n l y
)
else ( )
set ( MODEL_IMPL_TARGETS
l l a m a m o d e l - m a i n l i n e - c p u
l l a m a m o d e l - m a i n l i n e - c p u - a v x o n l y
)
endif ( )
if ( APPLE )
list ( APPEND MODEL_IMPL_TARGETS llamamodel-mainline-metal )
endif ( )
install (
T A R G E T S $ { M O D E L _ I M P L _ T A R G E T S }
L I B R A R Y D E S T I N A T I O N l i b C O M P O N E N T $ { C O M P O N E N T _ N A M E _ M A I N } # .so/.dylib
R U N T I M E D E S T I N A T I O N l i b C O M P O N E N T $ { C O M P O N E N T _ N A M E _ M A I N } # .dll
)
2024-06-28 14:21:18 -04:00
if ( APPLE AND GPT4ALL_SIGN_INSTALL )
2024-07-01 17:40:02 -04:00
include ( SignMacOSBinaries )
2024-06-28 14:21:18 -04:00
install_sign_osx ( chat )
install_sign_osx ( llmodel )
foreach ( tgt ${ MODEL_IMPL_TARGETS } )
install_sign_osx ( ${ tgt } )
endforeach ( )
endif ( )
2024-07-01 17:40:02 -04:00
if ( WIN32 AND GPT4ALL_SIGN_INSTALL )
include ( SignWindowsBinaries )
sign_target_windows ( chat )
sign_target_windows ( llmodel )
foreach ( tgt ${ MODEL_IMPL_TARGETS } )
sign_target_windows ( ${ tgt } )
endforeach ( )
endif ( )
2024-05-15 15:27:50 -04:00
if ( LLMODEL_CUDA )
set_property ( TARGET llamamodel-mainline-cuda llamamodel-mainline-cuda-avxonly
A P P E N D P R O P E R T Y I N S T A L L _ R P A T H " $ O R I G I N " )
install (
T A R G E T S l l a m a m o d e l - m a i n l i n e - c u d a
l l a m a m o d e l - m a i n l i n e - c u d a - a v x o n l y
R U N T I M E _ D E P E N D E N C Y _ S E T l l a m a - c u d a - d e p s
L I B R A R Y D E S T I N A T I O N l i b C O M P O N E N T $ { C O M P O N E N T _ N A M E _ M A I N } # .so/.dylib
R U N T I M E D E S T I N A T I O N l i b C O M P O N E N T $ { C O M P O N E N T _ N A M E _ M A I N } # .dll
)
if ( WIN32 )
install (
R U N T I M E _ D E P E N D E N C Y _ S E T l l a m a - c u d a - d e p s
P R E _ E X C L U D E _ R E G E X E S " ^ ( n v c u d a | a p i - m s - . * ) \ \ . d l l $ "
P O S T _ I N C L U D E _ R E G E X E S " ( ^ | [ / \ \ \ \ ] ) ( l i b ) ? ( c u d a | c u b l a s ) " P O S T _ E X C L U D E _ R E G E X E S .
D I R E C T O R I E S " $ { C U D A T o o l k i t _ B I N _ D I R } "
D E S T I N A T I O N l i b C O M P O N E N T $ { C O M P O N E N T _ N A M E _ M A I N }
)
endif ( )
2023-06-16 17:18:17 -04:00
endif ( )
2023-06-05 09:56:52 -04:00
2024-06-25 17:22:51 -04:00
if ( NOT APPLE )
2024-09-09 17:17:57 -04:00
install ( FILES "${LOCAL_EMBEDDING_MODEL_PATH}"
2024-06-25 17:22:51 -04:00
D E S T I N A T I O N r e s o u r c e s
C O M P O N E N T $ { C O M P O N E N T _ N A M E _ M A I N } )
endif ( )
2024-06-24 18:49:23 -04:00
2023-04-10 15:03:00 -04:00
set ( CPACK_GENERATOR "IFW" )
2023-04-21 23:23:57 -04:00
set ( CPACK_VERBATIM_VARIABLES YES )
set ( CPACK_IFW_VERBOSE ON )
2023-04-16 22:10:26 -04:00
2023-04-10 16:33:14 -04:00
if ( ${ CMAKE_SYSTEM_NAME } MATCHES Linux )
2023-09-19 13:59:43 -04:00
find_program ( LINUXDEPLOYQT linuxdeployqt HINTS "$ENV{HOME}/dev/linuxdeployqt/build/tools/linuxdeployqt" "$ENV{HOME}/project/linuxdeployqt/bin" )
2023-04-10 16:33:14 -04:00
configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/deploy-qt-linux.cmake.in"
" $ { C M A K E _ B I N A R Y _ D I R } / c m a k e / d e p l o y - q t - l i n u x . c m a k e " @ O N L Y )
set ( CPACK_PRE_BUILD_SCRIPTS ${ CMAKE_BINARY_DIR } /cmake/deploy-qt-linux.cmake )
2023-09-19 13:59:43 -04:00
set ( CPACK_IFW_ROOT "~/Qt/Tools/QtInstallerFramework/4.6" )
2023-04-17 15:59:14 -04:00
set ( CPACK_PACKAGE_FILE_NAME "${COMPONENT_NAME_MAIN}-installer-linux" )
2023-04-21 23:23:57 -04:00
set ( CPACK_IFW_TARGET_DIRECTORY "@HomeDir@/${COMPONENT_NAME_MAIN}" )
2023-04-10 16:33:14 -04:00
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"
" $ { C M A K E _ B I N A R Y _ D I R } / c m a k e / d e p l o y - q t - w i n d o w s . c m a k e " @ O N L Y )
set ( CPACK_PRE_BUILD_SCRIPTS ${ CMAKE_BINARY_DIR } /cmake/deploy-qt-windows.cmake )
2023-09-19 13:59:43 -04:00
set ( CPACK_IFW_ROOT "C:/Qt/Tools/QtInstallerFramework/4.6" )
2024-05-09 13:42:46 -04:00
set ( CPACK_IFW_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resources/gpt4all.ico" )
2023-04-17 15:59:14 -04:00
set ( CPACK_PACKAGE_FILE_NAME "${COMPONENT_NAME_MAIN}-installer-win64" )
2023-04-21 23:23:57 -04:00
set ( CPACK_IFW_TARGET_DIRECTORY "@HomeDir@\\${COMPONENT_NAME_MAIN}" )
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"
" $ { C M A K E _ B I N A R Y _ D I R } / c m a k e / d e p l o y - q t - m a c . c m a k e " @ O N L Y )
set ( CPACK_PRE_BUILD_SCRIPTS ${ CMAKE_BINARY_DIR } /cmake/deploy-qt-mac.cmake )
2023-09-19 13:59:43 -04:00
set ( CPACK_IFW_ROOT "~/Qt/Tools/QtInstallerFramework/4.6" )
2024-05-09 13:42:46 -04:00
set ( CPACK_IFW_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resources/gpt4all.icns" )
2023-04-17 15:59:14 -04:00
set ( CPACK_PACKAGE_FILE_NAME "${COMPONENT_NAME_MAIN}-installer-darwin" )
2023-04-28 21:19:12 -04:00
set ( CPACK_IFW_TARGET_DIRECTORY "@ApplicationsDir@/${COMPONENT_NAME_MAIN}" )
2023-04-23 22:05:24 -04:00
set ( CPACK_BUNDLE_NAME ${ COMPONENT_NAME_MAIN } )
2024-05-09 13:42:46 -04:00
set ( CPACK_BUNDLE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resources/gpt4all.icns" )
2023-04-10 16:33:14 -04:00
endif ( )
2023-04-10 15:03:00 -04:00
2023-04-17 15:59:14 -04:00
set ( CPACK_PACKAGE_INSTALL_DIRECTORY ${ COMPONENT_NAME_MAIN } )
2023-04-13 04:59:48 -04:00
set ( CPACK_PACKAGE_VERSION_MAJOR ${ PROJECT_VERSION_MAJOR } )
set ( CPACK_PACKAGE_VERSION_MINOR ${ PROJECT_VERSION_MINOR } )
SET ( CPACK_PACKAGE_VERSION_PATCH ${ PROJECT_VERSION_PATCH } )
2024-08-26 16:27:41 -04:00
set ( CPACK_PACKAGE_HOMEPAGE_URL "https://www.nomic.ai/gpt4all" )
2024-06-28 17:11:12 -04:00
set ( CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/icons/gpt4all-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 )
2023-04-17 07:50:39 -04:00
set ( CPACK_PACKAGE_EXECUTABLES "GPT4All" )
set ( CPACK_CREATE_DESKTOP_LINKS "GPT4All" )
set ( CPACK_IFW_PACKAGE_NAME "GPT4All" )
set ( CPACK_IFW_PACKAGE_TITLE "GPT4All Installer" )
2023-04-16 19:20:43 -04:00
set ( CPACK_IFW_PACKAGE_PUBLISHER "Nomic, Inc." )
2024-08-26 16:27:41 -04:00
set ( CPACK_IFW_PRODUCT_URL "https://www.nomic.ai/gpt4all" )
2023-04-10 15:03:00 -04:00
set ( CPACK_IFW_PACKAGE_WIZARD_STYLE "Aero" )
2024-06-28 17:11:12 -04:00
set ( CPACK_IFW_PACKAGE_LOGO "${CMAKE_CURRENT_SOURCE_DIR}/icons/gpt4all-48.png" )
set ( CPACK_IFW_PACKAGE_WINDOW_ICON "${CMAKE_CURRENT_SOURCE_DIR}/icons/gpt4all-32.png" )
2023-04-10 15:03:00 -04:00
set ( CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST OFF )
2024-09-09 17:17:57 -04:00
set ( CPACK_IFW_PACKAGE_CONTROL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/cmake/installer_control.qs" )
2023-04-11 12:16:49 -04:00
2023-04-28 21:26:38 -04:00
include ( InstallRequiredSystemLibraries )
2023-04-10 15:03:00 -04:00
include ( CPack )
include ( CPackIFW )
2023-09-18 16:21:34 -04:00
if ( GPT4ALL_OFFLINE_INSTALLER )
cpack_add_component ( ${ COMPONENT_NAME_MAIN } )
else ( )
cpack_add_component ( ${ COMPONENT_NAME_MAIN } DOWNLOADED )
endif ( )
2023-04-10 15:03:00 -04:00
cpack_ifw_configure_component ( ${ COMPONENT_NAME_MAIN } ESSENTIAL FORCED_INSTALLATION )
2023-04-16 19:20:43 -04:00
cpack_ifw_configure_component ( ${ COMPONENT_NAME_MAIN } VERSION ${ APP_VERSION } )
2023-04-21 23:23:57 -04:00
cpack_ifw_configure_component ( ${ COMPONENT_NAME_MAIN } LICENSES "MIT LICENSE" ${ CPACK_RESOURCE_FILE_LICENSE } )
2024-09-09 17:17:57 -04:00
cpack_ifw_configure_component ( ${ COMPONENT_NAME_MAIN } SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/cmake/installer_component.qs" )
2023-04-13 05:49:00 -04:00
cpack_ifw_configure_component ( ${ COMPONENT_NAME_MAIN } REPLACES "gpt4all-chat" ) #Was used in very earliest prototypes
2023-04-10 15:03:00 -04:00
2023-04-24 01:08:13 -04:00
if ( GPT4ALL_LOCALHOST )
cpack_ifw_add_repository ( "GPT4AllRepository" URL "http://localhost/repository" )
2023-04-29 12:13:11 -04:00
elseif ( GPT4ALL_OFFLINE_INSTALLER )
2023-09-19 13:59:43 -04:00
add_compile_definitions ( GPT4ALL_OFFLINE_INSTALLER )
2023-04-24 01:08:13 -04:00
else ( )
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 )
2023-06-04 15:28:58 -04:00
#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
2023-04-24 01:08:13 -04:00
cpack_ifw_add_repository ( "GPT4AllRepository" URL "https://gpt4all.io/installer_repos/windows/repository" )
elseif ( ${ CMAKE_SYSTEM_NAME } MATCHES Darwin )
cpack_ifw_add_repository ( "GPT4AllRepository" URL "https://gpt4all.io/installer_repos/mac/repository" )
endif ( )
2023-04-10 23:34:34 -04:00
endif ( )