From c56080ae7f005c3a60e4872325494fa0c7ce2b1b Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sat, 21 Dec 2024 14:57:03 -0800 Subject: [PATCH 01/51] build CppController.lib --- src/controller/cpp/Makefile | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/controller/cpp/Makefile b/src/controller/cpp/Makefile index 89ccd7da9a2..61b31426a56 100644 --- a/src/controller/cpp/Makefile +++ b/src/controller/cpp/Makefile @@ -90,7 +90,7 @@ LIBCONTROLLER = $(WEBOTS_CONTROLLER_LIB_PATH)/Controller.dll SHAREDLIBS = $(LIBCONTROLLER) CPPFLAGS = -c -Wall -mwindows CPPINCLUDES = -I$(WEBOTS_HOME_PATH)/include/controller/c -I$(WEBOTS_HOME_PATH)/include/controller/cpp -TARGET = $(WEBOTS_CONTROLLER_LIB_PATH)/CppController.dll +TARGET = $(WEBOTS_CONTROLLER_LIB_PATH)/CppController.dll $(WEBOTS_CONTROLLER_LIB_PATH)/CppController.lib endif ifeq ($(OSTYPE),darwin) @@ -144,6 +144,20 @@ $(TARGET):$(CPPOBJS) $(LIBCONTROLLER) endif +ifeq ($(OSTYPE),windows) + +$(WEBOTS_CONTROLLER_LIB_PATH)/CppController.lib: $(WEBOTS_CONTROLLER_LIB_PATH)/CppController.dll CppController.def +ifeq ($(VISUAL_STUDIO_PATH),) + @$(ECHO) "# \033[0;33m'VISUAL_STUDIO_PATH' not set, skipping CppController.lib\033[0m" +else + @echo "# creating "$@ + @PATH="$(VISUAL_STUDIO_PATH)/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64":$PATH lib /machine:X64 /def:CppController.def /out:CppController.lib > /dev/null + @mv CppController.lib "$(WEBOTS_CONTROLLER_LIB_PATH)" + @rm CppController.exp +endif + +endif + $(LIBCONTROLLER): @echo "Warning: $(LIBCONTROLLER) doesn't exist, rebuild it first." From f4b2af307220b2660d2732914310618b3acca9df Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sat, 21 Dec 2024 14:57:39 -0800 Subject: [PATCH 02/51] generate def files on Windows --- resources/Makefile.include | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/resources/Makefile.include b/resources/Makefile.include index b55fecfb20c..4f7e33d9f88 100644 --- a/resources/Makefile.include +++ b/resources/Makefile.include @@ -395,10 +395,11 @@ endif ifeq ($(OSTYPE),windows) ifdef BUILD_SHARED_LIBRARY ifndef USE_CXX - ifneq ($(wildcard /C/Program\ Files\ */Microsoft\ Visual\ Studio/2017),) - VISUAL_STUDIO_PATH?=/C/Program Files (x86)/Microsoft Visual Studio/2017 - endif + ifneq ($(wildcard /C/Program\ Files\ */Microsoft\ Visual\ Studio/2017),) + VISUAL_STUDIO_PATH?=/C/Program Files (x86)/Microsoft Visual Studio/2017 + endif VS_DEF_NAME = $(NAME).def + DYNAMIC_LINK_FLAGS += --def $(VS_DEF_NAME) endif endif endif From 0ccd15659eb8f030727fcdf66217bef2689b5e6c Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sat, 21 Dec 2024 15:21:58 -0800 Subject: [PATCH 03/51] generate CppController.def --- src/controller/cpp/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controller/cpp/Makefile b/src/controller/cpp/Makefile index 61b31426a56..f8c481d73a3 100644 --- a/src/controller/cpp/Makefile +++ b/src/controller/cpp/Makefile @@ -85,7 +85,7 @@ ifneq (,$(filter $(MAKECMDGOALS),debug release profile)) # if $(MAKECMDGOALS) is endif ifeq ($(OSTYPE),windows) -LDFLAGS = -frandom-seed=0 -shared -Wl,--out-implib,$(WEBOTS_CONTROLLER_LIB_PATH)/libCppController.a +LDFLAGS = -frandom-seed=0 -shared -Wl,--out-implib,$(WEBOTS_CONTROLLER_LIB_PATH)/libCppController.a,--def CppController.def LIBCONTROLLER = $(WEBOTS_CONTROLLER_LIB_PATH)/Controller.dll SHAREDLIBS = $(LIBCONTROLLER) CPPFLAGS = -c -Wall -mwindows From cc5deb391ab5d1b4716b9911c527fdf190f06ca7 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sat, 21 Dec 2024 16:41:03 -0800 Subject: [PATCH 04/51] mark CppController.def as a target --- src/controller/cpp/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controller/cpp/Makefile b/src/controller/cpp/Makefile index f8c481d73a3..2d777bafe7f 100644 --- a/src/controller/cpp/Makefile +++ b/src/controller/cpp/Makefile @@ -90,7 +90,7 @@ LIBCONTROLLER = $(WEBOTS_CONTROLLER_LIB_PATH)/Controller.dll SHAREDLIBS = $(LIBCONTROLLER) CPPFLAGS = -c -Wall -mwindows CPPINCLUDES = -I$(WEBOTS_HOME_PATH)/include/controller/c -I$(WEBOTS_HOME_PATH)/include/controller/cpp -TARGET = $(WEBOTS_CONTROLLER_LIB_PATH)/CppController.dll $(WEBOTS_CONTROLLER_LIB_PATH)/CppController.lib +TARGET = $(WEBOTS_CONTROLLER_LIB_PATH)/CppController.dll $(WEBOTS_CONTROLLER_LIB_PATH)/CppController.def endif ifeq ($(OSTYPE),darwin) From 14eb2211c8375c7ad5b69dd979aef4d70872b1b5 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sat, 21 Dec 2024 22:17:03 -0800 Subject: [PATCH 05/51] generate def files with dlltool --- src/controller/c/Controller.def | 635 -------------------------------- src/controller/c/Makefile | 11 +- src/controller/cpp/Makefile | 18 +- 3 files changed, 22 insertions(+), 642 deletions(-) delete mode 100644 src/controller/c/Controller.def diff --git a/src/controller/c/Controller.def b/src/controller/c/Controller.def deleted file mode 100644 index 4d895a30aa2..00000000000 --- a/src/controller/c/Controller.def +++ /dev/null @@ -1,635 +0,0 @@ -EXPORTS -wb_ANSI_RESET -wb_ANSI_BOLD -wb_ANSI_UNDERLINE -wb_ANSI_BLACK_BACKGROUND -wb_ANSI_RED_BACKGROUND -wb_ANSI_GREEN_BACKGROUND -wb_ANSI_YELLOW_BACKGROUND -wb_ANSI_BLUE_BACKGROUND -wb_ANSI_MAGENTA_BACKGROUND -wb_ANSI_CYAN_BACKGROUND -wb_ANSI_WHITE_BACKGROUND -wb_ANSI_BLACK_FOREGROUND -wb_ANSI_RED_FOREGROUND -wb_ANSI_GREEN_FOREGROUND -wb_ANSI_YELLOW_FOREGROUND -wb_ANSI_BLUE_FOREGROUND -wb_ANSI_MAGENTA_FOREGROUND -wb_ANSI_CYAN_FOREGROUND -wb_ANSI_WHITE_FOREGROUND -wb_ANSI_CLEAR_SCREEN -wb_KEYBOARD_END -wb_KEYBOARD_HOME -wb_KEYBOARD_LEFT -wb_KEYBOARD_UP -wb_KEYBOARD_RIGHT -wb_KEYBOARD_DOWN -wb_KEYBOARD_PAGEUP -wb_KEYBOARD_PAGEDOWN -wb_KEYBOARD_NUMPAD_HOME -wb_KEYBOARD_NUMPAD_LEFT -wb_KEYBOARD_NUMPAD_UP -wb_KEYBOARD_NUMPAD_RIGHT -wb_KEYBOARD_NUMPAD_DOWN -wb_KEYBOARD_NUMPAD_END -wb_KEYBOARD_KEY -wb_KEYBOARD_SHIFT -wb_KEYBOARD_CONTROL -wb_KEYBOARD_ALT -wb_LINEAR -wb_MF -wb_MF_BOOL -wb_MF_INT32 -wb_MF_FLOAT -wb_MF_VEC2F -wb_MF_VEC3F -wb_MF_ROTATION -wb_MF_COLOR -wb_MF_STRING -wb_MF_NODE -wb_NODE_NO_NODE -wb_NODE_APPEARANCE -wb_NODE_BACKGROUND -wb_NODE_BILLBOARD -wb_NODE_BOX -wb_NODE_CAD_SHAPE -wb_NODE_CAPSULE -wb_NODE_COLOR -wb_NODE_CONE -wb_NODE_COORDINATE -wb_NODE_CYLINDER -wb_NODE_DIRECTIONAL_LIGHT -wb_NODE_ELEVATION_GRID -wb_NODE_FOG -wb_NODE_GROUP -wb_NODE_IMAGE_TEXTURE -wb_NODE_INDEXED_FACE_SET -wb_NODE_INDEXED_LINE_SET -wb_NODE_MATERIAL -wb_NODE_MESH -wb_NODE_MUSCLE -wb_NODE_NORMAL -wb_NODE_PBR_APPEARANCE -wb_NODE_PLANE -wb_NODE_POINT_LIGHT -wb_NODE_POINT_SET -wb_NODE_POSE -wb_NODE_SHAPE -wb_NODE_SPHERE -wb_NODE_SPOT_LIGHT -wb_NODE_TEXTURE_COORDINATE -wb_NODE_TEXTURE_TRANSFORM -wb_NODE_TRANSFORM -wb_NODE_VIEWPOINT -wb_NODE_ROBOT -wb_NODE_ACCELEROMETER -wb_NODE_ALTIMETER -wb_NODE_BRAKE -wb_NODE_CAMERA -wb_NODE_COMPASS -wb_NODE_CONNECTOR -wb_NODE_DISPLAY -wb_NODE_DISTANCE_SENSOR -wb_NODE_EMITTER -wb_NODE_GPS -wb_NODE_GYRO -wb_NODE_INERTIAL_UNIT -wb_NODE_LED -wb_NODE_LIDAR -wb_NODE_LIGHT_SENSOR -wb_NODE_LINEAR_MOTOR -wb_NODE_PEN -wb_NODE_POSITION_SENSOR -wb_NODE_PROPELLER -wb_NODE_RADAR -wb_NODE_RANGE_FINDER -wb_NODE_RECEIVER -wb_NODE_ROTATIONAL_MOTOR -wb_NODE_SKIN -wb_NODE_SPEAKER -wb_NODE_TOUCH_SENSOR -wb_NODE_VACUUM_GRIPPER -wb_NODE_BALL_JOINT -wb_NODE_BALL_JOINT_PARAMETERS -wb_NODE_CHARGER -wb_NODE_CONTACT_PROPERTIES -wb_NODE_DAMPING -wb_NODE_FLUID -wb_NODE_FOCUS -wb_NODE_HINGE_JOINT -wb_NODE_HINGE_JOINT_PARAMETERS -wb_NODE_HINGE_2_JOINT -wb_NODE_IMMERSION_PROPERTIES -wb_NODE_JOINT_PARAMETERS -wb_NODE_LENS -wb_NODE_LENS_FLARE -wb_NODE_PHYSICS -wb_NODE_RECOGNITION -wb_NODE_SLIDER_JOINT -wb_NODE_SLOT -wb_NODE_SOLID -wb_NODE_SOLID_REFERENCE -wb_NODE_TRACK -wb_NODE_TRACK_WHEEL -wb_NODE_WORLD_INFO -wb_NODE_ZOOM -wb_NODE_MICROPHONE -wb_NODE_RADIO -wb_ROTATIONAL -wb_SF_BOOL -wb_SF_INT32 -wb_SF_FLOAT -wb_SF_VEC2F -wb_SF_VEC3F -wb_SF_ROTATION -wb_SF_COLOR -wb_SF_STRING -wb_SF_NODE -wb_accelerometer_disable -wb_accelerometer_enable -wb_accelerometer_get_sampling_period -wb_accelerometer_get_values -wb_accelerometer_get_lookup_table_size -wb_accelerometer_get_lookup_table -wb_altimeter_disable -wb_altimeter_enable -wb_altimeter_get_sampling_period -wb_altimeter_get_value -wb_brake_get_motor -wb_brake_get_position_sensor -wb_brake_get_type -wb_brake_set_damping_constant -wb_camera_disable -wb_camera_enable -wb_camera_get_exposure -wb_camera_get_focal_distance -wb_camera_get_focal_length -wb_camera_get_fov -wb_camera_get_height -wb_camera_get_image -wb_camera_get_max_focal_distance -wb_camera_get_max_fov -wb_camera_get_min_focal_distance -wb_camera_get_min_fov -wb_camera_get_near -wb_camera_get_sampling_period -wb_camera_get_width -wb_camera_has_recognition -wb_camera_recognition_disable -wb_camera_recognition_disable_segmentation -wb_camera_recognition_enable -wb_camera_recognition_enable_segmentation -wb_camera_recognition_get_number_of_objects -wb_camera_recognition_get_objects -wb_camera_recognition_get_sampling_period -wb_camera_recognition_get_segmentation_image -wb_camera_recognition_has_segmentation -wb_camera_recognition_is_segmentation_enabled -wb_camera_recognition_save_segmentation_image -wb_camera_save_image -wb_camera_set_exposure -wb_camera_set_focal_distance -wb_camera_set_fov -wb_compass_disable -wb_compass_enable -wb_compass_get_sampling_period -wb_compass_get_values -wb_compass_get_lookup_table_size -wb_compass_get_lookup_table -wb_connector_disable_presence -wb_connector_enable_presence -wb_connector_get_presence -wb_connector_get_presence_sampling_period -wb_connector_is_locked -wb_connector_lock -wb_connector_unlock -wb_console_print -wb_device_get_model -wb_device_get_name -wb_device_get_type -wb_device_get_node_type -wb_display_attach_camera -wb_display_detach_camera -wb_display_draw_line -wb_display_draw_oval -wb_display_draw_pixel -wb_display_draw_polygon -wb_display_draw_rectangle -wb_display_draw_text -wb_display_fill_oval -wb_display_fill_polygon -wb_display_fill_rectangle -wb_display_get_height -wb_display_get_width -wb_display_image_copy -wb_display_image_delete -wb_display_image_load -wb_display_image_new -wb_display_image_paste -wb_display_image_save -wb_display_set_alpha -wb_display_set_color -wb_display_set_font -wb_display_set_opacity -wb_distance_sensor_disable -wb_distance_sensor_enable -wb_distance_sensor_get_aperture -wb_distance_sensor_get_max_value -wb_distance_sensor_get_min_value -wb_distance_sensor_get_sampling_period -wb_distance_sensor_get_type -wb_distance_sensor_get_value -wb_distance_sensor_get_lookup_table_size -wb_distance_sensor_get_lookup_table -wb_emitter_get_buffer_size -wb_emitter_get_channel -wb_emitter_get_range -wb_emitter_send -wb_emitter_set_channel -wb_emitter_set_range -wb_gps_disable -wb_gps_convert_to_degrees_minutes_seconds -wb_gps_enable -wb_gps_get_coordinate_system -wb_gps_get_sampling_period -wb_gps_get_speed -wb_gps_get_speed_vector -wb_gps_get_values -wb_gyro_disable -wb_gyro_enable -wb_gyro_get_sampling_period -wb_gyro_get_values -wb_gyro_get_lookup_table_size -wb_gyro_get_lookup_table -wb_inertial_unit_disable -wb_inertial_unit_enable -wb_inertial_unit_get_roll_pitch_yaw -wb_inertial_unit_get_quaternion -wb_inertial_unit_get_sampling_period -wb_inertial_unit_get_noise -wb_joystick_disable -wb_joystick_enable -wb_joystick_get_axis_value -wb_joystick_get_model -wb_joystick_get_number_of_axes -wb_joystick_get_number_of_povs -wb_joystick_get_pov_value -wb_joystick_get_pressed_button -wb_joystick_get_sampling_period -wb_joystick_is_connected -wb_joystick_set_auto_centering_gain -wb_joystick_set_constant_force -wb_joystick_set_constant_force_duration -wb_joystick_set_force_axis -wb_joystick_set_resistance_gain -wb_keyboard_disable -wb_keyboard_enable -wb_keyboard_get_key -wb_keyboard_get_sampling_period -wb_led_get -wb_led_set -wb_lidar_disable -wb_lidar_disable_point_cloud -wb_lidar_enable -wb_lidar_enable_point_cloud -wb_lidar_get_fov -wb_lidar_get_frequency -wb_lidar_get_horizontal_resolution -wb_lidar_get_layer_point_cloud -wb_lidar_get_layer_range_image -wb_lidar_get_max_frequency -wb_lidar_get_max_range -wb_lidar_get_min_frequency -wb_lidar_get_min_range -wb_lidar_get_number_of_layers -wb_lidar_get_number_of_points -wb_lidar_get_point_cloud -wb_lidar_get_range_image -wb_lidar_get_sampling_period -wb_lidar_get_vertical_fov -wb_lidar_is_point_cloud_enabled -wb_lidar_set_frequency -wb_light_sensor_disable -wb_light_sensor_enable -wb_light_sensor_get_sampling_period -wb_light_sensor_get_value -wb_light_sensor_get_lookup_table_size -wb_light_sensor_get_lookup_table -wb_microphone_enable -wb_microphone_get_sample_data -wb_microphone_get_sample_size -wb_microphone_get_sampling_period -wb_motor_disable_force_feedback -wb_motor_disable_torque_feedback -wb_motor_enable_force_feedback -wb_motor_enable_torque_feedback -wb_motor_get_acceleration -wb_motor_get_available_force -wb_motor_get_available_torque -wb_motor_get_force_feedback -wb_motor_get_force_feedback_sampling_period -wb_motor_get_max_force -wb_motor_get_max_torque -wb_motor_get_max_position -wb_motor_get_max_velocity -wb_motor_get_min_position -wb_motor_get_multiplier -wb_motor_get_target_position -wb_motor_get_torque_feedback -wb_motor_get_torque_feedback_sampling_period -wb_motor_get_type -wb_motor_get_velocity -wb_motor_get_brake -wb_motor_get_position_sensor -wb_motor_set_acceleration -wb_motor_set_available_force -wb_motor_set_available_torque -wb_motor_set_control_pid -wb_motor_set_force -wb_motor_set_position -wb_motor_set_torque -wb_motor_set_velocity -wb_mouse_disable -wb_mouse_disable_3d_position -wb_mouse_enable -wb_mouse_enable_3d_position -wb_mouse_get_sampling_period -wb_mouse_get_state -wb_mouse_is_3d_position_enabled -wb_node_get_name -wb_pen_set_ink_color -wb_pen_write -wb_position_sensor_enable -wb_position_sensor_disable -wb_position_sensor_get_value -wb_position_sensor_get_sampling_period -wb_position_sensor_get_type -wb_position_sensor_get_brake -wb_position_sensor_get_motor -wb_radar_disable -wb_radar_enable -wb_radar_get_horizontal_fov -wb_radar_get_max_range -wb_radar_get_min_range -wb_radar_get_number_of_targets -wb_radar_get_sampling_period -wb_radar_get_targets -wb_radar_get_vertical_fov -wb_range_finder_enable -wb_range_finder_disable -wb_range_finder_get_sampling_period -wb_range_finder_get_range_image -wb_range_finder_get_width -wb_range_finder_get_height -wb_range_finder_get_fov -wb_range_finder_get_min_range -wb_range_finder_get_max_range -wb_range_finder_save_image -wb_range_finder_image_get_depth -wb_remote_control_custom_function -wb_receiver_disable -wb_receiver_enable -wb_receiver_get_channel -wb_receiver_get_data -wb_receiver_get_data_size -wb_receiver_get_emitter_direction -wb_receiver_get_queue_length -wb_receiver_get_sampling_period -wb_receiver_get_signal_strength -wb_receiver_next_packet -wb_receiver_set_channel -wb_robot_battery_sensor_disable -wb_robot_battery_sensor_enable -wb_robot_battery_sensor_get_value -wb_robot_battery_sensor_get_sampling_period -wb_robot_cleanup -wb_robot_get_basic_time_step -wb_robot_get_controller_name -wb_robot_get_custom_data -wb_robot_get_data -wb_robot_get_device -wb_robot_get_device_by_index -wb_robot_get_mode -wb_robot_get_model -wb_robot_get_name -wb_robot_get_number_of_devices -wb_robot_get_project_path -wb_robot_get_supervisor -wb_robot_get_synchronization -wb_robot_get_time -wb_robot_get_urdf -wb_robot_get_world_path -wb_robot_init -wb_robot_init_msvc -wb_robot_mutex_delete -wb_robot_mutex_lock -wb_robot_mutex_new -wb_robot_mutex_unlock -wb_robot_pin_to_static_environment -wb_robot_set_custom_data -wb_robot_set_data -wb_robot_set_mode -wb_robot_step -wb_robot_step_begin -wb_robot_step_end -wb_robot_task_new -wb_robot_wait_for_user_input_event -wb_robot_window_custom_function -wb_robot_wwi_send -wb_robot_wwi_receive -wb_robot_wwi_receive_text -wb_skin_get_bone_count -wb_skin_get_bone_name -wb_skin_get_bone_orientation -wb_skin_get_bone_position -wb_skin_set_bone_orientation -wb_skin_set_bone_position -wb_speaker_get_engine -wb_speaker_get_language -wb_speaker_is_sound_playing -wb_speaker_is_speaking -wb_speaker_play_sound -wb_speaker_set_engine -wb_speaker_set_language -wb_speaker_speak -wb_speaker_stop -wb_supervisor_node_add_force -wb_supervisor_node_add_force_with_offset -wb_supervisor_node_add_torque -wb_supervisor_animation_start_recording -wb_supervisor_animation_stop_recording -wb_supervisor_export_image -wb_supervisor_field_disable_sf_tracking -wb_supervisor_field_enable_sf_tracking -wb_supervisor_field_get_count -wb_supervisor_field_get_name -wb_supervisor_field_get_mf_bool -wb_supervisor_field_get_mf_color -wb_supervisor_field_get_mf_float -wb_supervisor_field_get_mf_int32 -wb_supervisor_field_get_mf_node -wb_supervisor_field_get_mf_rotation -wb_supervisor_field_get_mf_string -wb_supervisor_field_get_mf_vec2f -wb_supervisor_field_get_mf_vec3f -wb_supervisor_field_get_sf_bool -wb_supervisor_field_get_sf_color -wb_supervisor_field_get_sf_float -wb_supervisor_field_get_sf_int32 -wb_supervisor_field_get_sf_node -wb_supervisor_field_get_sf_rotation -wb_supervisor_field_get_sf_string -wb_supervisor_field_get_sf_vec2f -wb_supervisor_field_get_sf_vec3f -wb_supervisor_field_get_type -wb_supervisor_field_get_type_name -wb_supervisor_field_import_mf_node_from_string -wb_supervisor_field_import_sf_node_from_string -wb_supervisor_field_insert_mf_bool -wb_supervisor_field_insert_mf_color -wb_supervisor_field_insert_mf_float -wb_supervisor_field_insert_mf_int32 -wb_supervisor_field_insert_mf_rotation -wb_supervisor_field_insert_mf_string -wb_supervisor_field_insert_mf_vec2f -wb_supervisor_field_insert_mf_vec3f -wb_supervisor_field_remove_mf -wb_supervisor_field_remove_mf_node -wb_supervisor_field_remove_sf -wb_supervisor_field_set_mf_bool -wb_supervisor_field_set_mf_color -wb_supervisor_field_set_mf_float -wb_supervisor_field_set_mf_int32 -wb_supervisor_field_set_mf_rotation -wb_supervisor_field_set_mf_string -wb_supervisor_field_set_mf_vec2f -wb_supervisor_field_set_mf_vec3f -wb_supervisor_field_set_sf_bool -wb_supervisor_field_set_sf_color -wb_supervisor_field_set_sf_float -wb_supervisor_field_set_sf_int32 -wb_supervisor_field_set_sf_rotation -wb_supervisor_field_set_sf_string -wb_supervisor_field_set_sf_vec2f -wb_supervisor_field_set_sf_vec3f -wb_supervisor_movie_failed -wb_supervisor_movie_is_ready -wb_supervisor_movie_start_recording -wb_supervisor_movie_stop_recording -wb_supervisor_movie_get_status -wb_supervisor_node_disable_contact_point_tracking -wb_supervisor_node_disable_contact_points_tracking -wb_supervisor_node_disable_pose_tracking -wb_supervisor_node_enable_contact_point_tracking -wb_supervisor_node_enable_contact_points_tracking -wb_supervisor_node_enable_pose_tracking -wb_supervisor_node_export_string -wb_supervisor_node_get_base_type_name -wb_supervisor_node_get_def -wb_supervisor_node_get_field -wb_supervisor_node_get_field_by_index -wb_supervisor_node_get_from_def -wb_supervisor_node_get_from_id -wb_supervisor_node_get_from_proto_def -wb_supervisor_node_get_from_device -wb_supervisor_node_get_center_of_mass -wb_supervisor_node_get_contact_point -wb_supervisor_node_get_contact_points -wb_supervisor_node_get_contact_point_node -wb_supervisor_node_get_id -wb_supervisor_node_get_number_of_fields -wb_supervisor_node_get_number_of_contact_points -wb_supervisor_node_get_orientation -wb_supervisor_node_get_parent_node -wb_supervisor_node_get_pose -wb_supervisor_node_get_position -wb_supervisor_node_get_proto_field -wb_supervisor_node_get_proto_field_by_index -wb_supervisor_node_get_proto_number_of_fields -wb_supervisor_node_get_root -wb_supervisor_node_get_selected -wb_supervisor_node_get_self -wb_supervisor_node_get_static_balance -wb_supervisor_node_get_type -wb_supervisor_node_get_type_name -wb_supervisor_node_get_velocity -wb_supervisor_node_is_proto -wb_supervisor_node_load_state -wb_supervisor_node_move_viewpoint -wb_supervisor_node_remove -wb_supervisor_node_reset_physics -wb_supervisor_node_restart_controller -wb_supervisor_node_save_state -wb_supervisor_node_set_joint_position -wb_supervisor_node_set_velocity -wb_supervisor_node_set_visibility -wb_supervisor_set_label -wb_supervisor_simulation_get_mode -wb_supervisor_simulation_physics_reset -wb_supervisor_simulation_quit -wb_supervisor_simulation_reset -wb_supervisor_simulation_reset_physics -wb_supervisor_simulation_revert -wb_supervisor_simulation_set_mode -wb_supervisor_start_movie -wb_supervisor_stop_movie -wb_supervisor_get_movie_status -wb_supervisor_virtual_reality_headset_get_position -wb_supervisor_virtual_reality_headset_get_orientation -wb_supervisor_virtual_reality_headset_is_used -wb_supervisor_world_load -wb_supervisor_world_save -wb_supervisor_world_reload -wb_touch_sensor_disable -wb_touch_sensor_enable -wb_touch_sensor_get_sampling_period -wb_touch_sensor_get_type -wb_touch_sensor_get_value -wb_touch_sensor_get_values -wb_touch_sensor_get_lookup_table_size -wb_touch_sensor_get_lookup_table -wb_vacuum_gripper_disable_presence -wb_vacuum_gripper_enable_presence -wb_vacuum_gripper_get_presence -wb_vacuum_gripper_get_presence_sampling_period -wb_vacuum_gripper_is_on -wb_vacuum_gripper_turn_on -wb_vacuum_gripper_turn_off -wbr_accelerometer_set_values -wbr_camera_get_image_buffer -wbr_camera_set_image -wbr_camera_set_focal_distance -wbr_camera_set_fov -wbr_compass_set_values -wbr_display_save_image -wbr_distance_sensor_set_value -wbr_gps_set_values -wbr_gyro_set_values -wbr_light_sensor_set_value -wbr_microphone_set_buffer -wbr_motor_set_force_feedback -wbr_motor_set_torque_feedback -wbr_position_sensor_set_value -wbr_robot_battery_sensor_set_value -wbr_touch_sensor_set_value -wbr_touch_sensor_set_values -wbu_default_robot_window_configure -wbu_default_robot_window_update -wbu_default_robot_window_set_images_max_size -wbu_motion_delete -wbu_motion_get_duration -wbu_motion_get_time -wbu_motion_is_over -wbu_motion_new -wbu_motion_play -wbu_motion_set_loop -wbu_motion_set_reverse -wbu_motion_set_time -wbu_motion_stop -wbu_robot_window_configure -wbu_robot_window_update -wbu_string_replace -wbu_string_strsep -wbu_system_getenv -wbu_system_short_path diff --git a/src/controller/c/Makefile b/src/controller/c/Makefile index 00ea8b16b26..52ff4772044 100644 --- a/src/controller/c/Makefile +++ b/src/controller/c/Makefile @@ -61,7 +61,7 @@ endif ifeq ($(OSTYPE),windows) CFLAGS = -Wall -mwindows -frandom-seed=0 -D LIBCONTROLLER_VERSION='$(LIBCONTROLLER_VERSION)' INCLUDE = -I$(WEBOTS_HOME_PATH)/include/controller/c -I$(WEBOTS_HOME_PATH)/include -I/mingw64/include -LD_FLAGS = -shared -mwindows --def Controller.def -lws2_32 +LD_FLAGS = -shared -mwindows -lws2_32 PLATFORM = win32 CC = gcc TARGET = $(WEBOTS_CONTROLLER_LIB_PATH)/Controller.dll $(WEBOTS_CONTROLLER_LIB_PATH)/Controller.lib @@ -126,12 +126,16 @@ ifeq ($(OSTYPE),windows) MINGW64_OBJECTS = $(addprefix $(OBJDIR)/, $(OBJECTS)) -$(WEBOTS_CONTROLLER_LIB_PATH)/Controller.dll: $(MINGW64_OBJECTS) Controller.def +$(WEBOTS_CONTROLLER_LIB_PATH)/Controller.dll: $(MINGW64_OBJECTS) @echo "# linking "$@ @echo "# linking "$(WEBOTS_CONTROLLER_LIB_PATH)"/libController.a" @$(CC) -o $@ $(addprefix $(OBJDIR)/, $(OBJECTS)) $(LD_FLAGS) -Wl,--out-implib,$(WEBOTS_CONTROLLER_LIB_PATH)/libController.a -$(WEBOTS_CONTROLLER_LIB_PATH)/Controller.lib: $(WEBOTS_CONTROLLER_LIB_PATH)/Controller.dll Controller.def +Controller.def: $(WEBOTS_CONTROLLER_LIB_PATH)/Controller.dll + @echo "# generating "$@ + @dlltool --export-all-symbols -z Controller.def $(WEBOTS_CONTROLLER_LIB_PATH)/Controller.dll + +$(WEBOTS_CONTROLLER_LIB_PATH)/Controller.lib: Controller.def ifeq ($(VISUAL_STUDIO_PATH),) @$(ECHO) "# \033[0;33m'VISUAL_STUDIO_PATH' not set, skipping Controller.lib\033[0m" else @@ -195,3 +199,4 @@ $(OBJDIR)/%.d:%.c FILES_TO_REMOVE = $(TARGET) FILES_TO_REMOVE += $(WEBOTS_CONTROLLER_LIB_PATH)/libController.a FILES_TO_REMOVE += $(WEBOTS_CONTROLLER_LIB_PATH)/libController.lib +FILES_TO_REMOVE += Controller.def diff --git a/src/controller/cpp/Makefile b/src/controller/cpp/Makefile index 2d777bafe7f..3884c3a16fb 100644 --- a/src/controller/cpp/Makefile +++ b/src/controller/cpp/Makefile @@ -85,12 +85,12 @@ ifneq (,$(filter $(MAKECMDGOALS),debug release profile)) # if $(MAKECMDGOALS) is endif ifeq ($(OSTYPE),windows) -LDFLAGS = -frandom-seed=0 -shared -Wl,--out-implib,$(WEBOTS_CONTROLLER_LIB_PATH)/libCppController.a,--def CppController.def +LDFLAGS = -frandom-seed=0 -shared -Wl,--out-implib,$(WEBOTS_CONTROLLER_LIB_PATH)/libCppController.a LIBCONTROLLER = $(WEBOTS_CONTROLLER_LIB_PATH)/Controller.dll SHAREDLIBS = $(LIBCONTROLLER) CPPFLAGS = -c -Wall -mwindows CPPINCLUDES = -I$(WEBOTS_HOME_PATH)/include/controller/c -I$(WEBOTS_HOME_PATH)/include/controller/cpp -TARGET = $(WEBOTS_CONTROLLER_LIB_PATH)/CppController.dll $(WEBOTS_CONTROLLER_LIB_PATH)/CppController.def +TARGET = $(WEBOTS_CONTROLLER_LIB_PATH)/CppController.dll $(WEBOTS_CONTROLLER_LIB_PATH)/CppController.lib endif ifeq ($(OSTYPE),darwin) @@ -136,7 +136,9 @@ $(BUILD_GOAL_DIR)/arm64/libCppController.dylib: $(ARM64_OBJECTS) @echo "# linking" $@ "(arm64)" @$(CXX) -target arm64-apple-macos12 $(LDFLAGS) $(ARM64_OBJECTS) $(SHAREDLIBS) -o "$@" -else +endif + +ifeq ($(OSTYPE),linux) $(TARGET):$(CPPOBJS) $(LIBCONTROLLER) @echo "# linking" $@ @@ -146,7 +148,15 @@ endif ifeq ($(OSTYPE),windows) -$(WEBOTS_CONTROLLER_LIB_PATH)/CppController.lib: $(WEBOTS_CONTROLLER_LIB_PATH)/CppController.dll CppController.def +$(WEBOTS_CONTROLLER_LIB_PATH)/CppController.dll:$(CPPOBJS) $(LIBCONTROLLER) + @echo "# linking" $@ + @$(CXX) $(LDFLAGS) $(CPPOBJS) $(SHAREDLIBS) -o "$@" + +Controller.def: $(WEBOTS_CONTROLLER_LIB_PATH)/CppController.dll + @echo "# generating "$@ + @dlltool --export-all-symbols -z CppController.def $(WEBOTS_CONTROLLER_LIB_PATH)/CppController.dll + +$(WEBOTS_CONTROLLER_LIB_PATH)/CppController.lib: CppController.def ifeq ($(VISUAL_STUDIO_PATH),) @$(ECHO) "# \033[0;33m'VISUAL_STUDIO_PATH' not set, skipping CppController.lib\033[0m" else From 092c4ad7d15737f1f9c99f7529b59d27c32aeacb Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sat, 21 Dec 2024 22:19:49 -0800 Subject: [PATCH 06/51] generate def files in Makefile.include --- resources/Makefile.include | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/resources/Makefile.include b/resources/Makefile.include index 4f7e33d9f88..6a41ed54145 100644 --- a/resources/Makefile.include +++ b/resources/Makefile.include @@ -399,7 +399,6 @@ ifeq ($(OSTYPE),windows) VISUAL_STUDIO_PATH?=/C/Program Files (x86)/Microsoft Visual Studio/2017 endif VS_DEF_NAME = $(NAME).def - DYNAMIC_LINK_FLAGS += --def $(VS_DEF_NAME) endif endif endif @@ -510,14 +509,13 @@ $(MAIN_TARGET): $(TARGET_LIB_DIR)/$(MAIN_TARGET) ifdef VS_DEF_NAME @# Generate the .lib libraries to facilitate the integration with Visual Studio @# if the .def file is existing. - @if [ -f $(VS_DEF_NAME) ]; then \ - if [ -d "$(VISUAL_STUDIO_PATH)" ]; then \ - PATH="$(VISUAL_STUDIO_PATH)/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64":$PATH lib /machine:X64 /def:$(VS_DEF_NAME) /out:out.lib > /dev/null; \ - mv out.lib $(MAIN_TARGET_WINDOWS64_LIB); \ - rm -f *.exp; \ - else \ - $(ECHO) "\033[0;33m'VISUAL_STUDIO_PATH' environmental variable not set or Microsoft Visual Studio not installed, skipping $(NAME).lib\033[0m"; \ - fi \ + @dlltool --export-all-symbols -z $(VS_DEF_NAME) $(TARGET_LIB_DIR)/$(MAIN_TARGET) + if [ -d "$(VISUAL_STUDIO_PATH)" ]; then \ + PATH="$(VISUAL_STUDIO_PATH)/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64":$PATH lib /machine:X64 /def:$(VS_DEF_NAME) /out:out.lib > /dev/null; \ + mv out.lib $(MAIN_TARGET_WINDOWS64_LIB); \ + rm -f *.exp; \ + else \ + $(ECHO) "\033[0;33m'VISUAL_STUDIO_PATH' environmental variable not set or Microsoft Visual Studio not installed, skipping $(NAME).lib\033[0m"; \ fi endif From 46bf8212faf130a865272faad40702b25fb84347 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sat, 21 Dec 2024 22:21:45 -0800 Subject: [PATCH 07/51] ignore def files --- .gitignore | 1 + .../default/libraries/vehicle/c/car/car.def | 28 - .../libraries/vehicle/c/driver/driver.def | 30 - .../youbot_control/youbot_control.def | 34 - src/ode/ode.def | 649 ------------------ 5 files changed, 1 insertion(+), 741 deletions(-) delete mode 100644 projects/default/libraries/vehicle/c/car/car.def delete mode 100644 projects/default/libraries/vehicle/c/driver/driver.def delete mode 100644 projects/robots/kuka/youbot/libraries/youbot_control/youbot_control.def delete mode 100644 src/ode/ode.def diff --git a/.gitignore b/.gitignore index 333e6dfb634..17cfba3db0c 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ webots_catkin_ws *.hex *.pyc *.gch +*.def # Packages *.7z diff --git a/projects/default/libraries/vehicle/c/car/car.def b/projects/default/libraries/vehicle/c/car/car.def deleted file mode 100644 index 1c3e82018d5..00000000000 --- a/projects/default/libraries/vehicle/c/car/car.def +++ /dev/null @@ -1,28 +0,0 @@ -EXPORTS -wbu_car_init -wbu_car_cleanup -wbu_car_get_type -wbu_car_get_engine_type -wbu_car_set_indicator_period -wbu_car_get_indicator_period -wbu_car_get_backwards_lights -wbu_car_get_brake_lights -wbu_car_get_track_front -wbu_car_get_track_rear -wbu_car_get_wheelbase -wbu_car_get_front_wheel_radius -wbu_car_get_rear_wheel_radius -wbu_car_get_wheel_encoder -wbu_car_get_wheel_speed -wbu_car_set_right_steering_angle -wbu_car_get_right_steering_angle -wbu_car_set_left_steering_angle -wbu_car_get_left_steering_angle -wbu_car_enable_limited_slip_differential -wbu_car_enable_indicator_auto_disabling -_wbu_car_get_instance -_wbu_car_set_led_state_if_exist -_wbu_car_get_led_state_if_exist -_wbu_car_check_initialisation -_wbu_car_initialization_is_possible - diff --git a/projects/default/libraries/vehicle/c/driver/driver.def b/projects/default/libraries/vehicle/c/driver/driver.def deleted file mode 100644 index 20a14276f50..00000000000 --- a/projects/default/libraries/vehicle/c/driver/driver.def +++ /dev/null @@ -1,30 +0,0 @@ -EXPORTS -wbu_driver_init -wbu_driver_initialization_is_possible -wbu_driver_cleanup -wbu_driver_step -wbu_driver_set_steering_angle -wbu_driver_get_steering_angle -wbu_driver_set_cruising_speed -wbu_driver_get_target_cruising_speed -wbu_driver_get_current_speed -wbu_driver_set_throttle -wbu_driver_get_throttle -wbu_driver_set_brake_intensity -wbu_driver_get_brake_intensity -wbu_driver_set_indicator -wbu_driver_set_hazard_flashers -wbu_driver_get_indicator -wbu_driver_get_hazard_flashers -wbu_driver_set_dipped_beams -wbu_driver_set_antifog_lights -wbu_driver_get_dipped_beams -wbu_driver_get_antifog_lights -wbu_driver_get_rpm -wbu_driver_get_gear -wbu_driver_set_gear -wbu_driver_get_gear_number -wbu_driver_get_control_mode -wbu_driver_set_wiper_mode -wbu_driver_get_wiper_mode - diff --git a/projects/robots/kuka/youbot/libraries/youbot_control/youbot_control.def b/projects/robots/kuka/youbot/libraries/youbot_control/youbot_control.def deleted file mode 100644 index c31e921477d..00000000000 --- a/projects/robots/kuka/youbot/libraries/youbot_control/youbot_control.def +++ /dev/null @@ -1,34 +0,0 @@ -EXPORTS -arm_init -arm_reset -arm_set_height -arm_increase_height -arm_decrease_height -arm_set_orientation -arm_increase_orientation -arm_decrease_orientation -arm_set_sub_arm_rotation -arm_get_sub_arm_length -arm_ik -base_init -base_reset -base_forwards -base_backwards -base_turn_left -base_turn_right -base_strafe_left -base_strafe_right -base_forwards_increment -base_backwards_increment -base_turn_left_increment -base_turn_right_increment -base_strafe_left_increment -base_strafe_right_increment -base_goto_init -base_goto_set_target -base_goto_run -base_goto_reached -gripper_init -gripper_grip -gripper_release -gripper_set_gap diff --git a/src/ode/ode.def b/src/ode/ode.def deleted file mode 100644 index 17ba86a738d..00000000000 --- a/src/ode/ode.def +++ /dev/null @@ -1,649 +0,0 @@ -EXPORTS -dAlloc -dAllocateODEDataForThread -dAreConnected -dAreConnectedExcluding -dAreGeomsSame -dAreLinked -dBodyAddForce -dBodyAddForceAtPos -dBodyAddForceAtRelPos -dBodyAddRelForce -dBodyAddRelForceAtPos -dBodyAddRelForceAtRelPos -dBodyAddRelTorque -dBodyAddTorque -dBodyCopyPosition -dBodyCopyQuaternion -dBodyCopyRotation -dBodyCreate -dBodyDestroy -dBodyDisable -dBodyEnable -dBodyGetAngularDamping -dBodyGetAngularDampingThreshold -dBodyGetAngularVel -dBodyGetAutoDisableAngularThreshold -dBodyGetAutoDisableAverageSamplesCount -dBodyGetAutoDisableFlag -dBodyGetAutoDisableLinearThreshold -dBodyGetAutoDisableSteps -dBodyGetAutoDisableTime -dBodyGetData -dBodyGetFiniteRotationAxis -dBodyGetFiniteRotationMode -dBodyGetFirstGeom -dBodyGetForce -dBodyGetGravityMode -dBodyGetGyroscopicMode -dBodyGetImmersionLink -dBodyGetJoint -dBodyGetLinearDamping -dBodyGetLinearDampingThreshold -dBodyGetLinearVel -dBodyGetMass -dBodyGetMaxAngularSpeed -dBodyGetNextGeom -dBodyGetNumImmersionLinks -dBodyGetNumJoints -dBodyGetPointVel -dBodyGetPosRelPoint -dBodyGetPosition -dBodyGetQuaternion -dBodyGetRelPointPos -dBodyGetRelPointVel -dBodyGetRotation -dBodyGetTorque -dBodyGetWorld -dBodyIsEnabled -dBodyIsKinematic -dBodySetAngularDamping -dBodySetAngularDampingThreshold -dBodySetAngularVel -dBodySetAutoDisableAngularThreshold -dBodySetAutoDisableAverageSamplesCount -dBodySetAutoDisableDefaults -dBodySetAutoDisableFlag -dBodySetAutoDisableLinearThreshold -dBodySetAutoDisableSteps -dBodySetAutoDisableTime -dBodySetDamping -dBodySetDampingDefaults -dBodySetData -dBodySetDynamic -dBodySetFiniteRotationAxis -dBodySetFiniteRotationMode -dBodySetForce -dBodySetGravityMode -dBodySetGyroscopicMode -dBodySetKinematic -dBodySetLinearDamping -dBodySetLinearDampingThreshold -dBodySetLinearVel -dBodySetMass -dBodySetMaxAngularSpeed -dBodySetMovedCallback -dBodySetPosition -dBodySetQuaternion -dBodySetRotation -dBodySetTorque -dBodyVectorFromWorld -dBodyVectorToWorld -dBoxBox -dBoxTouchesBox -dCheckConfiguration -dCleanupODEAllDataForThread -dClearUpperTriangle -dCloseODE -dClosestLineSegmentPoints -dClusterGetCenter -dClusterGetClusterAABBs -dClusterGetCount -dClusterGetGridStep -dCollide -dConnectingJoint -dConnectingJointList -dCreateBox -dCreateCapsule -dCreateConvex -dCreateCylinder -dCreateGeom -dCreateGeomClass -dCreateGeomTransform -dCreateHeightfield -dCreatePlane -dCreateRay -dCreateSphere -dCreateTriMesh -dDQfromW -dDebug -dDot -dError -dFactorCholesky -dFactorLDLT -dFluidCreate -dFluidDestroy -dFluidDisable -dFluidDynamicsStep -dFluidEnable -dFluidGetData -dFluidGetDensity -dFluidGetFirstGeom -dFluidGetImmersionLink -dFluidGetNextGeom -dFluidGetNumImmersionLinks -dFluidGetStreamVel -dFluidGetViscosity -dFluidGetWorld -dFluidIsEnabled -dFluidSetData -dFluidSetDensity -dFluidSetStreamVel -dFluidSetViscosity -dFree -dGeomBoxGetArea -dGeomBoxGetFacePlane -dGeomBoxGetImmersionPlane -dGeomBoxGetLengths -dGeomBoxGetTangentPlane -dGeomBoxGetVolume -dGeomBoxPointDepth -dGeomBoxSetLengths -dGeomCapsuleGetArea -dGeomCapsuleGetImmersionPlane -dGeomCapsuleGetParams -dGeomCapsuleGetTangentPlane -dGeomCapsuleGetVolume -dGeomCapsulePointDepth -dGeomCapsuleSetParams -dGeomClearOffset -dGeomCopyOffsetPosition -dGeomCopyOffsetRotation -dGeomCopyPosition -dGeomCopyRotation -dGeomCylinderGetArea -dGeomCylinderGetDiskPlane -dGeomCylinderGetImmersionPlane -dGeomCylinderGetParams -dGeomCylinderGetTangentPlane -dGeomCylinderGetVolume -dGeomCylinderPointDepth -dGeomCylinderSetParams -dGeomDestroy -dGeomDisable -dGeomEnable -dGeomGetAABB -dGeomGetArea -dGeomGetBody -dGeomGetBodyNext -dGeomGetCategoryBits -dGeomGetClass -dGeomGetClassData -dGeomGetCollideBits -dGeomGetData -dGeomGetFlags -dGeomGetFluid -dGeomGetFluidNext -dGeomGetImmersionPlane -dGeomGetOffsetPosition -dGeomGetOffsetQuaternion -dGeomGetOffsetRotation -dGeomGetPosRelPoint -dGeomGetPosition -dGeomGetQuaternion -dGeomGetRelPointPos -dGeomGetRotation -dGeomGetSpace -dGeomGetVolume -dGeomHeightfieldDataBuildByte -dGeomHeightfieldDataBuildCallback -dGeomHeightfieldDataBuildDouble -dGeomHeightfieldDataBuildShort -dGeomHeightfieldDataBuildSingle -dGeomHeightfieldDataCreate -dGeomHeightfieldDataDestroy -dGeomHeightfieldDataSetBounds -dGeomHeightfieldGetHeightfieldData -dGeomHeightfieldSetHeightfieldData -dGeomIsBelowImmersionPlane -dGeomIsEnabled -dGeomIsInside -dGeomIsOffset -dGeomIsSpace -dGeomLowLevelControl -dGeomMoved -dGeomPlaneGetParams -dGeomPlanePointDepth -dGeomPlaneSetParams -dGeomRayGet -dGeomRayGetClosestHit -dGeomRayGetLength -dGeomRayGetParams -dGeomRaySet -dGeomRaySetClosestHit -dGeomRaySetLength -dGeomRaySetParams -dGeomSetBody -dGeomSetCategoryBits -dGeomSetCollideBits -dGeomSetConvex -dGeomSetData -dGeomSetDynamicFlag -dGeomSetFluid -dGeomSetOffsetPosition -dGeomSetOffsetQuaternion -dGeomSetOffsetRotation -dGeomSetOffsetWorldPosition -dGeomSetOffsetWorldQuaternion -dGeomSetOffsetWorldRotation -dGeomSetPosition -dGeomSetQuaternion -dGeomSetRotation -dGeomSphereGetArea -dGeomSphereGetImmersionPlane -dGeomSphereGetRadius -dGeomSphereGetTangentPlane -dGeomSphereGetVolume -dGeomSpherePointDepth -dGeomSphereSetRadius -dGeomTransformGetCleanup -dGeomTransformGetGeom -dGeomTransformGetInfo -dGeomTransformSetCleanup -dGeomTransformSetGeom -dGeomTransformSetInfo -dGeomTriMeshClearTCCache -dGeomTriMeshDataBuildDouble -dGeomTriMeshDataBuildDouble1 -dGeomTriMeshDataBuildSimple -dGeomTriMeshDataBuildSimple1 -dGeomTriMeshDataBuildSingle -dGeomTriMeshDataBuildSingle1 -dGeomTriMeshDataCreate -dGeomTriMeshDataDestroy -dGeomTriMeshDataGet -dGeomTriMeshDataGetBuffer -dGeomTriMeshDataPreprocess -dGeomTriMeshDataSet -dGeomTriMeshDataSetBuffer -dGeomTriMeshDataUpdate -dGeomTriMeshEnableTC -dGeomTriMeshGetArea -dGeomTriMeshGetArrayCallback -dGeomTriMeshGetBoundingPlane -dGeomTriMeshGetCallback -dGeomTriMeshGetCenterOfMass -dGeomTriMeshGetData -dGeomTriMeshGetImmersionPlane -dGeomTriMeshGetInertiaMatrix -dGeomTriMeshGetLastTransform -dGeomTriMeshGetPoint -dGeomTriMeshGetRayCallback -dGeomTriMeshGetRelCenterOfMass -dGeomTriMeshGetTriMergeCallback -dGeomTriMeshGetTriMeshDataID -dGeomTriMeshGetTriangle -dGeomTriMeshGetTriangleCount -dGeomTriMeshGetVolume -dGeomTriMeshIsTCEnabled -dGeomTriMeshPointDepth -dGeomTriMeshSetArrayCallback -dGeomTriMeshSetCallback -dGeomTriMeshSetData -dGeomTriMeshSetLastTransform -dGeomTriMeshSetRayCallback -dGeomTriMeshSetTriMergeCallback -dGeomVectorFromWorld -dGeomVectorToWorld -dGetAllocHandler -dGetConfiguration -dGetDebugHandler -dGetErrorHandler -dGetFreeHandler -dGetMessageHandler -dGetReallocHandler -dHashSpaceCreate -dHashSpaceGetLevels -dHashSpaceSetLevels -dImmerse -dImmersionLinkAttach -dImmersionLinkCreate -dImmersionLinkDestroy -dImmersionLinkDisable -dImmersionLinkEnable -dImmersionLinkGroupCreate -dImmersionLinkGroupDestroy -dImmersionLinkGroupEmpty -dImmersionLinkSetData -dImmersionOutlineCreate -dImmersionOutlineDestroy -dImmersionOutlineGetCurvedEdge -dImmersionOutlineGetCurvedEdgesSize -dImmersionOutlineGetStraightEdge -dImmersionOutlineGetStraightEdgeEnd -dImmersionOutlineGetStraightEdgeOrigin -dImmersionOutlineGetStraightEdgesSize -dInfiniteAABB -dInitODE -dInitODE2 -dInvertPDMatrix -dIsPositiveDefinite -dJointAddAMotorTorques -dJointAddHinge2Torques -dJointAddHingeTorque -dJointAddPRTorque -dJointAddPistonForce -dJointAddSliderForce -dJointAddUniversalTorques -dJointAttach -dJointCreateAMotor -dJointCreateBall -dJointCreateContact -dJointCreateFixed -dJointCreateHinge -dJointCreateHinge2 -dJointCreateLMotor -dJointCreateNull -dJointCreatePR -dJointCreatePU -dJointCreatePiston -dJointCreatePlane2D -dJointCreateSlider -dJointCreateUniversal -dJointDestroy -dJointDisable -dJointEnable -dJointGetAMotorAngle -dJointGetAMotorAngleRate -dJointGetAMotorAxis -dJointGetAMotorAxisRel -dJointGetAMotorMode -dJointGetAMotorNumAxes -dJointGetAMotorParam -dJointGetBallAnchor -dJointGetBallAnchor2 -dJointGetBallParam -dJointGetBody -dJointGetData -dJointGetFeedback -dJointGetFixedParam -dJointGetHinge2Anchor -dJointGetHinge2Anchor2 -dJointGetHinge2Angle1 -dJointGetHinge2Angle1Rate -dJointGetHinge2Angle2 -dJointGetHinge2Angle2Rate -dJointGetHinge2Axis1 -dJointGetHinge2Axis2 -dJointGetHinge2Param -dJointGetHinge2SuspensionAxis -dJointGetHingeAnchor -dJointGetHingeAnchor2 -dJointGetHingeAngle -dJointGetHingeAngleRate -dJointGetHingeAxis -dJointGetHingeParam -dJointGetHingeSuspensionAxis -dJointGetLMotorAxis -dJointGetLMotorNumAxes -dJointGetLMotorParam -dJointGetLMotorPosition -dJointGetNumBodies -dJointGetPRAnchor -dJointGetPRAngle -dJointGetPRAngleRate -dJointGetPRAxis1 -dJointGetPRAxis2 -dJointGetPRParam -dJointGetPRPosition -dJointGetPRPositionRate -dJointGetPUAnchor -dJointGetPUAngle1 -dJointGetPUAngle1Rate -dJointGetPUAngle2 -dJointGetPUAngle2Rate -dJointGetPUAngles -dJointGetPUAxis1 -dJointGetPUAxis2 -dJointGetPUAxis3 -dJointGetPUAxisP -dJointGetPUParam -dJointGetPUPosition -dJointGetPUPositionRate -dJointGetPistonAnchor -dJointGetPistonAnchor2 -dJointGetPistonAngle -dJointGetPistonAngleRate -dJointGetPistonAxis -dJointGetPistonParam -dJointGetPistonPosition -dJointGetPistonPositionRate -dJointGetSliderAxis -dJointGetSliderParam -dJointGetSliderPosition -dJointGetSliderPositionRate -dJointGetType -dJointGetUniversalAnchor -dJointGetUniversalAnchor2 -dJointGetUniversalAngle1 -dJointGetUniversalAngle1Rate -dJointGetUniversalAngle2 -dJointGetUniversalAngle2Rate -dJointGetUniversalAngles -dJointGetUniversalAxis1 -dJointGetUniversalAxis2 -dJointGetUniversalParam -dJointGroupCreate -dJointGroupDestroy -dJointGroupEmpty -dJointGroupGetCount -dJointIsEnabled -dJointSetAMotorAngle -dJointSetAMotorAxis -dJointSetAMotorMode -dJointSetAMotorNumAxes -dJointSetAMotorParam -dJointSetBallAnchor -dJointSetBallAnchor2 -dJointSetBallParam -dJointSetData -dJointSetFeedback -dJointSetFixed -dJointSetFixedParam -dJointSetHinge2Anchor -dJointSetHinge2Axis1 -dJointSetHinge2Axis2 -dJointSetHinge2Param -dJointSetHinge2SuspensionAxis -dJointSetHingeAnchor -dJointSetHingeAnchorDelta -dJointSetHingeAxis -dJointSetHingeAxisOffset -dJointSetHingeParam -dJointSetHingeSuspensionAxis -dJointSetLMotorAxis -dJointSetLMotorNumAxes -dJointSetLMotorParam -dJointSetLMotorPosition -dJointSetPRAnchor -dJointSetPRAxis1 -dJointSetPRAxis2 -dJointSetPRParam -dJointSetPUAnchor -dJointSetPUAnchorDelta -dJointSetPUAnchorOffset -dJointSetPUAxis1 -dJointSetPUAxis2 -dJointSetPUAxis3 -dJointSetPUAxisP -dJointSetPUParam -dJointSetPistonAnchor -dJointSetPistonAnchorOffset -dJointSetPistonAxis -dJointSetPistonAxisDelta -dJointSetPistonParam -dJointSetPlane2DAngleParam -dJointSetPlane2DXParam -dJointSetPlane2DYParam -dJointSetSliderAxis -dJointSetSliderAxisDelta -dJointSetSliderParam -dJointSetUniversalAnchor -dJointSetUniversalAxis1 -dJointSetUniversalAxis1Offset -dJointSetUniversalAxis2 -dJointSetUniversalAxis2Offset -dJointSetUniversalParam -dLDLTAddTL -dLDLTRemove -dMakeRandomMatrix -dMakeRandomVector -dMassAdd -dMassAdjust -dMassCheck -dMassRotate -dMassSetBox -dMassSetBoxTotal -dMassSetCappedCylinder -dMassSetCappedCylinderTotal -dMassSetCapsule -dMassSetCapsuleTotal -dMassSetCylinder -dMassSetCylinderTotal -dMassSetParameters -dMassSetSphere -dMassSetSphereTotal -dMassSetTrimesh -dMassSetTrimeshTotal -dMassSetZero -dMassTranslate -dMaxDifference -dMaxDifferenceLowerTriangle -dMessage -dMultiply0 -dMultiply1 -dMultiply2 -dNormalize3 -dNormalize4 -dOrthogonalizeR -dPlaneSpace -dPrintMatrix -dQFromAxisAndAngle -dQMultiply0 -dQMultiply1 -dQMultiply2 -dQMultiply3 -dQSetIdentity -dQfromR -dQuadTreeSpaceCreate -dRFrom2Axes -dRFromAxisAndAngle -dRFromEulerAngles -dRFromZAxis -dRSetIdentity -dRand -dRandGetSeed -dRandInt -dRandReal -dRandSetSeed -dRealloc -dRemoveRowCol -dRfromQ -dSafeNormalize3 -dSafeNormalize4 -dSetAllocHandler -dSetColliderOverride -dSetDebugHandler -dSetErrorHandler -dSetFreeHandler -dSetMessageHandler -dSetReallocHandler -dSetValue -dSetZero -dSimpleSpaceCreate -dSolveCholesky -dSolveL1 -dSolveL1T -dSolveLDLT -dSpaceAdd -dSpaceClean -dSpaceCollide -dSpaceCollide2 -dSpaceCollideAndWorldStep -dSpaceDestroy -dSpaceGetClass -dSpaceGetCleanup -dSpaceGetGeom -dSpaceGetManualCleanup -dSpaceGetNumGeoms -dSpaceGetSublevel -dSpaceQuery -dSpaceRemove -dSpaceSetCleanup -dSpaceSetManualCleanup -dSpaceSetSublevel -dStopwatchReset -dStopwatchStart -dStopwatchStop -dStopwatchTime -dSweepAndPruneSpaceCreate -dTestDataStructures -dTestRand -dTestSolveLCP -dTimerEnd -dTimerNow -dTimerReport -dTimerResolution -dTimerStart -dTimerTicksPerSecond -dToggleODE_MT -dVectorScale -dWorldCleanupWorkingMemory -dWorldCreate -dWorldDestroy -dWorldExportDIF -dWorldGetAngularDamping -dWorldGetAngularDampingThreshold -dWorldGetAutoDisableAngularThreshold -dWorldGetAutoDisableAverageSamplesCount -dWorldGetAutoDisableFlag -dWorldGetAutoDisableLinearThreshold -dWorldGetAutoDisableSteps -dWorldGetAutoDisableTime -dWorldGetCFM -dWorldGetContactMaxCorrectingVel -dWorldGetContactSurfaceLayer -dWorldGetERP -dWorldGetGravity -dWorldGetLinearDamping -dWorldGetLinearDampingThreshold -dWorldGetMaxAngularSpeed -dWorldGetQuickStepNumIterations -dWorldGetQuickStepW -dWorldImpulseToForce -dWorldQuickStep -dWorldRefreshParameters -dWorldSetAngularDamping -dWorldSetAngularDampingThreshold -dWorldSetAutoDisableAngularThreshold -dWorldSetAutoDisableAverageSamplesCount -dWorldSetAutoDisableFlag -dWorldSetAutoDisableLinearThreshold -dWorldSetAutoDisableSteps -dWorldSetAutoDisableTime -dWorldSetCFM -dWorldSetContactMaxCorrectingVel -dWorldSetContactSurfaceLayer -dWorldSetDamping -dWorldSetERP -dWorldSetGravity -dWorldSetLinearDamping -dWorldSetLinearDampingThreshold -dWorldSetMaxAngularSpeed -dWorldSetQuickStepNumIterations -dWorldSetQuickStepW -dWorldSetStepMemoryManager -dWorldSetStepMemoryReservationPolicy -dWorldStep -dWorldStepAndSpaceCollide -dWorldUseSharedWorkingMemory From 41348c866ec737088c416d7d8b2b3b413c00bb1b Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sat, 21 Dec 2024 22:22:45 -0800 Subject: [PATCH 08/51] clean defs --- resources/Makefile.include | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/Makefile.include b/resources/Makefile.include index 6a41ed54145..999b3c48ce4 100644 --- a/resources/Makefile.include +++ b/resources/Makefile.include @@ -510,6 +510,7 @@ ifdef VS_DEF_NAME @# Generate the .lib libraries to facilitate the integration with Visual Studio @# if the .def file is existing. @dlltool --export-all-symbols -z $(VS_DEF_NAME) $(TARGET_LIB_DIR)/$(MAIN_TARGET) + FILES_TO_REMOVE += $(VS_DEF_NAME) if [ -d "$(VISUAL_STUDIO_PATH)" ]; then \ PATH="$(VISUAL_STUDIO_PATH)/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64":$PATH lib /machine:X64 /def:$(VS_DEF_NAME) /out:out.lib > /dev/null; \ mv out.lib $(MAIN_TARGET_WINDOWS64_LIB); \ From 1306bc6a6d42bc03c606d0fd92aaf3fbf8228a2f Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sat, 21 Dec 2024 22:23:39 -0800 Subject: [PATCH 09/51] move linker flags to ldflags --- src/controller/c/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/controller/c/Makefile b/src/controller/c/Makefile index 52ff4772044..636b985d47c 100644 --- a/src/controller/c/Makefile +++ b/src/controller/c/Makefile @@ -61,7 +61,7 @@ endif ifeq ($(OSTYPE),windows) CFLAGS = -Wall -mwindows -frandom-seed=0 -D LIBCONTROLLER_VERSION='$(LIBCONTROLLER_VERSION)' INCLUDE = -I$(WEBOTS_HOME_PATH)/include/controller/c -I$(WEBOTS_HOME_PATH)/include -I/mingw64/include -LD_FLAGS = -shared -mwindows -lws2_32 +LD_FLAGS = -shared -mwindows -lws2_32 -Wl,--out-implib,$(WEBOTS_CONTROLLER_LIB_PATH)/libController.a PLATFORM = win32 CC = gcc TARGET = $(WEBOTS_CONTROLLER_LIB_PATH)/Controller.dll $(WEBOTS_CONTROLLER_LIB_PATH)/Controller.lib @@ -129,7 +129,7 @@ MINGW64_OBJECTS = $(addprefix $(OBJDIR)/, $(OBJECTS)) $(WEBOTS_CONTROLLER_LIB_PATH)/Controller.dll: $(MINGW64_OBJECTS) @echo "# linking "$@ @echo "# linking "$(WEBOTS_CONTROLLER_LIB_PATH)"/libController.a" - @$(CC) -o $@ $(addprefix $(OBJDIR)/, $(OBJECTS)) $(LD_FLAGS) -Wl,--out-implib,$(WEBOTS_CONTROLLER_LIB_PATH)/libController.a + @$(CC) -o $@ $(addprefix $(OBJDIR)/, $(OBJECTS)) $(LD_FLAGS) Controller.def: $(WEBOTS_CONTROLLER_LIB_PATH)/Controller.dll @echo "# generating "$@ From ba85cf4e012f2bd98af0d41593bf9c693886842a Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sat, 21 Dec 2024 22:29:45 -0800 Subject: [PATCH 10/51] generate impl libs for all shared libraries --- resources/Makefile.include | 3 +++ 1 file changed, 3 insertions(+) diff --git a/resources/Makefile.include b/resources/Makefile.include index 999b3c48ce4..0a2cf39d12a 100644 --- a/resources/Makefile.include +++ b/resources/Makefile.include @@ -382,6 +382,9 @@ ifdef BUILD_SHARED_LIBRARY ifeq ($(OSTYPE),darwin) DYNAMIC_LINK_FLAGS += -dynamiclib -compatibility_version 1.0 -current_version 1.0.0 endif + ifeq ($(OSTYPE),windows) + DYNAMIC_LINK_FLAGS += -Wl,--out-implib,$(TARGET_LIB_DIR)/$(MAIN_TARGET).lib + endif endif ifdef BUILD_STATIC_LIBRARY From b63b3c631b7d72bb122fd343aefc69dad62f0c22 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sat, 21 Dec 2024 22:35:44 -0800 Subject: [PATCH 11/51] clean lib files --- resources/Makefile.include | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/Makefile.include b/resources/Makefile.include index 0a2cf39d12a..58d81bfd4dc 100644 --- a/resources/Makefile.include +++ b/resources/Makefile.include @@ -273,6 +273,7 @@ endif FILES_TO_REMOVE += $(MAIN_TARGET_COPY) ifdef TARGET_LIB_DIR FILES_TO_REMOVE += $(TARGET_LIB_DIR)/$(MAIN_TARGET) + FILES_TO_REMOVE += $(TARGET_LIB_DIR)/$(MAIN_TARGET).lib endif WRENJS_DIR = $(WEBOTS_HOME_PATH)/resources/web/wwi From 0f484fc056698a692e9a360142c00ba6c8211809 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sat, 21 Dec 2024 22:36:15 -0800 Subject: [PATCH 12/51] move implib declaration --- resources/Makefile.include | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/resources/Makefile.include b/resources/Makefile.include index 58d81bfd4dc..e3e6ca9ab93 100644 --- a/resources/Makefile.include +++ b/resources/Makefile.include @@ -383,9 +383,6 @@ ifdef BUILD_SHARED_LIBRARY ifeq ($(OSTYPE),darwin) DYNAMIC_LINK_FLAGS += -dynamiclib -compatibility_version 1.0 -current_version 1.0.0 endif - ifeq ($(OSTYPE),windows) - DYNAMIC_LINK_FLAGS += -Wl,--out-implib,$(TARGET_LIB_DIR)/$(MAIN_TARGET).lib - endif endif ifdef BUILD_STATIC_LIBRARY @@ -514,6 +511,7 @@ ifdef VS_DEF_NAME @# Generate the .lib libraries to facilitate the integration with Visual Studio @# if the .def file is existing. @dlltool --export-all-symbols -z $(VS_DEF_NAME) $(TARGET_LIB_DIR)/$(MAIN_TARGET) + DYNAMIC_LINK_FLAGS += -Wl,--out-implib,$(TARGET_LIB_DIR)/$(MAIN_TARGET).lib FILES_TO_REMOVE += $(VS_DEF_NAME) if [ -d "$(VISUAL_STUDIO_PATH)" ]; then \ PATH="$(VISUAL_STUDIO_PATH)/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64":$PATH lib /machine:X64 /def:$(VS_DEF_NAME) /out:out.lib > /dev/null; \ From c02c3815722c3eddcb50463cea905861c12ee73b Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sat, 21 Dec 2024 22:45:29 -0800 Subject: [PATCH 13/51] fix CppController.def target name --- src/controller/cpp/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controller/cpp/Makefile b/src/controller/cpp/Makefile index 3884c3a16fb..85d40582377 100644 --- a/src/controller/cpp/Makefile +++ b/src/controller/cpp/Makefile @@ -152,7 +152,7 @@ $(WEBOTS_CONTROLLER_LIB_PATH)/CppController.dll:$(CPPOBJS) $(LIBCONTROLLER) @echo "# linking" $@ @$(CXX) $(LDFLAGS) $(CPPOBJS) $(SHAREDLIBS) -o "$@" -Controller.def: $(WEBOTS_CONTROLLER_LIB_PATH)/CppController.dll +CppController.def: $(WEBOTS_CONTROLLER_LIB_PATH)/CppController.dll @echo "# generating "$@ @dlltool --export-all-symbols -z CppController.def $(WEBOTS_CONTROLLER_LIB_PATH)/CppController.dll From 74cba180d213e9f02b9b073d7eaba2d1e72b47be Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sat, 21 Dec 2024 23:34:14 -0800 Subject: [PATCH 14/51] fix implib extension --- resources/Makefile.include | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/Makefile.include b/resources/Makefile.include index e3e6ca9ab93..a0a00181ec9 100644 --- a/resources/Makefile.include +++ b/resources/Makefile.include @@ -511,7 +511,7 @@ ifdef VS_DEF_NAME @# Generate the .lib libraries to facilitate the integration with Visual Studio @# if the .def file is existing. @dlltool --export-all-symbols -z $(VS_DEF_NAME) $(TARGET_LIB_DIR)/$(MAIN_TARGET) - DYNAMIC_LINK_FLAGS += -Wl,--out-implib,$(TARGET_LIB_DIR)/$(MAIN_TARGET).lib + DYNAMIC_LINK_FLAGS += -Wl,--out-implib,$(TARGET_LIB_DIR)/$(MAIN_TARGET).a FILES_TO_REMOVE += $(VS_DEF_NAME) if [ -d "$(VISUAL_STUDIO_PATH)" ]; then \ PATH="$(VISUAL_STUDIO_PATH)/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64":$PATH lib /machine:X64 /def:$(VS_DEF_NAME) /out:out.lib > /dev/null; \ From 07f49cd46d91f701b2e9c78e346886970629fe42 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sun, 22 Dec 2024 00:18:25 -0800 Subject: [PATCH 15/51] copy changes to apply to all targets --- resources/Makefile.include | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/resources/Makefile.include b/resources/Makefile.include index a0a00181ec9..543da1a2136 100644 --- a/resources/Makefile.include +++ b/resources/Makefile.include @@ -509,11 +509,10 @@ ifdef TARGET_LIB_DIR $(MAIN_TARGET): $(TARGET_LIB_DIR)/$(MAIN_TARGET) ifdef VS_DEF_NAME @# Generate the .lib libraries to facilitate the integration with Visual Studio - @# if the .def file is existing. @dlltool --export-all-symbols -z $(VS_DEF_NAME) $(TARGET_LIB_DIR)/$(MAIN_TARGET) DYNAMIC_LINK_FLAGS += -Wl,--out-implib,$(TARGET_LIB_DIR)/$(MAIN_TARGET).a FILES_TO_REMOVE += $(VS_DEF_NAME) - if [ -d "$(VISUAL_STUDIO_PATH)" ]; then \ + @if [ -d "$(VISUAL_STUDIO_PATH)" ]; then \ PATH="$(VISUAL_STUDIO_PATH)/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64":$PATH lib /machine:X64 /def:$(VS_DEF_NAME) /out:out.lib > /dev/null; \ mv out.lib $(MAIN_TARGET_WINDOWS64_LIB); \ rm -f *.exp; \ @@ -532,15 +531,15 @@ $(MAIN_TARGET): $(BUILD_GOAL_DIR)/$(MAIN_TARGET) @rm -f $(MAIN_TARGET) > /dev/null 2>&1 && echo "# copying to" $(MAIN_TARGET_COPY) && cp $(BUILD_GOAL_DIR)/$(MAIN_TARGET) $(MAIN_TARGET_COPY) > /dev/null 2>&1 ifdef VS_DEF_NAME @# Generate the .lib libraries to facilitate the integration with Visual Studio - @# if the .def file is existing. - @if [ -f $(VS_DEF_NAME) ]; then \ - if [ -d "$(VISUAL_STUDIO_PATH)" ]; then \ - PATH="$(VISUAL_STUDIO_PATH)/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64":$PATH lib /machine:X64 /def:$(VS_DEF_NAME) /out:out.lib > /dev/null; \ - mv out.lib $(MAIN_TARGET_WINDOWS64_LIB); \ - rm -f *.exp; \ - else \ - $(ECHO) "\033[0;33m'VISUAL_STUDIO_PATH' environmental variable not set or Microsoft Visual Studio not installed, skipping $(NAME).lib\033[0m"; \ - fi \ + @dlltool --export-all-symbols -z $(VS_DEF_NAME) $(BUILD_GOAL_DIR)/$(MAIN_TARGET) + DYNAMIC_LINK_FLAGS += -Wl,--out-implib,$(BUILD_GOAL_DIR)/$(MAIN_TARGET).a + FILES_TO_REMOVE += $(VS_DEF_NAME) + @if [ -d "$(VISUAL_STUDIO_PATH)" ]; then \ + PATH="$(VISUAL_STUDIO_PATH)/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64":$PATH lib /machine:X64 /def:$(VS_DEF_NAME) /out:out.lib > /dev/null; \ + mv out.lib $(MAIN_TARGET_WINDOWS64_LIB); \ + rm -f *.exp; \ + else \ + $(ECHO) "\033[0;33m'VISUAL_STUDIO_PATH' environmental variable not set or Microsoft Visual Studio not installed, skipping $(NAME).lib\033[0m"; \ fi endif From 80f57f93b87ca14e4401f525e2fa2ccd4b06ff59 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sun, 22 Dec 2024 00:20:53 -0800 Subject: [PATCH 16/51] add more files to clean --- resources/Makefile.include | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/resources/Makefile.include b/resources/Makefile.include index 543da1a2136..422d9142c75 100644 --- a/resources/Makefile.include +++ b/resources/Makefile.include @@ -273,7 +273,9 @@ endif FILES_TO_REMOVE += $(MAIN_TARGET_COPY) ifdef TARGET_LIB_DIR FILES_TO_REMOVE += $(TARGET_LIB_DIR)/$(MAIN_TARGET) - FILES_TO_REMOVE += $(TARGET_LIB_DIR)/$(MAIN_TARGET).lib + ifdef MAIN_TARGET_WINDOWS64_LIB + FILES_TO_REMOVE += $(TARGET_LIB_DIR)/$(MAIN_TARGET_WINDOWS64_LIB) + endif endif WRENJS_DIR = $(WEBOTS_HOME_PATH)/resources/web/wwi @@ -512,6 +514,7 @@ ifdef VS_DEF_NAME @dlltool --export-all-symbols -z $(VS_DEF_NAME) $(TARGET_LIB_DIR)/$(MAIN_TARGET) DYNAMIC_LINK_FLAGS += -Wl,--out-implib,$(TARGET_LIB_DIR)/$(MAIN_TARGET).a FILES_TO_REMOVE += $(VS_DEF_NAME) + FILES_TO_REMOVE += $(TARGET_LIB_DIR)/$(MAIN_TARGET).a @if [ -d "$(VISUAL_STUDIO_PATH)" ]; then \ PATH="$(VISUAL_STUDIO_PATH)/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64":$PATH lib /machine:X64 /def:$(VS_DEF_NAME) /out:out.lib > /dev/null; \ mv out.lib $(MAIN_TARGET_WINDOWS64_LIB); \ From afd08f294a232ee88f5a19252cc4682830477ed8 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sun, 22 Dec 2024 00:33:48 -0800 Subject: [PATCH 17/51] restructuring --- resources/Makefile.include | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/resources/Makefile.include b/resources/Makefile.include index 422d9142c75..475d1a875b9 100644 --- a/resources/Makefile.include +++ b/resources/Makefile.include @@ -273,9 +273,6 @@ endif FILES_TO_REMOVE += $(MAIN_TARGET_COPY) ifdef TARGET_LIB_DIR FILES_TO_REMOVE += $(TARGET_LIB_DIR)/$(MAIN_TARGET) - ifdef MAIN_TARGET_WINDOWS64_LIB - FILES_TO_REMOVE += $(TARGET_LIB_DIR)/$(MAIN_TARGET_WINDOWS64_LIB) - endif endif WRENJS_DIR = $(WEBOTS_HOME_PATH)/resources/web/wwi @@ -402,6 +399,10 @@ ifeq ($(OSTYPE),windows) VISUAL_STUDIO_PATH?=/C/Program Files (x86)/Microsoft Visual Studio/2017 endif VS_DEF_NAME = $(NAME).def + FILES_TO_REMOVE += $(VS_DEF_NAME) + ifdef MAIN_TARGET + DYNAMIC_LINK_FLAGS += -Wl,--out-implib,$(MAIN_TARGET).a + endif endif endif endif @@ -512,9 +513,6 @@ $(MAIN_TARGET): $(TARGET_LIB_DIR)/$(MAIN_TARGET) ifdef VS_DEF_NAME @# Generate the .lib libraries to facilitate the integration with Visual Studio @dlltool --export-all-symbols -z $(VS_DEF_NAME) $(TARGET_LIB_DIR)/$(MAIN_TARGET) - DYNAMIC_LINK_FLAGS += -Wl,--out-implib,$(TARGET_LIB_DIR)/$(MAIN_TARGET).a - FILES_TO_REMOVE += $(VS_DEF_NAME) - FILES_TO_REMOVE += $(TARGET_LIB_DIR)/$(MAIN_TARGET).a @if [ -d "$(VISUAL_STUDIO_PATH)" ]; then \ PATH="$(VISUAL_STUDIO_PATH)/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64":$PATH lib /machine:X64 /def:$(VS_DEF_NAME) /out:out.lib > /dev/null; \ mv out.lib $(MAIN_TARGET_WINDOWS64_LIB); \ @@ -535,8 +533,6 @@ $(MAIN_TARGET): $(BUILD_GOAL_DIR)/$(MAIN_TARGET) ifdef VS_DEF_NAME @# Generate the .lib libraries to facilitate the integration with Visual Studio @dlltool --export-all-symbols -z $(VS_DEF_NAME) $(BUILD_GOAL_DIR)/$(MAIN_TARGET) - DYNAMIC_LINK_FLAGS += -Wl,--out-implib,$(BUILD_GOAL_DIR)/$(MAIN_TARGET).a - FILES_TO_REMOVE += $(VS_DEF_NAME) @if [ -d "$(VISUAL_STUDIO_PATH)" ]; then \ PATH="$(VISUAL_STUDIO_PATH)/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64":$PATH lib /machine:X64 /def:$(VS_DEF_NAME) /out:out.lib > /dev/null; \ mv out.lib $(MAIN_TARGET_WINDOWS64_LIB); \ From 20c4947f9b492df59abf654d993c5e1084cab7c5 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sun, 22 Dec 2024 00:41:54 -0800 Subject: [PATCH 18/51] generate archive files in the correct location --- resources/Makefile.include | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/Makefile.include b/resources/Makefile.include index 475d1a875b9..50c67a6757d 100644 --- a/resources/Makefile.include +++ b/resources/Makefile.include @@ -400,9 +400,6 @@ ifeq ($(OSTYPE),windows) endif VS_DEF_NAME = $(NAME).def FILES_TO_REMOVE += $(VS_DEF_NAME) - ifdef MAIN_TARGET - DYNAMIC_LINK_FLAGS += -Wl,--out-implib,$(MAIN_TARGET).a - endif endif endif endif @@ -491,6 +488,9 @@ MAIN_TARGET_WINDOWS64_LIB = $(MAIN_TARGET:.dll=.lib) endif ifeq ($(OSTYPE),windows) FILES_TO_REMOVE += $(MAIN_TARGET_WINDOWS64_LIB) +ifdef BUILD_SHARED_LIBRARY + DYNAMIC_LINK_FLAGS += -Wl,--out-implib,$(MAIN_TARGET_COPY).a +endif endif ###----------------------------------------------------------------------------- From 7042bbfb093d1a01186d556161eb72f01b4d08e3 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sun, 22 Dec 2024 00:44:36 -0800 Subject: [PATCH 19/51] place def files in build directory --- resources/Makefile.include | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/Makefile.include b/resources/Makefile.include index 50c67a6757d..a4a391c57ff 100644 --- a/resources/Makefile.include +++ b/resources/Makefile.include @@ -398,8 +398,6 @@ ifeq ($(OSTYPE),windows) ifneq ($(wildcard /C/Program\ Files\ */Microsoft\ Visual\ Studio/2017),) VISUAL_STUDIO_PATH?=/C/Program Files (x86)/Microsoft Visual Studio/2017 endif - VS_DEF_NAME = $(NAME).def - FILES_TO_REMOVE += $(VS_DEF_NAME) endif endif endif @@ -489,6 +487,8 @@ endif ifeq ($(OSTYPE),windows) FILES_TO_REMOVE += $(MAIN_TARGET_WINDOWS64_LIB) ifdef BUILD_SHARED_LIBRARY + VS_DEF_NAME = $(MAIN_TARGET:.dll=.def) + FILES_TO_REMOVE += $(VS_DEF_NAME) DYNAMIC_LINK_FLAGS += -Wl,--out-implib,$(MAIN_TARGET_COPY).a endif endif From d1974e0519450e377dcf4557657686177af58aa6 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sun, 22 Dec 2024 01:17:53 -0800 Subject: [PATCH 20/51] actually put def files in the build directory --- resources/Makefile.include | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/resources/Makefile.include b/resources/Makefile.include index a4a391c57ff..d491b8d7472 100644 --- a/resources/Makefile.include +++ b/resources/Makefile.include @@ -487,8 +487,7 @@ endif ifeq ($(OSTYPE),windows) FILES_TO_REMOVE += $(MAIN_TARGET_WINDOWS64_LIB) ifdef BUILD_SHARED_LIBRARY - VS_DEF_NAME = $(MAIN_TARGET:.dll=.def) - FILES_TO_REMOVE += $(VS_DEF_NAME) + VS_DEF_NAME = $(BUILD_GOAL_DIR)/$(MAIN_TARGET:.dll=.def) DYNAMIC_LINK_FLAGS += -Wl,--out-implib,$(MAIN_TARGET_COPY).a endif endif From 404354e47ace70cf70ad6bd54cd06c5c29495613 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sun, 22 Dec 2024 01:29:37 -0800 Subject: [PATCH 21/51] match naming conventions of mingw libraries --- resources/Makefile.include | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/resources/Makefile.include b/resources/Makefile.include index d491b8d7472..efad97dad20 100644 --- a/resources/Makefile.include +++ b/resources/Makefile.include @@ -480,15 +480,17 @@ MAIN_TARGET_WINDOWS_LIB = $(MAIN_TARGET:.dll=.lib) ifdef WEBOTS_LIBRARY MAIN_TARGET_COPY = "$(subst $(space),\ ,$(WEBOTS_CONTROLLER_LIB_PATH))/$(MAIN_TARGET)" MAIN_TARGET_WINDOWS64_LIB = $(WEBOTS_CONTROLLER_LIB_PATH)/$(MAIN_TARGET_WINDOWS_LIB) +MAIN_TARGET_MINGW_LIB = $(WEBOTS_CONTROLLER_LIB_PATH)/lib$(MAIN_TARGET).a else MAIN_TARGET_COPY ?= $(MAIN_TARGET) MAIN_TARGET_WINDOWS64_LIB = $(MAIN_TARGET:.dll=.lib) +MAIN_TARGET_MINGW_LIB = lib$(MAIN_TARGET).a endif ifeq ($(OSTYPE),windows) FILES_TO_REMOVE += $(MAIN_TARGET_WINDOWS64_LIB) ifdef BUILD_SHARED_LIBRARY VS_DEF_NAME = $(BUILD_GOAL_DIR)/$(MAIN_TARGET:.dll=.def) - DYNAMIC_LINK_FLAGS += -Wl,--out-implib,$(MAIN_TARGET_COPY).a + DYNAMIC_LINK_FLAGS += -Wl,--out-implib,$(MAIN_TARGET_MINGW_LIB) endif endif From f1def5aeff3d5cc0f63db2ab9bc82826223e6a27 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sun, 22 Dec 2024 01:34:31 -0800 Subject: [PATCH 22/51] remove .dll from mingw lib names --- resources/Makefile.include | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/Makefile.include b/resources/Makefile.include index efad97dad20..47b20a63d72 100644 --- a/resources/Makefile.include +++ b/resources/Makefile.include @@ -477,14 +477,15 @@ clean: $(EXTRA_TARGETS) ifdef MAIN_TARGET MAIN_TARGET_WINDOWS_LIB = $(MAIN_TARGET:.dll=.lib) +MAIN_TARGET_MINGW_LIB_NAME = lib$(MAIN_TARGET:.dll=.a) ifdef WEBOTS_LIBRARY MAIN_TARGET_COPY = "$(subst $(space),\ ,$(WEBOTS_CONTROLLER_LIB_PATH))/$(MAIN_TARGET)" MAIN_TARGET_WINDOWS64_LIB = $(WEBOTS_CONTROLLER_LIB_PATH)/$(MAIN_TARGET_WINDOWS_LIB) -MAIN_TARGET_MINGW_LIB = $(WEBOTS_CONTROLLER_LIB_PATH)/lib$(MAIN_TARGET).a +MAIN_TARGET_MINGW_LIB = $(WEBOTS_CONTROLLER_LIB_PATH)/$(MAIN_TARGET_MINGW_LIB_NAME) else MAIN_TARGET_COPY ?= $(MAIN_TARGET) MAIN_TARGET_WINDOWS64_LIB = $(MAIN_TARGET:.dll=.lib) -MAIN_TARGET_MINGW_LIB = lib$(MAIN_TARGET).a +MAIN_TARGET_MINGW_LIB = $(MAIN_TARGET_MINGW_LIB_NAME) endif ifeq ($(OSTYPE),windows) FILES_TO_REMOVE += $(MAIN_TARGET_WINDOWS64_LIB) From 4558c0f4d867adaa7ce60ba270206fb666f54511 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sun, 22 Dec 2024 20:59:59 -0800 Subject: [PATCH 23/51] update matlab source test to work with new def file --- tests/sources/test_matlab_functions.py | 42 ++++++++++++++++++-------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/tests/sources/test_matlab_functions.py b/tests/sources/test_matlab_functions.py index 78cd55e9201..11597345e8d 100755 --- a/tests/sources/test_matlab_functions.py +++ b/tests/sources/test_matlab_functions.py @@ -30,17 +30,20 @@ def setUp(self): if sys.version_info[0] >= 3: mgenerate.UPDATE = False mgenerate.main() - """Get all the required function.""" + """Get all the required functions.""" skippedLines = [ - 'wbr', - 'microphone', - 'remote_control', - 'robot', - 'wb_device_get_type', - 'wb_node_get_name', - 'wbu_string', - 'lookup_table_size', - 'EXPORTS' + # Comments / def keywords + ';', 'EXPORTS', + 'abstract_camera', # Abstract Camera functions should be called through their variant functions (e.g. wb_camera_get_*) + 'microphone', # Microphone Node is Experimental + 'radio', # Radio Plugin + 'remote_control', 'wbr', # Remote Control Plugin + 'init', 'cleanup', # These are usually called automatically + 'robot', # Many robot functions are used internally by the C API (e.x. wb_robot_mutex_*) + 'lookup_table_size', # Matlab lets you get the size of an array, so these functions are not needed + 'no_mutex', # "no_mutex" function variants should only be used internally + 'get_unique_id', # Only used internally by the C API + 'wbu_string' # String manipulation functions are not needed ] self.functions = [] filename = os.path.join(WEBOTS_HOME, 'src', 'controller', 'c', 'Controller.def') @@ -50,8 +53,23 @@ def setUp(self): ) with open(filename) as file: for line in file: - if not any(skippedLine in line for skippedLine in skippedLines) and not line[3:].isupper(): - self.functions.append(line.replace('\n', '')) + if line.strip().startswith('wb') and not any(skippedLine in line for skippedLine in skippedLines) and not line[3:].isupper(): + line = line.strip() + self.functions.append(line[:line.find(' ')]) # Line is of the form "symbol_name @ address" + + # These functions are used internally by the Matlab API + self.functions.remove('wb_camera_recognition_get_object') + self.functions.remove('wb_lidar_get_point') + self.functions.remove('wb_mouse_get_state_pointer') + self.functions.remove('wb_radar_get_target') + + self.functions.remove('wb_device_get_type') # Deprecated since 8.0.0 + + # Not Yet Implemented + self.functions.remove('wb_node_get_name') + self.functions.remove('wb_file_get_extension') + self.functions.remove('wbu_system_tmpdir') + self.functions.remove('wbu_system_webots_instance_path') @unittest.skipIf(sys.version_info[0] < 3, "not supported by Python 2.7") def test_matlab_function_exists(self): From d05f1279aa5e595f17f7afd07207f43d88e20297 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sun, 22 Dec 2024 21:39:11 -0800 Subject: [PATCH 24/51] reclassify wb_file_get_extension --- tests/sources/test_matlab_functions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sources/test_matlab_functions.py b/tests/sources/test_matlab_functions.py index 11597345e8d..f684adf6a3e 100755 --- a/tests/sources/test_matlab_functions.py +++ b/tests/sources/test_matlab_functions.py @@ -64,10 +64,10 @@ def setUp(self): self.functions.remove('wb_radar_get_target') self.functions.remove('wb_device_get_type') # Deprecated since 8.0.0 + self.functions.remove('wb_file_get_extension') # Part of the internal API # Not Yet Implemented self.functions.remove('wb_node_get_name') - self.functions.remove('wb_file_get_extension') self.functions.remove('wbu_system_tmpdir') self.functions.remove('wbu_system_webots_instance_path') From e757b559936020fffcd0ce6d1ec9149d5c9aca4e Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sun, 22 Dec 2024 21:45:56 -0800 Subject: [PATCH 25/51] formatting --- tests/sources/test_matlab_functions.py | 29 +++++++++++++------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/tests/sources/test_matlab_functions.py b/tests/sources/test_matlab_functions.py index f684adf6a3e..add865c0367 100755 --- a/tests/sources/test_matlab_functions.py +++ b/tests/sources/test_matlab_functions.py @@ -32,18 +32,17 @@ def setUp(self): mgenerate.main() """Get all the required functions.""" skippedLines = [ - # Comments / def keywords - ';', 'EXPORTS', - 'abstract_camera', # Abstract Camera functions should be called through their variant functions (e.g. wb_camera_get_*) - 'microphone', # Microphone Node is Experimental - 'radio', # Radio Plugin - 'remote_control', 'wbr', # Remote Control Plugin - 'init', 'cleanup', # These are usually called automatically - 'robot', # Many robot functions are used internally by the C API (e.x. wb_robot_mutex_*) - 'lookup_table_size', # Matlab lets you get the size of an array, so these functions are not needed - 'no_mutex', # "no_mutex" function variants should only be used internally - 'get_unique_id', # Only used internally by the C API - 'wbu_string' # String manipulation functions are not needed + ';', 'EXPORTS', # Comments / Keywords + 'abstract_camera', # Abstract Camera functions should be called through their variant functions (e.g. wb_camera_get_*) + 'microphone', # Microphone Node is Experimental + 'radio', # Radio Plugin + 'remote_control', 'wbr', # Remote Control Plugin + 'init', 'cleanup', # These are usually called automatically + 'robot', # Many robot functions are used internally by the C API (e.x. wb_robot_mutex_*) + 'lookup_table_size', # Matlab lets you get the size of an array, so these functions are not needed + 'no_mutex', # "no_mutex" function variants should only be used internally + 'get_unique_id', # Only used internally by the C API + 'wbu_string' # String manipulation functions are not needed ] self.functions = [] filename = os.path.join(WEBOTS_HOME, 'src', 'controller', 'c', 'Controller.def') @@ -55,7 +54,7 @@ def setUp(self): for line in file: if line.strip().startswith('wb') and not any(skippedLine in line for skippedLine in skippedLines) and not line[3:].isupper(): line = line.strip() - self.functions.append(line[:line.find(' ')]) # Line is of the form "symbol_name @ address" + self.functions.append(line[:line.find(' ')]) # Line is of the form "symbol_name @ address" # These functions are used internally by the Matlab API self.functions.remove('wb_camera_recognition_get_object') @@ -63,8 +62,8 @@ def setUp(self): self.functions.remove('wb_mouse_get_state_pointer') self.functions.remove('wb_radar_get_target') - self.functions.remove('wb_device_get_type') # Deprecated since 8.0.0 - self.functions.remove('wb_file_get_extension') # Part of the internal API + self.functions.remove('wb_device_get_type') # Deprecated since 8.0.0 + self.functions.remove('wb_file_get_extension') # Part of the internal API # Not Yet Implemented self.functions.remove('wb_node_get_name') From 9fcee276fd1b85e9752bbee0c710bbab17f9eaec Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sun, 22 Dec 2024 21:50:35 -0800 Subject: [PATCH 26/51] reclassify wb_node_get_name --- tests/sources/test_matlab_functions.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/sources/test_matlab_functions.py b/tests/sources/test_matlab_functions.py index add865c0367..6ee1e610dfc 100755 --- a/tests/sources/test_matlab_functions.py +++ b/tests/sources/test_matlab_functions.py @@ -34,8 +34,7 @@ def setUp(self): skippedLines = [ ';', 'EXPORTS', # Comments / Keywords 'abstract_camera', # Abstract Camera functions should be called through their variant functions (e.g. wb_camera_get_*) - 'microphone', # Microphone Node is Experimental - 'radio', # Radio Plugin + 'microphone', 'radio', # Experimental Node Types 'remote_control', 'wbr', # Remote Control Plugin 'init', 'cleanup', # These are usually called automatically 'robot', # Many robot functions are used internally by the C API (e.x. wb_robot_mutex_*) @@ -64,9 +63,9 @@ def setUp(self): self.functions.remove('wb_device_get_type') # Deprecated since 8.0.0 self.functions.remove('wb_file_get_extension') # Part of the internal API + self.functions.remove('wb_node_get_name') # C API Only # Not Yet Implemented - self.functions.remove('wb_node_get_name') self.functions.remove('wbu_system_tmpdir') self.functions.remove('wbu_system_webots_instance_path') From 9fda13f4d176f9cac71e2a018bf3b0a23bd8ed30 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sun, 22 Dec 2024 21:55:06 -0800 Subject: [PATCH 27/51] add some more ignored Matlab functions --- tests/sources/test_matlab_functions.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/sources/test_matlab_functions.py b/tests/sources/test_matlab_functions.py index 6ee1e610dfc..f99b237e2c3 100755 --- a/tests/sources/test_matlab_functions.py +++ b/tests/sources/test_matlab_functions.py @@ -61,12 +61,17 @@ def setUp(self): self.functions.remove('wb_mouse_get_state_pointer') self.functions.remove('wb_radar_get_target') + # These functions are part of the internal API + self.functions.remove('wb_file_get_extension') + self.functions.remove('wb_lidar_get_unique_id') + self.functions.remove('wb_range_finder_get_unique_id') + self.functions.remove('wb_device_get_type') # Deprecated since 8.0.0 - self.functions.remove('wb_file_get_extension') # Part of the internal API self.functions.remove('wb_node_get_name') # C API Only # Not Yet Implemented self.functions.remove('wbu_system_tmpdir') + self.functions.remove('wbu_system_tmpdir') self.functions.remove('wbu_system_webots_instance_path') @unittest.skipIf(sys.version_info[0] < 3, "not supported by Python 2.7") From 70bab8e7cd405205ce4ed98e18191f865d02ad3b Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sun, 22 Dec 2024 21:59:19 -0800 Subject: [PATCH 28/51] more Matlab functions and restructuring --- tests/sources/test_matlab_functions.py | 48 ++++++++++++++------------ 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/tests/sources/test_matlab_functions.py b/tests/sources/test_matlab_functions.py index f99b237e2c3..765b239a95c 100755 --- a/tests/sources/test_matlab_functions.py +++ b/tests/sources/test_matlab_functions.py @@ -43,6 +43,27 @@ def setUp(self): 'get_unique_id', # Only used internally by the C API 'wbu_string' # String manipulation functions are not needed ] + skippedFunctions = [ + # These functions are used internally by the Matlab API + 'wb_camera_recognition_get_object', + 'wb_lidar_get_point', + 'wb_mouse_get_state_pointer', + 'wb_radar_get_target', + + # These functions are part of the internal API + 'wb_file_get_extension', + 'wb_lidar_get_unique_id', + 'wb_range_finder_get_unique_id', + + 'wb_device_get_type', # Deprecated since 8.0.0 + 'wb_node_get_name', # C API Only + + # Not Yet Implemented + 'wb_supervisor_load_world', + 'wb_supervisor_save_world', + 'wbu_system_tmpdir', + 'wbu_system_webots_instance_path', + ] self.functions = [] filename = os.path.join(WEBOTS_HOME, 'src', 'controller', 'c', 'Controller.def') self.assertTrue( @@ -51,28 +72,11 @@ def setUp(self): ) with open(filename) as file: for line in file: - if line.strip().startswith('wb') and not any(skippedLine in line for skippedLine in skippedLines) and not line[3:].isupper(): - line = line.strip() - self.functions.append(line[:line.find(' ')]) # Line is of the form "symbol_name @ address" - - # These functions are used internally by the Matlab API - self.functions.remove('wb_camera_recognition_get_object') - self.functions.remove('wb_lidar_get_point') - self.functions.remove('wb_mouse_get_state_pointer') - self.functions.remove('wb_radar_get_target') - - # These functions are part of the internal API - self.functions.remove('wb_file_get_extension') - self.functions.remove('wb_lidar_get_unique_id') - self.functions.remove('wb_range_finder_get_unique_id') - - self.functions.remove('wb_device_get_type') # Deprecated since 8.0.0 - self.functions.remove('wb_node_get_name') # C API Only - - # Not Yet Implemented - self.functions.remove('wbu_system_tmpdir') - self.functions.remove('wbu_system_tmpdir') - self.functions.remove('wbu_system_webots_instance_path') + line = line.strip() + if line.startswith('wb') and not any(skippedLine in line for skippedLine in skippedLines) and not line[3:].isupper(): + function = line[:line.find(' ')] # Line is of the form "symbol_name @ address" + if function not in skippedFunctions: + self.functions.append(function) @unittest.skipIf(sys.version_info[0] < 3, "not supported by Python 2.7") def test_matlab_function_exists(self): From 22e29bb87a20c806e0e4951428a77b4e9e293ab6 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sun, 22 Dec 2024 22:20:45 -0800 Subject: [PATCH 29/51] formatting --- tests/sources/test_matlab_functions.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/sources/test_matlab_functions.py b/tests/sources/test_matlab_functions.py index 765b239a95c..d96593256f7 100755 --- a/tests/sources/test_matlab_functions.py +++ b/tests/sources/test_matlab_functions.py @@ -32,9 +32,10 @@ def setUp(self): mgenerate.main() """Get all the required functions.""" skippedLines = [ - ';', 'EXPORTS', # Comments / Keywords - 'abstract_camera', # Abstract Camera functions should be called through their variant functions (e.g. wb_camera_get_*) - 'microphone', 'radio', # Experimental Node Types + ';', 'EXPORTS', # Comments / Keywords + 'abstract_camera', # Abstract Camera functions should be called through their variant functions + # (e.g. wb_camera_get_*) + 'microphone', 'radio', # Experimental Node Types 'remote_control', 'wbr', # Remote Control Plugin 'init', 'cleanup', # These are usually called automatically 'robot', # Many robot functions are used internally by the C API (e.x. wb_robot_mutex_*) @@ -73,7 +74,8 @@ def setUp(self): with open(filename) as file: for line in file: line = line.strip() - if line.startswith('wb') and not any(skippedLine in line for skippedLine in skippedLines) and not line[3:].isupper(): + if (line.startswith('wb') and not any(skippedLine in line for skippedLine in skippedLines) and + not line[3:].isupper()): function = line[:line.find(' ')] # Line is of the form "symbol_name @ address" if function not in skippedFunctions: self.functions.append(function) From a5c076e8b2f8a12b4bbe77a28d4ffafd9cc20f5d Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sun, 22 Dec 2024 23:47:49 -0800 Subject: [PATCH 30/51] make the matlab test work on linux and run it with the main test suite --- .github/workflows/test_suite_linux.yml | 1 + .../workflows/test_suite_linux_develop.yml | 1 + tests/{sources => }/test_matlab_functions.py | 23 +++++++++++++++---- 3 files changed, 20 insertions(+), 5 deletions(-) rename tests/{sources => }/test_matlab_functions.py (80%) mode change 100755 => 100644 diff --git a/.github/workflows/test_suite_linux.yml b/.github/workflows/test_suite_linux.yml index 8ee0aa57b48..5cd9a224925 100644 --- a/.github/workflows/test_suite_linux.yml +++ b/.github/workflows/test_suite_linux.yml @@ -114,6 +114,7 @@ jobs: python-version: 3.9 - name: Test Suite run: | + python tests/test_matlab_functions.py export LIBGL_ALWAYS_SOFTWARE=true export WEBOTS_DISABLE_SAVE_SCREEN_PERSPECTIVE_ON_CLOSE=true xvfb-run --auto-servernum python scripts/packaging/update_urls.py $(git log -1 --format='%H') diff --git a/.github/workflows/test_suite_linux_develop.yml b/.github/workflows/test_suite_linux_develop.yml index d17551ea22b..4802e63d877 100644 --- a/.github/workflows/test_suite_linux_develop.yml +++ b/.github/workflows/test_suite_linux_develop.yml @@ -110,6 +110,7 @@ jobs: python-version: 3.9 - name: Test Suite run: | + python tests/test_matlab_functions.py export LIBGL_ALWAYS_SOFTWARE=true export WEBOTS_DISABLE_SAVE_SCREEN_PERSPECTIVE_ON_CLOSE=true xvfb-run --auto-servernum python scripts/packaging/update_urls.py $(git log -1 --format='%H') diff --git a/tests/sources/test_matlab_functions.py b/tests/test_matlab_functions.py old mode 100755 new mode 100644 similarity index 80% rename from tests/sources/test_matlab_functions.py rename to tests/test_matlab_functions.py index d96593256f7..e3a3d5c23d4 --- a/tests/sources/test_matlab_functions.py +++ b/tests/test_matlab_functions.py @@ -22,6 +22,8 @@ sys.path.append(os.path.join(WEBOTS_HOME, 'src', 'controller', 'matlab')) import mgenerate # noqa: E402 +from command import Command + class TestMatlabFunctions(unittest.TestCase): """Unit test for checking that all the required Matlab functions are defined.""" @@ -66,21 +68,32 @@ def setUp(self): 'wbu_system_webots_instance_path', ] self.functions = [] + filename = os.path.join(WEBOTS_HOME, 'src', 'controller', 'c', 'Controller.def') - self.assertTrue( - os.path.isfile(filename), - msg='Missing "%s" file.' % filename - ) + if not os.path.isfile(filename): + if sys.platform == 'win32': + self.fail(f'Missing {filename}. Try rebuilding Webots.') + else: + import shlex + controllerLib = os.path.join(WEBOTS_HOME, 'lib', 'controller', 'libController.so') + if not os.path.isfile(controllerLib): + self.fail(f'Missing {controllerLib}. Try rebuilding Webots.') + command = Command(f"readelf -Ws {shlex.quote(controllerLib)} | awk '{{print $8}}' | sort > {shlex.quote(controllerLib)}") + command.run(shell=True) + if command.returncode != 0: + self.fail(f'Failed to generate {filename}.') + with open(filename) as file: for line in file: line = line.strip() if (line.startswith('wb') and not any(skippedLine in line for skippedLine in skippedLines) and not line[3:].isupper()): - function = line[:line.find(' ')] # Line is of the form "symbol_name @ address" + function = line[:line.find(' ')] # Remove any additional metadata if function not in skippedFunctions: self.functions.append(function) @unittest.skipIf(sys.version_info[0] < 3, "not supported by Python 2.7") + @unittest.skipIf(sys.platform == 'darwin', "not supported on macOS") def test_matlab_function_exists(self): """Test that the function file exists.""" for function in self.functions: From 83a0ec05728b777d4ff6ffa649fca58217592308 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Mon, 23 Dec 2024 00:29:14 -0800 Subject: [PATCH 31/51] formatting --- tests/test_matlab_functions.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_matlab_functions.py b/tests/test_matlab_functions.py index e3a3d5c23d4..b1b3226b7f3 100644 --- a/tests/test_matlab_functions.py +++ b/tests/test_matlab_functions.py @@ -21,7 +21,6 @@ WEBOTS_HOME = os.path.normpath(os.environ['WEBOTS_HOME']) sys.path.append(os.path.join(WEBOTS_HOME, 'src', 'controller', 'matlab')) import mgenerate # noqa: E402 - from command import Command @@ -75,10 +74,11 @@ def setUp(self): self.fail(f'Missing {filename}. Try rebuilding Webots.') else: import shlex - controllerLib = os.path.join(WEBOTS_HOME, 'lib', 'controller', 'libController.so') - if not os.path.isfile(controllerLib): - self.fail(f'Missing {controllerLib}. Try rebuilding Webots.') - command = Command(f"readelf -Ws {shlex.quote(controllerLib)} | awk '{{print $8}}' | sort > {shlex.quote(controllerLib)}") + binaryLib = os.path.join(WEBOTS_HOME, 'lib', 'controller', 'libController.so') + if not os.path.isfile(binaryLib): + self.fail(f'Missing {binaryLib}. Try rebuilding Webots.') + command = Command( + f"readelf -Ws {shlex.quote(binaryLib)} | awk '{{print $8}}' | sort > {shlex.quote(binaryLib)}") command.run(shell=True) if command.returncode != 0: self.fail(f'Failed to generate {filename}.') From b22c37356b870879d03b56cc8af2430a3ad1c066 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Mon, 23 Dec 2024 00:30:10 -0800 Subject: [PATCH 32/51] wait for WEBOTS_HOME to be defined --- .github/workflows/test_suite_linux.yml | 2 +- .github/workflows/test_suite_linux_develop.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_suite_linux.yml b/.github/workflows/test_suite_linux.yml index 5cd9a224925..70b92de6acf 100644 --- a/.github/workflows/test_suite_linux.yml +++ b/.github/workflows/test_suite_linux.yml @@ -114,13 +114,13 @@ jobs: python-version: 3.9 - name: Test Suite run: | - python tests/test_matlab_functions.py export LIBGL_ALWAYS_SOFTWARE=true export WEBOTS_DISABLE_SAVE_SCREEN_PERSPECTIVE_ON_CLOSE=true xvfb-run --auto-servernum python scripts/packaging/update_urls.py $(git log -1 --format='%H') export WEBOTS_HOME=$PWD/artifact/webots export TESTS_HOME=$PWD # required by cache group in the test suite export BRANCH_HASH=$(git log -1 --format='%H') + python tests/test_matlab_functions.py xvfb-run --auto-servernum python tests/test_suite.py - uses: actions/upload-artifact@v4 if: failure() diff --git a/.github/workflows/test_suite_linux_develop.yml b/.github/workflows/test_suite_linux_develop.yml index 4802e63d877..37e59583075 100644 --- a/.github/workflows/test_suite_linux_develop.yml +++ b/.github/workflows/test_suite_linux_develop.yml @@ -110,13 +110,13 @@ jobs: python-version: 3.9 - name: Test Suite run: | - python tests/test_matlab_functions.py export LIBGL_ALWAYS_SOFTWARE=true export WEBOTS_DISABLE_SAVE_SCREEN_PERSPECTIVE_ON_CLOSE=true xvfb-run --auto-servernum python scripts/packaging/update_urls.py $(git log -1 --format='%H') export WEBOTS_HOME=$PWD/artifact/webots export TESTS_HOME=$PWD # required by cache group in the test suite export BRANCH_HASH=$(git log -1 --format='%H') + python tests/test_matlab_functions.py xvfb-run --auto-servernum python tests/test_suite.py test-worlds: needs: build From ee331979ed54f32e466d7d3cb6e4ab4d21eabb55 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Mon, 23 Dec 2024 00:44:52 -0800 Subject: [PATCH 33/51] move import statement --- tests/test_matlab_functions.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_matlab_functions.py b/tests/test_matlab_functions.py index b1b3226b7f3..e9f4cd4c8b7 100644 --- a/tests/test_matlab_functions.py +++ b/tests/test_matlab_functions.py @@ -18,10 +18,11 @@ import unittest import os import sys +from command import Command + WEBOTS_HOME = os.path.normpath(os.environ['WEBOTS_HOME']) sys.path.append(os.path.join(WEBOTS_HOME, 'src', 'controller', 'matlab')) import mgenerate # noqa: E402 -from command import Command class TestMatlabFunctions(unittest.TestCase): @@ -78,7 +79,7 @@ def setUp(self): if not os.path.isfile(binaryLib): self.fail(f'Missing {binaryLib}. Try rebuilding Webots.') command = Command( - f"readelf -Ws {shlex.quote(binaryLib)} | awk '{{print $8}}' | sort > {shlex.quote(binaryLib)}") + f"readelf -Ws {shlex.quote(binaryLib)} | awk '{{print $8}}' > {shlex.quote(binaryLib)}") command.run(shell=True) if command.returncode != 0: self.fail(f'Failed to generate {filename}.') From 900eca71cb1c8466a4c16f9196a22bf0b93d168a Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Mon, 23 Dec 2024 00:53:49 -0800 Subject: [PATCH 34/51] write to correct file --- tests/test_matlab_functions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_matlab_functions.py b/tests/test_matlab_functions.py index e9f4cd4c8b7..1a7ef6bcda5 100644 --- a/tests/test_matlab_functions.py +++ b/tests/test_matlab_functions.py @@ -79,7 +79,7 @@ def setUp(self): if not os.path.isfile(binaryLib): self.fail(f'Missing {binaryLib}. Try rebuilding Webots.') command = Command( - f"readelf -Ws {shlex.quote(binaryLib)} | awk '{{print $8}}' > {shlex.quote(binaryLib)}") + f"readelf -Ws {shlex.quote(binaryLib)} | awk '{{print $8}}' > {shlex.quote(filename)}") command.run(shell=True) if command.returncode != 0: self.fail(f'Failed to generate {filename}.') From 3a99e2eb6415e6baa895f40f465acd870ad53afc Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Mon, 23 Dec 2024 01:07:05 -0800 Subject: [PATCH 35/51] correctly trim metadata --- tests/test_matlab_functions.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_matlab_functions.py b/tests/test_matlab_functions.py index 1a7ef6bcda5..29dadaeca6e 100644 --- a/tests/test_matlab_functions.py +++ b/tests/test_matlab_functions.py @@ -89,7 +89,8 @@ def setUp(self): line = line.strip() if (line.startswith('wb') and not any(skippedLine in line for skippedLine in skippedLines) and not line[3:].isupper()): - function = line[:line.find(' ')] # Remove any additional metadata + # Remove any additional metadata + function = line[:line.find(' ')] if ' ' in line else line if function not in skippedFunctions: self.functions.append(function) From a18d6d410d38e63206c437246c8f215f4e71041f Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Tue, 24 Dec 2024 16:05:38 -0800 Subject: [PATCH 36/51] Revert "make the matlab test work on linux and run it with the main test suite" This reverts commit a5c076e8b2f8a12b4bbe77a28d4ffafd9cc20f5d. --- tests/{ => sources}/test_matlab_functions.py | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) rename tests/{ => sources}/test_matlab_functions.py (83%) diff --git a/tests/test_matlab_functions.py b/tests/sources/test_matlab_functions.py similarity index 83% rename from tests/test_matlab_functions.py rename to tests/sources/test_matlab_functions.py index 29dadaeca6e..deaa40e62cb 100644 --- a/tests/test_matlab_functions.py +++ b/tests/sources/test_matlab_functions.py @@ -68,22 +68,11 @@ def setUp(self): 'wbu_system_webots_instance_path', ] self.functions = [] - filename = os.path.join(WEBOTS_HOME, 'src', 'controller', 'c', 'Controller.def') - if not os.path.isfile(filename): - if sys.platform == 'win32': - self.fail(f'Missing {filename}. Try rebuilding Webots.') - else: - import shlex - binaryLib = os.path.join(WEBOTS_HOME, 'lib', 'controller', 'libController.so') - if not os.path.isfile(binaryLib): - self.fail(f'Missing {binaryLib}. Try rebuilding Webots.') - command = Command( - f"readelf -Ws {shlex.quote(binaryLib)} | awk '{{print $8}}' > {shlex.quote(filename)}") - command.run(shell=True) - if command.returncode != 0: - self.fail(f'Failed to generate {filename}.') - + self.assertTrue( + os.path.isfile(filename), + msg='Missing "%s" file.' % filename + ) with open(filename) as file: for line in file: line = line.strip() @@ -95,7 +84,6 @@ def setUp(self): self.functions.append(function) @unittest.skipIf(sys.version_info[0] < 3, "not supported by Python 2.7") - @unittest.skipIf(sys.platform == 'darwin', "not supported on macOS") def test_matlab_function_exists(self): """Test that the function file exists.""" for function in self.functions: From c855662cdac90153c3ac9925fae4987fadc563ce Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Tue, 24 Dec 2024 16:06:37 -0800 Subject: [PATCH 37/51] fix comments --- include/controller/c/webots/supervisor.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/controller/c/webots/supervisor.h b/include/controller/c/webots/supervisor.h index c2b71a6e1a6..5ae8f985c56 100644 --- a/include/controller/c/webots/supervisor.h +++ b/include/controller/c/webots/supervisor.h @@ -215,10 +215,10 @@ void wb_supervisor_simulation_revert() WB_DEPRECATED; // please us void wb_supervisor_load_world(const char *filename) WB_DEPRECATED; // please use wb_supervisor_world_load() instead bool wb_supervisor_save_world(const char *filename) WB_DEPRECATED; // please use wb_supervisor_world_save() instead -// deprecated since Webots 8.6.0, plesae use wb_supervisor_field_remove_mf_item() instead +// deprecated since Webots 8.6.0, please use wb_supervisor_field_remove_mf() instead void wb_supervisor_field_remove_mf_node(WbFieldRef field, int position) WB_DEPRECATED; -// deprecated since Webots 8.0.0, plesae use wb_supervisor_simulation_reset_physics() instead +// deprecated since Webots 8.0.0, pleaae use wb_supervisor_simulation_reset_physics() instead void wb_supervisor_simulation_physics_reset() WB_DEPRECATED; // deprecated since Webots 8.4.0 please use wb_supervisor_movie_is_ready and wb_supervisor_movie_failed From b7c417e6d25e95f265ff6a2599e39de4e10ba4bd Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Tue, 24 Dec 2024 16:26:27 -0800 Subject: [PATCH 38/51] correct revert test suite changes --- .github/workflows/test_suite_linux.yml | 1 - .github/workflows/test_suite_linux_develop.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/test_suite_linux.yml b/.github/workflows/test_suite_linux.yml index 70b92de6acf..8ee0aa57b48 100644 --- a/.github/workflows/test_suite_linux.yml +++ b/.github/workflows/test_suite_linux.yml @@ -120,7 +120,6 @@ jobs: export WEBOTS_HOME=$PWD/artifact/webots export TESTS_HOME=$PWD # required by cache group in the test suite export BRANCH_HASH=$(git log -1 --format='%H') - python tests/test_matlab_functions.py xvfb-run --auto-servernum python tests/test_suite.py - uses: actions/upload-artifact@v4 if: failure() diff --git a/.github/workflows/test_suite_linux_develop.yml b/.github/workflows/test_suite_linux_develop.yml index 37e59583075..d17551ea22b 100644 --- a/.github/workflows/test_suite_linux_develop.yml +++ b/.github/workflows/test_suite_linux_develop.yml @@ -116,7 +116,6 @@ jobs: export WEBOTS_HOME=$PWD/artifact/webots export TESTS_HOME=$PWD # required by cache group in the test suite export BRANCH_HASH=$(git log -1 --format='%H') - python tests/test_matlab_functions.py xvfb-run --auto-servernum python tests/test_suite.py test-worlds: needs: build From 3f1b77fa84544d66a1226444da2b9585c8fe145f Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Tue, 24 Dec 2024 16:26:50 -0800 Subject: [PATCH 39/51] generate matlab expected function list from header files --- tests/sources/test_matlab_functions.py | 41 +++++++++++++++++--------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/tests/sources/test_matlab_functions.py b/tests/sources/test_matlab_functions.py index deaa40e62cb..7cef0427aaf 100644 --- a/tests/sources/test_matlab_functions.py +++ b/tests/sources/test_matlab_functions.py @@ -17,7 +17,10 @@ """Test that all the required Matlab functions are defined.""" import unittest import os +import shlex import sys +# Add the parent directory to the path so we can import the command module +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from command import Command WEBOTS_HOME = os.path.normpath(os.environ['WEBOTS_HOME']) @@ -68,20 +71,30 @@ def setUp(self): 'wbu_system_webots_instance_path', ] self.functions = [] - filename = os.path.join(WEBOTS_HOME, 'src', 'controller', 'c', 'Controller.def') - self.assertTrue( - os.path.isfile(filename), - msg='Missing "%s" file.' % filename - ) - with open(filename) as file: - for line in file: - line = line.strip() - if (line.startswith('wb') and not any(skippedLine in line for skippedLine in skippedLines) and - not line[3:].isupper()): - # Remove any additional metadata - function = line[:line.find(' ')] if ' ' in line else line - if function not in skippedFunctions: - self.functions.append(function) + + command = Command(( + # Search for function definitions + r"grep -Eho '\b\w+[ *]+\w+\(' " + # In the controller headers + f"{os.path.join(WEBOTS_HOME, 'include', 'controller', 'c', 'webots', '*.h')} " + f"{os.path.join(WEBOTS_HOME, 'include', 'controller', 'c', 'webots', 'utils', '*.h')} | " + # Filter out everything besides the function name and remove duplicates + r"sed -En 's/\b\w+[ *]+(\w+)\(/\1/p' | sort -u" + )) + command.run(shell=True) + if command.returncode != 0: + self.fail(f'Failed to generate function list: {command.output}') + # Print the list of functions to a file + with open('functions.txt', 'w') as file: + file.write(command.output) + + for line in command.output.splitlines(): + if (line.startswith('wb') and not any(skippedLine in line for skippedLine in skippedLines) and + not line[3:].isupper()): + # Remove any additional metadata + function = line[:line.find(' ')] if ' ' in line else line + if function not in skippedFunctions: + self.functions.append(function) @unittest.skipIf(sys.version_info[0] < 3, "not supported by Python 2.7") def test_matlab_function_exists(self): From fbedcb27aa5b2e37df92fc84a84b961cc97de3cb Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Tue, 24 Dec 2024 18:46:36 -0800 Subject: [PATCH 40/51] remove debug print --- tests/sources/test_matlab_functions.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/sources/test_matlab_functions.py b/tests/sources/test_matlab_functions.py index 7cef0427aaf..072b90ea490 100644 --- a/tests/sources/test_matlab_functions.py +++ b/tests/sources/test_matlab_functions.py @@ -84,9 +84,6 @@ def setUp(self): command.run(shell=True) if command.returncode != 0: self.fail(f'Failed to generate function list: {command.output}') - # Print the list of functions to a file - with open('functions.txt', 'w') as file: - file.write(command.output) for line in command.output.splitlines(): if (line.startswith('wb') and not any(skippedLine in line for skippedLine in skippedLines) and From 87d3f91262f712c90f517869be24e903713f7eef Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Tue, 24 Dec 2024 18:53:13 -0800 Subject: [PATCH 41/51] use safer shell syntax --- tests/sources/test_matlab_functions.py | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/tests/sources/test_matlab_functions.py b/tests/sources/test_matlab_functions.py index 072b90ea490..a33be0654e9 100644 --- a/tests/sources/test_matlab_functions.py +++ b/tests/sources/test_matlab_functions.py @@ -17,7 +17,7 @@ """Test that all the required Matlab functions are defined.""" import unittest import os -import shlex +import re import sys # Add the parent directory to the path so we can import the command module sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) @@ -72,25 +72,23 @@ def setUp(self): ] self.functions = [] - command = Command(( + command = Command([ # Search for function definitions - r"grep -Eho '\b\w+[ *]+\w+\(' " + 'grep', '-Eho', r'\b\w+[ *]+\w+\(', # In the controller headers - f"{os.path.join(WEBOTS_HOME, 'include', 'controller', 'c', 'webots', '*.h')} " - f"{os.path.join(WEBOTS_HOME, 'include', 'controller', 'c', 'webots', 'utils', '*.h')} | " - # Filter out everything besides the function name and remove duplicates - r"sed -En 's/\b\w+[ *]+(\w+)\(/\1/p' | sort -u" - )) - command.run(shell=True) + os.path.join(WEBOTS_HOME, 'include', 'controller', 'c', 'webots', '*.h'), + os.path.join(WEBOTS_HOME, 'include', 'controller', 'c', 'webots', 'utils', '*.h') + ]) + command.run() if command.returncode != 0: self.fail(f'Failed to generate function list: {command.output}') for line in command.output.splitlines(): - if (line.startswith('wb') and not any(skippedLine in line for skippedLine in skippedLines) and - not line[3:].isupper()): - # Remove any additional metadata - function = line[:line.find(' ')] if ' ' in line else line - if function not in skippedFunctions: + # Filter out the function name + function = re.sub(r'\b\w+[ *]+(\w+)\(', r'\1', line.strip()) + if (function.startswith('wb') and not any(skippedLine in function for skippedLine in skippedLines) and + not function[3:].isupper()): + if function not in skippedFunctions and function not in self.functions: self.functions.append(function) @unittest.skipIf(sys.version_info[0] < 3, "not supported by Python 2.7") From 77d6f958e7ac894bbd4af64c88fcfa8337aa779a Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Tue, 24 Dec 2024 18:59:22 -0800 Subject: [PATCH 42/51] formatting --- tests/sources/test_matlab_functions.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/sources/test_matlab_functions.py b/tests/sources/test_matlab_functions.py index a33be0654e9..ca5f6a43960 100644 --- a/tests/sources/test_matlab_functions.py +++ b/tests/sources/test_matlab_functions.py @@ -19,9 +19,10 @@ import os import re import sys + # Add the parent directory to the path so we can import the command module sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from command import Command +from command import Command # noqa: E402 WEBOTS_HOME = os.path.normpath(os.environ['WEBOTS_HOME']) sys.path.append(os.path.join(WEBOTS_HOME, 'src', 'controller', 'matlab')) From 6fb1a25afc9cdcf264a34fd7d370dfd38db0eca2 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Tue, 24 Dec 2024 20:13:04 -0800 Subject: [PATCH 43/51] update matlab function exclusions --- tests/sources/test_matlab_functions.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/tests/sources/test_matlab_functions.py b/tests/sources/test_matlab_functions.py index ca5f6a43960..51b86d0b71e 100644 --- a/tests/sources/test_matlab_functions.py +++ b/tests/sources/test_matlab_functions.py @@ -38,16 +38,10 @@ def setUp(self): mgenerate.main() """Get all the required functions.""" skippedLines = [ - ';', 'EXPORTS', # Comments / Keywords - 'abstract_camera', # Abstract Camera functions should be called through their variant functions - # (e.g. wb_camera_get_*) 'microphone', 'radio', # Experimental Node Types 'remote_control', 'wbr', # Remote Control Plugin - 'init', 'cleanup', # These are usually called automatically 'robot', # Many robot functions are used internally by the C API (e.x. wb_robot_mutex_*) 'lookup_table_size', # Matlab lets you get the size of an array, so these functions are not needed - 'no_mutex', # "no_mutex" function variants should only be used internally - 'get_unique_id', # Only used internally by the C API 'wbu_string' # String manipulation functions are not needed ] skippedFunctions = [ @@ -57,17 +51,17 @@ def setUp(self): 'wb_mouse_get_state_pointer', 'wb_radar_get_target', - # These functions are part of the internal API - 'wb_file_get_extension', - 'wb_lidar_get_unique_id', - 'wb_range_finder_get_unique_id', - 'wb_device_get_type', # Deprecated since 8.0.0 'wb_node_get_name', # C API Only + # The Matlab API exposes the image data as a multidimensional array, so these functions are not needed + 'wb_camera_image_get_red', + 'wb_camera_image_get_green', + 'wb_camera_image_get_blue', + 'wb_camera_image_get_gray', + 'wb_camera_image_get_grey', + # Not Yet Implemented - 'wb_supervisor_load_world', - 'wb_supervisor_save_world', 'wbu_system_tmpdir', 'wbu_system_webots_instance_path', ] From f5011d91fda3c9cfee560f6c5436626de700358e Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Tue, 24 Dec 2024 20:20:04 -0800 Subject: [PATCH 44/51] remove unused check --- tests/sources/test_matlab_functions.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/sources/test_matlab_functions.py b/tests/sources/test_matlab_functions.py index 51b86d0b71e..7cb9d29e82f 100644 --- a/tests/sources/test_matlab_functions.py +++ b/tests/sources/test_matlab_functions.py @@ -81,8 +81,7 @@ def setUp(self): for line in command.output.splitlines(): # Filter out the function name function = re.sub(r'\b\w+[ *]+(\w+)\(', r'\1', line.strip()) - if (function.startswith('wb') and not any(skippedLine in function for skippedLine in skippedLines) and - not function[3:].isupper()): + if (function.startswith('wb') and not any(skippedLine in function for skippedLine in skippedLines)): if function not in skippedFunctions and function not in self.functions: self.functions.append(function) From 282c49d928ecd3ab3c34b50e5f5976b3a87b5e21 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Tue, 24 Dec 2024 21:01:50 -0800 Subject: [PATCH 45/51] detect constants --- tests/sources/test_matlab_functions.py | 62 ++++++++++++++------------ 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/tests/sources/test_matlab_functions.py b/tests/sources/test_matlab_functions.py index 7cb9d29e82f..df7b72cb8e0 100644 --- a/tests/sources/test_matlab_functions.py +++ b/tests/sources/test_matlab_functions.py @@ -38,14 +38,27 @@ def setUp(self): mgenerate.main() """Get all the required functions.""" skippedLines = [ - 'microphone', 'radio', # Experimental Node Types - 'remote_control', 'wbr', # Remote Control Plugin - 'robot', # Many robot functions are used internally by the C API (e.x. wb_robot_mutex_*) - 'lookup_table_size', # Matlab lets you get the size of an array, so these functions are not needed - 'wbu_string' # String manipulation functions are not needed - ] - skippedFunctions = [ - # These functions are used internally by the Matlab API + # Patterns + '.*_H', # Header Guards + '.*_', # Some comments use the ..._* pattern to refer to a group of functions ; + # grep will filter the *, but no function should end with _ + 'wb_camera_image_get_.*', # The Matlab API exposes the image data as a multidimensional array, + # so these functions are not needed + 'wb_(microphone|radio)_.*', # Experimental Node Types + 'wb_remote_control_.*', 'wbr_.*', # Remote Control Plugin + 'wb_robot_.*', # Many robot functions are used internally by the C API (e.x. wb_robot_mutex_*) + '.*_lookup_table_size', # Matlab lets you get the size of an array, so these functions are not needed + 'wbu_string_.*', # String manipulation functions are not needed + + # Specific Functions + + ## Non-Function Macros + 'WB_ALLOW_MIXING_C_AND_CPP_API', + 'WB_DEPRECATED', + 'WB_MATLAB_LOADLIBRARY', + 'WB_USING_C(PP)?_API', + + ## These functions are used internally by the Matlab API 'wb_camera_recognition_get_object', 'wb_lidar_get_point', 'wb_mouse_get_state_pointer', @@ -54,22 +67,15 @@ def setUp(self): 'wb_device_get_type', # Deprecated since 8.0.0 'wb_node_get_name', # C API Only - # The Matlab API exposes the image data as a multidimensional array, so these functions are not needed - 'wb_camera_image_get_red', - 'wb_camera_image_get_green', - 'wb_camera_image_get_blue', - 'wb_camera_image_get_gray', - 'wb_camera_image_get_grey', - - # Not Yet Implemented + ## Not Yet Implemented 'wbu_system_tmpdir', 'wbu_system_webots_instance_path', ] self.functions = [] command = Command([ - # Search for function definitions - 'grep', '-Eho', r'\b\w+[ *]+\w+\(', + # Search for webots definitions + 'grep', '-Ehio', r'\bwb_\w+\b', # In the controller headers os.path.join(WEBOTS_HOME, 'include', 'controller', 'c', 'webots', '*.h'), os.path.join(WEBOTS_HOME, 'include', 'controller', 'c', 'webots', 'utils', '*.h') @@ -79,21 +85,19 @@ def setUp(self): self.fail(f'Failed to generate function list: {command.output}') for line in command.output.splitlines(): - # Filter out the function name - function = re.sub(r'\b\w+[ *]+(\w+)\(', r'\1', line.strip()) - if (function.startswith('wb') and not any(skippedLine in function for skippedLine in skippedLines)): - if function not in skippedFunctions and function not in self.functions: - self.functions.append(function) + if not any(re.match(f'^{skippedLine}$', line) for skippedLine in skippedLines) and line not in self.functions: + self.functions.append(line) @unittest.skipIf(sys.version_info[0] < 3, "not supported by Python 2.7") def test_matlab_function_exists(self): """Test that the function file exists.""" - for function in self.functions: - filename = os.path.join(WEBOTS_HOME, 'lib', 'controller', 'matlab', function + '.m') - self.assertTrue( - os.path.isfile(filename), - msg='Missing "%s" file.' % filename - ) + expectedFiles = (os.path.join(WEBOTS_HOME, 'lib', 'controller', 'matlab', function + '.m') for function in self.functions) + missingFiles = [file for file in expectedFiles if not os.path.isfile(file)] + + self.assertTrue( + not missingFiles, + msg='Missing files: %s' % ', '.join(missingFiles) + ) if __name__ == '__main__': From e5bc091b9d0fcdd3647fb3be9fdc502cd8574f0b Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Tue, 24 Dec 2024 21:06:21 -0800 Subject: [PATCH 46/51] formatting --- tests/sources/test_matlab_functions.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/sources/test_matlab_functions.py b/tests/sources/test_matlab_functions.py index df7b72cb8e0..6f0216f63c3 100644 --- a/tests/sources/test_matlab_functions.py +++ b/tests/sources/test_matlab_functions.py @@ -43,7 +43,7 @@ def setUp(self): '.*_', # Some comments use the ..._* pattern to refer to a group of functions ; # grep will filter the *, but no function should end with _ 'wb_camera_image_get_.*', # The Matlab API exposes the image data as a multidimensional array, - # so these functions are not needed + # so these functions are not needed 'wb_(microphone|radio)_.*', # Experimental Node Types 'wb_remote_control_.*', 'wbr_.*', # Remote Control Plugin 'wb_robot_.*', # Many robot functions are used internally by the C API (e.x. wb_robot_mutex_*) @@ -52,13 +52,13 @@ def setUp(self): # Specific Functions - ## Non-Function Macros + # Non-Function Macros 'WB_ALLOW_MIXING_C_AND_CPP_API', 'WB_DEPRECATED', 'WB_MATLAB_LOADLIBRARY', 'WB_USING_C(PP)?_API', - ## These functions are used internally by the Matlab API + # These functions are used internally by the Matlab API 'wb_camera_recognition_get_object', 'wb_lidar_get_point', 'wb_mouse_get_state_pointer', @@ -67,7 +67,7 @@ def setUp(self): 'wb_device_get_type', # Deprecated since 8.0.0 'wb_node_get_name', # C API Only - ## Not Yet Implemented + # Not Yet Implemented 'wbu_system_tmpdir', 'wbu_system_webots_instance_path', ] @@ -91,7 +91,8 @@ def setUp(self): @unittest.skipIf(sys.version_info[0] < 3, "not supported by Python 2.7") def test_matlab_function_exists(self): """Test that the function file exists.""" - expectedFiles = (os.path.join(WEBOTS_HOME, 'lib', 'controller', 'matlab', function + '.m') for function in self.functions) + expectedFiles = (os.path.join(WEBOTS_HOME, 'lib', 'controller', 'matlab', function + '.m') + for function in self.functions) missingFiles = [file for file in expectedFiles if not os.path.isfile(file)] self.assertTrue( From 249375ede0c6a5d7c69879d0098a31604af16d9f Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Tue, 24 Dec 2024 21:48:26 -0800 Subject: [PATCH 47/51] debugging info --- tests/sources/test_matlab_functions.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/sources/test_matlab_functions.py b/tests/sources/test_matlab_functions.py index 6f0216f63c3..ad2ae43312e 100644 --- a/tests/sources/test_matlab_functions.py +++ b/tests/sources/test_matlab_functions.py @@ -80,9 +80,12 @@ def setUp(self): os.path.join(WEBOTS_HOME, 'include', 'controller', 'c', 'webots', '*.h'), os.path.join(WEBOTS_HOME, 'include', 'controller', 'c', 'webots', 'utils', '*.h') ]) + print("Current location: " + os.path.abspath(__file__)) + print("Command: " + str(command.cmd)) + print("Dir exists: " + str(os.path.exists(os.path.join(WEBOTS_HOME, 'include', 'controller', 'c', 'webots', '*.h')))) command.run() if command.returncode != 0: - self.fail(f'Failed to generate function list: {command.output}') + self.fail(f'Failed to generate function list:\n{command.output}') for line in command.output.splitlines(): if not any(re.match(f'^{skippedLine}$', line) for skippedLine in skippedLines) and line not in self.functions: From 9aec7d6c33bd1cb298ce6518007cbe92ad6bca34 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Tue, 24 Dec 2024 21:57:29 -0800 Subject: [PATCH 48/51] write to stderr --- tests/sources/test_matlab_functions.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/sources/test_matlab_functions.py b/tests/sources/test_matlab_functions.py index ad2ae43312e..41404fdb477 100644 --- a/tests/sources/test_matlab_functions.py +++ b/tests/sources/test_matlab_functions.py @@ -80,9 +80,11 @@ def setUp(self): os.path.join(WEBOTS_HOME, 'include', 'controller', 'c', 'webots', '*.h'), os.path.join(WEBOTS_HOME, 'include', 'controller', 'c', 'webots', 'utils', '*.h') ]) - print("Current location: " + os.path.abspath(__file__)) - print("Command: " + str(command.cmd)) - print("Dir exists: " + str(os.path.exists(os.path.join(WEBOTS_HOME, 'include', 'controller', 'c', 'webots', '*.h')))) + print("Current location: " + os.path.abspath(__file__), file=sys.stderr) + print("Command: " + str(command.cmd), file=sys.stderr) + print("Dir exists: " + + str(os.path.exists(os.path.join(WEBOTS_HOME, 'include', 'controller', 'c', 'webots', '*.h'))), + file=sys.stderr) command.run() if command.returncode != 0: self.fail(f'Failed to generate function list:\n{command.output}') From 1848ba8b24fcb7d51f8aab22f0e50e3e9e22af64 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Tue, 24 Dec 2024 22:01:51 -0800 Subject: [PATCH 49/51] more info --- tests/sources/test_matlab_functions.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/sources/test_matlab_functions.py b/tests/sources/test_matlab_functions.py index 41404fdb477..70d57294008 100644 --- a/tests/sources/test_matlab_functions.py +++ b/tests/sources/test_matlab_functions.py @@ -80,11 +80,10 @@ def setUp(self): os.path.join(WEBOTS_HOME, 'include', 'controller', 'c', 'webots', '*.h'), os.path.join(WEBOTS_HOME, 'include', 'controller', 'c', 'webots', 'utils', '*.h') ]) - print("Current location: " + os.path.abspath(__file__), file=sys.stderr) - print("Command: " + str(command.cmd), file=sys.stderr) - print("Dir exists: " + - str(os.path.exists(os.path.join(WEBOTS_HOME, 'include', 'controller', 'c', 'webots', '*.h'))), - file=sys.stderr) + print("Current location: " + os.path.abspath(__file__)) + print("Command: " + str(command.cmd)) + print("Dir exists: " + str(os.path.exists(os.path.join(WEBOTS_HOME, 'include', 'controller', 'c', 'webots')))) + print("Dir contents: " + str(os.listdir(os.path.join(WEBOTS_HOME)))) command.run() if command.returncode != 0: self.fail(f'Failed to generate function list:\n{command.output}') From cb8f73a970922a708242fd844ece281fe2442de2 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Tue, 24 Dec 2024 22:09:40 -0800 Subject: [PATCH 50/51] correctly parse globs --- tests/sources/test_matlab_functions.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/sources/test_matlab_functions.py b/tests/sources/test_matlab_functions.py index 70d57294008..1bf98cfc784 100644 --- a/tests/sources/test_matlab_functions.py +++ b/tests/sources/test_matlab_functions.py @@ -16,6 +16,7 @@ """Test that all the required Matlab functions are defined.""" import unittest +import glob import os import re import sys @@ -77,13 +78,10 @@ def setUp(self): # Search for webots definitions 'grep', '-Ehio', r'\bwb_\w+\b', # In the controller headers - os.path.join(WEBOTS_HOME, 'include', 'controller', 'c', 'webots', '*.h'), - os.path.join(WEBOTS_HOME, 'include', 'controller', 'c', 'webots', 'utils', '*.h') + *glob.glob(os.path.join(WEBOTS_HOME, 'include', 'controller', 'c', 'webots', '*.h')), + *glob.glob(os.path.join(WEBOTS_HOME, 'include', 'controller', 'c', 'webots', 'utils', '*.h')) ]) - print("Current location: " + os.path.abspath(__file__)) - print("Command: " + str(command.cmd)) - print("Dir exists: " + str(os.path.exists(os.path.join(WEBOTS_HOME, 'include', 'controller', 'c', 'webots')))) - print("Dir contents: " + str(os.listdir(os.path.join(WEBOTS_HOME)))) + print(command.cmd) command.run() if command.returncode != 0: self.fail(f'Failed to generate function list:\n{command.output}') From fe292a86ca78234ade22f35105a42f28c441f706 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Tue, 24 Dec 2024 23:09:48 -0800 Subject: [PATCH 51/51] use subprocess directly --- tests/sources/test_matlab_functions.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/tests/sources/test_matlab_functions.py b/tests/sources/test_matlab_functions.py index 1bf98cfc784..8f1f9c9aec1 100644 --- a/tests/sources/test_matlab_functions.py +++ b/tests/sources/test_matlab_functions.py @@ -19,12 +19,9 @@ import glob import os import re +import subprocess import sys -# Add the parent directory to the path so we can import the command module -sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from command import Command # noqa: E402 - WEBOTS_HOME = os.path.normpath(os.environ['WEBOTS_HOME']) sys.path.append(os.path.join(WEBOTS_HOME, 'src', 'controller', 'matlab')) import mgenerate # noqa: E402 @@ -74,19 +71,17 @@ def setUp(self): ] self.functions = [] - command = Command([ + symbolSearch = subprocess.run([ # Search for webots definitions 'grep', '-Ehio', r'\bwb_\w+\b', # In the controller headers *glob.glob(os.path.join(WEBOTS_HOME, 'include', 'controller', 'c', 'webots', '*.h')), *glob.glob(os.path.join(WEBOTS_HOME, 'include', 'controller', 'c', 'webots', 'utils', '*.h')) - ]) - print(command.cmd) - command.run() - if command.returncode != 0: - self.fail(f'Failed to generate function list:\n{command.output}') + ], capture_output=True, text=True) + if symbolSearch.returncode != 0: + self.fail(f'Failed to generate function list:\n{symbolSearch.stdout}') - for line in command.output.splitlines(): + for line in symbolSearch.stdout.splitlines(): if not any(re.match(f'^{skippedLine}$', line) for skippedLine in skippedLines) and line not in self.functions: self.functions.append(line)