-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
323 additions
and
1,143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,50 @@ | ||
cmake_minimum_required(VERSION 3.11.3) | ||
|
||
if(NOT TESTING) | ||
set(TESTING "notest") | ||
endif() | ||
|
||
message("TESTING = ${TESTING}") | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) | ||
|
||
# Use the CMakeLists.txt's parent-directory-name for the project's id/name | ||
get_filename_component(PROJECT_ID ${CMAKE_CURRENT_SOURCE_DIR} NAME) | ||
string(REPLACE " " "_" PROJECT_ID ${PROJECT_ID}) | ||
project(${PROJECT_ID}) | ||
project(OSM_A_star_search) | ||
|
||
# | ||
# Project Output Paths | ||
# | ||
set(MAINFOLDER ${PROJECT_SOURCE_DIR}) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${MAINFOLDER}/bin") | ||
set(LIBRARY_OUTPUT_PATH "${MAINFOLDER}/lib") | ||
|
||
# | ||
# Locate Project Prerequisites | ||
# | ||
find_package(io2d REQUIRED) | ||
find_package(Cairo) | ||
find_package(GraphicsMagick) | ||
|
||
# | ||
# Add Build Targets | ||
# | ||
set(IO2D_WITHOUT_SAMPLES 1) | ||
set(IO2D_WITHOUT_TESTS 1) | ||
add_subdirectory(src) | ||
add_subdirectory(test) | ||
add_subdirectory(thirdparty/pugixml) | ||
add_subdirectory(thirdparty/googletest) | ||
|
||
# Find all executables | ||
file(GLOB project_SRCS src/*.cpp src/*.h) | ||
|
||
# Add project executable | ||
add_executable(OSM_A_star_search ${project_SRCS}) | ||
|
||
target_link_libraries(OSM_A_star_search | ||
PRIVATE io2d::io2d | ||
PUBLIC pugixml | ||
) | ||
|
||
if( ${CMAKE_SYSTEM_NAME} MATCHES "Linux" ) | ||
target_link_libraries(OSM_A_star_search PUBLIC pthread) | ||
endif() | ||
|
||
if(MSVC) | ||
target_compile_options(OSM_A_star_search PUBLIC /D_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING /wd4459) | ||
endif() | ||
|
||
# Create a library for unit tests | ||
add_library(route_planner OBJECT src/route_planner.cpp src/model.cpp src/route_model.cpp) | ||
target_include_directories(route_planner PRIVATE thirdparty/pugixml/src) | ||
|
||
# Add testing executable | ||
add_executable(test test/utest_rp_a_star_search.cpp) | ||
target_link_libraries(test gtest_main route_planner pugixml) | ||
add_test(NAME test COMMAND test) | ||
unset(TESTING CACHE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
# Route Planning Project Starter Code | ||
# Route Planning Project | ||
|
||
This is the starter code for the Route Planning project. Instructions for each exercise can be found in the `instructions` directory, and unit tests for some exercises in the `test` directory. | ||
This repo contains the starter code for the Route Planning project. | ||
|
||
<img src="map.png" width="600" height="450" /> | ||
|
||
## Cloning | ||
|
||
|
@@ -13,6 +15,21 @@ or with SSH: | |
git clone [email protected]:udacity/CppND-Route-Planning-Project.git --recurse-submodules | ||
``` | ||
|
||
## Dependencies for Running Locally | ||
* cmake >= 3.11.3 | ||
* All OSes: [click here for installation instructions](https://cmake.org/install/) | ||
* make >= 4.1 (Linux, Mac), 3.81 (Windows) | ||
* Linux: make is installed by default on most Linux distros | ||
* Mac: [install Xcode command line tools to get make](https://developer.apple.com/xcode/features/) | ||
* Windows: [Click here for installation instructions](http://gnuwin32.sourceforge.net/packages/make.htm) | ||
* gcc/g++ >= 7.4.0 | ||
* Linux: gcc / g++ is installed by default on most Linux distros | ||
* Mac: same instructions as make - [install Xcode command line tools](https://developer.apple.com/xcode/features/) | ||
* Windows: recommend using [MinGW](http://www.mingw.org/) | ||
* IO2D | ||
* Installation instructions for all operating systems can be found [here](https://github.com/cpp-io2d/P0267_RefImpl/blob/master/BUILDING.md) | ||
* This library must be built in a place where CMake `find_package` will be able to find it | ||
|
||
## Compiling and Running | ||
|
||
### Compiling | ||
|
@@ -26,33 +43,19 @@ cmake .. | |
make | ||
``` | ||
### Running | ||
The executables will be placed in the `bin` directory. From within `build`, you can run the project as follows: | ||
The executable will be placed in the `build` directory. From within `build`, you can run the project as follows: | ||
``` | ||
./OSM_A_star_search | ||
``` | ||
Or to specify a map file: | ||
``` | ||
../bin/<name-of-parent-directory> -f ../map.osm | ||
./OSM_A_star_search -f ../<your_osm_file.osm> | ||
``` | ||
|
||
## Testing | ||
|
||
For exercises that have unit tests, the project must be built with the approprate test cpp file. This can be done by passing a string with the `-DTESTING` flag in `cmake`. For example, from the build directory: | ||
The testing executable is also placed in the `build` directory. From within `build`, you can run the unit tests as follows: | ||
``` | ||
cmake -DTESTING="RouteModel" .. | ||
make | ||
``` | ||
Those commands will build the code with the tests for the "Fill Out Route Model" exercise. The tests can then be run from the `build` directory as follows: | ||
./test | ||
``` | ||
../bin/test | ||
``` | ||
Exercises with tests will specify which string to pass with `-DTESTING`, but a table is given below with the complete list for reference: | ||
|
||
| Exercise Name | `-DTESTING` String Value | | ||
|-----------------------------|:------------------------:| | ||
| Fill Out Route Model | "RouteModel" | | ||
| Fill Out Node Class | "RMNodeClass" | | ||
| Create RouteModel Nodes | "RMSNodes" | | ||
| Write the Distance Function | "NodeDist" | | ||
| Create Road to Node Hashmap | "NodeToRoad" | | ||
| Write FindNeighbors | "FindNeighbors" | | ||
| Find the Closest Node | "FindClosest" | | ||
| Write the A\* Search Stub | "AStarStub" | | ||
| Finish A\* Search | "AStarSearch" | | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.