Getting ready for next update.

This commit is contained in:
Adam Treat 2023-04-21 23:23:57 -04:00
parent 3578693a43
commit 10ebbafc22
6 changed files with 66 additions and 47 deletions

View File

@ -13,8 +13,8 @@ if(APPLE)
endif() endif()
set(APP_VERSION_MAJOR 2) set(APP_VERSION_MAJOR 2)
set(APP_VERSION_MINOR 1) set(APP_VERSION_MINOR 2)
set(APP_VERSION_PATCH 1) set(APP_VERSION_PATCH 0)
set(APP_VERSION "${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}.${APP_VERSION_PATCH}") set(APP_VERSION "${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}.${APP_VERSION_PATCH}")
# Generate a header file with the version number # Generate a header file with the version number
@ -32,7 +32,21 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON) set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt6 6.2 COMPONENTS Quick Svg REQUIRED) find_package(Qt6 6.2 COMPONENTS Core Quick Svg REQUIRED)
# 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}")
set(LLAMA_BUILD_EXAMPLES ON CACHE BOOL "llama: build examples" FORCE) set(LLAMA_BUILD_EXAMPLES ON CACHE BOOL "llama: build examples" FORCE)
set(BUILD_SHARED_LIBS ON FORCE) set(BUILD_SHARED_LIBS ON FORCE)
@ -84,25 +98,28 @@ target_link_libraries(chat
target_link_libraries(chat target_link_libraries(chat
PRIVATE llama) PRIVATE llama)
if(NOT (CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64"))
add_executable(test_hw test_hw.cpp)
endif()
set(COMPONENT_NAME_MAIN ${PROJECT_NAME}) set(COMPONENT_NAME_MAIN ${PROJECT_NAME})
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install) set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install)
if(NOT (CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64"))
add_executable(test_hw test_hw.cpp)
install(TARGETS test_hw DESTINATION bin COMPONENT ${COMPONENT_NAME_MAIN})
endif()
install(TARGETS chat DESTINATION bin COMPONENT ${COMPONENT_NAME_MAIN}) install(TARGETS chat DESTINATION bin COMPONENT ${COMPONENT_NAME_MAIN})
set(CPACK_GENERATOR "IFW") set(CPACK_GENERATOR "IFW")
set(CPACK_VERBATIM_VARIABLES YES)
set(BUNDLED_MODEL_NAME "ggml-gpt4all-j-v1.2-jazzy.bin") set(CPACK_IFW_VERBOSE ON)
if(${CMAKE_SYSTEM_NAME} MATCHES Linux) if(${CMAKE_SYSTEM_NAME} MATCHES Linux)
set(LINUXDEPLOYQT "/home/atreat/dev/linuxdeployqt/build/tools/linuxdeployqt/linuxdeployqt") set(LINUXDEPLOYQT "$ENV{HOME}/dev/linuxdeployqt/build/tools/linuxdeployqt/linuxdeployqt")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/deploy-qt-linux.cmake.in" configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/deploy-qt-linux.cmake.in"
"${CMAKE_BINARY_DIR}/cmake/deploy-qt-linux.cmake" @ONLY) "${CMAKE_BINARY_DIR}/cmake/deploy-qt-linux.cmake" @ONLY)
set(CPACK_PRE_BUILD_SCRIPTS ${CMAKE_BINARY_DIR}/cmake/deploy-qt-linux.cmake) set(CPACK_PRE_BUILD_SCRIPTS ${CMAKE_BINARY_DIR}/cmake/deploy-qt-linux.cmake)
set(CPACK_IFW_ROOT "~/Qt/Tools/QtInstallerFramework/4.5") set(CPACK_IFW_ROOT "~/Qt/Tools/QtInstallerFramework/4.5")
set(CPACK_PACKAGE_FILE_NAME "${COMPONENT_NAME_MAIN}-installer-linux") set(CPACK_PACKAGE_FILE_NAME "${COMPONENT_NAME_MAIN}-installer-linux")
set(CPACK_IFW_TARGET_DIRECTORY "@HomeDir@/${COMPONENT_NAME_MAIN}")
elseif(${CMAKE_SYSTEM_NAME} MATCHES Windows) elseif(${CMAKE_SYSTEM_NAME} MATCHES Windows)
find_program(WINDEPLOYQT windeployqt HINTS ${_qt_bin_dir}) find_program(WINDEPLOYQT windeployqt HINTS ${_qt_bin_dir})
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/deploy-qt-windows.cmake.in" configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/deploy-qt-windows.cmake.in"
@ -111,6 +128,7 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES Windows)
set(CPACK_IFW_ROOT "C:/Qt/Tools/QtInstallerFramework/4.5") set(CPACK_IFW_ROOT "C:/Qt/Tools/QtInstallerFramework/4.5")
set(CPACK_IFW_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/icons/favicon.ico") set(CPACK_IFW_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/icons/favicon.ico")
set(CPACK_PACKAGE_FILE_NAME "${COMPONENT_NAME_MAIN}-installer-win64") set(CPACK_PACKAGE_FILE_NAME "${COMPONENT_NAME_MAIN}-installer-win64")
set(CPACK_IFW_TARGET_DIRECTORY "@HomeDir@\\${COMPONENT_NAME_MAIN}")
elseif(${CMAKE_SYSTEM_NAME} MATCHES Darwin) elseif(${CMAKE_SYSTEM_NAME} MATCHES Darwin)
find_program(MACDEPLOYQT macdeployqt HINTS ${_qt_bin_dir}) find_program(MACDEPLOYQT macdeployqt HINTS ${_qt_bin_dir})
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/deploy-qt-mac.cmake.in" configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/deploy-qt-mac.cmake.in"
@ -119,6 +137,7 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES Darwin)
set(CPACK_IFW_ROOT "~/Qt/Tools/QtInstallerFramework/4.5") set(CPACK_IFW_ROOT "~/Qt/Tools/QtInstallerFramework/4.5")
set(CPACK_IFW_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/icons/favicon.icns") set(CPACK_IFW_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/icons/favicon.icns")
set(CPACK_PACKAGE_FILE_NAME "${COMPONENT_NAME_MAIN}-installer-darwin") set(CPACK_PACKAGE_FILE_NAME "${COMPONENT_NAME_MAIN}-installer-darwin")
set(CPACK_IFW_TARGET_DIRECTORY "@HomeDir@/Applications/${COMPONENT_NAME_MAIN}")
endif() endif()
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${COMPONENT_NAME_MAIN}) set(CPACK_PACKAGE_INSTALL_DIRECTORY ${COMPONENT_NAME_MAIN})
@ -145,7 +164,7 @@ include(CPackIFW)
cpack_add_component(${COMPONENT_NAME_MAIN} DOWNLOADED) cpack_add_component(${COMPONENT_NAME_MAIN} DOWNLOADED)
cpack_ifw_configure_component(${COMPONENT_NAME_MAIN} ESSENTIAL FORCED_INSTALLATION) cpack_ifw_configure_component(${COMPONENT_NAME_MAIN} ESSENTIAL FORCED_INSTALLATION)
cpack_ifw_configure_component(${COMPONENT_NAME_MAIN} VERSION ${APP_VERSION}) cpack_ifw_configure_component(${COMPONENT_NAME_MAIN} VERSION ${APP_VERSION})
cpack_ifw_configure_component(${COMPONENT_NAME_MAIN} LICENSES "GPL-3.0 LICENSE" ${CPACK_RESOURCE_FILE_LICENSE}) cpack_ifw_configure_component(${COMPONENT_NAME_MAIN} LICENSES "MIT 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} SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/cmake/installerscript.qs")
cpack_ifw_configure_component(${COMPONENT_NAME_MAIN} REPLACES "gpt4all-chat") #Was used in very earliest prototypes cpack_ifw_configure_component(${COMPONENT_NAME_MAIN} REPLACES "gpt4all-chat") #Was used in very earliest prototypes

