Route Planning Project

This repo contains the starter code for the Route Planning project.

Cloning

When cloning this project, be sure to use the --recurse-submodules flag. Using HTTPS:

git clone https://github.com/udacity/CppND-Route-Planning-Project.git --recurse-submodules

or with SSH:

git clone git@github.com:udacity/CppND-Route-Planning-Project.git --recurse-submodules

Dependencies for Running Locally

Compiling and Running

Compiling

To compile the project, first, create a build directory and change to that directory:

mkdir build && cd build

From within the build directory, then run cmake and make as follows:

cmake ..
make

Running

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:

./OSM_A_star_search -f ../<your_osm_file.osm>

Testing

The testing executable is also placed in the build directory. From within build, you can run the unit tests as follows:

./test

Troubleshooting

  • Some students have reported issues in cmake to find io2d packages, make sure you have downloaded this.

  • For MAC Users cmake issues: Comment these lines from CMakeLists.txt under P0267_RefImpl

    if( NOT DEFINED IO2D_WITHOUT_SAMPLES )
         add_subdirectory(P0267_RefImpl/Samples)
    endif()
    

    And then run "ALL_Build" and "install" in XCode.

    If any packages are missing try to install packages using

    brew install pkg-config
    
  • For Ubuntu Linux IO2D installation errors, follow the given steps:

     sudo apt update
     sudo apt install build-essential
     sudo apt install cmake
     sudo apt install libcairo2-dev
     sudo apt install libgraphicsmagick1-dev
     sudo apt install libpng-dev
    
     git clone --recurse-submodules https://github.com/cpp-io2d/P0267_RefImpl
     cd P0267_RefImpl
     mkdir Debug
     cd Debug
     cmake --config Debug "-DCMAKE_BUILD_TYPE=Debug" ..
     cmake --build .
     sudo make install
    
  • If you are working on windows and unable to install IO2D:

    • Enable WSL (Windows Subsystem for Linux) and use a distribution like Ubuntu.(available from the windows store):
    • Install the required dependencies (compiler, cmake etc.) in the WSL(as mentioned above for ubuntu)
    • Configure CLion to use the WSL toolchain
    • Use the WSL toolchain to build the project
    • If you are still facing errors, visit this link.
  • If you are facing errors with --config try to remove -- from the command.

Coding Resources

Resources on coding practices

  • For beginners to write code with high readability.
  • More advanced advice from an experienced developer.

Resources for performance optimization

Resources on software testing

The test framework used in this project is the Google C++ test. It is recommended to know about testing now because it is an essential element in software development.

Resources on CMake and Make

In the beginning, it is usually unclear what those build systems or build system generators are and how they can benefit us.

  • Overview of CMake and how it manages cross-platform build processes.
  • Introduction to CMake by examples applies to single file and multiple directory projects.

Please note that CMake isn't a build system. It's a build system generator. This is why we need to invoke make after running CMake. Running CMake generates Makefiles with the appropriate platform dependencies, and running make uses them.

However, we don't need to write Make files, as CMake does this for us. It is good to understand build systems.

  • Introduction to Make and how it uses the Makefile generated by CMake to build the system.
  • How to write Makefiles. This is just for your information. It is already automated through CMake.

Further improvement