Skip to content
This repository was archived by the owner on Dec 1, 2021. It is now read-only.

Commit 176c67b

Browse files
authored
Merge pull request #23 from zeroxs/develop
Develop
2 parents e4e1fbc + 30978e2 commit 176c67b

23 files changed

+487
-151
lines changed

CMakeLists.txt

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ message(STATUS "CMake version: ${CMAKE_VERSION}")
22

33
cmake_minimum_required(VERSION 3.8)
44

5-
file(READ ${CMAKE_SOURCE_DIR}/include/aegis/version.hpp version_hpp)
5+
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/include/aegis/version.hpp version_hpp)
66
if (NOT version_hpp MATCHES "AEGIS_VERSION_SHORT ([0-9][0-9])([0-9][0-9])([0-9][0-9])")
7-
message(FATAL_ERROR "Cannot get AEGIS_VERSION_SHORT from version.hpp. ${CMAKE_SOURCE_DIR}/include/aegis/version.hpp")
7+
message(FATAL_ERROR "Cannot get AEGIS_VERSION_SHORT from version.hpp. ${CMAKE_CURRENT_SOURCE_DIR}/include/aegis/version.hpp")
88
endif ()
99
math(EXPR AEGIS_VERSION_MAJOR ${CMAKE_MATCH_1})
1010
math(EXPR AEGIS_VERSION_MINOR ${CMAKE_MATCH_2})
@@ -26,7 +26,7 @@ endif()
2626

2727
project(libaegis VERSION ${AEGIS_VERSION} LANGUAGES CXX)
2828

29-
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake)
29+
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
3030

3131
set(THREADS_PREFER_PTHREAD_FLAG ON)
3232
find_package(Threads REQUIRED)
@@ -43,9 +43,9 @@ set(REQUIRED_LIBS OpenSSL::SSL ZLIB::ZLIB Spdlog::Spdlog JSON::JSON Asio::Asio d
4343
option(BUILD_SHARED_LIBS "Build the shared library" ON)
4444
option(BUILD_EXAMPLES "Build example programs" OFF)
4545

46-
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
47-
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
48-
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
46+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
47+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
48+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
4949
set(CMAKE_BUILD_TYPE Release)
5050

5151
set(AEGIS_FILES
@@ -150,7 +150,7 @@ if (BUILD_SHARED_LIBS)
150150
)
151151

152152
CONFIGURE_FILE(
153-
"${CMAKE_SOURCE_DIR}/cmake/aegis.pc.cmake"
153+
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/aegis.pc.cmake"
154154
"${CMAKE_CURRENT_BINARY_DIR}/aegis.pc"
155155
)
156156

@@ -195,7 +195,7 @@ else ()
195195
)
196196

197197
CONFIGURE_FILE(
198-
"${CMAKE_SOURCE_DIR}/cmake/aegis_static.pc.cmake"
198+
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/aegis_static.pc.cmake"
199199
"${CMAKE_CURRENT_BINARY_DIR}/aegis.pc"
200200
)
201201

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Including the helper header will automatically include all other files.
3939

4040
int main()
4141
{
42-
aegis::core bot;
42+
aegis::core bot(aegis::create_bot_t().log_level(spdlog::level::trace).token("TOKEN"));
4343
bot.set_on_message_create([](auto obj)
4444
{
4545
if (obj.msg.get_content() == "Hi")
@@ -112,3 +112,8 @@ You can change basic configuration options within the `config.json` file. It sho
112112
"log-format": "%^%Y-%m-%d %H:%M:%S.%e [%L] [th#%t]%$ : %v"
113113
}
114114
```
115+
116+
Alternatively you can configure the library by passing in the [create_bot_t()](https://docs.aegisbot.io/structaegis_1_1create__bot__t.html) object to the constructor of the aegis::core object. You can make use of it fluent-style.
117+
```cpp
118+
aegis::core(aegis::create_bot_t().log_level(spdlog::level::trace).token("TOKEN"))
119+
```

aegis.dox

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ using json = nlohmann::json;
2121
int main(int argc, char * argv[])
2222
{
2323
// Create bot object with a minimum log level of trace
24-
aegis::core bot(aegis::create_bot_t().log_level(spdlog::level::info).token("TOKEN"));
24+
aegis::core bot(aegis::create_bot_t().log_level(spdlog::level::trace).token("TOKEN"));
2525

2626
AEGIS_TRACE(bot.log, "Bot object created");
2727

@@ -76,7 +76,7 @@ void message_create(aegis::gateway::events::message_create obj)
7676
int main(int argc, char * argv[])
7777
{
7878
// Create bot object with a minimum log level of trace
79-
aegis::core bot(aegis::create_bot_t().log_level(spdlog::level::info).token("TOKEN"));
79+
aegis::core bot(aegis::create_bot_t().log_level(spdlog::level::trace).token("TOKEN"));
8080

8181
AEGIS_TRACE(bot.log, "Bot object created");
8282

@@ -125,7 +125,7 @@ public:
125125
int main(int argc, char * argv[])
126126
{
127127
// Create bot object with a minimum log level of trace
128-
aegis::core bot(aegis::create_bot_t().log_level(spdlog::level::info).token("TOKEN"));
128+
aegis::core bot(aegis::create_bot_t().log_level(spdlog::level::trace).token("TOKEN"));
129129

130130
my_bot my_bot_instance;
131131

cmake/FindAsio.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ find_path(Asio_INCLUDE_DIR
88

99
if (Asio_INCLUDE_DIR STREQUAL "Asio_INCLUDE_DIR-NOTFOUND")
1010
message(WARNING "Using git-module path for Asio")
11-
set(Asio_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/lib/asio/asio/include/)
11+
set(Asio_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/asio/asio/include/)
1212
endif ()
1313

1414
file(READ ${Asio_INCLUDE_DIR}/asio/version.hpp version_hpp)

cmake/FindJSON.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ find_path(JSON_INCLUDE_DIR
88

99
if (JSON_INCLUDE_DIR STREQUAL "JSON_INCLUDE_DIR-NOTFOUND")
1010
message(WARNING "Using git-module path for JSON")
11-
set(JSON_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/lib/json/include)
11+
set(JSON_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/json/include)
1212
set(JSON_SUBDIR true)
1313
endif ()
1414

cmake/FindSpdlog.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ find_path(Spdlog_INCLUDE_DIR
88

99
if (Spdlog_INCLUDE_DIR STREQUAL "Spdlog_INCLUDE_DIR-NOTFOUND")
1010
message(WARNING "Using git-module path for Spdlog")
11-
set(Spdlog_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/lib/spdlog/include/)
11+
set(Spdlog_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/spdlog/include/)
1212
endif ()
1313

1414
file(READ ${Spdlog_INCLUDE_DIR}/spdlog/common.h common_h)

cmake/FindWebsocketpp.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ find_path(Websocketpp_INCLUDE_DIR
88

99
if (Websocketpp_INCLUDE_DIR STREQUAL "Websocketpp_INCLUDE_DIR-NOTFOUND")
1010
message(WARNING "Using git-module path for Websocketpp")
11-
set(Websocketpp_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/lib/websocketpp/)
11+
set(Websocketpp_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/websocketpp/)
1212
endif ()
1313

1414
file(READ ${Websocketpp_INCLUDE_DIR}/websocketpp/version.hpp version_hpp)

0 commit comments

Comments
 (0)