View File

@ -1,17 +1,18 @@
set(LINUXDEPLOYQT "@LINUXDEPLOYQT@") set(LINUXDEPLOYQT "@LINUXDEPLOYQT@")
set(BUNDLED_MODEL_NAME "@BUNDLED_MODEL_NAME@")
set(COMPONENT_NAME_MAIN "@COMPONENT_NAME_MAIN@") set(COMPONENT_NAME_MAIN "@COMPONENT_NAME_MAIN@")
set(CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@") set(CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@")
execute_process(COMMAND ${LINUXDEPLOYQT} ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/packages/${COMPONENT_NAME_MAIN}/data/bin/chat -qmldir=${CMAKE_CURRENT_SOURCE_DIR} -verbose=2) set(DATA_DIR ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/packages/${COMPONENT_NAME_MAIN}/data)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/models/${BUNDLED_MODEL_NAME} set(BIN_DIR ${DATA_DIR}/bin)
DESTINATION ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/packages/${COMPONENT_NAME_MAIN}/data/bin) set(Qt6_ROOT_DIR "@Qt6_ROOT_DIR@")
set(ENV{LD_LIBRARY_PATH} "${BIN_DIR}:${Qt6_ROOT_DIR}/../lib/")
execute_process(COMMAND ${LINUXDEPLOYQT} ${BIN_DIR}/chat -qmldir=${CMAKE_CURRENT_SOURCE_DIR} -bundle-non-qt-libs -qmake=${Qt6_ROOT_DIR}/bin/qmake -verbose=2)
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/icons/logo-16.png" file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/icons/logo-16.png"
DESTINATION ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/packages/${COMPONENT_NAME_MAIN}/data) DESTINATION ${DATA_DIR})
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/icons/logo-32.png" file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/icons/logo-32.png"
DESTINATION ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/packages/${COMPONENT_NAME_MAIN}/data) DESTINATION ${DATA_DIR})
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/icons/logo-48.png" file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/icons/logo-48.png"
DESTINATION ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/packages/${COMPONENT_NAME_MAIN}/data) DESTINATION ${DATA_DIR})
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/icons/logo-64.png" file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/icons/logo-64.png"
DESTINATION ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/packages/${COMPONENT_NAME_MAIN}/data) DESTINATION ${DATA_DIR})
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/icons/logo-256.png" file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/icons/logo-256.png"
DESTINATION ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/packages/${COMPONENT_NAME_MAIN}/data) DESTINATION ${DATA_DIR})

