Skip to content

Commit

Permalink
Extended README.md and restructured CMake configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
michikommader committed Apr 29, 2017
1 parent a66912e commit fb20e22
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 10 deletions.
14 changes: 7 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
cmake_minimum_required(VERSION 2.6)

project (xodr)
include(FindXercesC)

# STATIC library output directory
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib)

add_library(libXodr STATIC src/OpenDRIVE_1.4H.cpp)
add_library(xodr STATIC src/OpenDRIVE_1.4H.cpp)
set_property(TARGET xodr PROPERTY POSITION_INDEPENDENT_CODE ON)

find_path(XSD_INCLUDE xsd)
find_path(XERCES_INCLUDE xercesc)
find_library(XERCES_LIB xerces-c_3.lib)
find_package(XercesC REQUIRED)
find_path(XSD_INCLUDE_DIR xsd)

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${XSD_INCLUDE} ${XERCES_INCLUDE})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${XSD_INCLUDE_DIR} ${XercesC_INCLUDE_DIR})

target_link_libraries(libXodr "${XERCES_LIB}")
target_link_libraries(${PROJECT_NAME} ${XercesC_LIBRARY})
27 changes: 24 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
# xodr
Easily accessible C++ object structure of OpenDRIVE.
Easily accessible C++ object structure of OpenDRIVE automatically generated from the [OpenDRIVE XSD schema](http://opendrive.org/download.html). Currently only OpenDRIVE 1.4 is supported.

## Building
### Dependencies
Make sure to meet the dependencies in advande. **xodr** depends on
- [CodeSynthesis XSD](http://codesynthesis.com/products/xsd/) in conjunction with
- [Xerces-C++](https://xerces.apache.org/xerces-c/)
### Building on Unix
With CMake as plattform-independent build tool **xodr** can be configured for various native build environments. An exemplary configuration for Make under Unix:
```
cd xodr
mkdir build
cd build
cmake ..
```
To build the project afterwards run
```
make
```
If everything went fine you will find the resulting library in the `lib/` folder of the project root.

## Source Code Generation
The C++ class structure can been automatically generated, e.g., using the XML data binding tool `xsd` from [CodeSynthesis XSD](http://codesynthesis.com/products/xsd/). The code used here in `xodr` was generated as follows:
For convenience the underlying OpenDRIVE schema is provided in `schema/` but can be obtained from the [OpenDRIVE download section](http://opendrive.org/download.html) in recent and previous versions. The C++ class structure was generated with [CodeSynthesis XSD](http://codesynthesis.com/products/xsd/) and can be automatically re-generated using the XML data binding tool `xsd`. The code used in **xodr** was generated with `xsd` version 4.0.0 as follows:
```
xsd cxx-tree --hxx-suffix .h --cxx-suffix .cpp --reserved-name access=parkingSpace_access --reserved-name link=lane_link OpenDRIVE_1.4H.xsd
xsd cxx-tree --hxx-suffix .h --cxx-suffix .cpp --reserved-name access=parkingSpace_access --reserved-name link=lane_link schema/OpenDRIVE_1.4H.xsd
```
## Licence
Due to XSD's [FLOSS Exception](http://www.codesynthesis.com/projects/xsd/FLOSSE) the generated code is includable in various Free/Libre and Open Source Software projects, see [XSD Licence](http://www.codesynthesis.com/products/xsd/license.xhtml).

0 comments on commit fb20e22

Please sign in to comment.