Skip to content

Commit

Permalink
Interlocking Route Exclusion (#42)
Browse files Browse the repository at this point in the history
* exclusion wip

* exclusion wip

* Story 8: Make UI Tests fail when a JavaScript error occurs (#43)

* add a basic ui test with github actions intergraion

* also run un-tests using firefox

* make ui-tests fail on JS errors

* Parse LZB/ETCS (#44)

* parse detailed lzb/etcs information

* add line model

* track etcs elements in station routes

* split into .h/.cc

* add alias

* add precondition/postcondition alias for asserts

* don't generate IRs when etcs is required

* fix sassert for release

* change line precons into soft preconditions

* fix linting issue

* fix linting issues

* clang tidy

* wip

* wip

* always rename cereal serialization function

* add ymd_to_abs

* add serve_element to soro-server

* clean up tests

* clean up css

* add exclusion set api to soro-server

* read exclusion sets from cliques

* add detail to station api

* fix kss parsing

* fix train iteration

* construct ordering graph with exclusion sets

* update gitignore

* add INVALID_ANCHOR

* remove unnecessary include

* fix ordering graph test case

* resolve merge conflicts

* rename expects -> expect to make room for the expects lambda function

* fix formatting

* print ordering graph statistics

* update utl

* put formatter into fmt namespace

* add absolute_time::operator<=>

* update cereal

* remove operator<=> and use operator<

* use CISTA_COMPARABLE()

* add explicit cast

* ignore meta elements for infrastructure stats

* add explicit cast for trip_to_nodes

* use brace initialization

* fix windows build

* add cross test

* refactor std_wrappers

* pull cycle detection out of simulation graph

* add refactored  std_wrapper

* add ordering graph cross test

* fix windows ci

* make inline

* always break lines for template declarations

* print absolute paths for errors

* remove exclusion sets api

* consistent naming

* fix windows ci

* tidy up

* dont start server in constructor

---------

Co-authored-by: Leon Vack <[email protected]>
  • Loading branch information
julianharbarth and LogicalOverflow authored Mar 21, 2023
1 parent 8f10845 commit 8bcbd96
Show file tree
Hide file tree
Showing 162 changed files with 6,375 additions and 2,927 deletions.
4 changes: 3 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ AccessModifierOffset: -2
ConstructorInitializerAllOnOneLineOrOnePerLine: true
AlignTrailingComments: false
RequiresClausePosition: OwnLine
BreakBeforeConceptDeclarations: Always
# RequiresExpressionIndentation: OuterScope // enable with clang 16
KeepEmptyLinesAtTheStartOfBlocks: true
AllowShortCaseLabelsOnASingleLine: true
AlwaysBreakTemplateDeclarations: true
AlwaysBreakTemplateDeclarations: Yes
SpacesBeforeTrailingComments: 2
IncludeBlocks: Preserve
IncludeCategories:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ jobs:
# ==== WEB TESTS ====
- name: Run Server
run: |
.\build\${{ matrix.config.preset }}\soro-server.exe -t --resource_dir .\resources --server_resource_dir .\build\${{ matrix.config.preset }}\server_resources\
cd build\${{ matrix.config.preset }}\
.\soro-server.exe -t --resource_dir ..\..\resources
# ==== DISTRIBUTION ====
- name: Delete unnecessary files
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
.pkg.mutex
/CMakeSettings.json
resources/infrastructure/de_iss
resources/de_iss
resources/timetable/de_kss
resources/de_kss
# Ignore the file produced by cmake
test/include/test/file_paths.h
16 changes: 14 additions & 2 deletions .pkg
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[cista]
[email protected]:felixguendling/cista.git
branch=master
commit=1ab98b3a3b9b41b12788107325df3d7b7c49efa6
commit=7d56bbdb0f653acdb04f21022e8071d8f67e0c66
[utl]
[email protected]:motis-project/utl.git
branch=master
commit=0be21a91d96f27f2de4583eb5badfd1c873e3f6c
commit=52afc3944fddf974d6875deb690afda58e971771
[doctest]
[email protected]:motis-project/doctest.git
branch=master
Expand Down Expand Up @@ -34,3 +34,15 @@
[email protected]:motis-project/boost.git
branch=master
commit=c90d53bdcd7ff741a416ae122b33c9c2a96e8be7
[net]
[email protected]:motis-project/net.git
branch=master
commit=47a699159ea87e781451ce80e09915e2a8278082
[range-v3]
[email protected]:motis-project/range-v3.git
branch=master
commit=4178d8359d76e3ba612d40a980bc0e5711073ca8
[cereal]
[email protected]:motis-project/cereal.git
branch=master
commit=9e4b49437bc3d47b628a271edd38c1cd7266c669
228 changes: 120 additions & 108 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,50 +8,53 @@ project(soro CXX)
option(SERIALIZE "Enable serialization with cista." OFF)
option(USE_CISTA_RAW "Use cista::raw instead of cista::offset." OFF)

if (SERIALIZE)
set(SORO_COMPILE_DEFINITIONS SERIALIZE ${SORO_COMPILE_DEFINITIONS})
else ()
set(SORO_COMPILE_DEFINITIONS STD ${SORO_COMPILE_DEFINITIONS})
endif ()
if(SERIALIZE)
set(SORO_COMPILE_DEFINITIONS SERIALIZE ${SORO_COMPILE_DEFINITIONS})
else()
set(SORO_COMPILE_DEFINITIONS STD ${SORO_COMPILE_DEFINITIONS})
endif()

if (USE_CISTA_RAW)
set(SORO_COMPILE_DEFINITIONS USE_CISTA_RAW ${SORO_COMPILE_DEFINITIONS})
endif ()
if(USE_CISTA_RAW)
set(SORO_COMPILE_DEFINITIONS USE_CISTA_RAW ${SORO_COMPILE_DEFINITIONS})
endif()

# rename the cereal serialization function to avoid naming conflicts with cista
set(SORO_COMPILE_DEFINITIONS CEREAL_SERIALIZE_FUNCTION_NAME=cereal_serialize ${SORO_COMPILE_DEFINITIONS})

# --- CLANG SUITE OPTIONS --- #
option(SORO_SAN "Run clang with sanitizers." OFF)
option(SORO_LINT "Run clang-tidy with the compiler." OFF)

if (SORO_SAN)
SET(SORO_COMPILE_DEFINITIONS SORO_SAN ${SORO_COMPILE_DEFINITIONS})
SET(SORO_LINK_STATIC "")
else ()
SET(SORO_LINK_STATIC "-static")
endif ()
if(SORO_SAN)
SET(SORO_COMPILE_DEFINITIONS SORO_SAN ${SORO_COMPILE_DEFINITIONS})
SET(SORO_LINK_STATIC "")
else()
SET(SORO_LINK_STATIC "-static")
endif()

if (SORO_LINT)
include(cmake/clang-tidy.cmake)
endif ()
if(SORO_LINT)
include(cmake/clang-tidy.cmake)
endif()

# --- MISC OPTIONS --- #
option(SORO_DEBUG "Build the code with debug information." OFF)
option(SORO_CUDA "Enable GPU-accelerated computing." OFF)

if (SORO_DEBUG)
set(SORO_COMPILE_DEFINITIONS SORO_DEBUG ${SORO_COMPILE_DEFINITIONS})
endif ()
if(SORO_DEBUG)
set(SORO_COMPILE_DEFINITIONS SORO_DEBUG ${SORO_COMPILE_DEFINITIONS})
endif()

if (SORO_CUDA)
set(SORO_COMPILE_DEFINITIONS SORO_CUDA ${SORO_COMPILE_DEFINITIONS})
if(SORO_CUDA)
set(SORO_COMPILE_DEFINITIONS SORO_CUDA ${SORO_COMPILE_DEFINITIONS})

set(SORO_CUDA_ARCH "-gencode arch=compute_75,code=sm_75 -gencode arch=compute_61,code=sm_61")
if (MSVC)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} ${SORO_CUDA_ARCH} -lcudadevrt")
else ()
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} ${SORO_CUDA_ARCH} --compiler-options -static")
endif ()
enable_language(CUDA)
endif ()
set(SORO_CUDA_ARCH "-gencode arch=compute_75,code=sm_75 -gencode arch=compute_61,code=sm_61")
if(MSVC)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} ${SORO_CUDA_ARCH} -lcudadevrt")
else()
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} ${SORO_CUDA_ARCH} --compiler-options -static")
endif()
enable_language(CUDA)
endif()

