1
0
Fork 0
mirror of https://github.com/KingDuckZ/kamokan.git synced 2024-12-23 21:25:43 +00:00

Separate Tawashi and Kamokan.

Unit tests are still a bit mixed up, but that should
be simple to split once I have a separate repo for
Tawashi.
This commit is contained in:
King_DuckZ 2017-06-12 10:32:20 +01:00
parent 44350478c1
commit 6c357f1dc7
35 changed files with 74 additions and 37 deletions

View file

@ -16,6 +16,7 @@ add_subdirectory(lib/incredis)
add_subdirectory(lib/mstch)
add_subdirectory(lib/houdini)
add_subdirectory(src/tawashi)
add_subdirectory(src/kamokan_impl)
add_subdirectory(src/kamokan)
install(DIRECTORY html/website/ DESTINATION html)

View file

@ -1,4 +1,4 @@
project(kamokan VERSION 0.1.0 LANGUAGES CXX)
project(kamokan LANGUAGES CXX)
set(KAMOKAN_CONFIG_PATH "etc" CACHE STRING "Path where config file will be located, absolute or relative to the install prefix")
set(KAMOKAN_CONFIG_FILE "kamokan.ini" CACHE STRING "Filename of the config file in KAMOKAN_CONFIG_PATH")
@ -10,7 +10,7 @@ add_executable(${PROJECT_NAME}
main.cpp
)
target_link_libraries(${PROJECT_NAME}
PRIVATE tawashi
PRIVATE kamokan_impl
#hack - add duckhandy to the project instead of picking from inside redis
PRIVATE duckhandy
)
@ -20,16 +20,8 @@ set_target_properties(
PROPERTIES SUFFIX .cgi
)
target_include_directories(${PROJECT_NAME}
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include
)
install(TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib/static
)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/kamokan_config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/include/kamokan_config.h"
)

View file

@ -0,0 +1,61 @@
project(kamokan_impl VERSION 0.2.3 LANGUAGES CXX)
find_package(SourceHighlight REQUIRED)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_library(${PROJECT_NAME} STATIC
response.cpp
submit_paste_response.cpp
num_to_token.cpp
index_response.cpp
pastie_response.cpp
ini_file.cpp
pathname/pathname.cpp
response_factory.cpp
list_highlight_langs.cpp
settings_bag.cpp
error_response.cpp
quick_submit_paste_response.cpp
storage.cpp
)
target_include_directories(${PROJECT_NAME}
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include
PUBLIC ${TAWASHI_SOURCE_ROOT}/lib/kakoune
PUBLIC ${TAWASHI_SOURCE_ROOT}/lib/mstch/include
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
)
target_include_directories(${PROJECT_NAME} SYSTEM
PUBLIC ${Boost_INCLUDE_DIRS}
PUBLIC ${TAWASHI_SOURCE_ROOT}/lib/better-enums
PRIVATE ${SourceHighlight_INCLUDE_DIR}
PRIVATE ${TAWASHI_SOURCE_ROOT}/lib/utf8_v2_3_4/source
PUBLIC ${TAWASHI_SOURCE_ROOT}/lib/spdlog/include
PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/include
)
target_link_libraries(${PROJECT_NAME}
PRIVATE ${Boost_LIBRARIES}
PRIVATE incredis
PRIVATE ${SourceHighlight_LIBRARIES}
PUBLIC mstch
PRIVATE pthread
PUBLIC tawashi
)
target_compile_definitions(${PROJECT_NAME}
PRIVATE BOOST_SPIRIT_USE_PHOENIX_V3=1
PUBLIC $<$<CONFIG:Debug>:SPDLOG_DEBUG_ON>
PUBLIC $<$<CONFIG:Debug>:SPDLOG_TRACE_ON>
PUBLIC $<$<BOOL:${BUILD_TESTING}>:tawashi_virtual_testing=virtual>
PUBLIC $<$<NOT:$<BOOL:${BUILD_TESTING}>>:tawashi_virtual_testing=>
PUBLIC $<$<BOOL:${BUILD_TESTING}>:KAMOKAN_WITH_TESTING>
)
target_compile_options(${PROJECT_NAME}
PRIVATE -fdiagnostics-color=always
)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/kamokan_config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/include/kamokan_config.h"
)

