Skip to content

Commit e3483a1

Browse files
committed
cmake changes, static library, no executable
1 parent 25a895a commit e3483a1

File tree

14 files changed

+51
-60
lines changed

14 files changed

+51
-60
lines changed

CMakeLists.txt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
cmake_minimum_required(VERSION 3.15)
2-
project(camille-agenty VERSION 0.1.0 LANGUAGES CXX)
2+
project(camille-agenty LANGUAGES CXX VERSION 1.1.1)
33

44
set(CMAKE_CXX_STANDARD 23)
5-
set(CMAKE_INCLUDE_CURRENT_DIR)
6-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
7-
set(CMAKE_CXX_SCAN_FOR_MODULES OFF)
85
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
96

10-
option(ENABLE_LOGGING "Enable Development Environment Logging" ON)
11-
12-
set(LLAMA_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
137
set(LLAMA_BUILD_TESTS OFF CACHE BOOL "" FORCE)
148
set(LLAMA_BUILD_SERVER OFF CACHE BOOL "" FORCE)
9+
set(LLAMA_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
1510

1611
add_subdirectory(vendor/llama.cpp)
1712

include/camille-agenty/agent/agent.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
#include "tools/tools-base.h"
1212

13+
namespace agenty::agent {
14+
1315
/**
1416
* @todo
1517
1. create client interface for multiple providers (provider: qwen -> qwen client & qwen models)
@@ -94,4 +96,6 @@ class agent {
9496
void run_async();
9597
};
9698

99+
}; // namespace agenty::agent
100+
97101
#endif
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
#ifndef QWEN_CLIENT_H_
22
#define QWEN_CLIENT_H_
33

4-
#include "clients/client.h"
4+
#include "camille-agenty/client/client.h"
55

6-
class qwen_client : public client {};
6+
namespace agenty::client::qwen {
7+
8+
class qwen_client {};
9+
10+
}; // namespace agenty::client::qwen
711

812
#endif

include/camille-agenty/http/http-client.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ struct http_post {
1919
};
2020

2121
struct client {
22-
static httplib::Result get(const std::string& url, const std::string& path);
22+
static httplib::Result get(const std::string& url, const std::string& path = "/");
2323

2424
static httplib::Result post(const std::string& url,
2525
const std::string& path,
2626
const std::string& body,
27-
const std::string& content_type);
27+
const std::string& content_type = "text/plain");
2828
};
2929

3030
}; // namespace agenty::http_client

include/camille-agenty/providers/provider.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include <vector>
55

6-
namespace agenty::providers {
6+
namespace agenty::provider {
77

88
class provider_config {
99
/**
@@ -37,6 +37,6 @@ class provider {
3737
virtual provider_config generate_config() = 0;
3838
};
3939

40-
}; // namespace agenty::providers
40+
}; // namespace agenty::provider
4141

4242
#endif
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#ifndef QWEN_PROVIDER_H_
22
#define QWEN_PROVIDER_H_
33

4-
#include "providers/provider.h"
4+
#include "camille-agenty/provider/provider.h"
55

6-
namespace agenty::providers::qwen {
6+
namespace agenty::provider::qwen {
77

88
class qwen_provider : public provider {
99
public:
@@ -12,6 +12,6 @@ class qwen_provider : public provider {
1212
private:
1313
};
1414

15-
}; // namespace agenty::providers::qwen
15+
} // namespace agenty::provider::qwen
1616

1717
#endif

src/CMakeLists.txt

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
1-
set(SOURCES
2-
camille-agenty.cpp
3-
1+
add_library(agenty STATIC
42
common/log.cpp
5-
63
http/http-client.cpp
74
)
85

9-
add_library(agenty STATIC ${SOURCES})
6+
target_include_directories(agenty SYSTEM PRIVATE
7+
${CMAKE_CURRENT_SOURCE_DIR}/../vendor
8+
${CMAKE_CURRENT_SOURCE_DIR}/../vendor/llama.cpp/include
9+
${CMAKE_CURRENT_SOURCE_DIR}/../vendor/llama.cpp/ggml/include
10+
)
1011

1112
target_include_directories(agenty PUBLIC
12-
${CMAKE_CURRENT_SOURCE_DIR}/../include/camille-agenty
13+
${CMAKE_CURRENT_SOURCE_DIR}/../include
1314
${CMAKE_CURRENT_SOURCE_DIR}/../vendor
1415
)
1516

16-
if (ENABLE_LOGGING)
17-
target_compile_definitions(agenty PUBLIC LOGGING=1)
18-
endif()
19-
20-
add_executable(camille-agenty ${SOURCES})
17+
# target_link_libraries(agenty PRIVATE llama)
2118

22-
target_link_libraries(camille-agenty PRIVATE agenty)
19+
target_compile_features(agenty PUBLIC cxx_std_23)

src/camille-agenty.cpp

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/common/log.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include <mutex>
22
#include <print>
33

4-
#include "common/log.h"
4+
#include "camille-agenty/common/log.h"
55

66
namespace agenty::common::log {
77

@@ -51,8 +51,8 @@ void log::add(log_entry& entry) {
5151
buffer_.resize(BUFFER_SIZE * 2);
5252
}
5353

54-
entry.timestamp = ts_micro() - timestamp;
55-
buffer_.push_back(entry);
54+
// entry.timestamp = ts_micro() - timestamp;
55+
// buffer_.push_back(entry);
5656

5757
condv_.notify_one();
5858
}

src/http/http-client.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "http/http-client.h"
1+
#include "camille-agenty/http/http-client.h"
22

33
namespace agenty::http_client {
44

@@ -15,14 +15,14 @@ httplib::Result http_post::operator()(const std::string& url,
1515
return client.Post(path, body, content_type);
1616
}
1717

18-
httplib::Result client::get(const std::string& url, const std::string& path = "/") {
18+
httplib::Result client::get(const std::string& url, const std::string& path) {
1919
return http_get()(url, path);
2020
}
2121

2222
httplib::Result client::post(const std::string& url,
2323
const std::string& path,
2424
const std::string& body,
25-
const std::string& content_type = "text/plain") {
25+
const std::string& content_type) {
2626
return http_post()(url, path, body, content_type);
2727
}
2828

0 commit comments

Comments
 (0)