add wt as external project

This commit is contained in:
Bartosz Wieczorek 2018-01-23 14:54:31 +01:00
parent 88c5b2ebae
commit 7fbd6277ad
14 changed files with 175 additions and 463 deletions

View File

@ -12,6 +12,7 @@ project(eedb)
include(cmake/Compiler.cmake)
include(cmake/FindAllRequirements.cmake)
#hunter_add_package(Boost COMPONENTS system filesystem)
#find_package(Boost CONFIG REQUIRED system filesystem)
#target_link_libraries(... Boost::system Boost::filesystem)
@ -29,6 +30,6 @@ include(cmake/FindAllRequirements.cmake)
#find_package(Sqlpp11 REQUIRED)
#find_package(PostgreSQL REQUIRED)
#add_subdirectory(src)
add_subdirectory(tests)
add_subdirectory(src)
#add_subdirectory(tests)
#add_subdirectory(benchmarks)

View File

@ -1,6 +1,40 @@
include(ExternalProject)
#https://github.com/ruslo/hunter/wiki/dev.variables
# This function is used to force a build on a dependant project at cmake configuration phase.
#
function (build_external_project target prefix url) #FOLLOWING ARGUMENTS are the CMAKE_ARGS of ExternalProject_Add
set(trigger_build_dir ${CMAKE_BINARY_DIR}/force_${target})
#mktemp dir in build tree
file(MAKE_DIRECTORY ${trigger_build_dir} ${trigger_build_dir}/build)
#generate false dependency project
set(CMAKE_LIST_CONTENT "
cmake_minimum_required(VERSION 2.8)
include(ExternalProject)
ExternalProject_add(${target}
PREFIX ${prefix}/${target}
GIT_REPOSITORY ${url}
CMAKE_ARGS ${ARGN}
INSTALL_COMMAND \"\"
)
add_custom_target(trigger_${target})
add_dependencies(trigger_${target} ${target})
")
file(WRITE ${trigger_build_dir}/CMakeLists.txt "${CMAKE_LIST_CONTENT}")
execute_process(COMMAND ${CMAKE_COMMAND} ..
WORKING_DIRECTORY ${trigger_build_dir}/build
)
execute_process(COMMAND ${CMAKE_COMMAND} --build .
WORKING_DIRECTORY ${trigger_build_dir}/build
)
endfunction()
SET(_BOOST_COMPONENTS program_options system filesystem thread)
hunter_add_package(Boost COMPONENTS ${_BOOST_COMPONENTS})
@ -22,19 +56,23 @@ find_package(spdlog CONFIG REQUIRED)
hunter_add_package(range-v3)
find_package(range-v3 CONFIG REQUIRED)
set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/external)
set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/lib CACHE STRING "external libs root path")
set(EXTERNAL_LOCATION ${CMAKE_BINARY_DIR}/external CACHE STRING "external sources root path")
set(_HUNTER_ROOT "${Boost_DIR}/../../../")
ExternalProject_Add(wt
GIT_REPOSITORY https://github.com/emweb/wt.git
CMAKE_ARGS
project(wt-download NONE)
build_external_project(project_wt external
https://github.com/emweb/wt.git
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION}
-DBoost_NO_SYSTEM_PATHS=ON
-DBoost_USE_STATIC_LIBS=ON
-DBOOST_PREFIX=/home/bwieczor/.hunter/_Base/a412c45/2cf74e8/85521ae/Install
-DBOOST_INCLUDEDIR=/home/bwieczor/.hunter/_Base/a412c45/2cf74e8/85521ae/Install/include/
-DBOOST_LIBRARYDIR=/home/bwieczor/.hunter/_Base/a412c45/2cf74e8/85521ae/Install/lib/
-DSHARED_LIBS:BOOL=OFF
-DBoost_NO_BOOST_CMAKE=TRUE
-DBoost_NO_SYSTEM_PATHS=TRUE
-DBOOST_ROOT:PATHNAME=${_HUNTER_ROOT}
-DBOOST_INCLUDEDIR:FILEPATH=${_HUNTER_ROOT}/include
-DBOOST_LIBRARYDIR:FILEPATH=${_HUNTER_ROOT}/lib
-DBoost_USE_STATIC_LIBS=TRUE
-DBUILD_EXAMPLES=OFF
-DINSTALL_RESOURCES=OFF
-DENABLE_SSL=OFF
@ -48,4 +86,21 @@ ExternalProject_Add(wt
-DENABLE_QT4=OFF
-DENABLE_LIBWTDBO=OFF
-DENABLE_OPENGL=OFF
-DENABLE_UNWIND=OFF )
-DENABLE_UNWIND=OFF
-DCONNECTOR_FCGI=OFF
)
#ExternalProject_Get_Property(project_wt install_dir)
add_library(wt STATIC IMPORTED)
set_target_properties(wt PROPERTIES IMPORTED_LOCATION ${EXTERNAL_INSTALL_LOCATION}/lib/libwt.a)
add_dependencies(wt project_wt)
add_library(wthttp STATIC IMPORTED)
set_target_properties(wthttp PROPERTIES IMPORTED_LOCATION ${EXTERNAL_INSTALL_LOCATION}/lib/libwthttp.a)
add_dependencies(wthttp project_wt)
#LIST(APPEND CMAKE_MODULE_PATH "${/home/bwieczor/src/build-eedb-Desktop-Debug/external/lib/cmake/}")
#find_library(wt REQUIRED)
#find_library(wthttp REQUIRED)

View File

@ -1,54 +0,0 @@
include(ExternalProject)
#https://github.com/ruslo/hunter/wiki/dev.variables
SET(_BOOST_COMPONENTS program_options system filesystem thread)
hunter_add_package(Boost COMPONENTS ${_BOOST_COMPONENTS})
<<<<<<< HEAD
set(Boost_USE_STATIC_LIBS ON)
=======
>>>>>>> 3d352adf476450da50c6b067bc3c39eaf0b789c2
find_package(Boost CONFIG REQUIRED ${_BOOST_COMPONENTS})
hunter_add_package(nlohmann_json)
find_package(nlohmann_json CONFIG REQUIRED)
hunter_add_package(GTest)
find_package(GMock CONFIG REQUIRED)
hunter_add_package(benchmark)
find_package(benchmark CONFIG REQUIRED)
hunter_add_package(spdlog)
find_package(spdlog CONFIG REQUIRED)
hunter_add_package(range-v3)
find_package(range-v3 CONFIG REQUIRED)
set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/external)
ExternalProject_Add(wt
GIT_REPOSITORY https://github.com/emweb/wt.git
CMAKE_ARGS
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION}
-DBoost_NO_SYSTEM_PATHS=ON
-DBoost_USE_STATIC_LIBS=ON
-DBOOST_PREFIX=/home/bwieczor/.hunter/_Base/a412c45/2cf74e8/85521ae/Install
-DBOOST_INCLUDEDIR=/home/bwieczor/.hunter/_Base/a412c45/2cf74e8/85521ae/Install/include/
-DBOOST_LIBRARYDIR=/home/bwieczor/.hunter/_Base/a412c45/2cf74e8/85521ae/Install/lib/
-DBUILD_EXAMPLES=OFF
-DINSTALL_RESOURCES=OFF
-DENABLE_SSL=OFF
-DENABLE_HARU=OFF
-DENABLE_PANGO=OFF
-DENABLE_SQLITE=OFF
-DENABLE_POSTGRES=OFF
-DENABLE_FIREBIRD=OFF
-DENABLE_MYSQL=OFF
-DENABLE_MSSQLSERVER=OFF
-DENABLE_QT4=OFF
-DENABLE_LIBWTDBO=OFF
-DENABLE_OPENGL=OFF
-DENABLE_UNWIND=OFF )

View File

@ -1,51 +0,0 @@
include(ExternalProject)
#https://github.com/ruslo/hunter/wiki/dev.variables
SET(_BOOST_COMPONENTS program_options system filesystem thread)
hunter_add_package(Boost COMPONENTS ${_BOOST_COMPONENTS})
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost CONFIG REQUIRED ${_BOOST_COMPONENTS})
hunter_add_package(nlohmann_json)
find_package(nlohmann_json CONFIG REQUIRED)
hunter_add_package(GTest)
find_package(GMock CONFIG REQUIRED)
hunter_add_package(benchmark)
find_package(benchmark CONFIG REQUIRED)
hunter_add_package(spdlog)
find_package(spdlog CONFIG REQUIRED)
hunter_add_package(range-v3)
find_package(range-v3 CONFIG REQUIRED)
set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/external)
ExternalProject_Add(wt
GIT_REPOSITORY https://github.com/emweb/wt.git
CMAKE_ARGS
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION}
-DBoost_NO_SYSTEM_PATHS=ON
-DBoost_USE_STATIC_LIBS=ON
-DBOOST_PREFIX=/home/bwieczor/.hunter/_Base/a412c45/2cf74e8/85521ae/Install
-DBOOST_INCLUDEDIR=/home/bwieczor/.hunter/_Base/a412c45/2cf74e8/85521ae/Install/include/
-DBOOST_LIBRARYDIR=/home/bwieczor/.hunter/_Base/a412c45/2cf74e8/85521ae/Install/lib/
-DBUILD_EXAMPLES=OFF
-DINSTALL_RESOURCES=OFF
-DENABLE_SSL=OFF
-DENABLE_HARU=OFF
-DENABLE_PANGO=OFF
-DENABLE_SQLITE=OFF
-DENABLE_POSTGRES=OFF
-DENABLE_FIREBIRD=OFF
-DENABLE_MYSQL=OFF
-DENABLE_MSSQLSERVER=OFF
-DENABLE_QT4=OFF
-DENABLE_LIBWTDBO=OFF
-DENABLE_OPENGL=OFF
-DENABLE_UNWIND=OFF )

View File

@ -1,48 +0,0 @@
include(ExternalProject)
#https://github.com/ruslo/hunter/wiki/dev.variables
hunter_add_package(Boost)
find_package(Boost CONFIG REQUIRED)
hunter_add_package(nlohmann_json)
find_package(nlohmann_json CONFIG REQUIRED)
hunter_add_package(GTest)
find_package(GMock CONFIG REQUIRED)
hunter_add_package(benchmark)
find_package(benchmark CONFIG REQUIRED)
hunter_add_package(spdlog)
find_package(spdlog CONFIG REQUIRED)
hunter_add_package(range-v3)
find_package(range-v3 CONFIG REQUIRED)
set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/external)
ExternalProject_Add(wt
GIT_REPOSITORY https://github.com/emweb/wt.git
CMAKE_ARGS
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION}
-DBOOST_ROOT=/home/bwieczor/.hunter/_Base/a412c45/f8d72b9/85521ae/Install/
-DBOOST_INCLUDEDIR=/home/bwieczor/.hunter/_Base/a412c45/f8d72b9/85521ae/Install/include/
-DBOOST_LIBRARYDIR=/home/bwieczor/.hunter/_Base/a412c45/f8d72b9/85521ae/Install/lib/
-DBoost_NO_SYSTEM_PATHS=ON
-DBUILD_EXAMPLES=OFF
-DINSTALL_RESOURCES=OFF
-DENABLE_SSL=OFF
-DENABLE_HARU=OFF
-DENABLE_PANGO=OFF
-DENABLE_SQLITE=OFF
-DENABLE_POSTGRES=OFF
-DENABLE_FIREBIRD=OFF
-DENABLE_MYSQL=OFF
-DENABLE_MSSQLSERVER=OFF
-DENABLE_QT4=OFF
-DENABLE_LIBWTDBO=OFF
-DENABLE_OPENGL=OFF
-DENABLE_UNWIND=OFF )

View File

@ -1,48 +0,0 @@
include(ExternalProject)
#https://github.com/ruslo/hunter/wiki/dev.variables
hunter_add_package(Boost)
find_package(Boost CONFIG REQUIRED)
hunter_add_package(nlohmann_json)
find_package(nlohmann_json CONFIG REQUIRED)
hunter_add_package(GTest)
find_package(GMock CONFIG REQUIRED)
hunter_add_package(benchmark)
find_package(benchmark CONFIG REQUIRED)
hunter_add_package(spdlog)
find_package(spdlog CONFIG REQUIRED)
hunter_add_package(range-v3)
find_package(range-v3 CONFIG REQUIRED)
set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/external)
ExternalProject_Add(wt
GIT_REPOSITORY https://github.com/emweb/wt.git
CMAKE_ARGS
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION}
-DBOOST_ROOT=/home/bwieczor/.hunter/_Base/a412c45/f8d72b9/85521ae/Install/
-DBOOST_INCLUDEDIR=/home/bwieczor/.hunter/_Base/a412c45/f8d72b9/85521ae/Install/include/
-DBOOST_LIBRARYDIR=/home/bwieczor/.hunter/_Base/a412c45/f8d72b9/85521ae/Install/lib/
-DBoost_NO_SYSTEM_PATHS=ON
-DBUILD_EXAMPLES=OFF
-DINSTALL_RESOURCES=OFF
-DENABLE_SSL=OFF
-DENABLE_HARU=OFF
-DENABLE_PANGO=OFF
-DENABLE_SQLITE=OFF
-DENABLE_POSTGRES=OFF
-DENABLE_FIREBIRD=OFF
-DENABLE_MYSQL=OFF
-DENABLE_MSSQLSERVER=OFF
-DENABLE_QT4=OFF
-DENABLE_LIBWTDBO=OFF
-DENABLE_OPENGL=OFF
-DENABLE_UNWIND=OFF )

