From 4e31c215006d53703a98d346ebc4a52628f47ddd Mon Sep 17 00:00:00 2001 From: kalipso Date: Fri, 22 Apr 2022 23:42:48 +0200 Subject: [PATCH] initial commit --- .gitignore | 2 ++ CMakeLists.txt | 19 +++++++++++++++++++ conanfile.txt | 9 +++++++++ requirements.txt | 1 + src/main.cpp | 15 +++++++++++++++ tests/CMakeLists.txt | 26 ++++++++++++++++++++++++++ tests/test.cpp | 10 ++++++++++ 7 files changed, 82 insertions(+) create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 conanfile.txt create mode 100644 requirements.txt create mode 100644 src/main.cpp create mode 100644 tests/CMakeLists.txt create mode 100644 tests/test.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..82173e6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +build +.venv diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..23c1e46 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required (VERSION 3.2.2) +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") + +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_BUILD_TYPE Release) + +project("commons" CXX) + +add_definitions("-std=c++2a -g") + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(${PROJECT_NAME} src/main.cpp) + +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) + +#enable_testing() +#add_subdirectory(tests) diff --git a/conanfile.txt b/conanfile.txt new file mode 100644 index 0000000..4d6782c --- /dev/null +++ b/conanfile.txt @@ -0,0 +1,9 @@ +[requires] +boost/1.78.0 +spdlog/1.10.0 +gtest/cci.20210126 +openssl/3.0.2 +nlohmann_json/3.10.5 + +[generators] +cmake diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..77d8d38 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +conan diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..743782f --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,15 @@ +#include +#include +#include "crow.h" + +int main() +{ + crow::SimpleApp app; + + CROW_ROUTE(app, "/")([]() { + return "Hello World"; + }); + + app.port(18080).run(); + return 0; +} diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..4e44a60 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.10.1) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +set(EXEC_TEST + "test.cpp" +) + +add_executable(exec_test ${EXEC_TEST}) + +message("CONAN INCLUDE DIRS:") +message("${CONAN_INCLUDE_DIRS}") +message("CONAN LIB DIRS:") +message("${CONAN_LIBS}") +target_include_directories(exec_test + PUBLIC + ${CONAN_INCLUDE_DIRS} + ) + +target_link_libraries(exec_test + PUBLIC + gtest + ) + +add_test(NAME exec_test COMMAND exec_test) diff --git a/tests/test.cpp b/tests/test.cpp new file mode 100644 index 0000000..23c31d7 --- /dev/null +++ b/tests/test.cpp @@ -0,0 +1,10 @@ +#include // googletest header file + +TEST(StrCompare, CStrNotEqual) { + EXPECT_EQ(1, 1); +} + +int main(int argc, char **argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +}