typesafe-carla 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- typesafe_carla-0.1.0/.gitignore +5 -0
- typesafe_carla-0.1.0/CLAUDE.md +100 -0
- typesafe_carla-0.1.0/CMakeLists.txt +340 -0
- typesafe_carla-0.1.0/LICENSE +21 -0
- typesafe_carla-0.1.0/PKG-INFO +1038 -0
- typesafe_carla-0.1.0/README.md +1014 -0
- typesafe_carla-0.1.0/bindings/actor.yaml +81 -0
- typesafe_carla-0.1.0/bindings/actor_blueprint.yaml +16 -0
- typesafe_carla-0.1.0/bindings/actor_list.yaml +8 -0
- typesafe_carla-0.1.0/bindings/blueprint.yaml +14 -0
- typesafe_carla-0.1.0/bindings/blueprint_library.yaml +14 -0
- typesafe_carla-0.1.0/bindings/client.yaml +97 -0
- typesafe_carla-0.1.0/bindings/collision_event.yaml +9 -0
- typesafe_carla-0.1.0/bindings/debug.yaml +35 -0
- typesafe_carla-0.1.0/bindings/junction.yaml +13 -0
- typesafe_carla-0.1.0/bindings/landmark.yaml +18 -0
- typesafe_carla-0.1.0/bindings/lane_invasion_event.yaml +13 -0
- typesafe_carla-0.1.0/bindings/light_manager.yaml +14 -0
- typesafe_carla-0.1.0/bindings/lists.yaml +19 -0
- typesafe_carla-0.1.0/bindings/map.yaml +63 -0
- typesafe_carla-0.1.0/bindings/obstacle_detection_event.yaml +11 -0
- typesafe_carla-0.1.0/bindings/sensor.yaml +8 -0
- typesafe_carla-0.1.0/bindings/server_side_sensor.yaml +26 -0
- typesafe_carla-0.1.0/bindings/traffic_light.yaml +22 -0
- typesafe_carla-0.1.0/bindings/traffic_manager.yaml +51 -0
- typesafe_carla-0.1.0/bindings/traffic_sign.yaml +8 -0
- typesafe_carla-0.1.0/bindings/transform.yaml +13 -0
- typesafe_carla-0.1.0/bindings/types.yaml +673 -0
- typesafe_carla-0.1.0/bindings/vehicle.yaml +29 -0
- typesafe_carla-0.1.0/bindings/vehicle_ext.yaml +54 -0
- typesafe_carla-0.1.0/bindings/walker.yaml +20 -0
- typesafe_carla-0.1.0/bindings/walker_ai_controller.yaml +10 -0
- typesafe_carla-0.1.0/bindings/waypoint.yaml +49 -0
- typesafe_carla-0.1.0/bindings/world.yaml +136 -0
- typesafe_carla-0.1.0/bindings/world_snapshot.yaml +9 -0
- typesafe_carla-0.1.0/cmake/FetchCarla.cmake +179 -0
- typesafe_carla-0.1.0/cmake/LibCarlaPrebuilt.cmake +454 -0
- typesafe_carla-0.1.0/cmake/LibCarlaPrebuiltAssemble.cmake +212 -0
- typesafe_carla-0.1.0/cmake/ThirdPartyNotices.cmake +473 -0
- typesafe_carla-0.1.0/cmake/licenses/Apache-2.0.txt +202 -0
- typesafe_carla-0.1.0/cmake/licenses/MIT.txt +17 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/__init__.codon +95 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/_actor_compat.codon +422 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/_callbacks.codon +672 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/_enum.codon +55 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/_eq.codon +46 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/_ffi.codon +1325 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/_fmt.codon +176 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/_strict.codon +35 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/actor.codon +466 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/blueprint.codon +301 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/client.codon +275 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/command.codon +363 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/constants.codon +48 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/control.codon +666 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/debug.codon +76 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/errors.codon +101 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/geo.codon +278 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/geometry.codon +1061 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/labels.codon +40 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/lane_marking.codon +74 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/light_manager.codon +227 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/map.codon +562 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/sensor.codon +1235 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/snapshot.codon +153 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/texture.codon +167 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/traffic_light.codon +177 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/traffic_manager.codon +243 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/v2x.codon +956 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/vehicle.codon +311 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/walker.codon +246 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/weather.codon +127 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/world.codon +279 -0
- typesafe_carla-0.1.0/codon/typesafe_carla/world_queries.codon +371 -0
- typesafe_carla-0.1.0/compat/pycarla/_runtime.py +482 -0
- typesafe_carla-0.1.0/compat/pycarla/pruned.json +34 -0
- typesafe_carla-0.1.0/docs/bindgen.md +351 -0
- typesafe_carla-0.1.0/docs/coverage.md +574 -0
- typesafe_carla-0.1.0/docs/design.md +1619 -0
- typesafe_carla-0.1.0/docs/releasing.md +465 -0
- typesafe_carla-0.1.0/docs/usage.md +168 -0
- typesafe_carla-0.1.0/examples/batch_spawn.py +21 -0
- typesafe_carla-0.1.0/examples/camera.py +50 -0
- typesafe_carla-0.1.0/examples/connect.py +11 -0
- typesafe_carla-0.1.0/examples/follow_lane.py +44 -0
- typesafe_carla-0.1.0/examples/spawn_vehicle.py +20 -0
- typesafe_carla-0.1.0/examples/synchronous_mode.py +24 -0
- typesafe_carla-0.1.0/examples/traffic.py +66 -0
- typesafe_carla-0.1.0/examples/vehicle_control.py +18 -0
- typesafe_carla-0.1.0/native/include/typesafe_carla/ffi.h +2306 -0
- typesafe_carla-0.1.0/native/mock/include/carla/FileSystem.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/Memory.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/Time.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/Version.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/client/Actor.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/client/ActorBlueprint.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/client/ActorList.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/client/ActorSnapshot.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/client/BlueprintLibrary.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/client/Client.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/client/ClientSideSensor.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/client/DebugHelper.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/client/Junction.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/client/Landmark.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/client/LightManager.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/client/Map.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/client/Sensor.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/client/ServerSideSensor.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/client/TimeoutException.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/client/Timestamp.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/client/TrafficLight.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/client/TrafficSign.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/client/Vehicle.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/client/Walker.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/client/WalkerAIController.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/client/Waypoint.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/client/World.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/client/WorldSnapshot.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/geom/BoundingBox.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/geom/GeoLocation.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/geom/GeoProjection.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/geom/Location.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/geom/Rotation.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/geom/Transform.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/geom/Vector2D.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/geom/Vector3D.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/image/CityScapesPalette.h +76 -0
- typesafe_carla-0.1.0/native/mock/include/carla/mock/Lights.h +77 -0
- typesafe_carla-0.1.0/native/mock/include/carla/mock/Mock.h +1721 -0
- typesafe_carla-0.1.0/native/mock/include/carla/mock/SensorDataExt.h +156 -0
- typesafe_carla-0.1.0/native/mock/include/carla/mock/V2X.h +39 -0
- typesafe_carla-0.1.0/native/mock/include/carla/mock/WorldExtras.h +98 -0
- typesafe_carla-0.1.0/native/mock/include/carla/pointcloud/PointCloudIO.h +47 -0
- typesafe_carla-0.1.0/native/mock/include/carla/road/Lane.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/road/element/LaneMarking.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/rpc/ActorState.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/rpc/Command.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/rpc/CommandResponse.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/rpc/CustomV2XBytes.h +21 -0
- typesafe_carla-0.1.0/native/mock/include/carla/rpc/EpisodeSettings.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/rpc/MaterialParameter.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/rpc/OpendriveGenerationParameters.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/rpc/Texture.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/rpc/TrafficLightState.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/rpc/VehicleControl.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/rpc/VehicleLightState.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/rpc/VehiclePhysicsControl.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/rpc/WalkerControl.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/rpc/WeatherParameters.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/rpc/WheelPhysicsControl.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/sensor/SensorData.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/sensor/data/CollisionEvent.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/sensor/data/DVSEventArray.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/sensor/data/GnssMeasurement.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/sensor/data/IMUMeasurement.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/sensor/data/Image.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/sensor/data/LaneInvasionEvent.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/sensor/data/LibITS.h +320 -0
- typesafe_carla-0.1.0/native/mock/include/carla/sensor/data/LidarMeasurement.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/sensor/data/ObstacleDetectionEvent.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/sensor/data/RadarMeasurement.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/sensor/data/SemanticLidarMeasurement.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/sensor/data/V2XData.h +26 -0
- typesafe_carla-0.1.0/native/mock/include/carla/sensor/data/V2XEvent.h +2 -0
- typesafe_carla-0.1.0/native/mock/include/carla/trafficmanager/TrafficManager.h +2 -0
- typesafe_carla-0.1.0/native/mock/src/mock.cpp +2774 -0
- typesafe_carla-0.1.0/native/mock/src/weather.cpp +36 -0
- typesafe_carla-0.1.0/native/mock/src/world_extras.cpp +378 -0
- typesafe_carla-0.1.0/native/src/actor.cpp +80 -0
- typesafe_carla-0.1.0/native/src/batch.cpp +167 -0
- typesafe_carla-0.1.0/native/src/blueprint.cpp +98 -0
- typesafe_carla-0.1.0/native/src/carla_compat.hpp +248 -0
- typesafe_carla-0.1.0/native/src/client.cpp +34 -0
- typesafe_carla-0.1.0/native/src/error.cpp +69 -0
- typesafe_carla-0.1.0/native/src/exports.map +7 -0
- typesafe_carla-0.1.0/native/src/generated/bindings.cpp +1719 -0
- typesafe_carla-0.1.0/native/src/geo.cpp +160 -0
- typesafe_carla-0.1.0/native/src/handle.cpp +86 -0
- typesafe_carla-0.1.0/native/src/internal.hpp +995 -0
- typesafe_carla-0.1.0/native/src/item_queue.hpp +102 -0
- typesafe_carla-0.1.0/native/src/light_manager.cpp +122 -0
- typesafe_carla-0.1.0/native/src/map.cpp +80 -0
- typesafe_carla-0.1.0/native/src/queue_signal.cpp +67 -0
- typesafe_carla-0.1.0/native/src/sensor.cpp +650 -0
- typesafe_carla-0.1.0/native/src/sensor_image.cpp +285 -0
- typesafe_carla-0.1.0/native/src/sensor_image.hpp +33 -0
- typesafe_carla-0.1.0/native/src/shared_types.cpp +65 -0
- typesafe_carla-0.1.0/native/src/snapshot.cpp +38 -0
- typesafe_carla-0.1.0/native/src/traffic_manager.cpp +138 -0
- typesafe_carla-0.1.0/native/src/vehicle.cpp +201 -0
- typesafe_carla-0.1.0/native/src/walker.cpp +32 -0
- typesafe_carla-0.1.0/native/src/world.cpp +134 -0
- typesafe_carla-0.1.0/native/src/world_queries.cpp +175 -0
- typesafe_carla-0.1.0/pyproject.toml +92 -0
- typesafe_carla-0.1.0/python/typesafe_carla/__init__.py +9 -0
- typesafe_carla-0.1.0/python/typesafe_carla/cli.py +508 -0
- typesafe_carla-0.1.0/python/typesafe_carla/paths.py +286 -0
- typesafe_carla-0.1.0/python/typesafe_carla/toolchain.py +88 -0
- typesafe_carla-0.1.0/tests/compatibility/arithmetic_cases.codon +197 -0
- typesafe_carla-0.1.0/tests/compatibility/arithmetic_cases.py +151 -0
- typesafe_carla-0.1.0/tests/compatibility/compare.py +107 -0
- typesafe_carla-0.1.0/tests/compatibility/equality_cases.codon +268 -0
- typesafe_carla-0.1.0/tests/compatibility/equality_cases.py +138 -0
- typesafe_carla-0.1.0/tests/compatibility/official_enums.json +78 -0
- typesafe_carla-0.1.0/tests/compatibility/scenario_official.py +613 -0
- typesafe_carla-0.1.0/tests/compatibility/scenario_typesafe.codon +666 -0
- typesafe_carla-0.1.0/tests/distribution/clean_env.sh +72 -0
- typesafe_carla-0.1.0/tests/distribution/main.py +38 -0
- typesafe_carla-0.1.0/tests/integration/data/straight_road.xodr +25 -0
- typesafe_carla-0.1.0/tests/integration/test_actor_compat.codon +170 -0
- typesafe_carla-0.1.0/tests/integration/test_issue10_location_vector.codon +76 -0
- typesafe_carla-0.1.0/tests/integration/test_issue19_actor.codon +159 -0
- typesafe_carla-0.1.0/tests/integration/test_issue20_vehicle_walker.codon +174 -0
- typesafe_carla-0.1.0/tests/integration/test_issue21_world.codon +205 -0
- typesafe_carla-0.1.0/tests/integration/test_issue22_map_geo.codon +141 -0
- typesafe_carla-0.1.0/tests/integration/test_issue23_api.codon +178 -0
- typesafe_carla-0.1.0/tests/integration/test_issue24_sensor_data.codon +313 -0
- typesafe_carla-0.1.0/tests/integration/test_issue33_api.codon +143 -0
- typesafe_carla-0.1.0/tests/integration/test_issue34_attachment_type.codon +68 -0
- typesafe_carla-0.1.0/tests/integration/test_issue35_client.codon +35 -0
- typesafe_carla-0.1.0/tests/integration/test_issue38_get_actors_by_id.codon +42 -0
- typesafe_carla-0.1.0/tests/integration/test_issue39_map_from_opendrive.codon +51 -0
- typesafe_carla-0.1.0/tests/integration/test_issue42_v2x.codon +170 -0
- typesafe_carla-0.1.0/tests/integration/test_issue86_callback_thread.codon +184 -0
- typesafe_carla-0.1.0/tests/integration/test_m0_vehicle.codon +77 -0
- typesafe_carla-0.1.0/tests/integration/test_m1_world.codon +134 -0
- typesafe_carla-0.1.0/tests/integration/test_m2_sensors.codon +164 -0
- typesafe_carla-0.1.0/tests/integration/test_m4_opendrive.codon +68 -0
- typesafe_carla-0.1.0/tests/integration/test_m4_world.codon +246 -0
- typesafe_carla-0.1.0/tests/integration/test_optional_none.codon +97 -0
- typesafe_carla-0.1.0/tests/integration/test_physics_control.codon +115 -0
- typesafe_carla-0.1.0/tests/integration/test_sensor_callbacks.codon +154 -0
- typesafe_carla-0.1.0/tests/integration/test_zz_issue36_recorder.codon +109 -0
- typesafe_carla-0.1.0/tests/native/test_ffi.c +1967 -0
- typesafe_carla-0.1.0/tests/native/test_generated.c +306 -0
- typesafe_carla-0.1.0/tests/native/test_header_strict.c +15 -0
- typesafe_carla-0.1.0/tests/native/test_image_converter.cpp +92 -0
- typesafe_carla-0.1.0/tests/upstream/GAPS.md +473 -0
- typesafe_carla-0.1.0/tests/upstream/README.md +236 -0
- typesafe_carla-0.1.0/tests/upstream/expectations.yaml +464 -0
- typesafe_carla-0.1.0/tests/upstream/ported/API/test_collision.py +212 -0
- typesafe_carla-0.1.0/tests/upstream/ported/smoke/__init__.py +212 -0
- typesafe_carla-0.1.0/tests/upstream/ported/smoke/test_blueprint.py +32 -0
- typesafe_carla-0.1.0/tests/upstream/ported/smoke/test_client.py +20 -0
- typesafe_carla-0.1.0/tests/upstream/ported/smoke/test_collision_determinism.py +503 -0
- typesafe_carla-0.1.0/tests/upstream/ported/smoke/test_collision_sensor.py +60 -0
- typesafe_carla-0.1.0/tests/upstream/ported/smoke/test_determinism.py +161 -0
- typesafe_carla-0.1.0/tests/upstream/ported/smoke/test_geoconversion.py +244 -0
- typesafe_carla-0.1.0/tests/upstream/ported/smoke/test_lidar.py +244 -0
- typesafe_carla-0.1.0/tests/upstream/ported/smoke/test_map.py +61 -0
- typesafe_carla-0.1.0/tests/upstream/ported/smoke/test_props_loading.py +45 -0
- typesafe_carla-0.1.0/tests/upstream/ported/smoke/test_sensor_determinism.py +354 -0
- typesafe_carla-0.1.0/tests/upstream/ported/smoke/test_sensor_tick_time.py +78 -0
- typesafe_carla-0.1.0/tests/upstream/ported/smoke/test_snapshot.py +61 -0
- typesafe_carla-0.1.0/tests/upstream/ported/smoke/test_spawnpoints.py +84 -0
- typesafe_carla-0.1.0/tests/upstream/ported/smoke/test_streamming.py +69 -0
- typesafe_carla-0.1.0/tests/upstream/ported/smoke/test_sync.py +186 -0
- typesafe_carla-0.1.0/tests/upstream/ported/smoke/test_vehicle_physics.py +696 -0
- typesafe_carla-0.1.0/tests/upstream/ported/smoke/test_world.py +30 -0
- typesafe_carla-0.1.0/tests/upstream/ported/test_vehicle_physics.py +589 -0
- typesafe_carla-0.1.0/tests/upstream/results/codon/0.10.0.json +556 -0
- typesafe_carla-0.1.0/tests/upstream/results/codon/ue5-dev.json +1264 -0
- typesafe_carla-0.1.0/tests/upstream/results/cpython/0.10.0.json +86 -0
- typesafe_carla-0.1.0/tests/upstream/results/cpython/ue5-dev.json +1350 -0
- typesafe_carla-0.1.0/tests/upstream/results/official/ue5-dev.json +996 -0
- typesafe_carla-0.1.0/tests/upstream/tsc_unittest.codon +151 -0
- typesafe_carla-0.1.0/tools/bindgen/__init__.py +5 -0
- typesafe_carla-0.1.0/tools/bindgen/__main__.py +56 -0
- typesafe_carla-0.1.0/tools/bindgen/clang.py +528 -0
- typesafe_carla-0.1.0/tools/bindgen/emit.py +192 -0
- typesafe_carla-0.1.0/tools/bindgen/spec.py +379 -0
- typesafe_carla-0.1.0/tools/bump_version.py +81 -0
- typesafe_carla-0.1.0/tools/check_wheel.py +82 -0
- typesafe_carla-0.1.0/tools/fetch_libcarla_prebuilt.py +312 -0
- typesafe_carla-0.1.0/tools/libcarla_cache_guard.sh +140 -0
- typesafe_carla-0.1.0/tools/port_upstream_tests.py +556 -0
- typesafe_carla-0.1.0/tools/pycarla.py +1354 -0
- typesafe_carla-0.1.0/tools/release_tag.py +311 -0
- typesafe_carla-0.1.0/tools/resolve_carla_ref.sh +40 -0
- typesafe_carla-0.1.0/tools/upstream_tests.py +1766 -0
- typesafe_carla-0.1.0/uv.lock +257 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# typesafe_carla
|
|
2
|
+
|
|
3
|
+
Statically typed CARLA (UE5) client for Codon: Codon API → C ABI
|
|
4
|
+
(`native/include/typesafe_carla/ffi.h`) → C++ shim → LibCarla. Design:
|
|
5
|
+
`docs/design.md`. Status and milestones: `README.md`. Release process:
|
|
6
|
+
`docs/releasing.md`.
|
|
7
|
+
|
|
8
|
+
## Commands
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
TSC_BACKEND=mock uv sync # dev install (+ bundled Codon via toolchain/)
|
|
12
|
+
cmake -S . -B build -DTSC_BACKEND=mock && cmake --build build -j
|
|
13
|
+
ctest --test-dir build # C ABI tests
|
|
14
|
+
uv run pytest # compile-pass/fail, runtime, launcher, architecture
|
|
15
|
+
uv run typesafe-codon run examples/connect.py
|
|
16
|
+
uv run python -m tools.bindgen generate # after editing bindings/*.yaml
|
|
17
|
+
uv run python -m tools.bindgen validate --build-dir build # spec vs LibCarla/mock headers (docs/bindgen.md)
|
|
18
|
+
|
|
19
|
+
# Real LibCarla (CARLA UE5; default ref ue5-dev). Slow first build.
|
|
20
|
+
cmake -S . -B build-carla -DTSC_CARLA_GIT_REF=ue5-dev && cmake --build build-carla -j
|
|
21
|
+
# add -DPREFER_CLONE=ON where GitHub archive downloads are blocked
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Rules
|
|
25
|
+
|
|
26
|
+
- No CPython on the core path: no `from python import`, `pyobj` or `@python`
|
|
27
|
+
in `codon/` (enforced by `tests/test_architecture.py`).
|
|
28
|
+
- C ABI: opaque refcounted handles, status codes + thread-local error,
|
|
29
|
+
output pointers for structs, no exceptions across the boundary. Any ABI
|
|
30
|
+
change bumps `TSC_ABI_VERSION_*` in both `ffi.h` and `_ffi.codon`.
|
|
31
|
+
- New API needs both a `tests/compile/pass` and, where misuse is possible, a
|
|
32
|
+
`tests/compile/fail` case with an `# expect-error:` line. Test programs must
|
|
33
|
+
*call* their functions: Codon only type-checks functions that are called.
|
|
34
|
+
Strict mode (`typesafe-codon --strict`): a pass program with a `# strict`
|
|
35
|
+
line must also compile in strict mode; `tests/compile/strict_fail` programs
|
|
36
|
+
must compile normally and fail in strict mode with their `# expect-error:`.
|
|
37
|
+
- Python-API compatibility shortcuts (not statically checked): an Actor
|
|
38
|
+
shortcut (`_actor_compat.codon`) takes `self: S, S: type` and starts with
|
|
39
|
+
`_plain_actor_only(self, "<name>()")`, a compile error on typed subclasses
|
|
40
|
+
(which inherit it), then
|
|
41
|
+
`compat_shortcut("Actor.<name>", "[tsc-compat] <what>", "<instead>")` with
|
|
42
|
+
literal strings (`_strict.codon`): a compile error in strict mode, else a
|
|
43
|
+
warning. The launcher finds the marker in the LLVM IR to warn at compile
|
|
44
|
+
time. `tests/test_architecture.py` checks this order for every shortcut.
|
|
45
|
+
- A C function that only checks a handle, converts arguments and calls one
|
|
46
|
+
LibCarla method belongs in `bindings/*.yaml` (generated), not hand-written.
|
|
47
|
+
Never edit generated code (`native/src/generated/`, marked blocks in
|
|
48
|
+
`ffi.h` and `_ffi.codon`). A method that a supported LibCarla lacks gets
|
|
49
|
+
`optional: {name: Class.python_name, missing_in: [<CARLA refs>]}`: the
|
|
50
|
+
generated code calls it through `TSC_CALL_OPTIONAL` (TSC_ERROR where it is
|
|
51
|
+
missing), and `validate` accepts it missing only on a libcarla build of a
|
|
52
|
+
listed ref (never on the mock).
|
|
53
|
+
Put argument validation and struct conversion in the type (`to_carla`
|
|
54
|
+
overload or `check_*` helper in `internal.hpp`) so the function stays
|
|
55
|
+
generatable; `self.codon` binds a value struct (e.g. `tsc_transform_t`)
|
|
56
|
+
as self. What stays hand-written and why: `docs/bindgen.md`.
|
|
57
|
+
- A new API parameter typed `Vector3D` or `Location` is generic (no
|
|
58
|
+
annotation) and goes through `geometry._vector_arg` / `_location_arg`
|
|
59
|
+
(`_vector_or` / `_location_or` if optional), with a distinct literal
|
|
60
|
+
`"[tsc-compat] a Location passed as a Vector3D to X"` (or the reverse);
|
|
61
|
+
the helpers call `compat_shortcut`. It needs a `tests/compile/strict_fail`
|
|
62
|
+
case for the compat path.
|
|
63
|
+
- The mock (`native/mock`) mirrors LibCarla UE5 (ue5-dev) signatures *and
|
|
64
|
+
behaviour* (return values, empty results, exceptions); keep it in sync with
|
|
65
|
+
any LibCarla API the shim starts using. Where 0.10.0 behaves differently,
|
|
66
|
+
the shim maps both to one documented status.
|
|
67
|
+
- Versions: `python/typesafe_carla/__init__.py` and
|
|
68
|
+
`codon/typesafe_carla/__init__.codon` must agree.
|
|
69
|
+
|
|
70
|
+
## Codon 0.19 gotchas
|
|
71
|
+
|
|
72
|
+
- Exceptions are `Static[Exception]`; no catchable hierarchy.
|
|
73
|
+
- `__del__` is not auto-registered; `_ffi.Handle` calls `register_finalizer`.
|
|
74
|
+
- Forward references in return types: define later and attach with `@extend`.
|
|
75
|
+
- `str.__copy__` does not copy; use `str.memcpy` into a new buffer.
|
|
76
|
+
- No `f"{x:.6f}"` (needs a locale); use `str(float)`.
|
|
77
|
+
- A comprehension over a list returned by a method called on an implicitly
|
|
78
|
+
unwrapped `Optional` crashes the compiler (`build`: segfault, rc 139; `run`:
|
|
79
|
+
`'<unknown type>' does not match expected type 'List[T]'`), even through a
|
|
80
|
+
variable. Repro: `wp = get()` (`-> Optional[W]`), `xs = wp.ls()`,
|
|
81
|
+
`[x for x in xs]`. Use `unwrap(wp)` or a plain `for` loop.
|
|
82
|
+
- `codon build -release` aborts (capture.cpp:618, "found multiple synthetic
|
|
83
|
+
assignments for loop var") on a lambda that captures a loop variable;
|
|
84
|
+
move the loop body into a function taking the variable.
|
|
85
|
+
- Subclasses do not upcast inside `Optional` (`Optional[Location]` is not an
|
|
86
|
+
`Optional[Vector3D]`), and `isinstance` is exact
|
|
87
|
+
(`isinstance(location, Vector3D)` is False).
|
|
88
|
+
- An argument whose type is inferred late (e.g. reached through an implicitly
|
|
89
|
+
unwrapped `Optional`) can mis-bind against a parameter annotated with a base
|
|
90
|
+
class, giving "'Vector3D' does not match expected type 'Location'". Use a
|
|
91
|
+
generic parameter plus `_upcast_vector` / `_upcast_location`. Same-name
|
|
92
|
+
methods with different signatures across a class hierarchy are dispatched
|
|
93
|
+
as virtual overrides: avoid them.
|
|
94
|
+
- Class hierarchies two levels deep are miscompiled: with `C(B(A))`, methods
|
|
95
|
+
`C` inherits from `B` read `A`'s fields at the wrong offset, and
|
|
96
|
+
`super().__init__()` chains through both levels crash. Keep classes one
|
|
97
|
+
level below `Actor` (`TrafficLight` and `TrafficSign` are siblings).
|
|
98
|
+
- `-D` definitions are visible only in the main file, and `CODON_PATH` holds
|
|
99
|
+
a single directory. The strict setting reaches the library through the
|
|
100
|
+
launcher-generated `_tsc_build_config` module.
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.27.2) # CARLA UE5 requires 3.27.2
|
|
2
|
+
|
|
3
|
+
# The version lives in python/typesafe_carla/__init__.py (single source of truth).
|
|
4
|
+
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/python/typesafe_carla/__init__.py" _tsc_version_line
|
|
5
|
+
REGEX "^__version__ = ")
|
|
6
|
+
string(REGEX REPLACE "^__version__ = \"([0-9]+\\.[0-9]+\\.[0-9]+)[^\"]*\"$" "\\1"
|
|
7
|
+
TSC_VERSION "${_tsc_version_line}")
|
|
8
|
+
project(typesafe_carla VERSION ${TSC_VERSION} LANGUAGES C CXX)
|
|
9
|
+
|
|
10
|
+
set(CMAKE_CXX_STANDARD 20) # LibCarla UE5 headers require C++20
|
|
11
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
12
|
+
# tools/bindgen parses the shim with these flags (validate, coverage).
|
|
13
|
+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
14
|
+
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
15
|
+
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
|
16
|
+
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
|
|
17
|
+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
18
|
+
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
19
|
+
set(CMAKE_BUILD_TYPE Release)
|
|
20
|
+
endif()
|
|
21
|
+
|
|
22
|
+
# ---------------------------------------------------------------------------
|
|
23
|
+
# Backend selection
|
|
24
|
+
#
|
|
25
|
+
# libcarla : LibCarla's client library built from CARLA UE5 sources, fetched
|
|
26
|
+
# at CARLA_GIT_REF (default: ue5-dev) or taken from
|
|
27
|
+
# CARLA_SOURCE_DIR. See cmake/FetchCarla.cmake.
|
|
28
|
+
# mock : in-memory stand-in for LibCarla (native/mock); for tests and
|
|
29
|
+
# development without a CARLA server. Not a simulator.
|
|
30
|
+
#
|
|
31
|
+
# The selected backend is reported at runtime by tsc_backend_name() and by
|
|
32
|
+
# `typesafe-codon info`.
|
|
33
|
+
# ---------------------------------------------------------------------------
|
|
34
|
+
if(DEFINED ENV{TSC_BACKEND} AND NOT "$ENV{TSC_BACKEND}" STREQUAL "")
|
|
35
|
+
set(_tsc_backend_default "$ENV{TSC_BACKEND}")
|
|
36
|
+
else()
|
|
37
|
+
set(_tsc_backend_default "libcarla")
|
|
38
|
+
endif()
|
|
39
|
+
set(TSC_BACKEND "${_tsc_backend_default}" CACHE STRING "Native backend: libcarla or mock")
|
|
40
|
+
set_property(CACHE TSC_BACKEND PROPERTY STRINGS libcarla mock)
|
|
41
|
+
if(NOT TSC_BACKEND MATCHES "^(libcarla|mock)$")
|
|
42
|
+
message(FATAL_ERROR "Unknown TSC_BACKEND '${TSC_BACKEND}' (expected libcarla or mock)")
|
|
43
|
+
endif()
|
|
44
|
+
message(STATUS "typesafe_carla backend: ${TSC_BACKEND}")
|
|
45
|
+
|
|
46
|
+
# ---------------------------------------------------------------------------
|
|
47
|
+
# Build metadata
|
|
48
|
+
# ---------------------------------------------------------------------------
|
|
49
|
+
set(TSC_BUILD_COMMIT "unknown")
|
|
50
|
+
find_package(Git QUIET)
|
|
51
|
+
if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
|
|
52
|
+
execute_process(
|
|
53
|
+
COMMAND "${GIT_EXECUTABLE}" rev-parse --short=12 HEAD
|
|
54
|
+
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
55
|
+
OUTPUT_VARIABLE _commit OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET
|
|
56
|
+
RESULT_VARIABLE _commit_result)
|
|
57
|
+
if(_commit_result EQUAL 0 AND _commit)
|
|
58
|
+
set(TSC_BUILD_COMMIT "${_commit}")
|
|
59
|
+
endif()
|
|
60
|
+
endif()
|
|
61
|
+
|
|
62
|
+
# ---------------------------------------------------------------------------
|
|
63
|
+
# The C ABI shim
|
|
64
|
+
# ---------------------------------------------------------------------------
|
|
65
|
+
add_library(typesafe_carla_ffi SHARED
|
|
66
|
+
native/src/actor.cpp
|
|
67
|
+
native/src/batch.cpp
|
|
68
|
+
native/src/blueprint.cpp
|
|
69
|
+
native/src/client.cpp
|
|
70
|
+
native/src/error.cpp
|
|
71
|
+
native/src/geo.cpp
|
|
72
|
+
native/src/handle.cpp
|
|
73
|
+
native/src/map.cpp
|
|
74
|
+
native/src/queue_signal.cpp
|
|
75
|
+
native/src/sensor.cpp
|
|
76
|
+
native/src/sensor_image.cpp
|
|
77
|
+
native/src/snapshot.cpp
|
|
78
|
+
native/src/traffic_manager.cpp
|
|
79
|
+
native/src/vehicle.cpp
|
|
80
|
+
native/src/walker.cpp
|
|
81
|
+
native/src/world.cpp
|
|
82
|
+
native/src/world_queries.cpp
|
|
83
|
+
native/src/light_manager.cpp
|
|
84
|
+
native/src/shared_types.cpp
|
|
85
|
+
native/src/generated/bindings.cpp
|
|
86
|
+
)
|
|
87
|
+
target_include_directories(typesafe_carla_ffi
|
|
88
|
+
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/native/include"
|
|
89
|
+
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/native/src")
|
|
90
|
+
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
|
91
|
+
target_compile_options(typesafe_carla_ffi PRIVATE -Wall -Wextra)
|
|
92
|
+
# Export only the tsc_* C ABI; keep LibCarla, Boost and libstdc++ template
|
|
93
|
+
# instantiations out of the dynamic symbol table.
|
|
94
|
+
target_link_options(typesafe_carla_ffi PRIVATE
|
|
95
|
+
"-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/native/src/exports.map"
|
|
96
|
+
-Wl,--no-undefined)
|
|
97
|
+
set_property(TARGET typesafe_carla_ffi APPEND PROPERTY LINK_DEPENDS
|
|
98
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/native/src/exports.map")
|
|
99
|
+
endif()
|
|
100
|
+
# Dependencies are found next to the library ($ORIGIN), never in /usr/lib.
|
|
101
|
+
set_target_properties(typesafe_carla_ffi PROPERTIES
|
|
102
|
+
BUILD_RPATH "$ORIGIN"
|
|
103
|
+
INSTALL_RPATH "$ORIGIN")
|
|
104
|
+
|
|
105
|
+
if(TSC_BACKEND STREQUAL "mock")
|
|
106
|
+
set(TSC_CARLA_RESOLVED_REF "mock")
|
|
107
|
+
set(TSC_CARLA_COMMIT "mock")
|
|
108
|
+
add_library(carla_mock STATIC native/mock/src/mock.cpp native/mock/src/weather.cpp
|
|
109
|
+
native/mock/src/world_extras.cpp)
|
|
110
|
+
target_include_directories(carla_mock PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/native/mock/include")
|
|
111
|
+
target_link_libraries(typesafe_carla_ffi PRIVATE carla_mock)
|
|
112
|
+
else()
|
|
113
|
+
include(cmake/FetchCarla.cmake)
|
|
114
|
+
include(cmake/LibCarlaPrebuilt.cmake)
|
|
115
|
+
|
|
116
|
+
# CARLA 0.10.0's carla/client/FileTransfer.h uses uint8_t without including
|
|
117
|
+
# <cstdint>; newer GCC (14, in the manylinux release image) no longer
|
|
118
|
+
# provides it transitively. Force-include it for CARLA and for the shim
|
|
119
|
+
# (which includes that header through Client.h). Harmless for other refs.
|
|
120
|
+
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
|
121
|
+
set(_tsc_include_cstdint "$<$<COMPILE_LANGUAGE:CXX>:SHELL:-include cstdint>")
|
|
122
|
+
add_compile_options("${_tsc_include_cstdint}")
|
|
123
|
+
target_compile_options(typesafe_carla_ffi PRIVATE "${_tsc_include_cstdint}")
|
|
124
|
+
endif()
|
|
125
|
+
endif()
|
|
126
|
+
|
|
127
|
+
if(TSC_BACKEND STREQUAL "libcarla" AND TSC_CARLA_PREBUILT_PREFIX)
|
|
128
|
+
# LibCarla and its dependencies from a prebuilt prefix: nothing to fetch or
|
|
129
|
+
# build (cmake/LibCarlaPrebuilt.cmake).
|
|
130
|
+
tsc_import_libcarla_prebuilt("${TSC_CARLA_PREBUILT_PREFIX}" "${TSC_CARLA_PREBUILT_SHA}")
|
|
131
|
+
target_link_libraries(typesafe_carla_ffi PRIVATE carla-client)
|
|
132
|
+
elseif(TSC_BACKEND STREQUAL "libcarla")
|
|
133
|
+
# Client library only: no server, Unreal, Python API, examples or tests.
|
|
134
|
+
# (CARLA sets policy CMP0077, so these normal variables override its options.)
|
|
135
|
+
set(BUILD_CARLA_CLIENT ON)
|
|
136
|
+
set(BUILD_CARLA_SERVER OFF)
|
|
137
|
+
set(BUILD_CARLA_UNREAL OFF)
|
|
138
|
+
set(BUILD_PYTHON_API OFF)
|
|
139
|
+
set(BUILD_EXAMPLES OFF)
|
|
140
|
+
set(BUILD_LIBCARLA_TESTS OFF)
|
|
141
|
+
set(BUILD_OSM_WORLD_RENDERER OFF)
|
|
142
|
+
set(ENABLE_ROS2 OFF)
|
|
143
|
+
set(ENABLE_ROS2_DEMO OFF)
|
|
144
|
+
set(ENABLE_OSM2ODR OFF)
|
|
145
|
+
set(ENABLE_RSS OFF)
|
|
146
|
+
set(ENABLE_PYTORCH OFF)
|
|
147
|
+
set(ENABLE_STREETMAP OFF)
|
|
148
|
+
set(ENABLE_ALL_WARNINGS OFF)
|
|
149
|
+
set(ENABLE_RTTI ON) # Actor::as_vehicle relies on dynamic_pointer_cast
|
|
150
|
+
set(ENABLE_EXCEPTIONS ON) # errors are caught and converted at the C ABI
|
|
151
|
+
|
|
152
|
+
# CARLA unconditionally downloads SQLite for its server-side tools, but
|
|
153
|
+
# carla-client never links it. Point FetchContent at an empty stand-in so the
|
|
154
|
+
# build does not depend on sqlite.org (override by setting
|
|
155
|
+
# FETCHCONTENT_SOURCE_DIR_SQLITE3 yourself). If a future CARLA makes the
|
|
156
|
+
# client use SQLite, the link fails loudly rather than silently.
|
|
157
|
+
if(NOT FETCHCONTENT_SOURCE_DIR_SQLITE3)
|
|
158
|
+
set(_tsc_sqlite_stub "${CMAKE_BINARY_DIR}/_deps/sqlite3-unused")
|
|
159
|
+
file(MAKE_DIRECTORY "${_tsc_sqlite_stub}")
|
|
160
|
+
foreach(_f sqlite3.h sqlite3.c)
|
|
161
|
+
file(WRITE "${_tsc_sqlite_stub}/${_f}" "/* unused by carla-client */\n")
|
|
162
|
+
endforeach()
|
|
163
|
+
file(WRITE "${_tsc_sqlite_stub}/shell.c" "int main(void) { return 1; }\n")
|
|
164
|
+
set(FETCHCONTENT_SOURCE_DIR_SQLITE3 "${_tsc_sqlite_stub}")
|
|
165
|
+
endif()
|
|
166
|
+
# Boost.Python. CARLA requests it from Boost even with BUILD_PYTHON_API=OFF,
|
|
167
|
+
# which Boost rejects ("library 'python' has been explicitly requested, but
|
|
168
|
+
# BOOST_ENABLE_PYTHON is OFF"), and some refs (0.10.0) link carla-client
|
|
169
|
+
# against Boost::python unconditionally. The client sources only use
|
|
170
|
+
# Boost.Python under LIBCARLA_WITH_PYTHON_SUPPORT, which is never defined
|
|
171
|
+
# here, so: build Boost without it, and satisfy any such link with an empty
|
|
172
|
+
# target (unused on refs that do not link it). No Python headers or
|
|
173
|
+
# libpython are needed (manylinux has no libpython). CARLA requires
|
|
174
|
+
# CMake >= 3.27 (CMP0126 NEW), so the normal variable shadows the cache
|
|
175
|
+
# entry CARLA's Dependencies.cmake writes.
|
|
176
|
+
file(READ "${TSC_CARLA_DIR}/CMake/Dependencies.cmake" _tsc_deps)
|
|
177
|
+
if(_tsc_deps MATCHES "set \\([ \t\r\n]*BOOST_INCLUDED_PROJECTS([^)]*)\\)")
|
|
178
|
+
string(REGEX REPLACE "[ \t\r\n]+" ";" _tsc_boost_libs "${CMAKE_MATCH_1}")
|
|
179
|
+
list(FILTER _tsc_boost_libs EXCLUDE REGEX "^(python|)$")
|
|
180
|
+
set(BOOST_INCLUDE_LIBRARIES "${_tsc_boost_libs}")
|
|
181
|
+
message(STATUS "typesafe_carla: Boost libraries for LibCarla: ${_tsc_boost_libs}")
|
|
182
|
+
else()
|
|
183
|
+
message(WARNING "typesafe_carla: could not read CARLA's Boost library list; "
|
|
184
|
+
"configuring Boost may fail on BOOST_ENABLE_PYTHON")
|
|
185
|
+
endif()
|
|
186
|
+
if(NOT TARGET Boost::python)
|
|
187
|
+
add_library(Boost::python INTERFACE IMPORTED)
|
|
188
|
+
endif()
|
|
189
|
+
|
|
190
|
+
# CMake 4 removed compatibility with cmake_minimum_required < 3.5, which some
|
|
191
|
+
# of CARLA's dependencies (e.g. libpng in 0.10.0) still declare. ue5-dev sets
|
|
192
|
+
# this itself; older refs need it from us.
|
|
193
|
+
if(CMAKE_VERSION VERSION_GREATER_EQUAL "4.0" AND NOT DEFINED CMAKE_POLICY_VERSION_MINIMUM)
|
|
194
|
+
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
|
|
195
|
+
endif()
|
|
196
|
+
|
|
197
|
+
# CARLA sets ZLIB_INCLUDE_DIRS to zlib's source and build directories with
|
|
198
|
+
# `set(ZLIB_INCLUDE_DIRS <src> <build> CACHE INTERNAL "")`, which keeps only
|
|
199
|
+
# the source directory; zlib generates zconf.h in its build directory, so
|
|
200
|
+
# libpng's pnglibconf step then finds zconf.h only if the system has one
|
|
201
|
+
# (zlib1g-dev) and fails otherwise. A normal variable with both shadows the
|
|
202
|
+
# cache entry (CMP0126, NEW from CARLA's minimum CMake 3.27).
|
|
203
|
+
if(FETCHCONTENT_BASE_DIR)
|
|
204
|
+
set(_tsc_fc_base "${FETCHCONTENT_BASE_DIR}")
|
|
205
|
+
else()
|
|
206
|
+
set(_tsc_fc_base "${CMAKE_BINARY_DIR}/_deps")
|
|
207
|
+
endif()
|
|
208
|
+
set(ZLIB_INCLUDE_DIRS "${_tsc_fc_base}/zlib-src;${_tsc_fc_base}/zlib-build")
|
|
209
|
+
|
|
210
|
+
add_subdirectory("${TSC_CARLA_DIR}" "${CMAKE_BINARY_DIR}/carla" EXCLUDE_FROM_ALL SYSTEM)
|
|
211
|
+
if(NOT TARGET carla-client)
|
|
212
|
+
message(FATAL_ERROR "CARLA at ${TSC_CARLA_DIR} did not define the carla-client target")
|
|
213
|
+
endif()
|
|
214
|
+
target_link_libraries(typesafe_carla_ffi PRIVATE carla-client)
|
|
215
|
+
|
|
216
|
+
file(STRINGS "${TSC_CARLA_DIR}/CMakeLists.txt" _tsc_carla_v REGEX "set \\(CARLA_VERSION_(MAJOR|MINOR|PATCH) [0-9]+\\)")
|
|
217
|
+
string(REGEX REPLACE ".*MAJOR ([0-9]+).*MINOR ([0-9]+).*PATCH ([0-9]+).*" "\\1.\\2.\\3"
|
|
218
|
+
TSC_CARLA_VERSION "${_tsc_carla_v}")
|
|
219
|
+
set(TSC_CARLA_LICENSE_FILE "${TSC_CARLA_DIR}/LICENSE")
|
|
220
|
+
# LibCarla (MIT) is linked statically; the wheel ships its license notice,
|
|
221
|
+
# and the notices of everything else linked in with it (Boost, rpclib,
|
|
222
|
+
# Recast, libpng, zlib, LibCarla's vendored sources), collected from the
|
|
223
|
+
# fetched sources. Configuring fails if any expected license text is missing.
|
|
224
|
+
include(cmake/ThirdPartyNotices.cmake)
|
|
225
|
+
set(TSC_CARLA_NOTICES_COMPONENTS "${CMAKE_BINARY_DIR}/THIRD_PARTY_NOTICES.components")
|
|
226
|
+
tsc_collect_third_party_notices("${TSC_CARLA_NOTICES_COMPONENTS}")
|
|
227
|
+
file(READ "${TSC_CARLA_NOTICES_COMPONENTS}" TSC_CARLA_NOTICES_COMPONENTS_TEXT)
|
|
228
|
+
|
|
229
|
+
# `cmake --build <dir> --target libcarla_prebuilt` makes a relocatable
|
|
230
|
+
# prefix of what was just built, for TSC_CARLA_PREBUILT_DIR (CI publishes
|
|
231
|
+
# them; docs/releasing.md, "LibCarla prebuilt").
|
|
232
|
+
set(TSC_CARLA_PREBUILT_OUTPUT "${CMAKE_BINARY_DIR}/libcarla-prebuilt" CACHE PATH
|
|
233
|
+
"Where the libcarla_prebuilt target assembles the LibCarla prebuilt")
|
|
234
|
+
tsc_add_libcarla_prebuilt_target("${TSC_CARLA_PREBUILT_OUTPUT}")
|
|
235
|
+
endif()
|
|
236
|
+
|
|
237
|
+
target_compile_definitions(typesafe_carla_ffi PRIVATE
|
|
238
|
+
TSC_BUILD_COMMIT="${TSC_BUILD_COMMIT}"
|
|
239
|
+
TSC_CARLA_GIT_REF="${TSC_CARLA_RESOLVED_REF}"
|
|
240
|
+
TSC_CARLA_GIT_COMMIT="${TSC_CARLA_COMMIT}")
|
|
241
|
+
|
|
242
|
+
# ---------------------------------------------------------------------------
|
|
243
|
+
# Tests (plain C client of the ABI)
|
|
244
|
+
# ---------------------------------------------------------------------------
|
|
245
|
+
option(TSC_BUILD_TESTS "Build native tests" ON)
|
|
246
|
+
if(TSC_BUILD_TESTS AND NOT SKBUILD)
|
|
247
|
+
enable_testing()
|
|
248
|
+
add_executable(test_ffi tests/native/test_ffi.c)
|
|
249
|
+
target_link_libraries(test_ffi PRIVATE typesafe_carla_ffi)
|
|
250
|
+
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
|
|
251
|
+
target_compile_options(test_ffi PRIVATE -Wall -Wextra -Werror -std=c99)
|
|
252
|
+
endif()
|
|
253
|
+
find_package(Threads REQUIRED)
|
|
254
|
+
target_link_libraries(test_ffi PRIVATE Threads::Threads)
|
|
255
|
+
add_test(NAME test_ffi COMMAND test_ffi)
|
|
256
|
+
set_tests_properties(test_ffi PROPERTIES LABELS "${TSC_BACKEND}")
|
|
257
|
+
|
|
258
|
+
# ffi.h under strict standards (-pedantic-errors): C99, C11 and C++17. The
|
|
259
|
+
# header must not need compiler extensions its users did not ask for.
|
|
260
|
+
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
|
|
261
|
+
set(_tsc_strict_src "${CMAKE_CURRENT_SOURCE_DIR}/tests/native/test_header_strict.c")
|
|
262
|
+
set(_tsc_strict_inc "-I${CMAKE_CURRENT_SOURCE_DIR}/native/include")
|
|
263
|
+
foreach(_std c99 c11)
|
|
264
|
+
add_test(NAME header_strict_${_std}
|
|
265
|
+
COMMAND ${CMAKE_C_COMPILER} -std=${_std} -pedantic-errors -Wall -Wextra -Werror
|
|
266
|
+
-fsyntax-only ${_tsc_strict_inc} ${_tsc_strict_src})
|
|
267
|
+
set_tests_properties(header_strict_${_std} PROPERTIES LABELS "${TSC_BACKEND}")
|
|
268
|
+
endforeach()
|
|
269
|
+
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
|
270
|
+
add_test(NAME header_strict_cxx17
|
|
271
|
+
COMMAND ${CMAKE_CXX_COMPILER} -x c++ -std=c++17 -pedantic-errors -Wall -Wextra
|
|
272
|
+
-Werror -fsyntax-only ${_tsc_strict_inc} ${_tsc_strict_src})
|
|
273
|
+
set_tests_properties(header_strict_cxx17 PROPERTIES LABELS "${TSC_BACKEND}")
|
|
274
|
+
endif()
|
|
275
|
+
endif()
|
|
276
|
+
|
|
277
|
+
# Generated with the bindings (tools/bindgen): NULL-handle checks for every
|
|
278
|
+
# generated function.
|
|
279
|
+
add_executable(test_generated tests/native/test_generated.c)
|
|
280
|
+
target_link_libraries(test_generated PRIVATE typesafe_carla_ffi)
|
|
281
|
+
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
|
|
282
|
+
target_compile_options(test_generated PRIVATE -Wall -Wextra -Werror -std=c99)
|
|
283
|
+
endif()
|
|
284
|
+
add_test(NAME test_generated COMMAND test_generated)
|
|
285
|
+
set_tests_properties(test_generated PROPERTIES LABELS "${TSC_BACKEND}")
|
|
286
|
+
|
|
287
|
+
# The shim's image converters, bit for bit against LibCarla's ImageConverter
|
|
288
|
+
# (Boost.GIL). Needs real LibCarla headers, so libcarla builds only.
|
|
289
|
+
if(TSC_BACKEND STREQUAL "libcarla")
|
|
290
|
+
add_executable(test_image_converter tests/native/test_image_converter.cpp
|
|
291
|
+
native/src/sensor_image.cpp)
|
|
292
|
+
target_include_directories(test_image_converter PRIVATE
|
|
293
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/native/include" "${CMAKE_CURRENT_SOURCE_DIR}/native/src")
|
|
294
|
+
target_link_libraries(test_image_converter PRIVATE carla-client)
|
|
295
|
+
add_test(NAME test_image_converter COMMAND test_image_converter)
|
|
296
|
+
set_tests_properties(test_image_converter PROPERTIES LABELS "${TSC_BACKEND}")
|
|
297
|
+
endif()
|
|
298
|
+
endif()
|
|
299
|
+
|
|
300
|
+
# ---------------------------------------------------------------------------
|
|
301
|
+
# Wheel layout (scikit-build-core installs only the "typesafe_carla" component,
|
|
302
|
+
# so CARLA's own install rules never end up in the wheel)
|
|
303
|
+
#
|
|
304
|
+
# typesafe_carla/_native/libtypesafe_carla_ffi.so
|
|
305
|
+
# typesafe_carla/_native/LICENSE.CARLA (libcarla backend)
|
|
306
|
+
# typesafe_carla/_native/THIRD_PARTY_NOTICES (libcarla backend)
|
|
307
|
+
# typesafe_carla/_codon/typesafe_carla/*.codon
|
|
308
|
+
# ---------------------------------------------------------------------------
|
|
309
|
+
install(TARGETS typesafe_carla_ffi
|
|
310
|
+
LIBRARY DESTINATION typesafe_carla/_native COMPONENT typesafe_carla)
|
|
311
|
+
install(DIRECTORY codon/typesafe_carla DESTINATION typesafe_carla/_codon
|
|
312
|
+
COMPONENT typesafe_carla FILES_MATCHING PATTERN "*.codon")
|
|
313
|
+
# What this wheel was built from; read by `typesafe-codon info` and
|
|
314
|
+
# typesafe_carla.paths.build_info() without loading the library.
|
|
315
|
+
if(NOT TSC_BACKEND STREQUAL "libcarla")
|
|
316
|
+
set(TSC_CARLA_VERSION "mock")
|
|
317
|
+
endif()
|
|
318
|
+
file(WRITE "${CMAKE_BINARY_DIR}/BUILD_INFO.json" "{
|
|
319
|
+
\"typesafe_carla\": \"${PROJECT_VERSION}\",
|
|
320
|
+
\"build_commit\": \"${TSC_BUILD_COMMIT}\",
|
|
321
|
+
\"backend\": \"${TSC_BACKEND}\",
|
|
322
|
+
\"carla_version\": \"${TSC_CARLA_VERSION}\",
|
|
323
|
+
\"carla_git_ref\": \"${TSC_CARLA_RESOLVED_REF}\",
|
|
324
|
+
\"carla_git_commit\": \"${TSC_CARLA_COMMIT}\"
|
|
325
|
+
}
|
|
326
|
+
")
|
|
327
|
+
install(FILES "${CMAKE_BINARY_DIR}/BUILD_INFO.json" DESTINATION typesafe_carla/_native
|
|
328
|
+
COMPONENT typesafe_carla)
|
|
329
|
+
|
|
330
|
+
if(TSC_BACKEND STREQUAL "libcarla")
|
|
331
|
+
# LibCarla's license and the notices of everything linked with it (see
|
|
332
|
+
# above; from the prebuilt, which collected them when it was built).
|
|
333
|
+
install(FILES "${TSC_CARLA_LICENSE_FILE}" DESTINATION typesafe_carla/_native
|
|
334
|
+
RENAME LICENSE.CARLA COMPONENT typesafe_carla)
|
|
335
|
+
include(cmake/ThirdPartyNotices.cmake)
|
|
336
|
+
tsc_write_third_party_notices("${CMAKE_BINARY_DIR}/THIRD_PARTY_NOTICES"
|
|
337
|
+
"${TSC_CARLA_NOTICES_COMPONENTS_TEXT}")
|
|
338
|
+
install(FILES "${CMAKE_BINARY_DIR}/THIRD_PARTY_NOTICES" DESTINATION typesafe_carla/_native
|
|
339
|
+
COMPONENT typesafe_carla)
|
|
340
|
+
endif()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 hakuturu583
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|