Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Use pkg for external deps #40

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ compile_commands.json
[._]s[a-w][a-z]
*.cppr
*.hr
cmake-build-debug
deps
9 changes: 0 additions & 9 deletions .gitmodules

This file was deleted.

14 changes: 14 additions & 0 deletions .pkg
Original file line number Diff line number Diff line change
@@ -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
9 changes: 1 addition & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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
Expand Down
40 changes: 40 additions & 0 deletions cmake/pkg.cmake
Original file line number Diff line number Diff line change
@@ -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"
)
2 changes: 0 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ include_directories(

add_subdirectory(util)
add_subdirectory(pfaedle)
add_subdirectory(cppgtfs)
add_subdirectory(configparser)
add_subdirectory(shapevl)
1 change: 0 additions & 1 deletion src/configparser
Submodule configparser deleted from ca166b
1 change: 0 additions & 1 deletion src/cppgtfs
Submodule cppgtfs deleted from 192272
3 changes: 2 additions & 1 deletion src/pfaedle/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion src/pfaedle/gtfs/Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/pfaedle/osm/OsmBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/pfaedle/osm/OsmBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion src/shapevl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
1 change: 0 additions & 1 deletion src/xml
Submodule xml deleted from ee9210