mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-30 16:40:28 +01:00
Checkpoint of the editor branch so work isn't carried loose across a branch switch. Builds. - maj0sted turnout geometry moved into the domain: domain::lay_turnout lays the diverging path (pre-blade lead, blade at beta, arc of alfa-beta, frog rail) and solve_junction is a thin adapter onto it. - the maj0sted web/ tree renamed to editor/ (namespace and paths) - there is no WASM here, it's plain native C++ the editor calls. - click places the switch at its start (początek rozjazdu); the branch's leaving straight is locked tangent to the frog; switches can be slid along the through track and flipped L/P. - Polish turnout templates carry catalogue length (Id-1-consistent lengths), plus blade-angle and pre-blade fields (left 0 until the catalogue figures are in). - TURNOUT_SPEC.md: the Bezier-based runtime/model contract. - also folds in other pending branch changes (scenery, tests) to leave a clean tree.
118 lines
3.8 KiB
CMake
118 lines
3.8 KiB
CMake
cmake_minimum_required(VERSION 3.20)
|
|
|
|
project(maj0sted
|
|
VERSION 0.1.0
|
|
DESCRIPTION "Domain-Driven Design library for a railway track-layout editor"
|
|
LANGUAGES CXX)
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# Options
|
|
# ----------------------------------------------------------------------------
|
|
option(MAJ0STED_BUILD_TESTS "Build unit tests" ON)
|
|
option(MAJ0STED_BUILD_EXAMPLES "Build usage examples" ON)
|
|
option(MAJ0STED_WARNINGS_AS_ERRORS "Treat warnings as errors" OFF)
|
|
|
|
# Only drive tests/examples/install defaults when built on its own, not when
|
|
# pulled in via add_subdirectory() from a larger project.
|
|
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
|
set(MAJ0STED_STANDALONE ON)
|
|
else()
|
|
set(MAJ0STED_STANDALONE OFF)
|
|
endif()
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# The static library
|
|
# ----------------------------------------------------------------------------
|
|
add_library(maj0sted STATIC
|
|
src/domain/map_project.cpp
|
|
src/domain/horizontal_alignment.cpp
|
|
src/domain/vertical_alignment.cpp
|
|
src/domain/niweleta.cpp
|
|
src/domain/parallelism_service.cpp
|
|
src/domain/fitting_service.cpp
|
|
src/domain/gap_fitter.cpp
|
|
src/domain/turnout.cpp
|
|
src/io/project_serializer.cpp
|
|
src/io/svg_writer.cpp
|
|
src/io/scn_export.cpp
|
|
src/render/plan_sampler.cpp
|
|
src/render/rail_renderer.cpp
|
|
src/editor/solve.cpp
|
|
src/editor/editor.cpp
|
|
src/editor/ribbon.cpp
|
|
src/editor/tile_cache.cpp
|
|
src/app/editor_document.cpp
|
|
src/app/straight_constraints.cpp
|
|
src/app/basket_draft.cpp
|
|
)
|
|
add_library(maj0sted::maj0sted ALIAS maj0sted)
|
|
|
|
target_compile_features(maj0sted PUBLIC cxx_std_20)
|
|
|
|
target_include_directories(maj0sted PUBLIC
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
$<INSTALL_INTERFACE:include>
|
|
)
|
|
|
|
if(MSVC)
|
|
target_compile_options(maj0sted PRIVATE /W4)
|
|
else()
|
|
target_compile_options(maj0sted PRIVATE
|
|
-Wall -Wextra -Wpedantic -Wconversion -Wshadow)
|
|
endif()
|
|
|
|
if(MAJ0STED_WARNINGS_AS_ERRORS)
|
|
if(MSVC)
|
|
target_compile_options(maj0sted PRIVATE /WX)
|
|
else()
|
|
target_compile_options(maj0sted PRIVATE -Werror)
|
|
endif()
|
|
endif()
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# Tests
|
|
# ----------------------------------------------------------------------------
|
|
if(MAJ0STED_BUILD_TESTS AND MAJ0STED_STANDALONE)
|
|
enable_testing()
|
|
add_subdirectory(tests)
|
|
endif()
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# Examples
|
|
# ----------------------------------------------------------------------------
|
|
if(MAJ0STED_BUILD_EXAMPLES AND MAJ0STED_STANDALONE)
|
|
add_subdirectory(examples)
|
|
endif()
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# Install / package
|
|
# ----------------------------------------------------------------------------
|
|
include(GNUInstallDirs)
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
install(TARGETS maj0sted
|
|
EXPORT maj0stedTargets
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
|
|
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
|
|
|
install(EXPORT maj0stedTargets
|
|
FILE maj0stedTargets.cmake
|
|
NAMESPACE maj0sted::
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/maj0sted)
|
|
|
|
configure_package_config_file(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/cmake/maj0stedConfig.cmake.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/maj0stedConfig.cmake
|
|
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/maj0sted)
|
|
|
|
write_basic_package_version_file(
|
|
${CMAKE_CURRENT_BINARY_DIR}/maj0stedConfigVersion.cmake
|
|
VERSION ${PROJECT_VERSION}
|
|
COMPATIBILITY SameMajorVersion)
|
|
|
|
install(FILES
|
|
${CMAKE_CURRENT_BINARY_DIR}/maj0stedConfig.cmake
|
|
${CMAKE_CURRENT_BINARY_DIR}/maj0stedConfigVersion.cmake
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/maj0sted)
|