View File

@ -1,51 +0,0 @@
include(ExternalProject)
#https://github.com/ruslo/hunter/wiki/dev.variables
SET(_BOOST_COMPONENTS program_options system filesystem thread)
hunter_add_package(Boost COMPONENTS ${_BOOST_COMPONENTS})
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost CONFIG REQUIRED ${_BOOST_COMPONENTS})
hunter_add_package(nlohmann_json)
find_package(nlohmann_json CONFIG REQUIRED)
hunter_add_package(GTest)
find_package(GMock CONFIG REQUIRED)
hunter_add_package(benchmark)
find_package(benchmark CONFIG REQUIRED)
hunter_add_package(spdlog)
find_package(spdlog CONFIG REQUIRED)
hunter_add_package(range-v3)
find_package(range-v3 CONFIG REQUIRED)
set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/external)
ExternalProject_Add(wt
GIT_REPOSITORY https://github.com/emweb/wt.git
CMAKE_ARGS
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION}
-DBoost_NO_SYSTEM_PATHS=ON
-DBoost_USE_STATIC_LIBS=ON
-DBOOST_PREFIX=/home/bwieczor/.hunter/_Base/a412c45/2cf74e8/85521ae/Install
-DBOOST_INCLUDEDIR=/home/bwieczor/.hunter/_Base/a412c45/2cf74e8/85521ae/Install/include/
-DBOOST_LIBRARYDIR=/home/bwieczor/.hunter/_Base/a412c45/2cf74e8/85521ae/Install/lib/
-DBUILD_EXAMPLES=OFF
-DINSTALL_RESOURCES=OFF
-DENABLE_SSL=OFF
-DENABLE_HARU=OFF
-DENABLE_PANGO=OFF
-DENABLE_SQLITE=OFF
-DENABLE_POSTGRES=OFF
-DENABLE_FIREBIRD=OFF
-DENABLE_MYSQL=OFF
-DENABLE_MSSQLSERVER=OFF
-DENABLE_QT4=OFF
-DENABLE_LIBWTDBO=OFF
-DENABLE_OPENGL=OFF
-DENABLE_UNWIND=OFF )

View File

@ -1,51 +0,0 @@
include(ExternalProject)
#https://github.com/ruslo/hunter/wiki/dev.variables
SET(_BOOST_COMPONENTS program_options system filesystem thread)
hunter_add_package(Boost COMPONENTS ${_BOOST_COMPONENTS})
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost CONFIG REQUIRED ${_BOOST_COMPONENTS})
hunter_add_package(nlohmann_json)
find_package(nlohmann_json CONFIG REQUIRED)
hunter_add_package(GTest)
find_package(GMock CONFIG REQUIRED)
hunter_add_package(benchmark)
find_package(benchmark CONFIG REQUIRED)
hunter_add_package(spdlog)
find_package(spdlog CONFIG REQUIRED)
hunter_add_package(range-v3)
find_package(range-v3 CONFIG REQUIRED)
set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/external)
ExternalProject_Add(wt
GIT_REPOSITORY https://github.com/emweb/wt.git
CMAKE_ARGS
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION}
-DBoost_NO_SYSTEM_PATHS=ON
-DBoost_USE_STATIC_LIBS=ON
-DBOOST_PREFIX=/home/bwieczor/.hunter/_Base/a412c45/2cf74e8/85521ae/Install
-DBOOST_INCLUDEDIR=/home/bwieczor/.hunter/_Base/a412c45/2cf74e8/85521ae/Install/include/
-DBOOST_LIBRARYDIR=/home/bwieczor/.hunter/_Base/a412c45/2cf74e8/85521ae/Install/lib/
-DBUILD_EXAMPLES=OFF
-DINSTALL_RESOURCES=OFF
-DENABLE_SSL=OFF
-DENABLE_HARU=OFF
-DENABLE_PANGO=OFF
-DENABLE_SQLITE=OFF
-DENABLE_POSTGRES=OFF
-DENABLE_FIREBIRD=OFF
-DENABLE_MYSQL=OFF
-DENABLE_MSSQLSERVER=OFF
-DENABLE_QT4=OFF
-DENABLE_LIBWTDBO=OFF
-DENABLE_OPENGL=OFF
-DENABLE_UNWIND=OFF )

View File

@ -1,49 +0,0 @@
include(ExternalProject)
#https://github.com/ruslo/hunter/wiki/dev.variables
SET(_BOOST_COMPONENTS program_options system filesystem thread)
hunter_add_package(Boost COMPONENTS ${_BOOST_COMPONENTS})
find_package(Boost CONFIG REQUIRED ${_BOOST_COMPONENTS})
hunter_add_package(nlohmann_json)
find_package(nlohmann_json CONFIG REQUIRED)
hunter_add_package(GTest)
find_package(GMock CONFIG REQUIRED)
hunter_add_package(benchmark)
find_package(benchmark CONFIG REQUIRED)
hunter_add_package(spdlog)
find_package(spdlog CONFIG REQUIRED)
hunter_add_package(range-v3)
find_package(range-v3 CONFIG REQUIRED)
set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/external)
ExternalProject_Add(wt
GIT_REPOSITORY https://github.com/emweb/wt.git
CMAKE_ARGS
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION}
-DBOOST_ROOT=/home/bwieczor/.hunter/_Base/a412c45/f8d72b9/85521ae/Install/
-DBOOST_INCLUDEDIR=/home/bwieczor/.hunter/_Base/a412c45/f8d72b9/85521ae/Install/include/
-DBOOST_LIBRARYDIR=/home/bwieczor/.hunter/_Base/a412c45/f8d72b9/85521ae/Install/lib/
-DBoost_NO_SYSTEM_PATHS=ON
-DBUILD_EXAMPLES=OFF
-DINSTALL_RESOURCES=OFF
-DENABLE_SSL=OFF
-DENABLE_HARU=OFF
-DENABLE_PANGO=OFF
-DENABLE_SQLITE=OFF
-DENABLE_POSTGRES=OFF
-DENABLE_FIREBIRD=OFF
-DENABLE_MYSQL=OFF
-DENABLE_MSSQLSERVER=OFF
-DENABLE_QT4=OFF
-DENABLE_LIBWTDBO=OFF
-DENABLE_OPENGL=OFF
-DENABLE_UNWIND=OFF )

View File

@ -1,49 +0,0 @@
include(ExternalProject)
#https://github.com/ruslo/hunter/wiki/dev.variables
SET(_BOOST_COMPONENTS program_options system filesystem thread)
hunter_add_package(Boost COMPONENTS ${_BOOST_COMPONENTS})
find_package(Boost CONFIG REQUIRED ${_BOOST_COMPONENTS})
hunter_add_package(nlohmann_json)
find_package(nlohmann_json CONFIG REQUIRED)
hunter_add_package(GTest)
find_package(GMock CONFIG REQUIRED)
hunter_add_package(benchmark)
find_package(benchmark CONFIG REQUIRED)
hunter_add_package(spdlog)
find_package(spdlog CONFIG REQUIRED)
hunter_add_package(range-v3)
find_package(range-v3 CONFIG REQUIRED)
set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/external)
ExternalProject_Add(wt
GIT_REPOSITORY https://github.com/emweb/wt.git
CMAKE_ARGS
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION}
-DBOOST_ROOT=/home/bwieczor/.hunter/_Base/a412c45/f8d72b9/85521ae/Install/
-DBOOST_INCLUDEDIR=/home/bwieczor/.hunter/_Base/a412c45/f8d72b9/85521ae/Install/include/
-DBOOST_LIBRARYDIR=/home/bwieczor/.hunter/_Base/a412c45/f8d72b9/85521ae/Install/lib/
-DBoost_NO_SYSTEM_PATHS=ON
-DBUILD_EXAMPLES=OFF
-DINSTALL_RESOURCES=OFF
-DENABLE_SSL=OFF
-DENABLE_HARU=OFF
-DENABLE_PANGO=OFF
-DENABLE_SQLITE=OFF
-DENABLE_POSTGRES=OFF
-DENABLE_FIREBIRD=OFF
-DENABLE_MYSQL=OFF
-DENABLE_MSSQLSERVER=OFF
-DENABLE_QT4=OFF
-DENABLE_LIBWTDBO=OFF
-DENABLE_OPENGL=OFF
-DENABLE_UNWIND=OFF )

View File

@ -1,6 +1,6 @@
project( eedb_app )
INCLUDE_DIRECTORIES(.)
add_subdirectory(utils)
add_subdirectory(eedb)
#add_subdirectory(utils)
#add_subdirectory(eedb)
add_subdirectory(app)

View File

@ -1,12 +1,26 @@
set(SOURCES
main.cpp)
INCLUDE_DIRECTORIES(${PostgreSQL_INCLUDE_DIRS})
#INCLUDE_DIRECTORIES(${PostgreSQL_INCLUDE_DIRS})
include_directories(${EXTERNAL_INSTALL_LOCATION}/include)
remove_definitions(WTHTTP_WITH_ZLIB)
add_executable(eedb ${SOURCES} )
add_dependencies(eedb project_wt)
link_directories(${EXTERNAL_INSTALL_LOCATION}/lib)
target_link_libraries(eedb
${Wt_LIBRARY} # or {Wt_DEBUG_LIBRARY}
${Wt_HTTP_LIBRARY} # or {Wt_HTTP_DEBUG_LIBRARY}
${Boost_LIBRARIES}
eedb_db auth
wthttp # or {Wt_HTTP_DEBUG_LIBRARY}
wt # or {Wt_DEBUG_LIBRARY}
# ${Wt_LIBRARY} # or {Wt_DEBUG_LIBRARY}
# ${Wt_HTTP_LIBRARY} # or {Wt_HTTP_DEBUG_LIBRARY}
Boost::system
Boost::filesystem
Boost::thread
Boost::program_options
z
# ${Boost_LIBRARIES}
# eedb_db auth
)

View File

