Changes

Jump to navigation Jump to search
1,155 bytes added ,  09:45, 14 January 2023
Started C++ guide
Line 1: Line 1:  
'''railostools''' is a set of Application Programming Interfaces for [[Railway Operation Simulator]] with implementations written in Python, C++, Java and Rust. Features for each implementation vary, but include libraries for constructing and parsing [[metadata file|metadata files]], [[.rly file|railway]] and [[.ttb file|timetable]] files. The source code is available on the [[Developer GitHub Organisation|Railway-Op-Sim GitHub Organisation]] and the project can be contributed to by anyone.
 
'''railostools''' is a set of Application Programming Interfaces for [[Railway Operation Simulator]] with implementations written in Python, C++, Java and Rust. Features for each implementation vary, but include libraries for constructing and parsing [[metadata file|metadata files]], [[.rly file|railway]] and [[.ttb file|timetable]] files. The source code is available on the [[Developer GitHub Organisation|Railway-Op-Sim GitHub Organisation]] and the project can be contributed to by anyone.
 +
 +
== C++ ==
 +
 +
The C++ library can be found in the <code>cpp</code> directory of the railostools repository. The framework requires a compiler which supports C++17 or greater, and has been tested on both GCC and Clang for Windows, macOS and Linux. It is recommended that the repository be added as a submodule in git to your project:
 +
 +
<pre>
 +
$ mkdir external
 +
$ git submodule add https://github.com/Railway-Op-Sim/railostools.git external/railostools
 +
</pre>
 +
 +
and the library be linked using CMake:
 +
<pre>
 +
cmake_minimum_required( VERSION 3.21 )
 +
set( CMAKE_CXX_STANDARD 17 )
 +
set( CMAKE_CXX_STANDARD_REQUIRED True )
 +
set( RAILOSTOOLS railostools )
 +
 +
project( MyProject VERSION 0.1.0 LANGUAGES CXX )
 +
 +
# E.g. find all project source files (in 'src' directory with .cxx suffix) to compile code
 +
file( PROJECT_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src*.cxx )
 +
 +
add_subdirectory( ${CMAKE_CURRENT_SOURCE_DIR}/external/railostools/cpp )
 +
 +
add_executable( ${PROJECT_NAME} ${PROJECT_SRC_FILES} )
 +
target_link_library( ${PROJECT_NAME} PUBLIC ${RAILOSTOOLS} )
 +
target_include_directories( ${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/external/railostools/cpp/include )
 +
</pre>
    
[[Category:External tools]]
 
[[Category:External tools]]
confirmed, superuser, Administrators
539

edits

Navigation menu