From 4ddab1b8e31db7f21acc43dffca2785522d154e5 Mon Sep 17 00:00:00 2001 From: dotieuthien Date: Thu, 5 Oct 2023 09:40:56 +0700 Subject: [PATCH 01/11] Modify CMakeLists for Windows --- nitro_deps/CMakeLists.txt | 58 ++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 16 deletions(-) diff --git a/nitro_deps/CMakeLists.txt b/nitro_deps/CMakeLists.txt index 6b106ac65..4181bf542 100644 --- a/nitro_deps/CMakeLists.txt +++ b/nitro_deps/CMakeLists.txt @@ -16,14 +16,28 @@ set(THIRD_PARTY_INSTALL_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../build_deps/_install) #set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) # # Add the external project +set(ZLIB_USE_STATIC_LIBS OFF) +find_package(ZLIB) +if(NOT ZLIB_FOUND) + set(ZLIB_USE_STATIC_LIBS ON) + ExternalProject_Add( + zlib + GIT_REPOSITORY https://github.com/madler/zlib.git + GIT_TAG v1.2.11 + CMAKE_ARGS + -DBUILD_SHARED_LIBS=OFF + -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_PATH} + ) +endif() + ExternalProject_Add( brotli GIT_REPOSITORY https://github.com/google/brotli GIT_TAG v1.1.0 CMAKE_ARGS - -DCMAKE_BUILD_TYPE=Release - -DBUILD_SHARED_LIBS=OFF - -DSHARE_INSTALL_PREFIX=${CMAKE_CURRENT_SOURCE_DIR}/share + -DCMAKE_BUILD_TYPE=Release + -DBUILD_SHARED_LIBS=OFF + -DSHARE_INSTALL_PREFIX=${CMAKE_CURRENT_SOURCE_DIR}/share -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_PATH} ) @@ -34,7 +48,6 @@ ExternalProject_Add( CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_PATH} - ) ExternalProject_Add( @@ -43,7 +56,7 @@ ExternalProject_Add( GIT_TAG cares-1_19_1 CMAKE_ARGS -DCARES_SHARED=OFF - -DCARES_STATIC=ON + -DCARES_STATIC=ON -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_PATH} ) @@ -52,24 +65,37 @@ ExternalProject_Add( GIT_REPOSITORY https://github.com/drogonframework/drogon GIT_TAG v1.8.6 CMAKE_ARGS - -DCMAKE_BUILD_TYPE=release - -DOPENSSL_USE_STATIC_LIBS=TRUE - # -DZLIB_USE_STATIC_LIBS=ON - -DBUILD_ORM=OFF - -DBUILD_YAML_CONFIG=OFF - -DBUILD_EXAMPLES=OFF - -DBUILD_CTL=OFF - -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - -DBUILD_BROTLI=ON - -DCMAKE_PREFIX_PATH=${THIRD_PARTY_INSTALL_PATH} -# -DCMAKE_FIND_ROOT_PATH=${THIRD_PARTY_INSTALL_PATH} # To set the dir (that will be used to force the look for .a) + -DCMAKE_BUILD_TYPE=Release + -DOPENSSL_USE_STATIC_LIBS=TRUE + -DZLIB_USE_STATIC_LIBS=${ZLIB_USE_STATIC_LIBS} + -DBUILD_ORM=OFF + -DBUILD_YAML_CONFIG=OFF + -DBUILD_EXAMPLES=OFF + -DBUILD_CTL=OFF + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + -DBUILD_BROTLI=ON + -DCMAKE_PREFIX_PATH=${THIRD_PARTY_INSTALL_PATH} + # -DCMAKE_FIND_ROOT_PATH=${THIRD_PARTY_INSTALL_PATH} # To set the dir (that will be used to force the look for .a) -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_PATH} ) +# Fix trantor cmakelists to link c-ares on Windows +if(WIN32) + set(TRANTOR_CMAKE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../build_deps/nitro_deps/drogon-prefix/src/drogon/trantor/CMakeLists.txt) + ExternalProject_Add_Step(drogon trantor_custom_target + COMMAND ${CMAKE_COMMAND} -E echo add_definitions(-DCARES_STATICLIB) >> ${TRANTOR_CMAKE_FILE} + DEPENDEES download + ) +endif() + include_directories(${THIRD_PARTY_INSTALL_PATH}/include) link_directories(${THIRD_PARTY_INSTALL_PATH}/lib) # Optionally link or add dependencies to your targets add_dependencies(drogon c-ares jsoncpp brotli) + +if(ZLIB_USE_STATIC_LIBS) + add_dependencies(drogon zlib) +endif() # target_link_libraries( ...) From f21859ca10b25dde78a66796089513a29d3151c5 Mon Sep 17 00:00:00 2001 From: dotieuthien Date: Thu, 5 Oct 2023 09:55:18 +0700 Subject: [PATCH 02/11] Add documents for Nitro on Windows --- README_temp.md | 31 ++++++++++++++++++++++--------- controllers/llamaCPP.h | 2 ++ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/README_temp.md b/README_temp.md index dc60c0033..a030670df 100644 --- a/README_temp.md +++ b/README_temp.md @@ -3,24 +3,28 @@ ### Step 1: Install dependencies static files - -```zsh -./install_deps.sh -``` - +- On MacOS with Apple silicon + ```zsh + ./install_deps.sh + ``` +- On Windows + ``` + cmake -S ./nitro_deps -B ./build_deps/nitro_deps + cmake --build ./build_deps/nitro_deps --config Release + ``` This will create a build_deps folder, just ignore it ### Step 2: Generate build file -- On MacOS with Apple silicon: +- On MacOS, Linux, and Windows ```zsh mkdir build && cd build cmake .. ``` -- On MacOS with Intel processors: +- On MacOS with Intel processors ```zsh mkdir build && cd build cmake -DLLAMA_METAL=OFF .. @@ -35,8 +39,17 @@ Build the app make -j $(%NUMBER_OF_PROCESSORS%) ``` -### Step 3: +- On Windows + ``` + cmake --build . --config Release + ``` -Run ./nitro to start the process. +### Step 3: +- On MacOS and Linux run ./nitro to start the process. +- On Windows: + ``` + cd Release + ./nitro + ``` To see if the build was successful, visit `localhost:8080/test` diff --git a/controllers/llamaCPP.h b/controllers/llamaCPP.h index 2494d317f..6c18d150c 100644 --- a/controllers/llamaCPP.h +++ b/controllers/llamaCPP.h @@ -1,3 +1,5 @@ +#define NOMINMAX + #pragma once #include "controllers/nitro_utils.h" From 718efacd47f084c5fcda1ead99f021864af3c9a8 Mon Sep 17 00:00:00 2001 From: dotieuthien Date: Thu, 5 Oct 2023 10:26:13 +0700 Subject: [PATCH 03/11] Copy zlib dynamic lib --- README_temp.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README_temp.md b/README_temp.md index a030670df..3d384670f 100644 --- a/README_temp.md +++ b/README_temp.md @@ -49,6 +49,8 @@ Build the app - On Windows: ``` cd Release + # add zlib dynamic lib + copy ..\..\build_deps\_install\bin\zlib.dll . ./nitro ``` From 82658e3c663938cff5347b1e832b9e286d07211d Mon Sep 17 00:00:00 2001 From: dotieuthien Date: Thu, 5 Oct 2023 09:40:56 +0700 Subject: [PATCH 04/11] Modify CMakeLists for Windows --- nitro_deps/CMakeLists.txt | 58 ++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 16 deletions(-) diff --git a/nitro_deps/CMakeLists.txt b/nitro_deps/CMakeLists.txt index 6b106ac65..4181bf542 100644 --- a/nitro_deps/CMakeLists.txt +++ b/nitro_deps/CMakeLists.txt @@ -16,14 +16,28 @@ set(THIRD_PARTY_INSTALL_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../build_deps/_install) #set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) # # Add the external project +set(ZLIB_USE_STATIC_LIBS OFF) +find_package(ZLIB) +if(NOT ZLIB_FOUND) + set(ZLIB_USE_STATIC_LIBS ON) + ExternalProject_Add( + zlib + GIT_REPOSITORY https://github.com/madler/zlib.git + GIT_TAG v1.2.11 + CMAKE_ARGS + -DBUILD_SHARED_LIBS=OFF + -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_PATH} + ) +endif() + ExternalProject_Add( brotli GIT_REPOSITORY https://github.com/google/brotli GIT_TAG v1.1.0 CMAKE_ARGS - -DCMAKE_BUILD_TYPE=Release - -DBUILD_SHARED_LIBS=OFF - -DSHARE_INSTALL_PREFIX=${CMAKE_CURRENT_SOURCE_DIR}/share + -DCMAKE_BUILD_TYPE=Release + -DBUILD_SHARED_LIBS=OFF + -DSHARE_INSTALL_PREFIX=${CMAKE_CURRENT_SOURCE_DIR}/share -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_PATH} ) @@ -34,7 +48,6 @@ ExternalProject_Add( CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_PATH} - ) ExternalProject_Add( @@ -43,7 +56,7 @@ ExternalProject_Add( GIT_TAG cares-1_19_1 CMAKE_ARGS -DCARES_SHARED=OFF - -DCARES_STATIC=ON + -DCARES_STATIC=ON -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_PATH} ) @@ -52,24 +65,37 @@ ExternalProject_Add( GIT_REPOSITORY https://github.com/drogonframework/drogon GIT_TAG v1.8.6 CMAKE_ARGS - -DCMAKE_BUILD_TYPE=release - -DOPENSSL_USE_STATIC_LIBS=TRUE - # -DZLIB_USE_STATIC_LIBS=ON - -DBUILD_ORM=OFF - -DBUILD_YAML_CONFIG=OFF - -DBUILD_EXAMPLES=OFF - -DBUILD_CTL=OFF - -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - -DBUILD_BROTLI=ON - -DCMAKE_PREFIX_PATH=${THIRD_PARTY_INSTALL_PATH} -# -DCMAKE_FIND_ROOT_PATH=${THIRD_PARTY_INSTALL_PATH} # To set the dir (that will be used to force the look for .a) + -DCMAKE_BUILD_TYPE=Release + -DOPENSSL_USE_STATIC_LIBS=TRUE + -DZLIB_USE_STATIC_LIBS=${ZLIB_USE_STATIC_LIBS} + -DBUILD_ORM=OFF + -DBUILD_YAML_CONFIG=OFF + -DBUILD_EXAMPLES=OFF + -DBUILD_CTL=OFF + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + -DBUILD_BROTLI=ON + -DCMAKE_PREFIX_PATH=${THIRD_PARTY_INSTALL_PATH} + # -DCMAKE_FIND_ROOT_PATH=${THIRD_PARTY_INSTALL_PATH} # To set the dir (that will be used to force the look for .a) -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_PATH} ) +# Fix trantor cmakelists to link c-ares on Windows +if(WIN32) + set(TRANTOR_CMAKE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../build_deps/nitro_deps/drogon-prefix/src/drogon/trantor/CMakeLists.txt) + ExternalProject_Add_Step(drogon trantor_custom_target + COMMAND ${CMAKE_COMMAND} -E echo add_definitions(-DCARES_STATICLIB) >> ${TRANTOR_CMAKE_FILE} + DEPENDEES download + ) +endif() + include_directories(${THIRD_PARTY_INSTALL_PATH}/include) link_directories(${THIRD_PARTY_INSTALL_PATH}/lib) # Optionally link or add dependencies to your targets add_dependencies(drogon c-ares jsoncpp brotli) + +if(ZLIB_USE_STATIC_LIBS) + add_dependencies(drogon zlib) +endif() # target_link_libraries( ...) From b517de1cb734ea3eddbf041a9601a5323485e5fe Mon Sep 17 00:00:00 2001 From: dotieuthien Date: Thu, 5 Oct 2023 09:55:18 +0700 Subject: [PATCH 05/11] Add documents for Nitro on Windows --- README_temp.md | 31 ++++++++++++++++++++++--------- controllers/llamaCPP.h | 2 ++ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/README_temp.md b/README_temp.md index 4eb9e4111..69c77bf25 100644 --- a/README_temp.md +++ b/README_temp.md @@ -3,24 +3,28 @@ ### Step 1: Install dependencies static files - -```zsh -./install_deps.sh -``` - +- On MacOS with Apple silicon + ```zsh + ./install_deps.sh + ``` +- On Windows + ``` + cmake -S ./nitro_deps -B ./build_deps/nitro_deps + cmake --build ./build_deps/nitro_deps --config Release + ``` This will create a build_deps folder, just ignore it ### Step 2: Generate build file -- On MacOS with Apple silicon: +- On MacOS, Linux, and Windows ```zsh mkdir build && cd build cmake .. ``` -- On MacOS with Intel processors: +- On MacOS with Intel processors ```zsh mkdir build && cd build cmake -DLLAMA_METAL=OFF .. @@ -42,8 +46,17 @@ Build the app make -j $(%NUMBER_OF_PROCESSORS%) ``` -### Step 3: +- On Windows + ``` + cmake --build . --config Release + ``` -Run ./nitro to start the process. +### Step 3: +- On MacOS and Linux run ./nitro to start the process. +- On Windows: + ``` + cd Release + ./nitro + ``` To see if the build was successful, visit `localhost:8080/test` diff --git a/controllers/llamaCPP.h b/controllers/llamaCPP.h index ad2b1c46a..f43aa9168 100644 --- a/controllers/llamaCPP.h +++ b/controllers/llamaCPP.h @@ -1,3 +1,5 @@ +#define NOMINMAX + #pragma once #include "controllers/nitro_utils.h" From 4bcfcbd2f64d389a27ccdd3439e663b81e82cb4e Mon Sep 17 00:00:00 2001 From: dotieuthien Date: Thu, 5 Oct 2023 10:26:13 +0700 Subject: [PATCH 06/11] Copy zlib dynamic lib --- README_temp.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README_temp.md b/README_temp.md index 69c77bf25..44422bcc3 100644 --- a/README_temp.md +++ b/README_temp.md @@ -56,6 +56,8 @@ Build the app - On Windows: ``` cd Release + # add zlib dynamic lib + copy ..\..\build_deps\_install\bin\zlib.dll . ./nitro ``` From 6acad6044d7ffcc355ec0d3d029e827944cb1f3b Mon Sep 17 00:00:00 2001 From: dotieuthien Date: Thu, 5 Oct 2023 14:31:58 +0700 Subject: [PATCH 07/11] Fix cmd to run nitro --- README_temp.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_temp.md b/README_temp.md index 44422bcc3..70a94fb72 100644 --- a/README_temp.md +++ b/README_temp.md @@ -58,7 +58,7 @@ Build the app cd Release # add zlib dynamic lib copy ..\..\build_deps\_install\bin\zlib.dll . - ./nitro + nitro.exe ``` To see if the build was successful, visit `localhost:8080/test` From 13f9afeed86986e3a1f22501621825ee02170606 Mon Sep 17 00:00:00 2001 From: dotieuthien Date: Thu, 5 Oct 2023 16:16:17 +0700 Subject: [PATCH 08/11] Add path to binary file --- main.cc | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/main.cc b/main.cc index 551f14e58..ca7b225f2 100644 --- a/main.cc +++ b/main.cc @@ -8,15 +8,17 @@ #elif defined(__linux__) #include // for dirname() #include // for readlink() +#elif defined(_WIN32) +#include #else #error "Unsupported platform!" #endif int main() { - char path[PATH_MAX]; std::string configPath; #if defined(__APPLE__) && defined(__MACH__) + char path[PATH_MAX]; uint32_t size = sizeof(path); if (_NSGetExecutablePath(path, &size) == 0) { path[size] = '\0'; // Null-terminate the string @@ -27,6 +29,7 @@ int main() { return 1; } #elif defined(__linux__) + char path[PATH_MAX]; ssize_t len = readlink("/proc/self/exe", path, sizeof(path) - 1); if (len != -1) { path[len] = '\0'; @@ -36,6 +39,23 @@ int main() { LOG_ERROR << "Failed to get binary location!"; return 1; } +#elif defined(_WIN32) + char path[MAX_PATH]; + char dir[MAX_PATH]; + // char dir[MAX_PATH]; + if(GetModuleFileNameA(NULL, path, sizeof(path))) { + char* lastBackslash = strrchr(path, '\\'); + if (lastBackslash == nullptr) { + return 1; + } + lastBackslash[0] = '\0'; + strcpy(dir, path); + configPath = std::string(dir) + "/config/config.json"; + } + else { + LOG_ERROR << "Failed to get binary location!"; + return 1; + } #else LOG_ERROR << "Unsupported platform!"; return 1; From a5ae7744dd4ff5c63333525822b85fd5eb7d9bb6 Mon Sep 17 00:00:00 2001 From: dotieuthien Date: Thu, 5 Oct 2023 17:37:55 +0700 Subject: [PATCH 09/11] Fix flag --- nitro_deps/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nitro_deps/CMakeLists.txt b/nitro_deps/CMakeLists.txt index 4181bf542..280df4e29 100644 --- a/nitro_deps/CMakeLists.txt +++ b/nitro_deps/CMakeLists.txt @@ -65,7 +65,7 @@ ExternalProject_Add( GIT_REPOSITORY https://github.com/drogonframework/drogon GIT_TAG v1.8.6 CMAKE_ARGS - -DCMAKE_BUILD_TYPE=Release + -DCMAKE_BUILD_TYPE=release -DOPENSSL_USE_STATIC_LIBS=TRUE -DZLIB_USE_STATIC_LIBS=${ZLIB_USE_STATIC_LIBS} -DBUILD_ORM=OFF From 14ab2be8c190dd73ed7b93f1f25a9121c0476337 Mon Sep 17 00:00:00 2001 From: dotieuthien Date: Thu, 5 Oct 2023 17:55:17 +0700 Subject: [PATCH 10/11] Fix format --- nitro_deps/CMakeLists.txt | 64 +++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/nitro_deps/CMakeLists.txt b/nitro_deps/CMakeLists.txt index 280df4e29..396e60647 100644 --- a/nitro_deps/CMakeLists.txt +++ b/nitro_deps/CMakeLists.txt @@ -19,15 +19,15 @@ set(THIRD_PARTY_INSTALL_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../build_deps/_install) set(ZLIB_USE_STATIC_LIBS OFF) find_package(ZLIB) if(NOT ZLIB_FOUND) - set(ZLIB_USE_STATIC_LIBS ON) - ExternalProject_Add( - zlib - GIT_REPOSITORY https://github.com/madler/zlib.git - GIT_TAG v1.2.11 - CMAKE_ARGS - -DBUILD_SHARED_LIBS=OFF - -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_PATH} - ) + set(ZLIB_USE_STATIC_LIBS ON) + ExternalProject_Add( + zlib + GIT_REPOSITORY https://github.com/madler/zlib.git + GIT_TAG v1.2.11 + CMAKE_ARGS + -DBUILD_SHARED_LIBS=OFF + -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_PATH} + ) endif() ExternalProject_Add( @@ -35,10 +35,10 @@ ExternalProject_Add( GIT_REPOSITORY https://github.com/google/brotli GIT_TAG v1.1.0 CMAKE_ARGS - -DCMAKE_BUILD_TYPE=Release - -DBUILD_SHARED_LIBS=OFF - -DSHARE_INSTALL_PREFIX=${CMAKE_CURRENT_SOURCE_DIR}/share - -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_PATH} + -DCMAKE_BUILD_TYPE=Release + -DBUILD_SHARED_LIBS=OFF + -DSHARE_INSTALL_PREFIX=${CMAKE_CURRENT_SOURCE_DIR}/share + -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_PATH} ) ExternalProject_Add( @@ -56,7 +56,7 @@ ExternalProject_Add( GIT_TAG cares-1_19_1 CMAKE_ARGS -DCARES_SHARED=OFF - -DCARES_STATIC=ON + -DCARES_STATIC=ON -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_PATH} ) @@ -65,27 +65,27 @@ ExternalProject_Add( GIT_REPOSITORY https://github.com/drogonframework/drogon GIT_TAG v1.8.6 CMAKE_ARGS - -DCMAKE_BUILD_TYPE=release - -DOPENSSL_USE_STATIC_LIBS=TRUE - -DZLIB_USE_STATIC_LIBS=${ZLIB_USE_STATIC_LIBS} - -DBUILD_ORM=OFF - -DBUILD_YAML_CONFIG=OFF - -DBUILD_EXAMPLES=OFF - -DBUILD_CTL=OFF - -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - -DBUILD_BROTLI=ON - -DCMAKE_PREFIX_PATH=${THIRD_PARTY_INSTALL_PATH} - # -DCMAKE_FIND_ROOT_PATH=${THIRD_PARTY_INSTALL_PATH} # To set the dir (that will be used to force the look for .a) - -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_PATH} + -DCMAKE_BUILD_TYPE=release + -DOPENSSL_USE_STATIC_LIBS=TRUE + -DZLIB_USE_STATIC_LIBS=${ZLIB_USE_STATIC_LIBS} + -DBUILD_ORM=OFF + -DBUILD_YAML_CONFIG=OFF + -DBUILD_EXAMPLES=OFF + -DBUILD_CTL=OFF + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + -DBUILD_BROTLI=ON + -DCMAKE_PREFIX_PATH=${THIRD_PARTY_INSTALL_PATH} + # -DCMAKE_FIND_ROOT_PATH=${THIRD_PARTY_INSTALL_PATH} # To set the dir (that will be used to force the look for .a) + -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_INSTALL_PATH} ) # Fix trantor cmakelists to link c-ares on Windows if(WIN32) - set(TRANTOR_CMAKE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../build_deps/nitro_deps/drogon-prefix/src/drogon/trantor/CMakeLists.txt) - ExternalProject_Add_Step(drogon trantor_custom_target - COMMAND ${CMAKE_COMMAND} -E echo add_definitions(-DCARES_STATICLIB) >> ${TRANTOR_CMAKE_FILE} - DEPENDEES download - ) + set(TRANTOR_CMAKE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../build_deps/nitro_deps/drogon-prefix/src/drogon/trantor/CMakeLists.txt) + ExternalProject_Add_Step(drogon trantor_custom_target + COMMAND ${CMAKE_COMMAND} -E echo add_definitions(-DCARES_STATICLIB) >> ${TRANTOR_CMAKE_FILE} + DEPENDEES download + ) endif() include_directories(${THIRD_PARTY_INSTALL_PATH}/include) @@ -94,7 +94,7 @@ link_directories(${THIRD_PARTY_INSTALL_PATH}/lib) add_dependencies(drogon c-ares jsoncpp brotli) if(ZLIB_USE_STATIC_LIBS) - add_dependencies(drogon zlib) + add_dependencies(drogon zlib) endif() # target_link_libraries( ...) From 5e15832caa752063ceb4b64ce975d33344d3c686 Mon Sep 17 00:00:00 2001 From: dotieuthien Date: Thu, 5 Oct 2023 17:59:36 +0700 Subject: [PATCH 11/11] Add Windows condition --- controllers/llamaCPP.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/controllers/llamaCPP.h b/controllers/llamaCPP.h index ed1f5eea0..e663e00aa 100644 --- a/controllers/llamaCPP.h +++ b/controllers/llamaCPP.h @@ -1,4 +1,6 @@ +#if defined(_WIN32) #define NOMINMAX +#endif #pragma once