diff --git a/meson.build b/meson.build index bceed86..d40c67d 100644 --- a/meson.build +++ b/meson.build @@ -6,19 +6,19 @@ configure_file(output : 'config.h', configuration : conf_data) configuration_inc = include_directories('.') -cmake = import('cmake') - #csv = cmake.subproject('csv-parser') #csv_lib = csv.dependency('csv') -nlohmann_lib = dependency('nlohmann_json', version : '>=3.5.0', required : false) +nlohmann_lib = dependency('nlohmann_json', version : '>=3.55.0', required : false) if not nlohmann_lib.found() - nlohmann = cmake.subproject('nlohmann_json', - cmake_options : ['-DJSON_BuildTests=OFF', '-DCMAKE_BUILD_TYPE=Release']) - nlohmann_lib = nlohmann.dependency('nlohmann_json') + nlohmann_inc = include_directories('subprojects/nlohmann_json/single_include/nlohmann') + nlohmann_lib = declare_dependency(include_directories : nlohmann_inc) endif +csv_inc = include_directories('subprojects/csv-parser/single_include') +csv_dep = declare_dependency(include_directories : csv_inc) + singleapp_proj = subproject('singleapplication') singleapp_lib = singleapp_proj.get_variable('singleapp_lib') singleapp_dep = singleapp_proj.get_variable('singleapp_dep') diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 8add251..0e4b100 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -3,6 +3,11 @@ set(Boost_USE_STATIC_LIBS ON) find_package(Boost 1.62 COMPONENTS date_time REQUIRED) find_package(SQLite3 REQUIRED) +# Because csv-parser needs threads: +set(THREADS_PREFER_PTHREAD_FLAG ON) +find_package(Threads REQUIRED) + + if (MINGW) find_package(XLNT REQUIRED STATIC) else (MINGW) @@ -27,13 +32,12 @@ set(CORE_SOURCES add_library(core STATIC ${CORE_SOURCES}) -target_include_directories(core PRIVATE ${PROJECT_SOURCE_DIR}/3rdparty/csv-parser/include) +target_include_directories(core PRIVATE ${PROJECT_SOURCE_DIR}/subprojects/csv-parser/single_include) if (WIN32) - target_link_libraries(core PRIVATE Boost::boost Boost::date_time sqlite3 nlohmann_json::nlohmann_json ${XLNT_LIBRARY} csv) + target_link_libraries(core PRIVATE Boost::boost Boost::date_time sqlite3 nlohmann_json::nlohmann_json ${XLNT_LIBRARY} Threads::Threads) target_link_libraries(core PRIVATE bcrypt) else() - target_link_libraries(core PRIVATE Boost::boost Boost::date_time sqlite3 nlohmann_json::nlohmann_json ${XLNT_LIBRARIES} csv) + target_link_libraries(core PRIVATE Boost::boost Boost::date_time sqlite3 nlohmann_json::nlohmann_json ${XLNT_LIBRARIES} Threads::Threads) endif() -#target_include_directories(core PRIVATE ${PROJECT_SOURCE_DIR}/3rdparty/csv-parser) target_include_directories(core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/..) diff --git a/src/core/csvreader.cpp b/src/core/csvreader.cpp index 848ddde..7b87044 100644 --- a/src/core/csvreader.cpp +++ b/src/core/csvreader.cpp @@ -2,8 +2,8 @@ #include "utils.h" #include -#include "../../subprojects/csv-parser/single_include/csv.hpp" -//#include + +#include namespace fs = std::filesystem; diff --git a/src/core/meson.build b/src/core/meson.build index c515eb8..a2923b9 100644 --- a/src/core/meson.build +++ b/src/core/meson.build @@ -8,6 +8,6 @@ src = ['database.cpp', 'entity.cpp', 'entityint.cpp', 'entityuuid.cpp', core_inc = include_directories('..') -core_lib = static_library('core', src, dependencies :[boost, xlnt, sqlite, nlohmann_lib]) +core_lib = static_library('core', src, dependencies :[boost, xlnt, sqlite, nlohmann_lib, csv_dep]) core_dep = declare_dependency(link_with : core_lib, include_directories : core_inc) diff --git a/subprojects/CMakeLists.txt b/subprojects/CMakeLists.txt index 94fa640..6ef42eb 100644 --- a/subprojects/CMakeLists.txt +++ b/subprojects/CMakeLists.txt @@ -2,4 +2,4 @@ if(NOT KIMA2_USE_EXTERNAL_JSON) set(JSON_BuildTests OFF CACHE INTERNAL "") add_subdirectory(nlohmann_json EXCLUDE_FROM_ALL) endif() -add_subdirectory(csv-parser) +#add_subdirectory(csv-parser)