From 4e4d2c5ce0116a1317ebe564ffb34c38319f3fc1 Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Sat, 3 Mar 2018 13:02:33 +0200 Subject: [PATCH] Remove git submodules in favor of cmake's ExternalProject --- .gitignore | 3 +++ .gitmodules | 6 ------ CMakeLists.txt | 26 ++++++++++++++------------ cmake/LMDBXX.cmake | 25 +++++++++++++++++++++++++ cmake/MatrixStructs.cmake | 27 +++++++++++++++++++++++++++ libs/lmdbxx | 1 - libs/matrix-structs | 1 - 7 files changed, 69 insertions(+), 20 deletions(-) delete mode 100644 .gitmodules create mode 100644 cmake/LMDBXX.cmake create mode 100644 cmake/MatrixStructs.cmake delete mode 160000 libs/lmdbxx delete mode 160000 libs/matrix-structs diff --git a/.gitignore b/.gitignore index e232f844..cb860801 100644 --- a/.gitignore +++ b/.gitignore @@ -91,3 +91,6 @@ compile_commands.json *.rpm *.deb package.dir + +# Dependencies +.third-party diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 737a3e0b..00000000 --- a/.gitmodules +++ /dev/null @@ -1,6 +0,0 @@ -[submodule "libs/lmdbxx"] - path = libs/lmdbxx - url = https://github.com/bendiken/lmdbxx -[submodule "libs/matrix-structs"] - path = libs/matrix-structs - url = https://github.com/mujx/matrix-structs diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ab8a63b..3f0c44e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,13 +45,6 @@ else() find_package_handle_standard_args(LMDB DEFAULT_MSG LMDB_INCLUDE_DIR LMDB_LIBRARY) endif() -if (NOT EXISTS "${CMAKE_SOURCE_DIR}/libs/lmdbxx/.git" OR - NOT EXISTS "${CMAKE_SOURCE_DIR}/libs/matrix-structs/.git") - message(WARNING "The git submodules are not available.") - message(STATUS "Running git submodule update --init --recursive ...") - execute_process(COMMAND git submodule update --init --recursive) -endif() - # # Discover Qt dependencies. # @@ -219,10 +212,21 @@ set(SRC_FILES src/main.cc ) +# +# matrix-structs +# +include(${CMAKE_SOURCE_DIR}/cmake/MatrixStructs.cmake) +include_directories(${MATRIX_STRUCTS_INCLUDE_DIRS}) + +# +# lmdbxx +# +include(${CMAKE_SOURCE_DIR}/cmake/LMDBXX.cmake) +include_directories(${LMDBXX_INCLUDE_DIRS}) + include_directories(include) include_directories(include/ui) -include_directories(libs/lmdbxx) include_directories(${LMDB_INCLUDE_DIR}) qt5_wrap_cpp(MOC_HEADERS @@ -317,10 +321,6 @@ endif() qt5_add_resources(LANG_QRC ${_qrc}) qt5_add_resources(QRC resources/res.qrc) -add_subdirectory(libs/matrix-structs) -include_directories(${matrix_structs_SOURCE_DIR}/include) -include_directories(${matrix_structs_SOURCE_DIR}/deps) - set(COMMON_LIBS matrix_structs Qt5::Widgets Qt5::Network Qt5::Concurrent) if(APPVEYOR_BUILD) @@ -342,6 +342,8 @@ else() target_link_libraries (nheko ${NHEKO_LIBS} Qt5::Multimedia) endif() +add_dependencies(nheko MatrixStructs lmdbxx) + if(UNIX AND NOT APPLE) install (TARGETS nheko RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") install (FILES "resources/nheko-16.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/16x16/apps" RENAME "nheko.png") diff --git a/cmake/LMDBXX.cmake b/cmake/LMDBXX.cmake new file mode 100644 index 00000000..502d6b6c --- /dev/null +++ b/cmake/LMDBXX.cmake @@ -0,0 +1,25 @@ +include(ExternalProject) + +# +# Build lmdbxx. +# + +set(THIRD_PARTY_ROOT ${CMAKE_SOURCE_DIR}/.third-party) +set(LMDBXX_ROOT ${THIRD_PARTY_ROOT}/lmdbxx) + +set(LMDBXX_INCLUDE_DIRS ${LMDBXX_ROOT}) + +ExternalProject_Add( + lmdbxx + + GIT_REPOSITORY https://github.com/bendiken/lmdbxx + GIT_TAG 0b43ca87d8cfabba392dfe884eb1edb83874de02 + + BUILD_IN_SOURCE 1 + SOURCE_DIR ${LMDBXX_ROOT} + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" +) + +include_directories(SYSTEM ${LMDBXX_ROOT}) diff --git a/cmake/MatrixStructs.cmake b/cmake/MatrixStructs.cmake new file mode 100644 index 00000000..447deecf --- /dev/null +++ b/cmake/MatrixStructs.cmake @@ -0,0 +1,27 @@ +include(ExternalProject) + +# +# Build matrix-structs. +# + +set(THIRD_PARTY_ROOT ${CMAKE_SOURCE_DIR}/.third-party) +set(MATRIX_STRUCTS_ROOT ${THIRD_PARTY_ROOT}/matrix_structs) + +set(MATRIX_STRUCTS_INCLUDE_DIRS ${MATRIX_STRUCTS_ROOT}/deps) + +ExternalProject_Add( + MatrixStructs + + GIT_REPOSITORY https://github.com/mujx/matrix-structs + GIT_TAG 83be1388e632a43f0570857cb79313c09fb3da0b + + BUILD_IN_SOURCE 1 + SOURCE_DIR ${MATRIX_STRUCTS_ROOT} + CONFIGURE_COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${MATRIX_STRUCTS_ROOT} + BUILD_COMMAND ${CMAKE_COMMAND} --build ${MATRIX_STRUCTS_ROOT} + INSTALL_COMMAND "" +) + +include_directories(SYSTEM ${MATRIX_STRUCTS_ROOT}/deps) +include_directories(SYSTEM ${MATRIX_STRUCTS_ROOT}/include) +link_directories(${MATRIX_STRUCTS_ROOT}) diff --git a/libs/lmdbxx b/libs/lmdbxx deleted file mode 160000 index 0b43ca87..00000000 --- a/libs/lmdbxx +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0b43ca87d8cfabba392dfe884eb1edb83874de02 diff --git a/libs/matrix-structs b/libs/matrix-structs deleted file mode 160000 index 335ece4c..00000000 --- a/libs/matrix-structs +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 335ece4cbe411393e9179621a299dd96433c1757