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 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 deleted file mode 100644 index 0b9e413..0000000 --- a/.gitmodules +++ /dev/null @@ -1,9 +0,0 @@ -[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..173338a --- /dev/null +++ b/.pkg @@ -0,0 +1,14 @@ +[cppgtfs] + url=git@github.com:vesavlad/cppgtfs.git + 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 + commit=c7202d1435b6a4d460fc38b59ca131620b204c4f diff --git a/CMakeLists.txt b/CMakeLists.txt index ce5e3e7..293c96c 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) @@ -63,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 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 fbf3449..7857033 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,6 +10,4 @@ include_directories( add_subdirectory(util) add_subdirectory(pfaedle) -add_subdirectory(cppgtfs) -add_subdirectory(configparser) add_subdirectory(shapevl) 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 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..43734bd 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 configparser) 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/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}) 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