- More cmake cleanup
This commit is contained in:
@@ -1,23 +1,25 @@
|
|||||||
project(pistache)
|
project(pistache)
|
||||||
|
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
|
|
||||||
ExternalProject_Add(PistacheDownload
|
set_directory_properties(PROPERTIES EP_UPDATE_DISCONNECTED true)
|
||||||
PREFIX third_party
|
|
||||||
GIT_REPOSITORY https://github.com/pistacheio/pistache.git
|
|
||||||
GIT_TAG master
|
|
||||||
INSTALL_COMMAND ""
|
|
||||||
)
|
|
||||||
|
|
||||||
set(PISTACHE_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/third_party/src/PistacheDownload/include)
|
set(pistache_root ${THIRD_PARTY_DIR}/${PROJECT_NAME})
|
||||||
set(PISTACHE_LIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/third_party/src/PistacheDownload-build/src)
|
|
||||||
|
ExternalProject_Add(PistacheDownload
|
||||||
|
PREFIX ${pistache_root}
|
||||||
|
GIT_REPOSITORY https://github.com/pistacheio/pistache.git
|
||||||
|
GIT_TAG master
|
||||||
|
INSTALL_COMMAND ""
|
||||||
|
)
|
||||||
|
|
||||||
|
ExternalProject_Get_Property(PistacheDownload SOURCE_DIR)
|
||||||
|
set(PISTACHE_INCLUDE_DIR ${SOURCE_DIR}/include)
|
||||||
|
set(PISTACHE_LIB_DIR ${pistache_root}/src/PistacheDownload-build/src)
|
||||||
|
|
||||||
|
file(MAKE_DIRECTORY ${PISTACHE_INCLUDE_DIR})
|
||||||
|
|
||||||
add_library(${PROJECT_NAME} SHARED IMPORTED)
|
add_library(${PROJECT_NAME} SHARED IMPORTED)
|
||||||
add_dependencies(${PROJECT_NAME} $PistacheDownload)
|
add_dependencies(${PROJECT_NAME} PistacheDownload)
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES IMPORTED_LOCATION "${PISTACHE_LIB_DIR}/libpistache.a")
|
target_include_directories(${PROJECT_NAME} INTERFACE ${PISTACHE_INCLUDE_DIR})
|
||||||
|
set_target_properties(${PROJECT_NAME} PROPERTIES IMPORTED_LOCATION "${PISTACHE_LIB_DIR}/libpistache.a")
|
||||||
#add_library(${PROJECT_NAME} STATIC IMPORTED)
|
|
||||||
|
|
||||||
#set_target_properties(${PROJECT_NAME} PROPERTIES IMPORTED_LOCATION "${PISTACHE_BINARY_DIR}/lib/libpistache.a")
|
|
||||||
|
|
||||||
#file(MAKE_DIRECTORY "${PISTACHE_BINARY_DIR}/include")
|
|
||||||
#target_include_directories(${PROJECT_NAME} SYSTEM INTERFACE "${PISTACHE_BINARY_DIR}/include/")
|
|
||||||
@@ -2,6 +2,5 @@ project(daggy)
|
|||||||
|
|
||||||
file(GLOB_RECURSE SOURCES src/*.cpp)
|
file(GLOB_RECURSE SOURCES src/*.cpp)
|
||||||
add_library(${PROJECT_NAME} STATIC ${SOURCES})
|
add_library(${PROJECT_NAME} STATIC ${SOURCES})
|
||||||
include_directories(${PISTACHE_INCLUDE_DIR})
|
|
||||||
target_include_directories(${PROJECT_NAME} PUBLIC include)
|
target_include_directories(${PROJECT_NAME} PUBLIC include)
|
||||||
target_link_libraries(${PROJECT_NAME} pistache pthread rapidjson magicEnum)
|
target_link_libraries(${PROJECT_NAME} pistache pthread rapidjson magicEnum)
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
#include <pistache/endpoint.h>
|
#include <pistache/endpoint.h>
|
||||||
#include <pistache/http.h>
|
#include <pistache/http.h>
|
||||||
|
|
||||||
// #include <pistache/thirdparty/serializer/rapidjson.h>
|
#include <rapidjson/document.h>
|
||||||
|
|
||||||
namespace daggy {
|
namespace daggy {
|
||||||
class Server {
|
class Server {
|
||||||
@@ -19,18 +19,6 @@ namespace daggy {
|
|||||||
private:
|
private:
|
||||||
void createDescription();
|
void createDescription();
|
||||||
|
|
||||||
//
|
|
||||||
// DAG Definition handlers
|
|
||||||
//
|
|
||||||
|
|
||||||
void listDAGs(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
|
||||||
|
|
||||||
void upsertDAG(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
|
||||||
|
|
||||||
void deleteDAG(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
|
||||||
|
|
||||||
void getDAG(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// DAG Runs
|
// DAG Runs
|
||||||
//
|
//
|
||||||
@@ -43,9 +31,10 @@ namespace daggy {
|
|||||||
// Get status of specific run
|
// Get status of specific run
|
||||||
void getDAGRun(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
void getDAGRun(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
||||||
|
|
||||||
|
void handleReady(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
|
||||||
|
|
||||||
Pistache::Http::Endpoint endpoint_;
|
Pistache::Http::Endpoint endpoint_;
|
||||||
Pistache::Rest::Description desc_;
|
Pistache::Rest::Description desc_;
|
||||||
Pistache::Rest::Router router_;
|
Pistache::Rest::Router router_;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,13 +32,11 @@ namespace daggy {
|
|||||||
.produces(MIME(Application, Json))
|
.produces(MIME(Application, Json))
|
||||||
.consumes(MIME(Application, Json));
|
.consumes(MIME(Application, Json));
|
||||||
|
|
||||||
/*
|
|
||||||
desc_
|
desc_
|
||||||
.route(desc_.get("/ready"))
|
.route(desc_.get("/ready"))
|
||||||
.bind(&Generic::handleReady)
|
.bind(&Server::handleReady, this)
|
||||||
.response(Http::Code::Ok, "Response to the /ready call")
|
.response(Http::Code::Ok, "Response to the /ready call")
|
||||||
.hide();
|
.hide();
|
||||||
*/
|
|
||||||
|
|
||||||
auto versionPath = desc_.path("/v1");
|
auto versionPath = desc_.path("/v1");
|
||||||
|
|
||||||
@@ -53,4 +51,8 @@ namespace daggy {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Server::handleReady(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
||||||
|
response.send(Pistache::Http::Code::Ok, "All good here");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
project(rest_server)
|
project(rest_server)
|
||||||
file(GLOB SOURCES *.cpp)
|
file(GLOB SOURCES *.cpp)
|
||||||
add_executable(${PROJECT_NAME} ${SOURCES})
|
add_executable(${PROJECT_NAME} ${SOURCES})
|
||||||
target_link_libraries(${PROJECT_NAME} daggy stdc++fs rapidjson pistache argparse)
|
target_link_libraries(${PROJECT_NAME} pistache stdc++fs rapidjson argparse daggy)
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "daggy")
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
#include <argoarse/argparse.hpp>
|
#include <argparse.hpp>
|
||||||
|
|
||||||
#include <daggy/Server.hpp>
|
#include <daggy/Server.hpp>
|
||||||
#include <daggy/executors/task/ForkingTaskExecutor.hpp>
|
#include <daggy/executors/task/ForkingTaskExecutor.hpp>
|
||||||
@@ -19,5 +19,5 @@ int main(int argc, char **argv) {
|
|||||||
.help("Port to listen to")
|
.help("Port to listen to")
|
||||||
.action([](const std::string &value) { return std::stoi(value); });
|
.action([](const std::string &value) { return std::stoi(value); });
|
||||||
|
|
||||||
daggy::Server endpoint;
|
// daggy::Server endpoint(10);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user