View file

@ -23,7 +23,7 @@
#include "list_highlight_langs.hpp"
#include "cgi_env.hpp"
#include "num_conv.hpp"
#include "tawashi_config.h"
#include "kamokan_config.h"
#include <utility>
#include <cassert>
#include <fstream>

View file

@ -19,7 +19,6 @@
#include "settings_bag.hpp"
#include "incredis/incredis.hpp"
#include "num_to_token.hpp"
#include "tawashi_config.h"
#include "duckhandy/stringize.h"
#include "spdlog.hpp"
#include "truncated_string.hpp"
@ -151,7 +150,7 @@ namespace tawashi {
return pastie;
}
#if defined(TAWASHI_WITH_TESTING)
#if defined(KAMOKAN_WITH_TESTING)
const SettingsBag& Storage::settings() const {
return *m_settings;
}

View file

@ -54,7 +54,7 @@ namespace tawashi {
tawashi_virtual_testing boost::optional<std::string> retrieve_pastie (const boost::string_view& parToken) const;
#if defined(TAWASHI_WITH_TESTING)
#if defined(KAMOKAN_WITH_TESTING)
const SettingsBag& settings() const;
#endif

View file

@ -73,7 +73,7 @@ namespace tawashi {
}
} //unnamed namespace
#if defined(TAWASHI_WITH_TESTING)
#if defined(KAMOKAN_WITH_TESTING)
SubmitPasteResponse::SubmitPasteResponse (
const Kakoune::SafePtr<SettingsBag>& parSettings,
std::ostream* parStreamOut,

View file

@ -27,7 +27,7 @@
namespace tawashi {
class SubmitPasteResponse : public Response {
public:
#if defined(TAWASHI_WITH_TESTING)
#if defined(KAMOKAN_WITH_TESTING)
SubmitPasteResponse (
const Kakoune::SafePtr<SettingsBag>& parSettings,
std::ostream* parStreamOut,

View file

@ -2,37 +2,23 @@ project(tawashi VERSION 0.2.3 LANGUAGES CXX C)
option(TAWASHI_WITH_IP_LOGGING "Enable code in Tawashi that may result in users IPs being stored in the DB or in logs" ON)
find_package(Boost 1.53.0 REQUIRED COMPONENTS program_options filesystem system)
find_package(SourceHighlight REQUIRED)
find_package(Boost 1.53.0 REQUIRED)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_library(${PROJECT_NAME} STATIC
add_library(${PROJECT_NAME}
split_get_vars.cpp
response.cpp
submit_paste_response.cpp
cgi_environment_vars.cpp
cgi_env.cpp
num_to_token.cpp
cgi_post.cpp
escapist.cpp
index_response.cpp
pastie_response.cpp
ini_file.cpp
pathname/pathname.cpp
response_factory.cpp
list_highlight_langs.cpp
settings_bag.cpp
sanitized_utf8.cpp
tiger.c
error_response.cpp
tawashi_exception.cpp
http_header.cpp
quick_submit_paste_response.cpp
ip_utils.cpp
mime_split.cpp
storage.cpp
truncated_string.cpp
)
@ -51,11 +37,8 @@ target_include_directories(${PROJECT_NAME} SYSTEM
)
target_link_libraries(${PROJECT_NAME}
PRIVATE ${Boost_LIBRARIES}
PRIVATE incredis
PRIVATE ${SourceHighlight_LIBRARIES}
PUBLIC mstch
PRIVATE houdini
PRIVATE pthread
PRIVATE duckhandy
)
target_compile_definitions(${PROJECT_NAME}
PRIVATE BOOST_SPIRIT_USE_PHOENIX_V3=1

View file

@ -19,7 +19,7 @@ target_include_directories(${PROJECT_NAME}
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include
)
target_link_libraries(${PROJECT_NAME}
PRIVATE tawashi
PRIVATE kamokan_impl
PRIVATE duckhandy
)

View file

@ -26,6 +26,7 @@ target_include_directories(${PROJECT_NAME}
target_link_libraries(${PROJECT_NAME}
PRIVATE tawashi
PRIVATE duckhandy
PRIVATE kamokan_impl
PRIVATE ${GLIB_LIBRARIES}
)