View File

@ -1,10 +1,7 @@
set(MACDEPLOYQT "@MACDEPLOYQT@") set(MACDEPLOYQT "@MACDEPLOYQT@")
set(BUNDLED_MODEL_NAME "@BUNDLED_MODEL_NAME@")
set(COMPONENT_NAME_MAIN "@COMPONENT_NAME_MAIN@") set(COMPONENT_NAME_MAIN "@COMPONENT_NAME_MAIN@")
set(CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@") set(CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@")
execute_process(COMMAND ${MACDEPLOYQT} ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/packages/${COMPONENT_NAME_MAIN}/data/bin/chat.app -qmldir=${CMAKE_CURRENT_SOURCE_DIR} -verbose=2) execute_process(COMMAND ${MACDEPLOYQT} ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/packages/${COMPONENT_NAME_MAIN}/data/bin/chat.app -qmldir=${CMAKE_CURRENT_SOURCE_DIR} -verbose=2)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/models/${BUNDLED_MODEL_NAME}
DESTINATION ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/packages/${COMPONENT_NAME_MAIN}/data/bin/chat.app/Contents/MacOS)
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/icons/logo-16.png" file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/icons/logo-16.png"
DESTINATION ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/packages/${COMPONENT_NAME_MAIN}/data) DESTINATION ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/packages/${COMPONENT_NAME_MAIN}/data)
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/icons/logo-32.png" file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/icons/logo-32.png"

View File

@ -1,10 +1,7 @@
set(WINDEPLOYQT "@WINDEPLOYQT@") set(WINDEPLOYQT "@WINDEPLOYQT@")
set(BUNDLED_MODEL_NAME "@BUNDLED_MODEL_NAME@")
set(COMPONENT_NAME_MAIN "@COMPONENT_NAME_MAIN@") set(COMPONENT_NAME_MAIN "@COMPONENT_NAME_MAIN@")
set(CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@") set(CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@")
execute_process(COMMAND ${WINDEPLOYQT} --qmldir ${CMAKE_CURRENT_SOURCE_DIR} ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/packages/${COMPONENT_NAME_MAIN}/data/bin) execute_process(COMMAND ${WINDEPLOYQT} --qmldir ${CMAKE_CURRENT_SOURCE_DIR} ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/packages/${COMPONENT_NAME_MAIN}/data/bin)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/models/${BUNDLED_MODEL_NAME}
DESTINATION ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/packages/${COMPONENT_NAME_MAIN}/data/bin)
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/icons/logo-16.png" file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/icons/logo-16.png"
DESTINATION ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/packages/${COMPONENT_NAME_MAIN}/data) DESTINATION ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/packages/${COMPONENT_NAME_MAIN}/data)
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/icons/logo-32.png" file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/icons/logo-32.png"

View File

@ -1,43 +1,48 @@
function Component() function Component() {
{
// default constructor
} }
var targetDirectory;
Component.prototype.beginInstallation = function() {
targetDirectory = installer.value("TargetDir");
};
Component.prototype.createOperations = function() Component.prototype.createOperations = function()
{ {
try { try {
// call the base create operations function // call the base create operations function
component.createOperations(); component.createOperations();
if (systemInfo.productType === "windows") { if (systemInfo.productType === "windows") {
try { try {
var userProfile = installer.environmentVariable("USERPROFILE"); var userProfile = installer.environmentVariable("USERPROFILE");
installer.setValue("UserProfile", userProfile); installer.setValue("UserProfile", userProfile);
component.addOperation("CreateShortcut", component.addOperation("CreateShortcut",
"@TargetDir@/bin/chat.exe", targetDirectory + "/bin/chat.exe",
"@UserProfile@/Desktop/GPT4All.lnk", "@UserProfile@/Desktop/GPT4All.lnk",
"workingDirectory=@TargetDir@/bin", "workingDirectory=" + targetDirectory + "/bin",
"iconPath=@TargetDir@/favicon.ico", "iconPath=" + targetDirectory + "/favicon.ico",
"iconId=0", "description=Open GPT4All Chat"); "iconId=0", "description=Open GPT4All");
} catch (e) { } catch (e) {
print("ERROR: creating desktop shortcut" + e); print("ERROR: creating desktop shortcut" + e);
} }
component.addOperation("CreateShortcut", component.addOperation("CreateShortcut",
"@TargetDir@/bin/chat.exe", targetDirectory + "/bin/chat.exe",
"@StartMenuDir@/GPT4All.lnk", "@StartMenuDir@/GPT4All.lnk",
"workingDirectory=@TargetDir@/bin", "workingDirectory=" + targetDirectory + "/bin",
"iconPath=@TargetDir@/favicon.ico", "iconPath=" + targetDirectory + "/favicon.ico",
"iconId=0", "description=Open GPT4All Chat"); "iconId=0", "description=Open GPT4All");
} else if (systemInfo.productType === "osx") { } else if (systemInfo.productType === "osx") {
targetDirectory += "/chat.app/Contents/MacOS/"
} else { // linux } else { // linux
component.addOperation("CreateDesktopEntry", var homeDir = installer.environmentVariable("HOME");
"/usr/share/applications/GPT4AllChat.desktop", if (!installer.fileExists(homeDir + "/Desktop/GPT4All.desktop")) {
"Type=Application\nTerminal=false\nExec=\"@TargetDir@/bin/chat\"\nName=GPT4All-Chat\nIcon=@TargetDir@/logo-48.png\nName[en_US]=GPT4All-Chat"); component.addOperation("CreateDesktopEntry",
component.addElevatedOperation("Copy", homeDir + "/Desktop/GPT4All.desktop",
"/usr/share/applications/GPT4AllChat.desktop", "Type=Application\nTerminal=false\nExec=\"" + targetDirectory +
"@HomeDir@/Desktop/GPT4AllChat.desktop"); "/bin/chat\"\nName=GPT4All\nIcon=" + targetDirectory +
"/logo-48.png\nName[en_US]=GPT4All");
}
} }
} catch (e) { } catch (e) {
print("ERROR: creating desktop/startmenu shortcuts" + e); print("ERROR: running post installscript.qs" + e);
} }
} }

View File

@ -9,9 +9,9 @@ int main(int argc, char *argv[])
static bool sse3 = __builtin_cpu_supports("sse3"); static bool sse3 = __builtin_cpu_supports("sse3");
static std::string s; static std::string s;
s = "gpt4all hardware test results:\n"; s = "gpt4all hardware test results:\n";
s += " AVX = " + std::to_string(avx) + "\n"; s += " AVX = " + std::to_string(avx) + "\n";
s += " AVX2 = " + std::to_string(avx2) + "\n"; s += " AVX2 = " + std::to_string(avx2) + "\n";
s += " FMA = " + std::to_string(fma) + "\n"; s += " FMA = " + std::to_string(fma) + "\n";
s += " SSE3 = " + std::to_string(sse3) + "\n"; s += " SSE3 = " + std::to_string(sse3) + "\n";
fprintf(stderr, "%s", s.c_str()); fprintf(stderr, "%s", s.c_str());
fprintf(stderr, "your hardware supports the \""); fprintf(stderr, "your hardware supports the \"");