Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 762a2b7

Browse files
authored
Merge pull request #300 from janhq/124-feat-add-flag-for-nitro-version-build-with-cmake-example-dnitro_version
124 feat add flag for nitro version build with cmake example dnitro version
2 parents 11df54b + 3e2ce49 commit 762a2b7

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

CMakeLists.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ if(DEBUG)
4141
add_compile_definitions(ALLOW_ALL_CORS)
4242
endif()
4343

44+
if(NOT DEFINED NITRO_VERSION)
45+
set(NITRO_VERSION "default_version")
46+
endif()
47+
48+
add_compile_definitions(NITRO_VERSION="${NITRO_VERSION}")
49+
4450
add_subdirectory(llama.cpp)
4551
add_executable(${PROJECT_NAME} main.cc)
4652

@@ -71,11 +77,10 @@ aux_source_directory(controllers CTL_SRC)
7177
# aux_source_directory(filters FILTER_SRC) aux_source_directory(plugins
7278
# PLUGIN_SRC) aux_source_directory(models MODEL_SRC)
7379

74-
#drogon_create_views(${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/views
75-
# ${CMAKE_CURRENT_BINARY_DIR})
76-
# use the following line to create views with namespaces.
7780
# drogon_create_views(${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/views
78-
# ${CMAKE_CURRENT_BINARY_DIR} TRUE)
81+
# ${CMAKE_CURRENT_BINARY_DIR}) use the following line to create views with
82+
# namespaces. drogon_create_views(${PROJECT_NAME}
83+
# ${CMAKE_CURRENT_SOURCE_DIR}/views ${CMAKE_CURRENT_BINARY_DIR} TRUE)
7984

8085
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
8186
# ${CMAKE_CURRENT_SOURCE_DIR}/models)

main.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include <drogon/HttpAppFramework.h>
44
#include <drogon/drogon.h>
55
#include <iostream>
6-
#include <algorithm>
76

87
#if defined(__APPLE__) && defined(__MACH__)
98
#include <libgen.h> // for dirname()
@@ -41,6 +40,11 @@ int main(int argc, char *argv[]) {
4140
int logical_cores = std::thread::hardware_concurrency();
4241
int drogon_thread_num = std::max(thread_num, logical_cores);
4342
nitro_utils::nitro_logo();
43+
#ifdef NITRO_VERSION
44+
LOG_INFO << "Nitro version: " << NITRO_VERSION;
45+
#else
46+
LOG_INFO << "Nitro version: undefined";
47+
#endif
4448
LOG_INFO << "Server started, listening at: " << host << ":" << port;
4549
LOG_INFO << "Please load your model";
4650
drogon::app().addListener(host, port);

0 commit comments

Comments
 (0)