Difference between revisions of "Railostools"
(Changed file links) Tags: Mobile web edit Mobile edit Advanced mobile edit |
(→Python) |
||
(8 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | '''railostools''' is a set of | + | '''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. |
+ | |||
+ | == 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]): | ||
+ | |||
+ | <pre> | ||
+ | $ pip install "git+https://github.com/Railway-Op-Sim/railostools.git#egg=<release-tag>&subdirectory=python" | ||
+ | </pre> | ||
+ | |||
+ | == C++ == | ||
+ | |||
+ | The C++ library can be found within 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> | ||
+ | |||
+ | == External Links == | ||
+ | |||
+ | [https://github.com/Railway-Op-Sim/railostools RailOSTools Repository] | ||
[[Category:External tools]] | [[Category:External tools]] |
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 )