set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")

Expand All @@ -69,52 +72,59 @@ find_package(Threads REQUIRED)
### --- CXX FLAGS --- ###

set(SORO_COMPILE_OPTIONS "")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(SORO_COMPILE_OPTIONS ${SORO_COMPILE_OPTIONS}
-Weverything
-Wno-c++98-compat
-Wno-c++98-compat-pedantic
-Wno-newline-eof
-Wno-missing-prototypes
-Wno-padded
-Wno-double-promotion
-Wno-undef
-Wno-undefined-reinterpret-cast
-Wno-float-conversion
-Wno-global-constructors
-Wno-exit-time-destructors
-Wno-switch-enum
-Wno-c99-designator
-Wno-zero-as-null-pointer-constant
-Wno-missing-noreturn
-Wno-deprecated-experimental-coroutine
-Werror
-fcoroutines-ts
${SORO_LINK_STATIC}
)

if (CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 15)
set(SORO_COMPILE_OPTIONS ${SORO_COMPILE_OPTIONS}
-Wno-deprecated-non-prototype)
endif ()

if (SORO_SAN)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address,undefined -fno-omit-frame-pointer")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,undefined, -fno-omit-frame-pointer")
endif ()
elseif (MSVC)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(SORO_COMPILE_OPTIONS ${SORO_COMPILE_OPTIONS}
-Weverything
-Wno-c++98-compat
-Wno-c++98-compat-pedantic
-Wno-newline-eof
-Wno-missing-prototypes
-Wno-padded
-Wno-double-promotion
-Wno-undef
-Wno-undefined-reinterpret-cast
-Wno-float-conversion
-Wno-global-constructors
-Wno-exit-time-destructors
-Wno-switch-enum
-Wno-c99-designator
-Wno-zero-as-null-pointer-constant
-Wno-missing-noreturn
-Wno-deprecated-experimental-coroutine
-Werror
-fcoroutines-ts
-fexperimental-library
${SORO_LINK_STATIC}
)

if(CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 15)
set(SORO_COMPILE_OPTIONS ${SORO_COMPILE_OPTIONS}
/WX
)
else ()
-Wno-deprecated-non-prototype)
endif()

if(CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 16)
set(SORO_COMPILE_OPTIONS ${SORO_COMPILE_OPTIONS}
-Wall
-Wextra
-Werror
-fcoroutines
${SORO_LINK_STATIC}
)
endif ()
-Wno-unsafe-buffer-usage) # TODO(julian) try enabling this
endif()

if(SORO_SAN)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address,undefined -fno-omit-frame-pointer")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,undefined, -fno-omit-frame-pointer")
endif()
elseif(MSVC)
set(SORO_COMPILE_OPTIONS ${SORO_COMPILE_OPTIONS}
/WX
)
else()
set(SORO_COMPILE_OPTIONS ${SORO_COMPILE_OPTIONS}
-Wall
-Wextra
-Werror
-fcoroutines
-fconcepts-diagnostics-depth=10
${SORO_LINK_STATIC}
)
endif()

set(SORO_COMPILE_FEATURES cxx_std_20)

Expand All @@ -126,27 +136,27 @@ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
file(GLOB_RECURSE soro-lib-files src/*.cc)
add_library(soro-lib STATIC EXCLUDE_FROM_ALL ${soro-lib-files})

if (SORO_CUDA)
add_library(infrastructure-cuda src/infrastructure/gpu/exclusion.cu)
set_target_properties(infrastructure-cuda PROPERTIES
WINDOWS_EXPORT_ALL_SYMBOLS ON
CUDA_STANDARD 20
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
INSTALL_RPATH "$ORIGIN/../lib:$ORIGIN/")
target_include_directories(infrastructure-cuda PUBLIC include)
set_property(TARGET infrastructure-cuda PROPERTY CUDA_ARCHITECTURES 75 61)
endif ()
if(SORO_CUDA)
add_library(infrastructure-cuda src/infrastructure/gpu/exclusion.cu)
set_target_properties(infrastructure-cuda PROPERTIES
WINDOWS_EXPORT_ALL_SYMBOLS ON
CUDA_STANDARD 20
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
INSTALL_RPATH "$ORIGIN/../lib:$ORIGIN/")
target_include_directories(infrastructure-cuda PUBLIC include)
set_property(TARGET infrastructure-cuda PROPERTY CUDA_ARCHITECTURES 75 61)
endif()

target_compile_options(soro-lib PRIVATE ${SORO_COMPILE_OPTIONS})
target_compile_features(soro-lib PRIVATE ${SORO_COMPILE_FEATURES})
target_compile_definitions(soro-lib PRIVATE ${SORO_COMPILE_DEFINITIONS})
target_include_directories(soro-lib PUBLIC include)
target_link_libraries(soro-lib PRIVATE utl cista date pugixml Threads::Threads)
target_link_libraries(soro-lib PUBLIC utl cista date pugixml range-v3 Threads::Threads)

if (SORO_CUDA)
target_link_libraries(soro-lib PUBLIC infrastructure-cuda)
endif ()
if(SORO_CUDA)
target_link_libraries(soro-lib PUBLIC infrastructure-cuda)
endif()

# Gets us the soro-server-client target
set(SORO_SERVER_DIR ${CMAKE_CURRENT_BINARY_DIR})
Expand All @@ -155,7 +165,7 @@ add_subdirectory(web/client)

# Generate file_paths.h for locating the test resources
configure_file(test/include/test/file_paths.h.in
${CMAKE_CURRENT_SOURCE_DIR}/test/include/test/file_paths.h)
${CMAKE_CURRENT_SOURCE_DIR}/test/include/test/file_paths.h)

# Build the tests by getting all test files and linking to doctest and soro-lib
file(GLOB_RECURSE soro-test-files test/src/*.cc web/server/test/src/*.cc)
Expand All @@ -172,24 +182,26 @@ target_include_directories(soro-test PUBLIC test/include)

# returns all targets except targets defined in deps/-
function(get_all_targets _result _dir)
get_property(_subdirs DIRECTORY "${_dir}" PROPERTY SUBDIRECTORIES)
foreach (_subdir IN LISTS _subdirs)
if (NOT ${_subdir} MATCHES ".*deps.*")
get_all_targets(${_result} "${_subdir}")
endif ()
endforeach ()

get_directory_property(_sub_targets DIRECTORY "${_dir}" BUILDSYSTEM_TARGETS)
set(${_result} ${${_result}} ${_sub_targets} PARENT_SCOPE)
get_property(_subdirs DIRECTORY "${_dir}" PROPERTY SUBDIRECTORIES)
foreach(_subdir IN LISTS _subdirs)
if(NOT ${_subdir} MATCHES ".*deps.*")
get_all_targets(${_result} "${_subdir}")
endif()
endforeach()

get_directory_property(_sub_targets DIRECTORY "${_dir}" BUILDSYSTEM_TARGETS)
set(${_result} ${${_result}} ${_sub_targets} PARENT_SCOPE)
endfunction()

# if linting is on set the clang tidy property on all defined targets
if (SORO_LINT)
get_all_targets(all-targets ${CMAKE_CURRENT_SOURCE_DIR})

foreach (target ${all-targets})
set_target_properties(${target} PROPERTIES
CXX_CLANG_TIDY ${SORO_CLANG_TIDY}
)
endforeach ()
endif ()
if(SORO_LINT)
get_all_targets(all-targets ${CMAKE_CURRENT_SOURCE_DIR})

foreach(target ${all-targets})
set_target_properties(${target} PROPERTIES
CXX_CLANG_TIDY ${SORO_CLANG_TIDY}
)
endforeach()
endif()

add_subdirectory(tools)
Loading

0 comments on commit 8bcbd96

Please sign in to comment.