@ -1,53 +1,96 @@
#include <eedb/EEDB.hpp>
#include <eedb/Session.hpp>
//#include <eedb/EEDB.hpp>
//#include <eedb/Session.hpp>
#include <eedb/auth/PgUserAuth.hpp>
#include <eedb/auth/Services.hpp>
//#include <eedb/auth/PgUserAuth.hpp>
//#include <eedb/auth/Services.hpp>
#include <eedb/db/config.hpp>
#include <eedb/db/connection.hpp>
//#include <eedb/db/config.hpp>
//#include <eedb/db/connection.hpp>
#include <eedb/widgets/DefaultAuthPage.hpp>
#include <eedb/widgets/DefaultHomePage.hpp>
#include <eedb/widgets/DefaultNavigationBar.hpp>
//#include <eedb/widgets/DefaultAuthPage.hpp>
//#include <eedb/widgets/DefaultHomePage.hpp>
//#include <eedb/widgets/DefaultNavigationBar.hpp>
#include <Wt/WApplication>
#include <Wt/WServer>
//#include <Wt/WApplication.h>
//#include <Wt/WServer.h>
Wt::WApplication * createApplication(const Wt::WEnvironment & env) {
using std::move;
using std::make_unique;
using std::unique_ptr;
//Wt::WApplication * createApplication(const Wt::WEnvironment & env) {
// using std::move;
// using std::make_unique;
// using std::unique_ptr;
auto dbConfig = make_unique< eedb::db::PgConfig >(env);
auto dbConnection = make_unique< eedb::db::PgConnection >(move(dbConfig));
auto session = unique_ptr< eedb::Session >(make_unique< eedb::WebSession >(move(dbConnection), env));
// auto dbConfig = make_unique< eedb::db::PgConfig >(env);
// auto dbConnection = make_unique< eedb::db::PgConnection >(move(dbConfig));
// auto session = unique_ptr< eedb::Session >(make_unique< eedb::WebSession >(move(dbConnection), env));
auto authPageFactory = [_session = session.get()]()->std::unique_ptr< eedb::AuthPage > {
auto userDatabase = make_unique< eedb::auth::PgUserAuth >(_session->db(), _session->enviroment());
auto services = eedb::auth::Services();
auto & login = _session->login();
// auto authPageFactory = [_session = session.get()]()->std::unique_ptr< eedb::AuthPage > {
// auto userDatabase = make_unique< eedb::auth::PgUserAuth >(_session->db(), _session->enviroment());
// auto services = eedb::auth::Services();
// auto & login = _session->login();
return make_unique< eedb::DefaultAuthPage >(services, std::move(userDatabase), login);
};
// return make_unique< eedb::DefaultAuthPage >(services, std::move(userDatabase), login);
// };
auto homePageFactory = [_session = session.get()]()->std::unique_ptr< eedb::HomePage > {
auto navigationBar = std::make_unique< eedb::DefaultNavigationBar >();
return make_unique< eedb::DefaultHomePage >(*_session, std::move(navigationBar));
};
// auto homePageFactory = [_session = session.get()]()->std::unique_ptr< eedb::HomePage > {
// auto navigationBar = std::make_unique< eedb::DefaultNavigationBar >();
// return make_unique< eedb::DefaultHomePage >(*_session, std::move(navigationBar));
// };
return new eedb::EEDB{std::move(session), authPageFactory, homePageFactory};
// return new eedb::EEDB{std::move(session), authPageFactory, homePageFactory};
//}
//int main(int argc, char ** argv) {
// try {
// Wt::WServer server(argc, argv, WTHTTP_CONFIGURATION);
// server.addEntryPoint(Wt::Application, createApplication);
// eedb::auth::Services::configureAuth();
// server.run();
// } catch(Wt::WServer::Exception & e) {
// std::cerr << e.what() << std::endl;
// } catch(std::exception & e) {
// std::cerr << "exception: " << e.what() << std::endl;
// }
// return 0;
//}
#include <Wt/WApplication.h>
#include <Wt/WBreak.h>
#include <Wt/WContainerWidget.h>
#include <Wt/WLineEdit.h>
#include <Wt/WPushButton.h>
#include <Wt/WText.h>
class HelloApplication : public Wt::WApplication
{
public:
HelloApplication(const Wt::WEnvironment& env);
private:
Wt::WLineEdit *nameEdit_;
Wt::WText *greeting_;
void greet();
};
HelloApplication::HelloApplication(const Wt::WEnvironment& env)
: Wt::WApplication(env)
{
setTitle("Hello world");
root()->addWidget(std::make_unique<Wt::WText>("Your name, please? "));
nameEdit_ = root()->addWidget(std::make_unique<Wt::WLineEdit>());
Wt::WPushButton *button = root()->addWidget(std::make_unique<Wt::WPushButton>("Greet me."));
root()->addWidget(std::make_unique<Wt::WBreak>());
greeting_ = root()->addWidget(std::make_unique<Wt::WText>());
button->clicked().connect(this, [this](){
greeting_->setText("Hello there, " + nameEdit_->text());
});
}
int main(int argc, char ** argv) {
try {
Wt::WServer server(argc, argv, WTHTTP_CONFIGURATION);
server.addEntryPoint(Wt::Application, createApplication);
eedb::auth::Services::configureAuth();
server.run();
} catch(Wt::WServer::Exception & e) {
std::cerr << e.what() << std::endl;
} catch(std::exception & e) {
std::cerr << "exception: " << e.what() << std::endl;
}
int main(int argc, char **argv)
{
return Wt::WRun(argc, argv, [](const Wt::WEnvironment& env) {
return std::make_unique<HelloApplication>(env);
});
}

View File

@ -15,7 +15,7 @@ include_directories( ${gmock_SOURCE_DIR}/include)
#add test files
file(GLOB_RECURSE TEST_FILES test_*.cpp )
INCLUDE_DIRECTORIES(${PostgreSQL_INCLUDE_DIRS})
add_executable( ${TEST_EXECUTABLE_NAME} ${TEST_FILES})
# add_executable( ${TEST_EXECUTABLE_NAME} ${TEST_FILES})
# target_link_libraries( ${TEST_EXECUTABLE_NAME} GMock::main wt wttest eedb_db auth ${Boost_LIBRARIES} )