From 97cd3e988dfe286262e619a97d37754925244886 Mon Sep 17 00:00:00 2001 From: Vlad Vesa Date: Thu, 23 Feb 2023 17:17:51 +0200 Subject: [PATCH 1/6] make use of pkg for modeling external dependencies --- .gitignore | 2 ++ .gitmodules | 6 ------ .pkg | 9 +++++++++ CMakeLists.txt | 1 + src/CMakeLists.txt | 1 - src/cppgtfs | 1 - src/pfaedle/CMakeLists.txt | 3 ++- src/pfaedle/gtfs/Writer.cpp | 2 +- src/pfaedle/osm/OsmBuilder.cpp | 2 +- src/pfaedle/osm/OsmBuilder.h | 2 +- src/xml | 1 - 11 files changed, 17 insertions(+), 13 deletions(-) create mode 100644 .pkg delete mode 160000 src/cppgtfs delete mode 160000 src/xml diff --git a/.gitignore b/.gitignore index 880d38c..bfd91c5 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ compile_commands.json [._]s[a-w][a-z] *.cppr *.hr +cmake-build-debug +deps diff --git a/.gitmodules b/.gitmodules index 0b9e413..39fc129 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,3 @@ -[submodule "src/cppgtfs"] - path = src/cppgtfs - url = https://github.com/ad-freiburg/cppgtfs.git -[submodule "src/xml"] - path = src/xml - url = https://github.com/patrickbr/pfxml.git [submodule "src/configparser"] path = src/configparser url = https://git.patrickbrosi.de/patrick/configparser diff --git a/.pkg b/.pkg new file mode 100644 index 0000000..02784c0 --- /dev/null +++ b/.pkg @@ -0,0 +1,9 @@ +[cppgtfs] + url=git@github.com:vesavlad/cppgtfs.git + branch=add-propper-cmake-project-definition + commit=69dcdbf392b30777dbfc943c6ca512f33df8eac6 + +[pfxml] + url=git@github.com:patrickbr/pfxml.git + branch=master + commit=c7202d1435b6a4d460fc38b59ca131620b204c4f diff --git a/CMakeLists.txt b/CMakeLists.txt index ce5e3e7..de4c1a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ cmake_minimum_required (VERSION 2.8) project (pfaedle) +include(cmake/pkg.cmake) if (CMAKE_BUILD_TYPE) string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fbf3449..13c1a4d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,6 +10,5 @@ include_directories( add_subdirectory(util) add_subdirectory(pfaedle) -add_subdirectory(cppgtfs) add_subdirectory(configparser) add_subdirectory(shapevl) diff --git a/src/cppgtfs b/src/cppgtfs deleted file mode 160000 index 192272f..0000000 --- a/src/cppgtfs +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 192272f4ab542e75ffad9b545be5cc68e5599828 diff --git a/src/pfaedle/CMakeLists.txt b/src/pfaedle/CMakeLists.txt index e36ccf1..82acc1d 100644 --- a/src/pfaedle/CMakeLists.txt +++ b/src/pfaedle/CMakeLists.txt @@ -17,8 +17,9 @@ configure_file ( add_executable(pfaedle ${pfaedle_main}) add_library(pfaedle_dep ${pfaedle_SRC}) +target_link_libraries(pfaedle_dep PRIVATE ad_cppgtfs pfxml) include_directories(pfaedle_dep PUBLIC ${PROJECT_SOURCE_DIR}/src/cppgtfs/src) -target_link_libraries(pfaedle pfaedle_dep util configparser ad_cppgtfs -lpthread ${LIBZIP_LIBRARY}) +target_link_libraries(pfaedle pfaedle_dep util configparser -lpthread ${LIBZIP_LIBRARY}) add_subdirectory(tests) diff --git a/src/pfaedle/gtfs/Writer.cpp b/src/pfaedle/gtfs/Writer.cpp index 0380fc1..6c38729 100644 --- a/src/pfaedle/gtfs/Writer.cpp +++ b/src/pfaedle/gtfs/Writer.cpp @@ -18,7 +18,7 @@ #include "ad/cppgtfs/Parser.h" #include "ad/cppgtfs/Writer.h" #include "ad/cppgtfs/gtfs/flat/Agency.h" -#include "ad/util/CsvWriter.h" +#include "ad/cppgtfs/util/CsvWriter.h" #include "pfaedle/gtfs/Writer.h" using ad::cppgtfs::Parser; diff --git a/src/pfaedle/osm/OsmBuilder.cpp b/src/pfaedle/osm/OsmBuilder.cpp index 425e283..d385412 100644 --- a/src/pfaedle/osm/OsmBuilder.cpp +++ b/src/pfaedle/osm/OsmBuilder.cpp @@ -24,7 +24,7 @@ #include "util/Misc.h" #include "util/Nullable.h" #include "util/log/Log.h" -#include "xml/pfxml.h" +#include "pfxml/pfxml.h" using ad::cppgtfs::gtfs::Stop; using pfaedle::osm::BlockSearch; diff --git a/src/pfaedle/osm/OsmBuilder.h b/src/pfaedle/osm/OsmBuilder.h index 9cf1505..73b8e9e 100644 --- a/src/pfaedle/osm/OsmBuilder.h +++ b/src/pfaedle/osm/OsmBuilder.h @@ -25,7 +25,7 @@ #include "util/Nullable.h" #include "util/geo/Geo.h" #include "util/xml/XmlWriter.h" -#include "xml/pfxml.h" +#include "pfxml/pfxml.h" namespace pfaedle { namespace osm { diff --git a/src/xml b/src/xml deleted file mode 160000 index ee92108..0000000 --- a/src/xml +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ee9210828b1d1f81fb9ff9f3b7da87327c3390e6 From 9f23a5f7c0731283013966801195f71875520ab6 Mon Sep 17 00:00:00 2001 From: Vlad Vesa Date: Thu, 23 Feb 2023 17:36:24 +0200 Subject: [PATCH 2/6] move dependencies to use pkg --- .gitmodules | 3 --- .pkg | 5 +++++ cmake/pkg.cmake | 40 ++++++++++++++++++++++++++++++++++++++ src/CMakeLists.txt | 1 - src/pfaedle/CMakeLists.txt | 2 +- 5 files changed, 46 insertions(+), 5 deletions(-) delete mode 100644 .gitmodules create mode 100644 cmake/pkg.cmake diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 39fc129..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "src/configparser"] - path = src/configparser - url = https://git.patrickbrosi.de/patrick/configparser diff --git a/.pkg b/.pkg index 02784c0..173338a 100644 --- a/.pkg +++ b/.pkg @@ -3,6 +3,11 @@ branch=add-propper-cmake-project-definition commit=69dcdbf392b30777dbfc943c6ca512f33df8eac6 +[config-parser] + url=git@github.com:vesavlad/config-parser.git + branch=master + commit=f96586a5522312fc4d1d8aa67cc5b7ec9039a825 + [pfxml] url=git@github.com:patrickbr/pfxml.git branch=master diff --git a/cmake/pkg.cmake b/cmake/pkg.cmake new file mode 100644 index 0000000..a914e96 --- /dev/null +++ b/cmake/pkg.cmake @@ -0,0 +1,40 @@ +set(pkg-bin "${CMAKE_BINARY_DIR}/dl/pkg") +if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + set(pkg-url "pkg") +elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + set(pkg-url "pkg.exe") +elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + set(pkg-url "pkgosx") +else() + message(STATUS "Not downloading pkg tool. Using pkg from PATH.") + set(pkg-bin "pkg") +endif() + +if (pkg-url) + if (NOT EXISTS ${pkg-bin}) + message(STATUS "Downloading pkg binary from https://github.com/motis-project/pkg/releases/latest/download/${pkg-url}") + file(DOWNLOAD "https://github.com/motis-project/pkg/releases/latest/download/${pkg-url}" ${pkg-bin}) + if (UNIX) + execute_process(COMMAND chmod +x ${pkg-bin}) + endif() + else() + message(STATUS "Pkg binary located in project.") + endif() +endif() + +message(STATUS "${pkg-bin} -l -h -f") +execute_process( + COMMAND ${pkg-bin} -l -h -f + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} +) + +if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/deps") + add_subdirectory(deps) +endif() + +set_property( + DIRECTORY + APPEND + PROPERTY CMAKE_CONFIGURE_DEPENDS + "${CMAKE_CURRENT_SOURCE_DIR}/.pkg" +) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 13c1a4d..7857033 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,5 +10,4 @@ include_directories( add_subdirectory(util) add_subdirectory(pfaedle) -add_subdirectory(configparser) add_subdirectory(shapevl) diff --git a/src/pfaedle/CMakeLists.txt b/src/pfaedle/CMakeLists.txt index 82acc1d..43734bd 100644 --- a/src/pfaedle/CMakeLists.txt +++ b/src/pfaedle/CMakeLists.txt @@ -17,7 +17,7 @@ configure_file ( add_executable(pfaedle ${pfaedle_main}) add_library(pfaedle_dep ${pfaedle_SRC}) -target_link_libraries(pfaedle_dep PRIVATE ad_cppgtfs pfxml) +target_link_libraries(pfaedle_dep PRIVATE ad_cppgtfs pfxml configparser) include_directories(pfaedle_dep PUBLIC ${PROJECT_SOURCE_DIR}/src/cppgtfs/src) target_link_libraries(pfaedle pfaedle_dep util configparser -lpthread ${LIBZIP_LIBRARY}) From 1c7a9ad4f57b511edc8de0bc63c0f171f02638d5 Mon Sep 17 00:00:00 2001 From: Vlad Vesa Date: Thu, 23 Feb 2023 23:05:31 +0200 Subject: [PATCH 3/6] no need for submodule initialization in workflow --- .github/workflows/build.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c1d3ab5..4714abc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,8 +7,6 @@ jobs: steps: - name: Checkout repository code uses: actions/checkout@v2 - - name: Checkout submodules - run: git submodule update --init --recursive - name: install dependencies run: sudo apt install -y cmake g++-5 gcc-5 - name: cmake @@ -26,8 +24,6 @@ jobs: steps: - name: Checkout repository code uses: actions/checkout@v2 - - name: Checkout submodules - run: git submodule update --init --recursive - name: install dependencies run: sudo apt install -y cmake gcc g++ - name: cmake @@ -41,8 +37,6 @@ jobs: steps: - name: Checkout repository code uses: actions/checkout@v2 - - name: Checkout submodules - run: git submodule update --init --recursive - name: install dependencies run: sudo apt install -y cmake gcc g++ - name: cmake @@ -56,8 +50,6 @@ jobs: steps: - name: Checkout repository code uses: actions/checkout@v2 - - name: Checkout submodules - run: git submodule update --init --recursive - name: install dependencies run: sudo apt install -y cmake clang-3.9 - name: cmake @@ -75,8 +67,6 @@ jobs: steps: - name: Checkout repository code uses: actions/checkout@v2 - - name: Checkout submodules - run: git submodule update --init --recursive - name: install dependencies run: sudo apt install -y cmake clang - name: cmake @@ -94,8 +84,6 @@ jobs: steps: - name: Checkout repository code uses: actions/checkout@v2 - - name: Checkout submodules - run: git submodule update --init --recursive - name: install dependencies run: sudo apt install -y cmake clang - name: cmake @@ -113,8 +101,6 @@ jobs: steps: - name: Checkout repository code uses: actions/checkout@v2 - - name: Checkout submodules - run: git submodule update --init --recursive - name: install dependencies run: brew install cmake - name: cmake @@ -128,8 +114,6 @@ jobs: steps: - name: Checkout repository code uses: actions/checkout@v2 - - name: Checkout submodules - run: git submodule update --init --recursive - name: install dependencies run: brew install cmake - name: cmake From 0be99e1c08343f8c0f2670fd7097e24aae716d15 Mon Sep 17 00:00:00 2001 From: Vlad Vesa Date: Thu, 23 Feb 2023 23:14:21 +0200 Subject: [PATCH 4/6] fixed shapevl app build --- src/shapevl/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/shapevl/CMakeLists.txt b/src/shapevl/CMakeLists.txt index bb55963..a191030 100644 --- a/src/shapevl/CMakeLists.txt +++ b/src/shapevl/CMakeLists.txt @@ -12,6 +12,7 @@ include_directories( add_executable(shapevl ${shapevl_main}) add_library(shapevl_dep ${shapevl_SRC}) +target_link_libraries(shapevl_dep PUBLIC ad_cppgtfs) include_directories(shapevl_dep PUBLIC ${PROJECT_SOURCE_DIR}/src/cppgtfs/src) -target_link_libraries(shapevl shapevl_dep util ad_cppgtfs -lpthread ${LIBZIP_LIBRARY}) +target_link_libraries(shapevl shapevl_dep util -lpthread ${LIBZIP_LIBRARY}) From 9a0ff477200be32b58b173bf02db759fc193c9d4 Mon Sep 17 00:00:00 2001 From: Vlad Vesa Date: Thu, 23 Feb 2023 23:18:19 +0200 Subject: [PATCH 5/6] remove config parser submodule for good --- src/configparser | 1 - 1 file changed, 1 deletion(-) delete mode 160000 src/configparser diff --git a/src/configparser b/src/configparser deleted file mode 160000 index ca166b3..0000000 --- a/src/configparser +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ca166b3446d5bb8b5fb8c6f637ca3f9cb0a8ff3b From f84cf52c2d0c8e1f829432e0833bdb79da8e464c Mon Sep 17 00:00:00 2001 From: Vlad Vesa Date: Thu, 23 Feb 2023 23:20:29 +0200 Subject: [PATCH 6/6] do not trigger git submodule init with cmake since it is not needed anymore --- CMakeLists.txt | 8 -------- 1 file changed, 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index de4c1a3..293c96c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,14 +64,6 @@ else() set(VERSION_GIT_FULL "${VERSION_GIT}-${VERSION_GIT_IS_DIRTY}") endif() -# Download submodules if needed - -if(NOT EXISTS ${CMAKE_SOURCE_DIR}/src/configparser/.git OR NOT EXISTS ${CMAKE_SOURCE_DIR}/src/cppgtfs/.git OR NOT EXISTS ${CMAKE_SOURCE_DIR}/src/xml/.git) - execute_process( - COMMAND git submodule update --init --recursive - ) -endif() - add_subdirectory(src) # tests