diff --git a/cmake/scripts/GenerateWidget.cmake b/cmake/scripts/GenerateWidget.cmake index f46a67e690..b6748422f5 100644 --- a/cmake/scripts/GenerateWidget.cmake +++ b/cmake/scripts/GenerateWidget.cmake @@ -13,6 +13,7 @@ cmake_minimum_required(VERSION 3.5) # The parameter "enumname" specifies the enumeration to extract. This can also be a regular expression. # The parameter "filename" specifies the relative path to the file, where the enumeration is extracted from. This can also be a glob expression. # +# All files where enumerations are extracted from are automatically added via #include # if(NOT GENERATE_SOURCE_FILE) @@ -41,6 +42,7 @@ foreach(ENUM IN LISTS ENUM_LINES) string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" FILE ${FILE}) string(APPEND ${PLACE_HOLDER} "\n${ADD_INDENT}/* automatically generated from ${FILE} */") + list(APPEND INCLUDES "#include \"${FILE}\"") foreach(LINE IN LISTS SOURCE_LINES) string(REPLACE "${RM_INDENT}" "" LINE "${LINE}") @@ -116,4 +118,7 @@ foreach(ENUM IN LISTS ENUM_LINES) endforeach() endforeach() + list(REMOVE_DUPLICATES INCLUDES) + string(REPLACE ";" "\n" INCLUDES "${INCLUDES}") + configure_file(${GENERATE_SOURCE_FILE} ${GENERATE_BINARY_FILE}) diff --git a/src/script/api/script_window.hpp.in b/src/script/api/script_window.hpp.in index a1dbb65670..c0f37d1070 100644 --- a/src/script/api/script_window.hpp.in +++ b/src/script/api/script_window.hpp.in @@ -11,65 +11,8 @@ #define SCRIPT_WINDOW_HPP #include "script_object.hpp" -#include "../../window_type.h" -#include "../../gfx_type.h" -#include "../../widgets/ai_widget.h" -#include "../../widgets/airport_widget.h" -#include "../../widgets/autoreplace_widget.h" -#include "../../widgets/bootstrap_widget.h" -#include "../../widgets/bridge_widget.h" -#include "../../widgets/build_vehicle_widget.h" -#include "../../widgets/cheat_widget.h" -#include "../../widgets/company_widget.h" -#include "../../widgets/console_widget.h" -#include "../../widgets/date_widget.h" -#include "../../widgets/depot_widget.h" -#include "../../widgets/dock_widget.h" -#include "../../widgets/dropdown_widget.h" -#include "../../widgets/engine_widget.h" -#include "../../widgets/error_widget.h" -#include "../../widgets/fios_widget.h" -#include "../../widgets/framerate_widget.h" -#include "../../widgets/genworld_widget.h" -#include "../../widgets/goal_widget.h" -#include "../../widgets/graph_widget.h" -#include "../../widgets/group_widget.h" -#include "../../widgets/highscore_widget.h" -#include "../../widgets/industry_widget.h" -#include "../../widgets/intro_widget.h" -#include "../../widgets/main_widget.h" -#include "../../widgets/misc_widget.h" -#include "../../widgets/music_widget.h" -#include "../../widgets/network_chat_widget.h" -#include "../../widgets/network_content_widget.h" -#include "../../widgets/network_widget.h" -#include "../../widgets/newgrf_debug_widget.h" -#include "../../widgets/newgrf_widget.h" -#include "../../widgets/news_widget.h" -#include "../../widgets/object_widget.h" -#include "../../widgets/order_widget.h" -#include "../../widgets/osk_widget.h" -#include "../../widgets/rail_widget.h" -#include "../../widgets/road_widget.h" -#include "../../widgets/screenshot_widget.h" -#include "../../widgets/settings_widget.h" -#include "../../widgets/sign_widget.h" -#include "../../widgets/smallmap_widget.h" -#include "../../widgets/station_widget.h" -#include "../../widgets/statusbar_widget.h" -#include "../../widgets/subsidy_widget.h" -#include "../../widgets/terraform_widget.h" -#include "../../widgets/timetable_widget.h" -#include "../../widgets/toolbar_widget.h" -#include "../../widgets/town_widget.h" -#include "../../widgets/transparency_widget.h" -#include "../../widgets/tree_widget.h" -#include "../../widgets/vehicle_widget.h" -#include "../../widgets/viewport_widget.h" -#include "../../widgets/waypoint_widget.h" -#include "../../widgets/link_graph_legend_widget.h" -#include "../../widgets/story_widget.h" +${INCLUDES} /** * Class that handles window interaction. A Window in OpenTTD has two imporant