Domain - Signal carries a SignalType (Power/GndShield/Other), auto-inferred from the name in Signal::Signal via infer_signal_type. Override with the new `set-signal-type` command. - SignalType extracted to its own header so Pin can store an `expected_signal_type` without a pins↔signals include cycle. - pin_role(connector_type, pin_name) → SignalType lookup, called from set-type to populate each Pin's expected_signal_type. The VPX 3U table is currently a stub (returns Other). - New `verify` command walks typed parts and reports pins whose connected signal's type doesn't match the expectation. - ODS importer no longer drops pins with empty signal column — they stay in the part as NC, matching the rule "a pin is either NC or connected to a signal". - persist: new S tag for non-default signal type overrides. Tests - doctest v2.4.11 via FetchContent (with CMAKE_POLICY_VERSION_MINIMUM shim, doctest's CMakeLists has a too-old floor for current CMake). - Source files moved into a static library `essim_lib` so both `essim` and `essim_tests` reuse the same compilation. main.cpp is the only file kept out of the lib. - Layer 1 (pure helpers): ToLower, LongestCommonPrefix, Tokenize, NaturalLess (numeric/case/leading-zero edge cases + total-order invariants), signal_type round-trips and infer_signal_type families, VpxTransform registry + symmetry + reference-table mapping for connector P0 row 1, IdentityTransform same-name wiring. - Layer 2 (round-trip): build a synthetic 2-module system in code, save → restore → assert modules / parts / connector_types / NC pins / signal type overrides / connections + pin_map are all preserved. - Tui::Tokenize moved to a free function in tui_helpers so tests can call it without dragging ftxui into the unit-test layer. - 27 test cases, 123 assertions, ~150 ms. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
66 lines
1.7 KiB
CMake
66 lines
1.7 KiB
CMake
cmake_minimum_required(VERSION 3.14)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
project(essim
|
|
LANGUAGES CXX
|
|
VERSION 0.1
|
|
DESCRIPTION "System digital twin."
|
|
)
|
|
|
|
include(FetchContent)
|
|
|
|
set(FTXUI_BUILD_DOCS OFF CACHE INTERNAL "")
|
|
set(FTXUI_BUILD_EXAMPLES OFF CACHE INTERNAL "")
|
|
set(FTXUI_BUILD_TESTS OFF CACHE INTERNAL "")
|
|
set(FTXUI_ENABLE_INSTALL OFF CACHE INTERNAL "")
|
|
|
|
FetchContent_Declare(ftxui
|
|
GIT_REPOSITORY https://github.com/ArthurSonzogni/FTXUI.git
|
|
GIT_TAG v6.1.9
|
|
GIT_SHALLOW TRUE
|
|
)
|
|
FetchContent_MakeAvailable(ftxui)
|
|
|
|
find_package(libzip REQUIRED)
|
|
find_package(pugixml REQUIRED)
|
|
|
|
# Library target = everything except main.cpp; reused by `essim` and `essim_tests`.
|
|
file(GLOB_RECURSE LIB_SOURCES "src/*.cpp")
|
|
list(REMOVE_ITEM LIB_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
|
|
|
|
add_library(essim_lib STATIC ${LIB_SOURCES})
|
|
target_include_directories(essim_lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
|
target_link_libraries(essim_lib
|
|
PUBLIC
|
|
ftxui::screen
|
|
ftxui::dom
|
|
ftxui::component
|
|
libzip::zip
|
|
pugixml::pugixml
|
|
)
|
|
|
|
add_executable(essim src/main.cpp)
|
|
target_link_libraries(essim PRIVATE essim_lib)
|
|
|
|
# Tests
|
|
include(CTest)
|
|
if(BUILD_TESTING)
|
|
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
|
|
FetchContent_Declare(doctest
|
|
GIT_REPOSITORY https://github.com/doctest/doctest.git
|
|
GIT_TAG v2.4.11
|
|
GIT_SHALLOW TRUE
|
|
)
|
|
FetchContent_MakeAvailable(doctest)
|
|
unset(CMAKE_POLICY_VERSION_MINIMUM)
|
|
|
|
file(GLOB TEST_SOURCES "tests/*.cpp")
|
|
if(TEST_SOURCES)
|
|
add_executable(essim_tests ${TEST_SOURCES})
|
|
target_link_libraries(essim_tests PRIVATE essim_lib doctest::doctest)
|
|
add_test(NAME essim_tests COMMAND essim_tests)
|
|
endif()
|
|
endif()
|