Difference between revisions of "Railostools"

From Railway Operation Simulator Wiki
Jump to navigation Jump to search
 
Line 3: Line 3:
 
== Python ==
 
== Python ==
  
The Python module can be found within the <code>python</code> directory of the railostools repository. The module can be installed using <code>pip</code> referring to the repository as the source (replacing <code><release-tag></code> with the latest release [https://github.com/Railway-Op-Sim/railostools/releases/latest here]:
+
The Python module can be found within the <code>python</code> directory of the railostools repository. The module can be installed using <code>pip</code> referring to the repository as the source (replacing <code><release-tag></code> with the latest release [https://github.com/Railway-Op-Sim/railostools/releases/latest here]):
  
 
<pre>
 
<pre>

Latest revision as of 21:59, 16 May 2023

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 files, railway and timetable files. The source code is available on the Railway-Op-Sim GitHub Organisation and the project can be contributed to by anyone.

Python

The Python module can be found within the python directory of the railostools repository. The module can be installed using pip referring to the repository as the source (replacing <release-tag> with the latest release here):

$ pip install "git+https://github.com/Railway-Op-Sim/railostools.git#egg=<release-tag>&subdirectory=python"

C++

The C++ library can be found within the cpp 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:

$ mkdir external
$ git submodule add https://github.com/Railway-Op-Sim/railostools.git external/railostools

and the library be linked using CMake:

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 )

External Links

RailOSTools Repository