mirror of
https://github.com/KingDuckZ/kamokan.git
synced 2025-08-03 12:50:02 +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:
parent
44350478c1
commit
6c357f1dc7
35 changed files with 74 additions and 37 deletions
|
@ -16,6 +16,7 @@ add_subdirectory(lib/incredis)
|
||||||
add_subdirectory(lib/mstch)
|
add_subdirectory(lib/mstch)
|
||||||
add_subdirectory(lib/houdini)
|
add_subdirectory(lib/houdini)
|
||||||
add_subdirectory(src/tawashi)
|
add_subdirectory(src/tawashi)
|
||||||
|
add_subdirectory(src/kamokan_impl)
|
||||||
add_subdirectory(src/kamokan)
|
add_subdirectory(src/kamokan)
|
||||||
|
|
||||||
install(DIRECTORY html/website/ DESTINATION html)
|
install(DIRECTORY html/website/ DESTINATION html)
|
||||||
|
|
|
@ -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_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")
|
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
|
main.cpp
|
||||||
)
|
)
|
||||||
target_link_libraries(${PROJECT_NAME}
|
target_link_libraries(${PROJECT_NAME}
|
||||||
PRIVATE tawashi
|
PRIVATE kamokan_impl
|
||||||
#hack - add duckhandy to the project instead of picking from inside redis
|
#hack - add duckhandy to the project instead of picking from inside redis
|
||||||
PRIVATE duckhandy
|
PRIVATE duckhandy
|
||||||
)
|
)
|
||||||
|
@ -20,16 +20,8 @@ set_target_properties(
|
||||||
PROPERTIES SUFFIX .cgi
|
PROPERTIES SUFFIX .cgi
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(${PROJECT_NAME}
|
|
||||||
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include
|
|
||||||
)
|
|
||||||
install(TARGETS ${PROJECT_NAME}
|
install(TARGETS ${PROJECT_NAME}
|
||||||
LIBRARY DESTINATION lib
|
LIBRARY DESTINATION lib
|
||||||
RUNTIME DESTINATION bin
|
RUNTIME DESTINATION bin
|
||||||
ARCHIVE DESTINATION lib/static
|
ARCHIVE DESTINATION lib/static
|
||||||
)
|
)
|
||||||
|
|
||||||
configure_file(
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/kamokan_config.h.in"
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/include/kamokan_config.h"
|
|
||||||
)
|
|
||||||
|
|
61
src/kamokan_impl/CMakeLists.txt
Normal file
61
src/kamokan_impl/CMakeLists.txt
Normal 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"
|
||||||
|
)
|
|
@ -23,7 +23,7 @@
|
||||||
#include "list_highlight_langs.hpp"
|
#include "list_highlight_langs.hpp"
|
||||||
#include "cgi_env.hpp"
|
#include "cgi_env.hpp"
|
||||||
#include "num_conv.hpp"
|
#include "num_conv.hpp"
|
||||||
#include "tawashi_config.h"
|
#include "kamokan_config.h"
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <fstream>
|
#include <fstream>
|
|
@ -19,7 +19,6 @@
|
||||||
#include "settings_bag.hpp"
|
#include "settings_bag.hpp"
|
||||||
#include "incredis/incredis.hpp"
|
#include "incredis/incredis.hpp"
|
||||||
#include "num_to_token.hpp"
|
#include "num_to_token.hpp"
|
||||||
#include "tawashi_config.h"
|
|
||||||
#include "duckhandy/stringize.h"
|
#include "duckhandy/stringize.h"
|
||||||
#include "spdlog.hpp"
|
#include "spdlog.hpp"
|
||||||
#include "truncated_string.hpp"
|
#include "truncated_string.hpp"
|
||||||
|
@ -151,7 +150,7 @@ namespace tawashi {
|
||||||
return pastie;
|
return pastie;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(TAWASHI_WITH_TESTING)
|
#if defined(KAMOKAN_WITH_TESTING)
|
||||||
const SettingsBag& Storage::settings() const {
|
const SettingsBag& Storage::settings() const {
|
||||||
return *m_settings;
|
return *m_settings;
|
||||||
}
|
}
|
|
@ -54,7 +54,7 @@ namespace tawashi {
|
||||||
|
|
||||||
tawashi_virtual_testing boost::optional<std::string> retrieve_pastie (const boost::string_view& parToken) const;
|
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;
|
const SettingsBag& settings() const;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -73,7 +73,7 @@ namespace tawashi {
|
||||||
}
|
}
|
||||||
} //unnamed namespace
|
} //unnamed namespace
|
||||||
|
|
||||||
#if defined(TAWASHI_WITH_TESTING)
|
#if defined(KAMOKAN_WITH_TESTING)
|
||||||
SubmitPasteResponse::SubmitPasteResponse (
|
SubmitPasteResponse::SubmitPasteResponse (
|
||||||
const Kakoune::SafePtr<SettingsBag>& parSettings,
|
const Kakoune::SafePtr<SettingsBag>& parSettings,
|
||||||
std::ostream* parStreamOut,
|
std::ostream* parStreamOut,
|
|
@ -27,7 +27,7 @@
|
||||||
namespace tawashi {
|
namespace tawashi {
|
||||||
class SubmitPasteResponse : public Response {
|
class SubmitPasteResponse : public Response {
|
||||||
public:
|
public:
|
||||||
#if defined(TAWASHI_WITH_TESTING)
|
#if defined(KAMOKAN_WITH_TESTING)
|
||||||
SubmitPasteResponse (
|
SubmitPasteResponse (
|
||||||
const Kakoune::SafePtr<SettingsBag>& parSettings,
|
const Kakoune::SafePtr<SettingsBag>& parSettings,
|
||||||
std::ostream* parStreamOut,
|
std::ostream* parStreamOut,
|
|
@ -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)
|
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(Boost 1.53.0 REQUIRED)
|
||||||
find_package(SourceHighlight REQUIRED)
|
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 14)
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
add_library(${PROJECT_NAME} STATIC
|
add_library(${PROJECT_NAME}
|
||||||
split_get_vars.cpp
|
split_get_vars.cpp
|
||||||
response.cpp
|
|
||||||
submit_paste_response.cpp
|
|
||||||
cgi_environment_vars.cpp
|
cgi_environment_vars.cpp
|
||||||
cgi_env.cpp
|
cgi_env.cpp
|
||||||
num_to_token.cpp
|
|
||||||
cgi_post.cpp
|
cgi_post.cpp
|
||||||
escapist.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
|
sanitized_utf8.cpp
|
||||||
tiger.c
|
tiger.c
|
||||||
error_response.cpp
|
|
||||||
tawashi_exception.cpp
|
tawashi_exception.cpp
|
||||||
http_header.cpp
|
http_header.cpp
|
||||||
quick_submit_paste_response.cpp
|
|
||||||
ip_utils.cpp
|
ip_utils.cpp
|
||||||
mime_split.cpp
|
mime_split.cpp
|
||||||
storage.cpp
|
|
||||||
truncated_string.cpp
|
truncated_string.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -51,11 +37,8 @@ target_include_directories(${PROJECT_NAME} SYSTEM
|
||||||
)
|
)
|
||||||
target_link_libraries(${PROJECT_NAME}
|
target_link_libraries(${PROJECT_NAME}
|
||||||
PRIVATE ${Boost_LIBRARIES}
|
PRIVATE ${Boost_LIBRARIES}
|
||||||
PRIVATE incredis
|
|
||||||
PRIVATE ${SourceHighlight_LIBRARIES}
|
|
||||||
PUBLIC mstch
|
|
||||||
PRIVATE houdini
|
PRIVATE houdini
|
||||||
PRIVATE pthread
|
PRIVATE duckhandy
|
||||||
)
|
)
|
||||||
target_compile_definitions(${PROJECT_NAME}
|
target_compile_definitions(${PROJECT_NAME}
|
||||||
PRIVATE BOOST_SPIRIT_USE_PHOENIX_V3=1
|
PRIVATE BOOST_SPIRIT_USE_PHOENIX_V3=1
|
||||||
|
|
|
@ -19,7 +19,7 @@ target_include_directories(${PROJECT_NAME}
|
||||||
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include
|
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include
|
||||||
)
|
)
|
||||||
target_link_libraries(${PROJECT_NAME}
|
target_link_libraries(${PROJECT_NAME}
|
||||||
PRIVATE tawashi
|
PRIVATE kamokan_impl
|
||||||
PRIVATE duckhandy
|
PRIVATE duckhandy
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ target_include_directories(${PROJECT_NAME}
|
||||||
target_link_libraries(${PROJECT_NAME}
|
target_link_libraries(${PROJECT_NAME}
|
||||||
PRIVATE tawashi
|
PRIVATE tawashi
|
||||||
PRIVATE duckhandy
|
PRIVATE duckhandy
|
||||||
|
PRIVATE kamokan_impl
|
||||||
PRIVATE ${GLIB_LIBRARIES}
|
PRIVATE ${GLIB_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue