summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/CMakeLists.txt3
-rw-r--r--src/3rdparty/md5/CMakeLists.txt4
-rw-r--r--src/3rdparty/os2/CMakeLists.txt7
-rw-r--r--src/3rdparty/squirrel/CMakeLists.txt3
-rw-r--r--src/3rdparty/squirrel/include/CMakeLists.txt6
-rw-r--r--src/3rdparty/squirrel/sqstdlib/CMakeLists.txt4
-rw-r--r--src/3rdparty/squirrel/squirrel/CMakeLists.txt30
-rw-r--r--src/CMakeLists.txt479
-rw-r--r--src/ai/CMakeLists.txt14
-rw-r--r--src/blitter/CMakeLists.txt55
-rw-r--r--src/core/CMakeLists.txt30
-rw-r--r--src/core/endian_type.hpp28
-rw-r--r--src/depend/depend.cpp1084
-rw-r--r--src/game/CMakeLists.txt14
-rw-r--r--src/lang/CMakeLists.txt122
-rw-r--r--src/linkgraph/CMakeLists.txt22
-rw-r--r--src/misc/CMakeLists.txt14
-rw-r--r--src/music/CMakeLists.txt54
-rw-r--r--src/network/CMakeLists.txt28
-rw-r--r--src/network/core/CMakeLists.txt27
-rw-r--r--src/os/CMakeLists.txt4
-rw-r--r--src/os/macosx/CMakeLists.txt11
-rw-r--r--src/os/os2/CMakeLists.txt4
-rw-r--r--src/os/unix/CMakeLists.txt9
-rw-r--r--src/os/windows/CMakeLists.txt8
-rw-r--r--src/os/windows/ottdres.rc.in14
-rw-r--r--src/pathfinder/CMakeLists.txt9
-rw-r--r--src/pathfinder/npf/CMakeLists.txt8
-rw-r--r--src/pathfinder/yapf/CMakeLists.txt20
-rw-r--r--src/rev.cpp.in12
-rw-r--r--src/saveload/CMakeLists.txt43
-rw-r--r--src/script/CMakeLists.txt23
-rw-r--r--src/script/api/CMakeLists.txt140
-rw-r--r--src/settingsgen/CMakeLists.txt13
-rw-r--r--src/sound/CMakeLists.txt37
-rw-r--r--src/spriteloader/CMakeLists.txt5
-rw-r--r--src/stdafx.h11
-rw-r--r--src/strgen/CMakeLists.txt25
-rw-r--r--src/table/CMakeLists.txt83
-rw-r--r--src/video/CMakeLists.txt35
-rw-r--r--src/video/cocoa/CMakeLists.txt8
-rw-r--r--src/widgets/CMakeLists.txt61
42 files changed, 1482 insertions, 1129 deletions
diff --git a/src/3rdparty/CMakeLists.txt b/src/3rdparty/CMakeLists.txt
new file mode 100644
index 000000000..e3927fa21
--- /dev/null
+++ b/src/3rdparty/CMakeLists.txt
@@ -0,0 +1,3 @@
+add_subdirectory(md5)
+add_subdirectory(squirrel)
+add_subdirectory(os2)
diff --git a/src/3rdparty/md5/CMakeLists.txt b/src/3rdparty/md5/CMakeLists.txt
new file mode 100644
index 000000000..58720ca2d
--- /dev/null
+++ b/src/3rdparty/md5/CMakeLists.txt
@@ -0,0 +1,4 @@
+add_files(
+ md5.cpp
+ md5.h
+)
diff --git a/src/3rdparty/os2/CMakeLists.txt b/src/3rdparty/os2/CMakeLists.txt
new file mode 100644
index 000000000..8edc63479
--- /dev/null
+++ b/src/3rdparty/os2/CMakeLists.txt
@@ -0,0 +1,7 @@
+add_files(
+ getaddrinfo.c
+ getaddrinfo.h
+ getnameinfo.c
+ getnameinfo.h
+ CONDITION OPTION_OS2
+)
diff --git a/src/3rdparty/squirrel/CMakeLists.txt b/src/3rdparty/squirrel/CMakeLists.txt
new file mode 100644
index 000000000..9602087cd
--- /dev/null
+++ b/src/3rdparty/squirrel/CMakeLists.txt
@@ -0,0 +1,3 @@
+add_subdirectory(include)
+add_subdirectory(sqstdlib)
+add_subdirectory(squirrel)
diff --git a/src/3rdparty/squirrel/include/CMakeLists.txt b/src/3rdparty/squirrel/include/CMakeLists.txt
new file mode 100644
index 000000000..5237360d3
--- /dev/null
+++ b/src/3rdparty/squirrel/include/CMakeLists.txt
@@ -0,0 +1,6 @@
+add_files(
+ sqstdaux.h
+ sqstdmath.h
+ sqstdstring.h
+ squirrel.h
+)
diff --git a/src/3rdparty/squirrel/sqstdlib/CMakeLists.txt b/src/3rdparty/squirrel/sqstdlib/CMakeLists.txt
new file mode 100644
index 000000000..2b3bd6bb3
--- /dev/null
+++ b/src/3rdparty/squirrel/sqstdlib/CMakeLists.txt
@@ -0,0 +1,4 @@
+add_files(
+ sqstdaux.cpp
+ sqstdmath.cpp
+)
diff --git a/src/3rdparty/squirrel/squirrel/CMakeLists.txt b/src/3rdparty/squirrel/squirrel/CMakeLists.txt
new file mode 100644
index 000000000..a86a92b7d
--- /dev/null
+++ b/src/3rdparty/squirrel/squirrel/CMakeLists.txt
@@ -0,0 +1,30 @@
+add_files(
+ sqapi.cpp
+ sqarray.h
+ sqbaselib.cpp
+ sqclass.cpp
+ sqclass.h
+ sqclosure.h
+ sqcompiler.cpp
+ sqcompiler.h
+ sqdebug.cpp
+ sqfuncproto.h
+ sqfuncstate.cpp
+ sqfuncstate.h
+ sqlexer.cpp
+ sqlexer.h
+ sqmem.cpp
+ sqobject.cpp
+ sqobject.h
+ sqopcodes.h
+ sqpcheader.h
+ sqstate.cpp
+ sqstate.h
+ sqstring.h
+ sqtable.cpp
+ sqtable.h
+ squserdata.h
+ squtils.h
+ sqvm.cpp
+ sqvm.h
+)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 000000000..0ccf650ab
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,479 @@
+add_subdirectory(3rdparty)
+add_subdirectory(ai)
+add_subdirectory(blitter)
+add_subdirectory(core)
+add_subdirectory(game)
+add_subdirectory(lang)
+add_subdirectory(linkgraph)
+add_subdirectory(misc)
+add_subdirectory(music)
+add_subdirectory(network)
+add_subdirectory(os)
+add_subdirectory(pathfinder)
+add_subdirectory(saveload)
+add_subdirectory(script)
+add_subdirectory(settingsgen)
+add_subdirectory(sound)
+add_subdirectory(spriteloader)
+add_subdirectory(strgen)
+add_subdirectory(table)
+add_subdirectory(video)
+add_subdirectory(widgets)
+
+add_files(
+ viewport_sprite_sorter_sse4.cpp
+ CONDITION SSE_FOUND
+)
+if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
+ set_compile_flags(
+ viewport_sprite_sorter_sse4.cpp
+ COMPILE_FLAGS -msse4.1)
+endif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
+
+add_files(
+ aircraft.h
+ aircraft_cmd.cpp
+ aircraft_gui.cpp
+ airport.cpp
+ airport.h
+ airport_gui.cpp
+ animated_tile.cpp
+ animated_tile_func.h
+ articulated_vehicles.cpp
+ articulated_vehicles.h
+ autoreplace.cpp
+ autoreplace_base.h
+ autoreplace_cmd.cpp
+ autoreplace_func.h
+ autoreplace_gui.cpp
+ autoreplace_gui.h
+ autoreplace_type.h
+ autoslope.h
+ base_consist.cpp
+ base_consist.h
+ base_media_base.h
+ base_media_func.h
+ base_station_base.h
+ bitmap_type.h
+ bmp.cpp
+ bmp.h
+ bootstrap_gui.cpp
+ bridge.h
+ bridge_gui.cpp
+ bridge_map.cpp
+ bridge_map.h
+ build_vehicle_gui.cpp
+ cargo_type.h
+ cargoaction.cpp
+ cargoaction.h
+ cargomonitor.cpp
+ cargomonitor.h
+ cargopacket.cpp
+ cargopacket.h
+ cargotype.cpp
+ cargotype.h
+ cheat.cpp
+ cheat_func.h
+ cheat_gui.cpp
+ cheat_type.h
+ clear_cmd.cpp
+ clear_func.h
+ clear_map.h
+ cmd_helper.h
+ command.cpp
+ command_func.h
+ command_type.h
+ company_base.h
+ company_cmd.cpp
+ company_func.h
+ company_gui.cpp
+ company_gui.h
+ company_manager_face.h
+ company_type.h
+ console.cpp
+ console_cmds.cpp
+ console_func.h
+ console_gui.cpp
+ console_gui.h
+ console_internal.h
+ console_type.h
+ cpu.cpp
+ cpu.h
+ crashlog.cpp
+ crashlog.h
+ currency.cpp
+ currency.h
+ date.cpp
+ date_func.h
+ date_gui.cpp
+ date_gui.h
+ date_type.h
+ debug.cpp
+ debug.h
+ dedicated.cpp
+ depot.cpp
+ depot_base.h
+ depot_cmd.cpp
+ depot_func.h
+ depot_gui.cpp
+ depot_map.h
+ depot_type.h
+ direction_func.h
+ direction_type.h
+ disaster_vehicle.cpp
+ disaster_vehicle.h
+ dock_gui.cpp
+ driver.cpp
+ driver.h
+ economy.cpp
+ economy_base.h
+ economy_func.h
+ economy_type.h
+ effectvehicle.cpp
+ effectvehicle_base.h
+ effectvehicle_func.h
+ elrail.cpp
+ elrail_func.h
+ engine.cpp
+ engine_base.h
+ engine_func.h
+ engine_gui.cpp
+ engine_gui.h
+ engine_type.h
+ error.h
+ error_gui.cpp
+ fileio.cpp
+ fileio_func.h
+ fileio_type.h
+ fios.cpp
+ fios.h
+ fios_gui.cpp
+ fontcache.cpp
+ fontcache.h
+ fontdetection.cpp
+ fontdetection.h
+ framerate_gui.cpp
+ framerate_type.h
+ gamelog.cpp
+ gamelog.h
+ gamelog_internal.h
+ genworld.cpp
+ genworld.h
+ genworld_gui.cpp
+ gfx.cpp
+ gfx_func.h
+ gfx_layout.cpp
+ gfx_layout.h
+ gfx_type.h
+ gfxinit.cpp
+ gfxinit.h
+ goal.cpp
+ goal_base.h
+ goal_gui.cpp
+ goal_type.h
+ graph_gui.cpp
+ graph_gui.h
+ ground_vehicle.cpp
+ ground_vehicle.hpp
+ group.h
+ group_cmd.cpp
+ group_gui.cpp
+ group_gui.h
+ group_type.h
+ gui.h
+ guitimer_func.h
+ heightmap.cpp
+ heightmap.h
+ highscore.cpp
+ highscore.h
+ highscore_gui.cpp
+ hotkeys.cpp
+ hotkeys.h
+ house.h
+ house_type.h
+ industry.h
+ industry_cmd.cpp
+ industry_gui.cpp
+ industry_map.h
+ industry_type.h
+ industrytype.h
+ ini.cpp
+ ini_load.cpp
+ ini_type.h
+ intro_gui.cpp
+ landscape.cpp
+ landscape.h
+ landscape_type.h
+ language.h
+ livery.h
+ main_gui.cpp
+ map.cpp
+ map_func.h
+ map_type.h
+ misc.cpp
+ misc_cmd.cpp
+ misc_gui.cpp
+ mixer.cpp
+ mixer.h
+ music.cpp
+ music_gui.cpp
+ newgrf.cpp
+ newgrf.h
+ newgrf_airport.cpp
+ newgrf_airport.h
+ newgrf_airporttiles.cpp
+ newgrf_airporttiles.h
+ newgrf_animation_base.h
+ newgrf_animation_type.h
+ newgrf_callbacks.h
+ newgrf_canal.cpp
+ newgrf_canal.h
+ newgrf_cargo.cpp
+ newgrf_cargo.h
+ newgrf_class.h
+ newgrf_class_func.h
+ newgrf_commons.cpp
+ newgrf_commons.h
+ newgrf_config.cpp
+ newgrf_config.h
+ newgrf_debug.h
+ newgrf_debug_gui.cpp
+ newgrf_engine.cpp
+ newgrf_engine.h
+ newgrf_generic.cpp
+ newgrf_generic.h
+ newgrf_gui.cpp
+ newgrf_house.cpp
+ newgrf_house.h
+ newgrf_industries.cpp
+ newgrf_industries.h
+ newgrf_industrytiles.cpp
+ newgrf_industrytiles.h
+ newgrf_object.cpp
+ newgrf_object.h
+ newgrf_profiling.cpp
+ newgrf_profiling.h
+ newgrf_properties.h
+ newgrf_railtype.cpp
+ newgrf_railtype.h
+ newgrf_roadtype.cpp
+ newgrf_roadtype.h
+ newgrf_sound.cpp
+ newgrf_sound.h
+ newgrf_spritegroup.cpp
+ newgrf_spritegroup.h
+ newgrf_station.cpp
+ newgrf_station.h
+ newgrf_storage.cpp
+ newgrf_storage.h
+ newgrf_text.cpp
+ newgrf_text.h
+ newgrf_town.cpp
+ newgrf_town.h
+ newgrf_townname.cpp
+ newgrf_townname.h
+ news_func.h
+ news_gui.cpp
+ news_gui.h
+ news_type.h
+ object.h
+ object_base.h
+ object_cmd.cpp
+ object_gui.cpp
+ object_map.h
+ object_type.h
+ openttd.cpp
+ openttd.h
+ order_backup.cpp
+ order_backup.h
+ order_base.h
+ order_cmd.cpp
+ order_func.h
+ order_gui.cpp
+ order_type.h
+ osk_gui.cpp
+ pbs.cpp
+ pbs.h
+ progress.cpp
+ progress.h
+ querystring_gui.h
+ rail.cpp
+ rail.h
+ rail_cmd.cpp
+ rail_gui.cpp
+ rail_gui.h
+ rail_map.h
+ rail_type.h
+ rev.h
+ road.cpp
+ road.h
+ road_cmd.cpp
+ road_cmd.h
+ road_func.h
+ road_gui.cpp
+ road_gui.h
+ road_internal.h
+ road_map.cpp
+ road_map.h
+ road_type.h
+ roadstop.cpp
+ roadstop_base.h
+ roadveh.h
+ roadveh_cmd.cpp
+ roadveh_gui.cpp
+ safeguards.h
+ screenshot_gui.cpp
+ screenshot_gui.h
+ screenshot.cpp
+ screenshot.h
+ settings.cpp
+ settings_func.h
+ settings_gui.cpp
+ settings_gui.h
+ settings_internal.h
+ settings_type.h
+ ship.h
+ ship_cmd.cpp
+ ship_gui.cpp
+ signal.cpp
+ signal_func.h
+ signal_type.h
+ signs.cpp
+ signs_base.h
+ signs_cmd.cpp
+ signs_func.h
+ signs_gui.cpp
+ signs_type.h
+ slope_func.h
+ slope_type.h
+ smallmap_gui.cpp
+ smallmap_gui.h
+ sortlist_type.h
+ sound.cpp
+ sound_func.h
+ sound_type.h
+ sprite.cpp
+ sprite.h
+ spritecache.cpp
+ spritecache.h
+ station.cpp
+ station_base.h
+ station_cmd.cpp
+ station_func.h
+ station_gui.cpp
+ station_gui.h
+ station_kdtree.h
+ station_map.h
+ station_type.h
+ statusbar_gui.cpp
+ statusbar_gui.h
+ stdafx.h
+ story.cpp
+ story_base.h
+ story_gui.cpp
+ story_type.h
+ strgen/strgen.h
+ string.cpp
+ string_base.h
+ string_func.h
+ string_type.h
+ stringfilter.cpp
+ stringfilter_type.h
+ strings.cpp
+ strings_func.h
+ strings_type.h
+ subsidy.cpp
+ subsidy_base.h
+ subsidy_func.h
+ subsidy_gui.cpp
+ subsidy_type.h
+ tar_type.h
+ terraform_cmd.cpp
+ terraform_gui.cpp
+ terraform_gui.h
+ textbuf.cpp
+ textbuf_gui.h
+ textbuf_type.h
+ texteff.cpp
+ texteff.hpp
+ textfile_gui.cpp
+ textfile_gui.h
+ textfile_type.h
+ tgp.cpp
+ tgp.h
+ thread.h
+ tile_cmd.h
+ tile_map.cpp
+ tile_map.h
+ tile_type.h
+ tilearea.cpp
+ tilearea_type.h
+ tilehighlight_func.h
+ tilehighlight_type.h
+ tilematrix_type.hpp
+ timetable.h
+ timetable_cmd.cpp
+ timetable_gui.cpp
+ toolbar_gui.cpp
+ toolbar_gui.h
+ town.h
+ town_cmd.cpp
+ town_gui.cpp
+ town_kdtree.h
+ town_map.h
+ town_type.h
+ townname.cpp
+ townname_func.h
+ townname_type.h
+ track_func.h
+ track_type.h
+ train.h
+ train_cmd.cpp
+ train_gui.cpp
+ transparency.h
+ transparency_gui.cpp
+ transparency_gui.h
+ transport_type.h
+ tree_cmd.cpp
+ tree_gui.cpp
+ tree_map.h
+ tunnel_map.cpp
+ tunnel_map.h
+ tunnelbridge.h
+ tunnelbridge_cmd.cpp
+ tunnelbridge_map.h
+ vehicle.cpp
+ vehicle_base.h
+ vehicle_cmd.cpp
+ vehicle_func.h
+ vehicle_gui.cpp
+ vehicle_gui.h
+ vehicle_gui_base.h
+ vehicle_type.h
+ vehiclelist.cpp
+ vehiclelist.h
+ viewport.cpp
+ viewport_func.h
+ viewport_gui.cpp
+ viewport_kdtree.h
+ viewport_sprite_sorter.h
+ viewport_type.h
+ void_cmd.cpp
+ void_map.h
+ water.h
+ water_cmd.cpp
+ water_map.h
+ waypoint.cpp
+ waypoint_base.h
+ waypoint_cmd.cpp
+ waypoint_func.h
+ waypoint_gui.cpp
+ widget.cpp
+ widget_type.h
+ window.cpp
+ window_func.h
+ window_gui.h
+ window_type.h
+ zoom_func.h
+ zoom_type.h
+)
diff --git a/src/ai/CMakeLists.txt b/src/ai/CMakeLists.txt
new file mode 100644
index 000000000..cab886b26
--- /dev/null
+++ b/src/ai/CMakeLists.txt
@@ -0,0 +1,14 @@
+add_files(
+ ai.hpp
+ ai_config.cpp
+ ai_config.hpp
+ ai_core.cpp
+ ai_gui.cpp
+ ai_gui.hpp
+ ai_info.cpp
+ ai_info.hpp
+ ai_instance.cpp
+ ai_instance.hpp
+ ai_scanner.cpp
+ ai_scanner.hpp
+)
diff --git a/src/blitter/CMakeLists.txt b/src/blitter/CMakeLists.txt
new file mode 100644
index 000000000..2abe6aec0
--- /dev/null
+++ b/src/blitter/CMakeLists.txt
@@ -0,0 +1,55 @@
+add_files(
+ 32bpp_anim.cpp
+ 32bpp_anim.hpp
+ 32bpp_base.cpp
+ 32bpp_base.hpp
+ 32bpp_optimized.cpp
+ 32bpp_optimized.hpp
+ 32bpp_simple.cpp
+ 32bpp_simple.hpp
+ 8bpp_base.cpp
+ 8bpp_base.hpp
+ 8bpp_optimized.cpp
+ 8bpp_optimized.hpp
+ 8bpp_simple.cpp
+ 8bpp_simple.hpp
+ CONDITION NOT OPTION_DEDICATED
+)
+
+add_files(
+ 32bpp_anim_sse2.cpp
+ 32bpp_anim_sse2.hpp
+ 32bpp_anim_sse4.cpp
+ 32bpp_anim_sse4.hpp
+ 32bpp_sse2.cpp
+ 32bpp_sse2.hpp
+ 32bpp_sse4.cpp
+ 32bpp_sse4.hpp
+ 32bpp_sse_func.hpp
+ 32bpp_sse_type.h
+ 32bpp_ssse3.cpp
+ 32bpp_ssse3.hpp
+ CONDITION NOT OPTION_DEDICATED AND SSE_FOUND
+)
+
+if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
+ set_compile_flags(
+ 32bpp_anim_sse2.cpp
+ 32bpp_sse2.cpp
+ COMPILE_FLAGS -msse2)
+ set_compile_flags(
+ 32bpp_ssse3.cpp
+ COMPILE_FLAGS -mssse3)
+ set_compile_flags(
+ 32bpp_anim_sse4.cpp
+ 32bpp_sse4.cpp
+ COMPILE_FLAGS -msse4.1)
+endif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
+
+add_files(
+ base.hpp
+ common.hpp
+ factory.hpp
+ null.cpp
+ null.hpp
+)
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
new file mode 100644
index 000000000..96da08932
--- /dev/null
+++ b/src/core/CMakeLists.txt
@@ -0,0 +1,30 @@
+add_files(
+ alloc_func.cpp
+ alloc_func.hpp
+ alloc_type.hpp
+ backup_type.hpp
+ bitmath_func.cpp
+ bitmath_func.hpp
+ endian_func.hpp
+ endian_type.hpp
+ enum_type.hpp
+ geometry_func.cpp
+ geometry_func.hpp
+ geometry_type.hpp
+ kdtree.hpp
+ math_func.cpp
+ math_func.hpp
+ mem_func.hpp
+ multimap.hpp
+ overflowsafe_type.hpp
+ pool_func.cpp
+ pool_func.hpp
+ pool_type.hpp
+ random_func.cpp
+ random_func.hpp
+ smallmap_type.hpp
+ smallmatrix_type.hpp
+ smallstack_type.hpp
+ smallvec_type.hpp
+ string_compare_type.hpp
+)
diff --git a/src/core/endian_type.hpp b/src/core/endian_type.hpp
index 1b927ef45..e1add251e 100644
--- a/src/core/endian_type.hpp
+++ b/src/core/endian_type.hpp
@@ -23,30 +23,8 @@
/** Big endian builds use this for TTD_ENDIAN. */
#define TTD_BIG_ENDIAN 1
-/* Windows has always LITTLE_ENDIAN */
-#if defined(_WIN32) || defined(__OS2__) || defined(__HAIKU__)
-# define TTD_ENDIAN TTD_LITTLE_ENDIAN
-#elif defined(OSX)
-# include <sys/types.h>
-# if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
-# define TTD_ENDIAN TTD_LITTLE_ENDIAN
-# else
-# define TTD_ENDIAN TTD_BIG_ENDIAN
-# endif
-#elif defined(__OpenBSD__)
-# include <endian.h>
-# if BYTE_ORDER == LITTLE_ENDIAN
-# define TTD_ENDIAN TTD_LITTLE_ENDIAN
-# else
-# define TTD_ENDIAN TTD_BIG_ENDIAN
-# endif
-#elif !defined(TESTING)
-# include <sys/param.h>
-# if __BYTE_ORDER == __LITTLE_ENDIAN
-# define TTD_ENDIAN TTD_LITTLE_ENDIAN
-# else
-# define TTD_ENDIAN TTD_BIG_ENDIAN
-# endif
-#endif /* _WIN32 || __OS2__ */
+#if !defined(TTD_ENDIAN)
+# error "TTD_ENDIAN is not defined; please set it to either TTD_LITTLE_ENDIAN or TTD_BIG_ENDIAN"
+#endif /* !TTD_ENDIAN */
#endif /* ENDIAN_TYPE_HPP */
diff --git a/src/depend/depend.cpp b/src/depend/depend.cpp
deleted file mode 100644
index 5a3bd868d..000000000
--- a/src/depend/depend.cpp
+++ /dev/null
@@ -1,1084 +0,0 @@
-/*
- * This file is part of OpenTTD.
- * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
- * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * @file depend/depend.cpp Custom implementation of Makedepend.
- *
- * We previously used makedepend, but that could not handle the amount of
- * files we have and does not handle conditional includes in a sane manner.
- * This caused many link problems because not enough files were recompiled.
- * This has lead to the development of our own dependency generator. It is
- * meant to be a substitute to the (relatively slow) dependency generation
- * via gcc. It thus helps speeding up compilation. It will also ignore
- * system headers making it less error prone when system headers are moved
- * or renamed.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <limits.h>
-#include <unistd.h>
-#include <map>
-#include <set>
-#include <stack>
-#include <cassert>
-
-/**
- * Return the length of an fixed size array.
- * Unlike sizeof this function returns the number of elements
- * of the given type.
- *
- * @param x The pointer to the first element of the array
- * @return The number of elements
- */
-#define lengthof(x) (sizeof(x) / sizeof(x[0]))
-
-/**
- * Get the last element of an fixed size array.
- *
- * @param x The pointer to the first element of the array
- * @return The pointer to the last element of the array
- */
-#define lastof(x) (&x[lengthof(x) - 1])
-
-/**
- * Copies characters from one buffer to another.
- *
- * Copies the source string to the destination buffer with respect of the
- * terminating null-character and the last pointer to the last element in
- * the destination buffer. If the last pointer is set to nullptr no boundary
- * check is performed.
- *
- * @note usage: strecpy(dst, src, lastof(dst));
- * @note lastof() applies only to fixed size arrays
- *
- * @param dst The destination buffer
- * @param src The buffer containing the string to copy
- * @param last The pointer to the last element of the destination buffer
- * @return The pointer to the terminating null-character in the destination buffer
- */
-char *strecpy(char *dst, const char *src, const char *last)
-{
- assert(dst <= last);
- while (dst != last && *src != '\0') {
- *dst++ = *src++;
- }
- *dst = '\0';
-
- if (dst == last && *src != '\0') {
- fprintf(stderr, "String too long for destination buffer\n");
- exit(-3);
- }
- return dst;
-}
-
-/**
- * Appends characters from one string to another.
- *
- * Appends the source string to the destination string with respect of the
- * terminating null-character and and the last pointer to the last element
- * in the destination buffer. If the last pointer is set to nullptr no
- * boundary check is performed.
- *
- * @note usage: strecat(dst, src, lastof(dst));
- * @note lastof() applies only to fixed size arrays
- *
- * @param dst The buffer containing the target string
- * @param src The buffer containing the string to append
- * @param last The pointer to the last element of the destination buffer
- * @return The pointer to the terminating null-character in the destination buffer
- */
-static char *strecat(char *dst, const char *src, const char *last)
-{
- assert(dst <= last);
- while (*dst != '\0') {
- if (dst == last) return dst;
- dst++;
- }
-
- return strecpy(dst, src, last);
-}
-
-#if defined(__CYGWIN__)
-/**
- * Version of strdup copied from glibc.
- * Duplicate S, returning an identical malloc'd string.
- * @param s The string to duplicate.
- */
-char *
-strdup (const char *s)
-{
- size_t len = strlen(s) + 1;
- void *n = malloc(len);
-
- if (n == NULL) return NULL;
- return (char *) memcpy(n, s, len);
-}
-#endif
-
-/**
- * Version of the standard free that accepts const pointers.
- * @param ptr The data to free.
- */
-static inline void free(const void *ptr)
-{
- free(const_cast<void *>(ptr));
-}
-
-#ifndef PATH_MAX
-/** The maximum length of paths, if we don't know it. */
-# define PATH_MAX 260
-#endif
-
-/** Simple string comparator using strcmp as implementation */
-struct StringCompare {
- /**
- * Compare a to b using strcmp.
- * @param a string to compare.
- * @param b string to compare.
- * @return whether a is less than b.
- */
- bool operator () (const char *a, const char *b) const
- {
- return strcmp(a, b) < 0;
- }
-};
-/** Set of C-style strings. */
-typedef std::set<const char*, StringCompare> StringSet;
-/** Mapping of C-style string to a set of C-style strings. */
-typedef std::map<const char*, StringSet*, StringCompare> StringMap;
-/** Pair of C-style string and a set of C-style strings. */
-typedef std::pair<const char*, StringSet*> StringMapItem;
-
-/** Include directory to search in. */
-static StringSet _include_dirs;
-/** Files that have been parsed/handled with their dependencies. */
-static StringMap _files;
-/** Dependencies of headers. */
-static StringMap _headers;
-/** The current 'active' defines. */
-static StringSet _defines;
-
-/**
- * Helper class to read a file.
- */
-class File {
-public:
- /**
- * Create the helper by opening the given file.
- * @param filename the file to open
- * @post the file is open; otherwise the application is killed.
- */
- File(const char *filename)
- {
- this->fp = fopen(filename, "r");
- if (this->fp == nullptr) {
- fprintf(stdout, "Could not open %s for reading\n", filename);
- exit(1);
- }
- this->dirname = strdup(filename);
- char *last = strrchr(this->dirname, '/');
- if (last != nullptr) {
- *last = '\0';
- } else {
- *this->dirname = '\0';
- }
- }
-
- /** Free everything we have allocated. */
- ~File()
- {
- fclose(this->fp);
- free(this->dirname);
- }
-
- /**
- * Get a single character from the file.
- * If we are reading beyond the end of the file '\0' is returned.
- * @return the read character.
- */
- char GetChar() const
- {
- int c = fgetc(this->fp);
- return (c == EOF) ? '\0' : c;
- }
-
- /**
- * Get the directory name of the file.
- * @return the directory name.
- */
- const char *GetDirname() const
- {
- return this->dirname;
- }
-
-private:
- FILE *fp; ///< The currently opened file.
- char *dirname; ///< The directory of the file.
-};
-
-/** A token returned by the tokenizer. */
-enum Token {
- TOKEN_UNKNOWN, ///< Unknown token
- TOKEN_END, ///< End of document
- TOKEN_EOL, ///< End of line
- TOKEN_SHARP, ///< # character, usually telling something important comes.
- TOKEN_LOCAL, ///< Read a local include
- TOKEN_GLOBAL, ///< Read a global include
- TOKEN_IDENTIFIER, ///< Identifier within the data.
- TOKEN_DEFINE, ///< \c \#define in code
- TOKEN_IF, ///< \c \#if in code
- TOKEN_IFDEF, ///< \c \#ifdef in code
- TOKEN_IFNDEF, ///< \c \#ifndef in code
- TOKEN_ELIF, ///< \c \#elif in code
- TOKEN_ELSE, ///< \c \#else in code
- TOKEN_ENDIF, ///< \c \#endif in code
- TOKEN_UNDEF, ///< \c \#undef in code
- TOKEN_OR, ///< '||' within \c \#if expression
- TOKEN_AND, ///< '&&' within \c \#if expression
- TOKEN_DEFINED, ///< 'defined' within \c \#if expression
- TOKEN_OPEN, ///< '(' within \c \#if expression
- TOKEN_CLOSE, ///< ')' within \c \#if expression
- TOKEN_NOT, ///< '!' within \c \#if expression
- TOKEN_ZERO, ///< '0' within \c \#if expression
- TOKEN_INCLUDE, ///< \c \#include in code
-};
-
-/** Mapping from a C-style keyword representation to a Token. */
-typedef std::map<const char*, Token, StringCompare> KeywordList;
-
-/**
- * Lexer of a file.
- */
-class Lexer {
-public:
- /**
- * Create the lexer and fill the keywords table.
- * @param file the file to read from.
- */
- Lexer(const File *file) : file(file), current_char('\0'), string(nullptr), token(TOKEN_UNKNOWN)
- {
- this->keywords["define"] = TOKEN_DEFINE;
- this->keywords["defined"] = TOKEN_DEFINED;
- this->keywords["if"] = TOKEN_IF;
- this->keywords["ifdef"] = TOKEN_IFDEF;
- this->keywords["ifndef"] = TOKEN_IFNDEF;
- this->keywords["include"] = TOKEN_INCLUDE;
- this->keywords["elif"] = TOKEN_ELIF;
- this->keywords["else"] = TOKEN_ELSE;
- this->keywords["endif"] = TOKEN_ENDIF;
- this->keywords["undef"] = TOKEN_UNDEF;
-
- /* Initialise currently read character. */
- this->Next();
-
- /* Allocate the buffer. */
- this->buf_len = 32;
- this->buf = (char*)malloc(sizeof(*this->buf) * this->buf_len);
- }
-
- /** Free everything */
- ~Lexer()
- {
- free(this->buf);
- }
-
- /**
- * Read the next character into 'current_char'.
- */
- void Next()
- {
- this->current_char = this->file->GetChar();
- }
-
- /**
- * Get the current token.
- * @return the token.
- */
- Token GetToken() const
- {
- return this->token;
- }
-
- /**
- * Read the currently processed string.
- * @return the string, can be nullptr.
- */
- const char *GetString() const
- {
- return this->string;
- }
-
- /**
- * Perform the lexing/tokenizing of the file till we can return something
- * that must be parsed.
- */
- void Lex()
- {
- for (;;) {
- free(this->string);
- this->string = nullptr;
- this->token = TOKEN_UNKNOWN;
-
- switch (this->current_char) {
- /* '\0' means End-Of-File */
- case '\0': this->token = TOKEN_END; return;
-
- /* Skip some chars, as they don't do anything */
- case '\t': this->Next(); break;
- case '\r': this->Next(); break;
- case ' ': this->Next(); break;
-
- case '\\':
- this->Next();
- if (this->current_char == '\n') this->Next();
- break;
-
- case '\n':
- this->token = TOKEN_EOL;
- this->Next();
- return;
-
- case '#':
- this->token = TOKEN_SHARP;
- this->Next();
- return;
-
- case '"':
- this->ReadString('"', TOKEN_LOCAL);
- this->Next();
- return;
-
- case '<':
- this->ReadString('>', TOKEN_GLOBAL);
- this->Next();
- return;
-
- case '&':
- this->Next();
- if (this->current_char == '&') {
- this->Next();
- this->token = TOKEN_AND;
- return;
- }
- break;
-
- case '|':
- this->Next();
- if (this->current_char == '|') {
- this->Next();
- this->token = TOKEN_OR;
- return;
- }
- break;
-
- case '(':
- this->Next();
- this->token = TOKEN_OPEN;
- return;
-
- case ')':
- this->Next();
- this->token = TOKEN_CLOSE;
- return;
-
- case '!':
- this->Next();
- if (this->current_char != '=') {
- this->token = TOKEN_NOT;
- return;
- }
- break;
-
- /* Possible begin of comment */
- case '/':
- this->Next();
- switch (this->current_char) {
- case '*': {
- this->Next();
- char previous_char = '\0';
- while ((this->current_char != '/' || previous_char != '*') && this->current_char != '\0') {
- previous_char = this->current_char;
- this->Next();
- }
- this->Next();
- break;
- }
- case '/': while (this->current_char != '\n' && this->current_char != '\0') this->Next(); break;
- default: break;
- }
- break;
-
- default:
- if (isalpha(this->current_char) || this->current_char == '_') {
- /* If the name starts with a letter, it is an identifier */
- this->ReadIdentifier();
- return;
- }
- if (isdigit(this->current_char)) {
- bool zero = this->current_char == '0';
- this->Next();
- if (this->current_char == 'x' || this->current_char == 'X') Next();
- while (isdigit(this->current_char) || this->current_char == '.' || (this->current_char >= 'a' && this->current_char <= 'f') || (this->current_char >= 'A' && this->current_char <= 'F')) {
- zero &= this->current_char == '0';
- this->Next();
- }
- if (zero) this->token = TOKEN_ZERO;
- return;
- }
- this->Next();
- break;
- }
- }
- }
-
-private:
- /**
- * The token based on keyword with a given name.
- * @param name the actual keyword.
- * @return the token of the keyword.
- */
- Token FindKeyword(const char *name) const
- {
- KeywordList::const_iterator it = this->keywords.find(name);
- if (it == this->keywords.end()) return TOKEN_IDENTIFIER;
- return (*it).second;
- }
-
- /**
- * Read an identifier.
- */
- void ReadIdentifier()
- {
- size_t count = 0;
-
- /* Read the rest of the identifier */
- do {
- this->buf[count++] = this->current_char;
- this->Next();
-
- if (count >= buf_len) {
- /* Scale the buffer if required */
- this->buf_len *= 2;
- this->buf = (char *)realloc(this->buf, sizeof(*this->buf) * this->buf_len);
- }
- } while ((isalpha(this->current_char) || this->current_char == '_' || isdigit(this->current_char)));
- this->buf[count] = '\0';
-
- free(this->string);
- this->string = strdup(this->buf);
- this->token = FindKeyword(this->string);
- }
-
- /**
- * Read a string up to a given character, then set the given token.
- * @param end the 'marker' for the end of the string.
- * @param token the token to set after returning.
- */
- void ReadString(char end, Token token)
- {
- size_t count = 0;
- this->Next();
- while (this->current_char != end && this->current_char != ')' && this->current_char != '\n' && this->current_char != '\0') {
- this->buf[count++] = this->current_char;
- this->Next();
-
- if (count >= this->buf_len) {
- /* Scale the buffer if required */
- this->buf_len *= 2;
- this->buf = (char *)realloc(this->buf, sizeof(*this->buf) * this->buf_len);
- }
- }
- this->buf[count] = '\0';
- free(this->string);
- this->string = strdup(this->buf);
- this->token = token;
- }
-
- const File *file; ///< The file to read from.
- char current_char; ///< The current character to process.
- char *string; ///< Currently processed string.
- Token token; ///< The current token to process.
- char *buf; ///< Temporary buffer.
- size_t buf_len; ///< Length of the temporary buffer.
- KeywordList keywords; ///< All keywords we know of.
-};
-
-/**
- * Generate a path from a directory name and a relative filename.
- * If the file is not local the include directory names will be used instead
- * of the passed parameter with directory name. If the file is local both will
- * be queried where the parameter takes precedence.
- * @param dirname the directory to look in.
- * @param filename the file to look for.
- * @param local whether to look locally (in dirname) for the file.
- * @return the absolute path, or nullptr if the file doesn't exist.
- */
-const char *GeneratePath(const char *dirname, const char *filename, bool local)
-{
- /* Ignore C++ standard library headers. */
- if (strchr(filename, '.') == nullptr) return nullptr;
-
- if (local) {
- if (access(filename, R_OK) == 0) return strdup(filename);
-
- char path[PATH_MAX];
- strecpy(path, dirname, lastof(path));
- const char *p = filename;
- /* Remove '..' from the begin of the filename. */
- while (*p == '.') {
- if (*(++p) == '.') {
- char *s = strrchr(path, '/');
- if (s != nullptr) *s = '\0';
- p += 2;
- }
- }
- strecat(path, "/", lastof(path));
- strecat(path, p, lastof(path));
-
- if (access(path, R_OK) == 0) return strdup(path);
- }
-
- for (StringSet::iterator it = _include_dirs.begin(); it != _include_dirs.end(); it++) {
- char path[PATH_MAX];
- strecpy(path, *it, lastof(path));
- const char *p = filename;
- /* Remove '..' from the begin of the filename. */
- while (*p == '.') {
- if (*(++p) == '.') {
- char *s = strrchr(path, '/');
- if (s != nullptr) *s = '\0';
- p += 2;
- }
- }
- strecat(path, "/", lastof(path));
- strecat(path, p, lastof(path));
-
- if (access(path, R_OK) == 0) return strdup(path);
- }
-
- return nullptr;
-}
-
-/**
- * Try to parse a 'defined(expr)' expression.
- * @param lexer the lexer to get tokens from.
- * @param defines the set of known defines.
- * @param verbose whether to give verbose debugging information.
- * @return the value of the expression.
- */
-bool ExpressionDefined(Lexer *lexer, StringSet *defines, bool verbose);
-
-/**
- * Try to parse a 'expr || expr' expression.
- * @param lexer the lexer to get tokens from.
- * @param defines the set of known defines.
- * @param verbose whether to give verbose debugging information.
- * @return the value of the expression.
- */
-bool ExpressionOr(Lexer *lexer, StringSet *defines, bool verbose);
-
-/**
- * Try to parse a '!expr' expression. Also parses the '(expr)', '0' and
- * identifiers. Finally it also consumes any unknown tokens.
- * @param lexer the lexer to get tokens from.
- * @param defines the set of known defines.
- * @param verbose whether to give verbose debugging information.
- * @return the value of the expression.
- */
-bool ExpressionNot(Lexer *lexer, StringSet *defines, bool verbose)
-{
- if (lexer->GetToken() == TOKEN_NOT) {
- if (verbose) fprintf(stderr, "!");
- lexer->Lex();
- bool value = !ExpressionDefined(lexer, defines, verbose);
- if (verbose) fprintf(stderr, "[%d]", value);
- return value;
- }
-
- if (lexer->GetToken() == TOKEN_OPEN) {
- if (verbose) fprintf(stderr, "(");
- lexer->Lex();
- bool value = ExpressionOr(lexer, defines, verbose);
- if (verbose) fprintf(stderr, ")[%d]", value);
- lexer->Lex();
- return value;
- }
-
- if (lexer->GetToken() == TOKEN_ZERO) {
- if (verbose) fprintf(stderr, "0");
- lexer->Lex();
- if (verbose) fprintf(stderr, "[0]");
- return false;
- }
-
- bool first = true;
- while (lexer->GetToken() == TOKEN_UNKNOWN || lexer->GetToken() == TOKEN_IDENTIFIER) {
- if (verbose && first) fprintf(stderr, "<assumed true>");
- first = false;
- lexer->Lex();
- }
-
- return true;
-}
-
-/**
- * Try to parse a 'defined(expr)' expression.
- * @param lexer the lexer to get tokens from.
- * @param defines the set of known defines.
- * @param verbose whether to give verbose debugging information.
- * @return the value of the expression.
- */
-bool ExpressionDefined(Lexer *lexer, StringSet *defines, bool verbose)
-{
- bool value = ExpressionNot(lexer, defines, verbose);
-
- if (lexer->GetToken() != TOKEN_DEFINED) return value;
- lexer->Lex();
- if (verbose) fprintf(stderr, "defined");
- bool open = (lexer->GetToken() == TOKEN_OPEN);
- if (open) lexer->Lex();
- if (verbose) fprintf(stderr, open ? "(" : " ");
- if (lexer->GetToken() == TOKEN_IDENTIFIER) {
- if (verbose) fprintf(stderr, "%s", lexer->GetString());
- value = defines->find(lexer->GetString()) != defines->end();
- }
- if (open) {
- if (verbose) fprintf(stderr, ")");
- lexer->Lex();
- }
- lexer->Lex();
- if (verbose) fprintf(stderr, "[%d]", value);
- return value;
-}
-
-/**
- * Try to parse a 'expr && expr' expression.
- * @param lexer the lexer to get tokens from.
- * @param defines the set of known defines.
- * @param verbose whether to give verbose debugging information.
- * @return the value of the expression.
- */
-bool ExpressionAnd(Lexer *lexer, StringSet *defines, bool verbose)
-{
- bool value = ExpressionDefined(lexer, defines, verbose);
-
- for (;;) {
- if (lexer->GetToken() != TOKEN_AND) return value;
- if (verbose) fprintf(stderr, " && ");
- lexer->Lex();
- value = value && ExpressionDefined(lexer, defines, verbose);
- }
-}
-
-/**
- * Try to parse a 'expr || expr' expression.
- * @param lexer the lexer to get tokens from.
- * @param defines the set of known defines.
- * @param verbose whether to give verbose debugging information.
- * @return the value of the expression.
- */
-bool ExpressionOr(Lexer *lexer, StringSet *defines, bool verbose)
-{
- bool value = ExpressionAnd(lexer, defines, verbose);
-
- for (;;) {
- if (lexer->GetToken() != TOKEN_OR) return value;
- if (verbose) fprintf(stderr, " || ");
- lexer->Lex();
- value = value || ExpressionAnd(lexer, defines, verbose);
- }
-}
-
-/** Enumerator to tell how long to ignore 'stuff'. */
-enum Ignore {
- NOT_IGNORE, ///< No ignoring.
- IGNORE_UNTIL_ELSE, ///< Ignore till a \c \#else is reached.
- IGNORE_UNTIL_ENDIF, ///< Ignore till a \c \#endif is reached.
-};
-
-/**
- * Scan a file for includes, defines and the lot.
- * @param filename the name of the file to scan.
- * @param ext the extension of the filename.
- * @param header whether the file is a header or not.
- * @param verbose whether to give verbose debugging information.
- */
-void ScanFile(const char *filename, const char *ext, bool header, bool verbose)
-{
- static StringSet defines;
- static std::stack<Ignore> ignore;
- /* Copy in the default defines (parameters of depend) */
- if (!header) {
- for (StringSet::iterator it = _defines.begin(); it != _defines.end(); it++) {
- defines.insert(strdup(*it));
- }
- }
-
- File file(filename);
- Lexer lexer(&file);
-
- /* Start the lexing! */
- lexer.Lex();
-
- while (lexer.GetToken() != TOKEN_END) {
- switch (lexer.GetToken()) {
- /* We reached the end of the file... yay, we're done! */
- case TOKEN_END: break;
-
- /* The line started with a # (minus whitespace) */
- case TOKEN_SHARP:
- lexer.Lex();
- switch (lexer.GetToken()) {
- case TOKEN_INCLUDE:
- if (verbose) fprintf(stderr, "%s #include ", filename);
- lexer.Lex();
- switch (lexer.GetToken()) {
- case TOKEN_LOCAL:
- case TOKEN_GLOBAL: {
- if (verbose) fprintf(stderr, "%s", lexer.GetString());
- if (!ignore.empty() && ignore.top() != NOT_IGNORE) {
- if (verbose) fprintf(stderr, " (ignored)");
- break;
- }
- const char *h = GeneratePath(file.GetDirname(), lexer.GetString(), lexer.GetToken() == TOKEN_LOCAL);
- if (h != nullptr) {
- StringMap::iterator it = _headers.find(h);
- if (it == _headers.end()) {
- it = (_headers.insert(StringMapItem(strdup(h), new StringSet()))).first;
- if (verbose) fprintf(stderr, "\n");
- ScanFile(h, ext, true, verbose);
- }
- StringMap::iterator curfile;
- if (header) {
- curfile = _headers.find(filename);
- } else {
- /* Replace the extension with the provided extension of '.o'. */
- char path[PATH_MAX];
- strecpy(path, filename, lastof(path));
- *(strrchr(path, '.')) = '\0';
- strecat(path, ext != nullptr ? ext : ".o", lastof(path));
- curfile = _files.find(path);
- if (curfile == _files.end()) {
- curfile = (_files.insert(StringMapItem(strdup(path), new StringSet()))).first;
- }
- }
- if (it != _headers.end()) {
- for (StringSet::iterator header = it->second->begin(); header != it->second->end(); header++) {
- if (curfile->second->find(*header) == curfile->second->end()) curfile->second->insert(strdup(*header));
- }
- }
- if (curfile->second->find(h) == curfile->second->end()) curfile->second->insert(strdup(h));
- free(h);
- }
- }
- /* FALL THROUGH */
- default: break;
- }
- break;
-
- case TOKEN_DEFINE:
- if (verbose) fprintf(stderr, "%s #define ", filename);
- lexer.Lex();
- if (lexer.GetToken() == TOKEN_IDENTIFIER) {
- if (verbose) fprintf(stderr, "%s", lexer.GetString());
- if (!ignore.empty() && ignore.top() != NOT_IGNORE) {
- if (verbose) fprintf(stderr, " (ignored)");
- break;
- }
- if (defines.find(lexer.GetString()) == defines.end()) defines.insert(strdup(lexer.GetString()));
- lexer.Lex();
- }
- break;
-
- case TOKEN_UNDEF:
- if (verbose) fprintf(stderr, "%s #undef ", filename);
- lexer.Lex();
- if (lexer.GetToken() == TOKEN_IDENTIFIER) {
- if (verbose) fprintf(stderr, "%s", lexer.GetString());
- if (!ignore.empty() && ignore.top() != NOT_IGNORE) {
- if (verbose) fprintf(stderr, " (ignored)");
- break;
- }
- StringSet::iterator it = defines.find(lexer.GetString());
- if (it != defines.end()) {
- free(*it);
- defines.erase(it);
- }
- lexer.Lex();
- }
- break;
-
- case TOKEN_ENDIF:
- if (verbose) fprintf(stderr, "%s #endif", filename);
- lexer.Lex();
- if (!ignore.empty()) ignore.pop();
- if (verbose) fprintf(stderr, " -> %signore", (!ignore.empty() && ignore.top() != NOT_IGNORE) ? "" : "not ");
- break;
-
- case TOKEN_ELSE: {
- if (verbose) fprintf(stderr, "%s #else", filename);
- lexer.Lex();
- Ignore last = ignore.empty() ? NOT_IGNORE : ignore.top();
- if (!ignore.empty()) ignore.pop();
- if (ignore.empty() || ignore.top() == NOT_IGNORE) {
- ignore.push(last == IGNORE_UNTIL_ELSE ? NOT_IGNORE : IGNORE_UNTIL_ENDIF);
- } else {
- ignore.push(IGNORE_UNTIL_ENDIF);
- }
- if (verbose) fprintf(stderr, " -> %signore", (!ignore.empty() && ignore.top() != NOT_IGNORE) ? "" : "not ");
- break;
- }
-
- case TOKEN_ELIF: {
- if (verbose) fprintf(stderr, "%s #elif ", filename);
- lexer.Lex();
- Ignore last = ignore.empty() ? NOT_IGNORE : ignore.top();
- if (!ignore.empty()) ignore.pop();
- if (ignore.empty() || ignore.top() == NOT_IGNORE) {
- bool value = ExpressionOr(&lexer, &defines, verbose);
- ignore.push(last == IGNORE_UNTIL_ELSE ? (value ? NOT_IGNORE : IGNORE_UNTIL_ELSE) : IGNORE_UNTIL_ENDIF);
- } else {
- ignore.push(IGNORE_UNTIL_ENDIF);
- }
- if (verbose) fprintf(stderr, " -> %signore", (!ignore.empty() && ignore.top() != NOT_IGNORE) ? "" : "not ");
- break;
- }
-
- case TOKEN_IF: {
- if (verbose) fprintf(stderr, "%s #if ", filename);
- lexer.Lex();
- if (ignore.empty() || ignore.top() == NOT_IGNORE) {
- bool value = ExpressionOr(&lexer, &defines, verbose);
- ignore.push(value ? NOT_IGNORE : IGNORE_UNTIL_ELSE);
- } else {
- ignore.push(IGNORE_UNTIL_ENDIF);
- }
- if (verbose) fprintf(stderr, " -> %signore", (!ignore.empty() && ignore.top() != NOT_IGNORE) ? "" : "not ");
- break;
- }
-
- case TOKEN_IFDEF:
- if (verbose) fprintf(stderr, "%s #ifdef ", filename);
- lexer.Lex();
- if (lexer.GetToken() == TOKEN_IDENTIFIER) {
- bool value = defines.find(lexer.GetString()) != defines.end();
- if (verbose) fprintf(stderr, "%s[%d]", lexer.GetString(), value);
- if (ignore.empty() || ignore.top() == NOT_IGNORE) {
- ignore.push(value ? NOT_IGNORE : IGNORE_UNTIL_ELSE);
- } else {
- ignore.push(IGNORE_UNTIL_ENDIF);
- }
- }
- if (verbose) fprintf(stderr, " -> %signore", (!ignore.empty() && ignore.top() != NOT_IGNORE) ? "" : "not ");
- break;
-
- case TOKEN_IFNDEF:
- if (verbose) fprintf(stderr, "%s #ifndef ", filename);
- lexer.Lex();
- if (lexer.GetToken() == TOKEN_IDENTIFIER) {
- bool value = defines.find(lexer.GetString()) != defines.end();
- if (verbose) fprintf(stderr, "%s[%d]", lexer.GetString(), value);
- if (ignore.empty() || ignore.top() == NOT_IGNORE) {
- ignore.push(!value ? NOT_IGNORE : IGNORE_UNTIL_ELSE);
- } else {
- ignore.push(IGNORE_UNTIL_ENDIF);
- }
- }
- if (verbose) fprintf(stderr, " -> %signore", (!ignore.empty() && ignore.top() != NOT_IGNORE) ? "" : "not ");
- break;
-
- default:
- if (verbose) fprintf(stderr, "%s #<unknown>", filename);
- lexer.Lex();
- break;
- }
- if (verbose) fprintf(stderr, "\n");
- /* FALL THROUGH */
- default:
- /* Ignore the rest of the garbage on this line */
- while (lexer.GetToken() != TOKEN_EOL && lexer.GetToken() != TOKEN_END) lexer.Lex();
- lexer.Lex();
- break;
- }
- }
-
- if (!header) {
- for (StringSet::iterator it = defines.begin(); it != defines.end(); it++) {
- free(*it);
- }
- defines.clear();
- while (!ignore.empty()) ignore.pop();
- }
-}
-
-/**
- * Entry point. Arguably the most common function in all applications.
- * @param argc the number of arguments.
- * @param argv the actual arguments.
- * @return return value for the caller to tell we succeed or not.
- */
-int main(int argc, char *argv[])
-{
- bool ignorenext = true;
- char *filename = nullptr;
- char *ext = nullptr;
- char *delimiter = nullptr;
- bool append = false;
- bool verbose = false;
-
- for (int i = 0; i < argc; i++) {
- if (ignorenext) {
- ignorenext = false;
- continue;
- }
- if (argv[i][0] == '-') {
- /* Append */
- if (strncmp(argv[i], "-a", 2) == 0) append = true;
- /* Include dir */
- if (strncmp(argv[i], "-I", 2) == 0) {
- if (argv[i][2] == '\0') {
- i++;
- _include_dirs.insert(strdup(argv[i]));
- } else {
- _include_dirs.insert(strdup(&argv[i][2]));
- }
- continue;
- }
- /* Define */
- if (strncmp(argv[i], "-D", 2) == 0) {
- char *p = strchr(argv[i], '=');
- if (p != nullptr) *p = '\0';
- _defines.insert(strdup(&argv[i][2]));
- continue;
- }
- /* Output file */
- if (strncmp(argv[i], "-f", 2) == 0) {
- if (filename != nullptr) continue;
- filename = strdup(&argv[i][2]);
- continue;
- }
- /* Object file extension */
- if (strncmp(argv[i], "-o", 2) == 0) {
- if (ext != nullptr) continue;
- ext = strdup(&argv[i][2]);
- continue;
- }
- /* Starting string delimiter */
- if (strncmp(argv[i], "-s", 2) == 0) {
- if (delimiter != nullptr) continue;
- delimiter = strdup(&argv[i][2]);
- continue;
- }
- /* Verbose */
- if (strncmp(argv[i], "-v", 2) == 0) verbose = true;
- continue;
- }
- ScanFile(argv[i], ext, false, verbose);
- }
-
- /* Default output file is Makefile */
- if (filename == nullptr) filename = strdup("Makefile");
-
- /* Default delimiter string */
- if (delimiter == nullptr) delimiter = strdup("# DO NOT DELETE");
-
- char backup[PATH_MAX];
- strecpy(backup, filename, lastof(backup));
- strecat(backup, ".bak", lastof(backup));
-
- char *content = nullptr;
- long size = 0;
-
- /* Read in the current file; so we can overwrite everything from the
- * end of non-depend data marker down till the end. */
- FILE *src = fopen(filename, "rb");
- if (src != nullptr) {
- fseek(src, 0, SEEK_END);
- if ((size = ftell(src)) < 0) {
- fprintf(stderr, "Could not read %s\n", filename);
- exit(-2);
- }
- rewind(src);
- content = (char*)malloc(size * sizeof(*content));
- if (fread(content, 1, size, src) != (size_t)size) {
- fprintf(stderr, "Could not read %s\n", filename);
- exit(-2);
- }
- fclose(src);
- }
-
- FILE *dst = fopen(filename, "w");
- bool found_delimiter = false;
-
- if (size != 0) {
- src = fopen(backup, "wb");
- if (fwrite(content, 1, size, src) != (size_t)size) {
- fprintf(stderr, "Could not write %s\n", filename);
- exit(-2);
- }
- fclose(src);
-
- /* Then append it to the real file. */
- src = fopen(backup, "r");
- while (fgets(content, size, src) != nullptr) {
- fputs(content, dst);
- if (!strncmp(content, delimiter, strlen(delimiter))) found_delimiter = true;
- if (!append && found_delimiter) break;
- }
- fclose(src);
- }
- if (!found_delimiter) fprintf(dst, "\n%s\n", delimiter);
-
- for (StringMap::iterator it = _files.begin(); it != _files.end(); it++) {
- for (StringSet::iterator h = it->second->begin(); h != it->second->end(); h++) {
- fprintf(dst, "%s: %s\n", it->first, *h);
- }
- }
-
- /* Clean up our mess. */
- fclose(dst);
-
- free(delimiter);
- free(filename);
- free(ext);
- free(content);
-
- for (StringMap::iterator it = _files.begin(); it != _files.end(); it++) {
- for (StringSet::iterator h = it->second->begin(); h != it->second->end(); h++) {
- free(*h);
- }
- it->second->clear();
- delete it->second;
- free(it->first);
- }
- _files.clear();
-
- for (StringMap::iterator it = _headers.begin(); it != _headers.end(); it++) {
- for (StringSet::iterator h = it->second->begin(); h != it->second->end(); h++) {
- free(*h);
- }
- it->second->clear();
- delete it->second;
- free(it->first);
- }
- _headers.clear();
-
- for (StringSet::iterator it = _defines.begin(); it != _defines.end(); it++) {
- free(*it);
- }
- _defines.clear();
-
- for (StringSet::iterator it = _include_dirs.begin(); it != _include_dirs.end(); it++) {
- free(*it);
- }
- _include_dirs.clear();
-
- return 0;
-}
diff --git a/src/game/CMakeLists.txt b/src/game/CMakeLists.txt
new file mode 100644
index 000000000..aafb5a7b8
--- /dev/null
+++ b/src/game/CMakeLists.txt
@@ -0,0 +1,14 @@
+add_files(
+ game.hpp
+ game_config.cpp
+ game_config.hpp
+ game_core.cpp
+ game_info.cpp
+ game_info.hpp
+ game_instance.cpp
+ game_instance.hpp
+ game_scanner.cpp
+ game_scanner.hpp
+ game_text.cpp
+ game_text.hpp
+)
diff --git a/src/lang/CMakeLists.txt b/src/lang/CMakeLists.txt
new file mode 100644
index 000000000..00b554126
--- /dev/null
+++ b/src/lang/CMakeLists.txt
@@ -0,0 +1,122 @@
+set(LANG_SOURCE_FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/afrikaans.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/arabic_egypt.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/basque.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/belarusian.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/brazilian_portuguese.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/bulgarian.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/catalan.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/croatian.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/czech.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/danish.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/dutch.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/english.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/english_AU.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/english_US.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/esperanto.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/estonian.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/faroese.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/finnish.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/french.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/gaelic.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/galician.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/german.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/greek.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/hebrew.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/hungarian.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/icelandic.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/indonesian.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/irish.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/italian.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/japanese.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/korean.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/latin.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/latvian.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/lithuanian.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/luxembourgish.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/malay.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/norwegian_bokmal.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/norwegian_nynorsk.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/polish.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/portuguese.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/romanian.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/russian.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/serbian.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/simplified_chinese.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/slovak.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/slovenian.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/spanish.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/spanish_MX.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/swedish.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/tamil.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/thai.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/traditional_chinese.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/turkish.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/ukrainian.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/vietnamese.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/welsh.txt
+)
+
+set(LANG_BINARY_DIR ${CMAKE_BINARY_DIR}/lang)
+
+# Walk over all the (finished) language files, and generate a command to compile them
+foreach(LANG_SOURCE_FILE IN LISTS LANG_SOURCE_FILES)
+ get_filename_component(LANG_SOURCE_FILE_NAME_WE ${LANG_SOURCE_FILE} NAME_WE)
+
+ set(LANG_BINARY_FILE ${LANG_BINARY_DIR}/${LANG_SOURCE_FILE_NAME_WE}.lng)
+
+ add_custom_command(OUTPUT ${LANG_BINARY_FILE}
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${LANG_BINARY_DIR}
+ COMMAND strgen
+ -s ${CMAKE_CURRENT_SOURCE_DIR}
+ -d ${LANG_BINARY_DIR}
+ ${LANG_SOURCE_FILE}
+ DEPENDS strgen
+ MAIN_DEPENDENCY ${LANG_SOURCE_FILE}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Compiling language ${LANG_SOURCE_FILE_NAME_WE}"
+ )
+
+ list(APPEND LANG_BINARY_FILES ${LANG_BINARY_FILE})
+endforeach(LANG_SOURCE_FILE)
+
+# Create a new target which compiles all language files
+add_custom_target(language_files
+ DEPENDS
+ ${LANG_BINARY_FILES}
+)
+set_target_properties(language_files
+ PROPERTIES LANG_SOURCE_FILES "${LANG_SOURCE_FILES}"
+)
+
+
+set(GENERATED_BINARY_DIR ${CMAKE_BINARY_DIR}/generated)
+set(TABLE_BINARY_DIR ${GENERATED_BINARY_DIR}/table)
+
+# Generate a command and target to create the strings table
+add_custom_command_timestamp(OUTPUT ${TABLE_BINARY_DIR}/strings.h
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${TABLE_BINARY_DIR}
+ COMMAND strgen
+ -s ${CMAKE_CURRENT_SOURCE_DIR}
+ -d ${TABLE_BINARY_DIR}
+ DEPENDS strgen ${LANG_SOURCE_FILES}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Generating table/strings.h"
+)
+add_custom_target_timestamp(table_strings
+ DEPENDS
+ ${TABLE_BINARY_DIR}/strings.h
+)
+
+add_library(languages
+ INTERFACE
+)
+target_include_directories(languages
+ INTERFACE
+ ${GENERATED_BINARY_DIR}
+)
+add_dependencies(languages
+ language_files
+ table_strings
+)
+add_library(openttd::languages ALIAS languages)
diff --git a/src/linkgraph/CMakeLists.txt b/src/linkgraph/CMakeLists.txt
new file mode 100644
index 000000000..c3d73a15e
--- /dev/null
+++ b/src/linkgraph/CMakeLists.txt
@@ -0,0 +1,22 @@
+add_files(
+ demands.cpp
+ demands.h
+ flowmapper.cpp
+ flowmapper.h
+ init.h
+ linkgraph.cpp
+ linkgraph.h
+ linkgraph_base.h
+ linkgraph_gui.cpp
+ linkgraph_gui.h
+ linkgraph_type.h
+ linkgraphjob.cpp
+ linkgraphjob.h
+ linkgraphjob_base.h
+ linkgraphschedule.cpp
+ linkgraphschedule.h
+ mcf.cpp
+ mcf.h
+ refresh.cpp
+ refresh.h
+)
diff --git a/src/misc/CMakeLists.txt b/src/misc/CMakeLists.txt
new file mode 100644
index 000000000..3a5363e7b
--- /dev/null
+++ b/src/misc/CMakeLists.txt
@@ -0,0 +1,14 @@
+add_files(
+ array.hpp
+ binaryheap.hpp
+ blob.hpp
+ countedobj.cpp
+ countedptr.hpp
+ dbg_helpers.cpp
+ dbg_helpers.h
+ fixedsizearray.hpp
+ getoptdata.cpp
+ getoptdata.h
+ hashtable.hpp
+ str.hpp
+)
diff --git a/src/music/CMakeLists.txt b/src/music/CMakeLists.txt
new file mode 100644
index 000000000..0ae15fde2
--- /dev/null
+++ b/src/music/CMakeLists.txt
@@ -0,0 +1,54 @@
+if (NOT OPTION_DEDICATED)
+ add_files(
+ allegro_m.cpp
+ allegro_m.h
+ CONDITION Allegro_FOUND
+ )
+
+ add_files(
+ fluidsynth.cpp
+ fluidsynth.h
+ CONDITION Fluidsynth_FOUND
+ )
+
+ add_files(
+ cocoa_m.cpp
+ cocoa_m.h
+ CONDITION APPLE
+ )
+
+ add_files(
+ dmusic.cpp
+ dmusic.h
+ win32_m.cpp
+ win32_m.h
+ CONDITION WIN32
+ )
+
+ add_files(
+ extmidi.cpp
+ extmidi.h
+ CONDITION UNIX
+ )
+
+ add_files(
+ bemidi.cpp
+ bemidi.h
+ CONDITION OPTION_HAIKU
+ )
+
+ add_files(
+ os2_m.cpp
+ os2_m.h
+ CONDITION OPTION_OS2
+ )
+endif (NOT OPTION_DEDICATED)
+
+add_files(
+ midi.h
+ midifile.cpp
+ midifile.hpp
+ music_driver.hpp
+ null_m.cpp
+ null_m.h
+)
diff --git a/src/network/CMakeLists.txt b/src/network/CMakeLists.txt
new file mode 100644
index 000000000..1c27d6206
--- /dev/null
+++ b/src/network/CMakeLists.txt
@@ -0,0 +1,28 @@
+add_subdirectory(core)
+
+add_files(
+ network.cpp
+ network.h
+ network_admin.cpp
+ network_admin.h
+ network_base.h
+ network_chat_gui.cpp
+ network_client.cpp
+ network_client.h
+ network_command.cpp
+ network_content.cpp
+ network_content.h
+ network_content_gui.cpp
+ network_content_gui.h
+ network_func.h
+ network_gamelist.cpp
+ network_gamelist.h
+ network_gui.cpp
+ network_gui.h
+ network_internal.h
+ network_server.cpp
+ network_server.h
+ network_type.h
+ network_udp.cpp
+ network_udp.h
+)
diff --git a/src/network/core/CMakeLists.txt b/src/network/core/CMakeLists.txt
new file mode 100644
index 000000000..777d15d84
--- /dev/null
+++ b/src/network/core/CMakeLists.txt
@@ -0,0 +1,27 @@
+add_files(
+ address.cpp
+ address.h
+ config.h
+ core.cpp
+ core.h
+ game.h
+ host.cpp
+ host.h
+ os_abstraction.h
+ packet.cpp
+ packet.h
+ tcp.cpp
+ tcp.h
+ tcp_admin.cpp
+ tcp_admin.h
+ tcp_connect.cpp
+ tcp_content.cpp
+ tcp_content.h
+ tcp_game.cpp
+ tcp_game.h
+ tcp_http.cpp
+ tcp_http.h
+ tcp_listen.h
+ udp.cpp
+ udp.h
+)
diff --git a/src/os/CMakeLists.txt b/src/os/CMakeLists.txt
new file mode 100644
index 000000000..e302c448b
--- /dev/null
+++ b/src/os/CMakeLists.txt
@@ -0,0 +1,4 @@
+add_subdirectory(macosx)
+add_subdirectory(os2)
+add_subdirectory(unix)
+add_subdirectory(windows)
diff --git a/src/os/macosx/CMakeLists.txt b/src/os/macosx/CMakeLists.txt
new file mode 100644
index 000000000..e6b6c237b
--- /dev/null
+++ b/src/os/macosx/CMakeLists.txt
@@ -0,0 +1,11 @@
+add_files(
+ crashlog_osx.cpp
+ macos.h
+ macos.mm
+ osx_stdafx.h
+ splash.cpp
+ splash.h
+ string_osx.cpp
+ string_osx.h
+ CONDITION APPLE
+)
diff --git a/src/os/os2/CMakeLists.txt b/src/os/os2/CMakeLists.txt
new file mode 100644
index 000000000..52534dbcb
--- /dev/null
+++ b/src/os/os2/CMakeLists.txt
@@ -0,0 +1,4 @@
+add_files(
+ os2.cpp
+ CONDITION OPTION_OS2
+)
diff --git a/src/os/unix/CMakeLists.txt b/src/os/unix/CMakeLists.txt
new file mode 100644
index 000000000..b548d3bb2
--- /dev/null
+++ b/src/os/unix/CMakeLists.txt
@@ -0,0 +1,9 @@
+add_files(
+ crashlog_unix.cpp
+ CONDITION UNIX AND NOT APPLE AND NOT OPTION_OS2
+)
+
+add_files(
+ unix.cpp
+ CONDITION UNIX AND NOT OPTION_OS2
+)
diff --git a/src/os/windows/CMakeLists.txt b/src/os/windows/CMakeLists.txt
new file mode 100644
index 000000000..19d1bd46e
--- /dev/null
+++ b/src/os/windows/CMakeLists.txt
@@ -0,0 +1,8 @@
+add_files(
+ crashlog_win.cpp
+ string_uniscribe.cpp
+ string_uniscribe.h
+ win32.cpp
+ win32.h
+ CONDITION WIN32
+)
diff --git a/src/os/windows/ottdres.rc.in b/src/os/windows/ottdres.rc.in
index a2f8c28f5..741fa0e10 100644
--- a/src/os/windows/ottdres.rc.in
+++ b/src/os/windows/ottdres.rc.in
@@ -37,7 +37,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
-100 ICON DISCARDABLE "../../../media/openttd.ico"
+100 ICON DISCARDABLE "${CMAKE_SOURCE_DIR}/os/windows/openttd.ico"
/////////////////////////////////////////////////////////////////////////////
//
@@ -77,8 +77,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,11,0,!!ISODATE!!
- PRODUCTVERSION 1,11,0,!!ISODATE!!
+ FILEVERSION 1,11,0,${REV_ISODATE}
+ PRODUCTVERSION 1,11,0,${REV_ISODATE}
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -96,14 +96,14 @@ BEGIN
VALUE "Comments", "This program is licensed under the GNU General Public License version 2.\0"
VALUE "CompanyName", "OpenTTD Development Team\0"
VALUE "FileDescription", "OpenTTD\0"
- VALUE "FileVersion", "!!VERSION!!\0"
+ VALUE "FileVersion", "${REV_VERSION}\0"
VALUE "InternalName", "openttd\0"
- VALUE "LegalCopyright", "Copyright \xA9 OpenTTD Developers 2002-!!YEAR!!. All Rights Reserved.\0"
+ VALUE "LegalCopyright", "Copyright \xA9 OpenTTD Developers 2002-${REV_YEAR}. All Rights Reserved.\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "openttd.exe\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "OpenTTD\0"
- VALUE "ProductVersion", "!!VERSION!!\0"
+ VALUE "ProductVersion", "${REV_VERSION}\0"
VALUE "SpecialBuild", "-\0"
END
END
@@ -116,7 +116,7 @@ END
#endif // !_MAC
#ifdef __MINGW32__
-1 24 "..\\..\\..\\projects\\dpi_aware.manifest"
+1 24 "${CMAKE_SOURCE_DIR}/os/windows/openttd.manifest"
#endif
#endif // Neutral (Default) resources
diff --git a/src/pathfinder/CMakeLists.txt b/src/pathfinder/CMakeLists.txt
new file mode 100644
index 000000000..2e275706f
--- /dev/null
+++ b/src/pathfinder/CMakeLists.txt
@@ -0,0 +1,9 @@
+add_subdirectory(npf)
+add_subdirectory(yapf)
+
+add_files(
+ follow_track.hpp
+ pathfinder_func.h
+ pathfinder_type.h
+ pf_performance_timer.hpp
+)
diff --git a/src/pathfinder/npf/CMakeLists.txt b/src/pathfinder/npf/CMakeLists.txt
new file mode 100644
index 000000000..e3ace57e5
--- /dev/null
+++ b/src/pathfinder/npf/CMakeLists.txt
@@ -0,0 +1,8 @@
+add_files(
+ aystar.cpp
+ aystar.h
+ npf.cpp
+ npf_func.h
+ queue.cpp
+ queue.h
+)
diff --git a/src/pathfinder/yapf/CMakeLists.txt b/src/pathfinder/yapf/CMakeLists.txt
new file mode 100644
index 000000000..170c1ad61
--- /dev/null
+++ b/src/pathfinder/yapf/CMakeLists.txt
@@ -0,0 +1,20 @@
+add_files(
+ nodelist.hpp
+ yapf.h
+ yapf.hpp
+ yapf_base.hpp
+ yapf_cache.h
+ yapf_common.hpp
+ yapf_costbase.hpp
+ yapf_costcache.hpp
+ yapf_costrail.hpp
+ yapf_destrail.hpp
+ yapf_node.hpp
+ yapf_node_rail.hpp
+ yapf_node_road.hpp
+ yapf_node_ship.hpp
+ yapf_rail.cpp
+ yapf_road.cpp
+ yapf_ship.cpp
+ yapf_type.hpp
+)
diff --git a/src/rev.cpp.in b/src/rev.cpp.in
index 3f5b126dc..16c403a67 100644
--- a/src/rev.cpp.in
+++ b/src/rev.cpp.in
@@ -35,7 +35,7 @@ bool IsReleasedVersion()
*
* <modified> shows a "M", if the binary is made from modified source code.
*/
-const char _openttd_revision[] = "!!VERSION!!";
+const char _openttd_revision[] = "${REV_VERSION}";
/**
* The text version of OpenTTD's build date.
@@ -48,12 +48,12 @@ const char _openttd_build_date[] = __DATE__ " " __TIME__;
/**
* The git revision hash of this version.
*/
-const char _openttd_revision_hash[] = "!!GITHASH!!";
+const char _openttd_revision_hash[] = "${REV_HASH}";
/**
* The year of this version.
*/
-const char _openttd_revision_year[] = "!!YEAR!!";
+const char _openttd_revision_year[] = "${REV_YEAR}";
/**
* Let us know if current build was modified. This detection
@@ -63,14 +63,14 @@ const char _openttd_revision_year[] = "!!YEAR!!";
* (compiling from sources without any version control software)
* and 2 is for modified revision.
*/
-const byte _openttd_revision_modified = !!MODIFIED!!;
+const byte _openttd_revision_modified = ${REV_MODIFIED};
/**
* Indicate whether this is a tagged version.
* If this is non-0, then _openttd_revision is the name of the tag,
* and the version is likely a beta, release candidate, or real release.
*/
-const byte _openttd_revision_tagged = !!ISTAG!!;
+const byte _openttd_revision_tagged = ${REV_ISTAG};
/**
* The NewGRF revision of OTTD:
@@ -85,4 +85,4 @@ const byte _openttd_revision_tagged = !!ISTAG!!;
* final release will always have a lower version number than the released
* version, thus making comparisons on specific revisions easy.
*/
-const uint32 _openttd_newgrf_version = 1 << 28 | 11 << 24 | 0 << 20 | !!ISSTABLETAG!! << 19 | 28004;
+const uint32 _openttd_newgrf_version = 1 << 28 | 11 << 24 | 0 << 20 | ${REV_ISSTABLETAG} << 19 | 28004;
diff --git a/src/saveload/CMakeLists.txt b/src/saveload/CMakeLists.txt
new file mode 100644
index 000000000..52f103fa7
--- /dev/null
+++ b/src/saveload/CMakeLists.txt
@@ -0,0 +1,43 @@
+add_files(
+ afterload.cpp
+ ai_sl.cpp
+ airport_sl.cpp
+ animated_tile_sl.cpp
+ autoreplace_sl.cpp
+ cargomonitor_sl.cpp
+ cargopacket_sl.cpp
+ cheat_sl.cpp
+ company_sl.cpp
+ depot_sl.cpp
+ economy_sl.cpp
+ engine_sl.cpp
+ game_sl.cpp
+ gamelog_sl.cpp
+ goal_sl.cpp
+ group_sl.cpp
+ industry_sl.cpp
+ labelmaps_sl.cpp
+ linkgraph_sl.cpp
+ map_sl.cpp
+ misc_sl.cpp
+ newgrf_sl.cpp
+ newgrf_sl.h
+ object_sl.cpp
+ oldloader.cpp
+ oldloader.h
+ oldloader_sl.cpp
+ order_sl.cpp
+ saveload.cpp
+ saveload.h
+ saveload_filter.h
+ saveload_internal.h
+ signs_sl.cpp
+ station_sl.cpp
+ storage_sl.cpp
+ strings_sl.cpp
+ story_sl.cpp
+ subsidy_sl.cpp
+ town_sl.cpp
+ vehicle_sl.cpp
+ waypoint_sl.cpp
+)
diff --git a/src/script/CMakeLists.txt b/src/script/CMakeLists.txt
new file mode 100644
index 000000000..e5915332c
--- /dev/null
+++ b/src/script/CMakeLists.txt
@@ -0,0 +1,23 @@
+add_subdirectory(api)
+
+add_files(
+ script_config.cpp
+ script_config.hpp
+ script_fatalerror.hpp
+ script_info.cpp
+ script_info.hpp
+ script_info_dummy.cpp
+ script_instance.cpp
+ script_instance.hpp
+ script_scanner.cpp
+ script_scanner.hpp
+ script_storage.hpp
+ script_suspend.hpp
+ squirrel.cpp
+ squirrel.hpp
+ squirrel_class.hpp
+ squirrel_helper.hpp
+ squirrel_helper_type.hpp
+ squirrel_std.cpp
+ squirrel_std.hpp
+)
diff --git a/src/script/api/CMakeLists.txt b/src/script/api/CMakeLists.txt
new file mode 100644
index 000000000..9c665293c
--- /dev/null
+++ b/src/script/api/CMakeLists.txt
@@ -0,0 +1,140 @@
+add_files(
+ ai_changelog.hpp
+ game_changelog.hpp
+ script_accounting.hpp
+ script_admin.hpp
+ script_airport.hpp
+ script_base.hpp
+ script_basestation.hpp
+ script_bridge.hpp
+ script_bridgelist.hpp
+ script_cargo.hpp
+ script_cargolist.hpp
+ script_cargomonitor.hpp
+ script_client.hpp
+ script_clientlist.hpp
+ script_company.hpp
+ script_companymode.hpp
+ script_controller.hpp
+ script_date.hpp
+ script_depotlist.hpp
+ script_engine.hpp
+ script_enginelist.hpp
+ script_error.hpp
+ script_event.hpp
+ script_event_types.hpp
+ script_execmode.hpp
+ script_game.hpp
+ script_gamesettings.hpp
+ script_goal.hpp
+ script_group.hpp
+ script_grouplist.hpp
+ script_industry.hpp
+ script_industrylist.hpp
+ script_industrytype.hpp
+ script_industrytypelist.hpp
+ script_info_docs.hpp
+ script_infrastructure.hpp
+ script_list.hpp
+ script_log.hpp
+ script_map.hpp
+ script_marine.hpp
+ script_news.hpp
+ script_object.hpp
+ script_order.hpp
+ script_priorityqueue.hpp
+ script_rail.hpp
+ script_railtypelist.hpp
+ script_road.hpp
+ script_roadtypelist.hpp
+ script_sign.hpp
+ script_signlist.hpp
+ script_station.hpp
+ script_stationlist.hpp
+ script_story_page.hpp
+ script_storypagelist.hpp
+ script_storypageelementlist.hpp
+ script_subsidy.hpp
+ script_subsidylist.hpp
+ script_testmode.hpp
+ script_text.hpp
+ script_tile.hpp
+ script_tilelist.hpp
+ script_town.hpp
+ script_townlist.hpp
+ script_tunnel.hpp
+ script_types.hpp
+ script_vehicle.hpp
+ script_vehiclelist.hpp
+ script_viewport.hpp
+ script_waypoint.hpp
+ script_waypointlist.hpp
+ script_window.hpp
+ script_accounting.cpp
+ script_admin.cpp
+ script_airport.cpp
+ script_base.cpp
+ script_basestation.cpp
+ script_bridge.cpp
+ script_bridgelist.cpp
+ script_cargo.cpp
+ script_cargolist.cpp
+ script_cargomonitor.cpp
+ script_client.cpp
+ script_clientlist.cpp
+ script_company.cpp
+ script_companymode.cpp
+ script_controller.cpp
+ script_date.cpp
+ script_depotlist.cpp
+ script_engine.cpp
+ script_enginelist.cpp
+ script_error.cpp
+ script_event.cpp
+ script_event_types.cpp
+ script_execmode.cpp
+ script_game.cpp
+ script_gamesettings.cpp
+ script_goal.cpp
+ script_group.cpp
+ script_grouplist.cpp
+ script_industry.cpp
+ script_industrylist.cpp
+ script_industrytype.cpp
+ script_industrytypelist.cpp
+ script_infrastructure.cpp
+ script_list.cpp
+ script_log.cpp
+ script_map.cpp
+ script_marine.cpp
+ script_news.cpp
+ script_object.cpp
+ script_order.cpp
+ script_priorityqueue.cpp
+ script_rail.cpp
+ script_railtypelist.cpp
+ script_road.cpp
+ script_roadtypelist.cpp
+ script_sign.cpp
+ script_signlist.cpp
+ script_station.cpp
+ script_stationlist.cpp
+ script_story_page.cpp
+ script_storypagelist.cpp
+ script_storypageelementlist.cpp
+ script_subsidy.cpp
+ script_subsidylist.cpp
+ script_testmode.cpp
+ script_text.cpp
+ script_tile.cpp
+ script_tilelist.cpp
+ script_town.cpp
+ script_townlist.cpp
+ script_tunnel.cpp
+ script_vehicle.cpp
+ script_vehiclelist.cpp
+ script_viewport.cpp
+ script_waypoint.cpp
+ script_waypointlist.cpp
+ script_window.cpp
+)
diff --git a/src/settingsgen/CMakeLists.txt b/src/settingsgen/CMakeLists.txt
new file mode 100644
index 000000000..e17b8ad6b
--- /dev/null
+++ b/src/settingsgen/CMakeLists.txt
@@ -0,0 +1,13 @@
+cmake_minimum_required(VERSION 3.5)
+
+project(settingsgen)
+
+set(sourcefiles
+ settingsgen.cpp
+ ../core/alloc_func.cpp
+ ../misc/getoptdata.cpp
+ ../ini_load.cpp
+ ../string.cpp
+)
+add_definitions(-DSETTINGSGEN)
+add_executable(settingsgen ${sourcefiles})
diff --git a/src/sound/CMakeLists.txt b/src/sound/CMakeLists.txt
new file mode 100644
index 000000000..35f65d120
--- /dev/null
+++ b/src/sound/CMakeLists.txt
@@ -0,0 +1,37 @@
+if (NOT OPTION_DEDICATED)
+ add_files(
+ allegro_s.cpp
+ allegro_s.h
+ CONDITION Allegro_FOUND
+ )
+
+ add_files(
+ sdl_s.cpp
+ sdl_s.h
+ CONDITION SDL_FOUND
+ )
+
+ add_files(
+ cocoa_s.cpp
+ cocoa_s.h
+ CONDITION APPLE
+ )
+
+ add_files(
+ win32_s.cpp
+ win32_s.h
+ CONDITION WIN32
+ )
+
+ add_files(
+ xaudio2_s.cpp
+ xaudio2_s.h
+ CONDITION WIN32 AND XAUDIO2_FOUND
+ )
+endif (NOT OPTION_DEDICATED)
+
+add_files(
+ sound_driver.hpp
+ null_s.cpp
+ null_s.h
+)
diff --git a/src/spriteloader/CMakeLists.txt b/src/spriteloader/CMakeLists.txt
new file mode 100644
index 000000000..5d6a2f865
--- /dev/null
+++ b/src/spriteloader/CMakeLists.txt
@@ -0,0 +1,5 @@
+add_files(
+ grf.cpp
+ grf.hpp
+ spriteloader.hpp
+)
diff --git a/src/stdafx.h b/src/stdafx.h
index 4fb84a956..c52092553 100644
--- a/src/stdafx.h
+++ b/src/stdafx.h
@@ -424,17 +424,14 @@ void NORETURN CDECL usererror(const char *str, ...) WARN_FORMAT(1, 2);
void NORETURN CDECL error(const char *str, ...) WARN_FORMAT(1, 2);
#define NOT_REACHED() error("NOT_REACHED triggered at line %i of %s", __LINE__, __FILE__)
-/* For non-debug builds with assertions enabled use the special assertion handler:
- * - For MSVC: NDEBUG is set for all release builds and WITH_ASSERT overrides the disabling of asserts.
- * - For non MSVC: NDEBUG is set when assertions are disables, _DEBUG is set for non-release builds.
- */
-#if (defined(_MSC_VER) && defined(NDEBUG) && defined(WITH_ASSERT)) || (!defined(_MSC_VER) && !defined(NDEBUG) && !defined(_DEBUG))
+/* For non-debug builds with assertions enabled use the special assertion handler. */
+#if defined(NDEBUG) && defined(WITH_ASSERT)
#undef assert
#define assert(expression) if (!(expression)) error("Assertion failed at line %i of %s: %s", __LINE__, __FILE__, #expression);
#endif
-/* Asserts are enabled if NDEBUG isn't defined, or if we are using MSVC and WITH_ASSERT is defined. */
-#if !defined(NDEBUG) || (defined(_MSC_VER) && defined(WITH_ASSERT))
+/* Asserts are enabled if NDEBUG isn't defined or WITH_ASSERT is defined. */
+#if !defined(NDEBUG) || defined(WITH_ASSERT)
#define OTTD_ASSERT
#endif
diff --git a/src/strgen/CMakeLists.txt b/src/strgen/CMakeLists.txt
new file mode 100644
index 000000000..b8f61cde3
--- /dev/null
+++ b/src/strgen/CMakeLists.txt
@@ -0,0 +1,25 @@
+cmake_minimum_required(VERSION 3.5)
+
+project(strgen)
+
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake")
+
+set(sourcefiles
+ strgen.cpp
+ strgen_base.cpp
+ ../core/alloc_func.cpp
+ ../misc/getoptdata.cpp
+ ../string.cpp
+)
+add_definitions(-DSTRGEN)
+add_executable(strgen ${sourcefiles})
+
+include(Endian)
+add_endian_definition()
+
+
+# Source Files
+add_files(strgen_base.cpp)
+
+# Header Files
+add_files(strgen.h)
diff --git a/src/table/CMakeLists.txt b/src/table/CMakeLists.txt
new file mode 100644
index 000000000..23b4724e3
--- /dev/null
+++ b/src/table/CMakeLists.txt
@@ -0,0 +1,83 @@
+set(GENERATED_BINARY_DIR ${CMAKE_BINARY_DIR}/generated)
+set(TABLE_BINARY_DIR ${GENERATED_BINARY_DIR}/table)
+
+set(TABLE_INI_SOURCE_FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/company_settings.ini
+ ${CMAKE_CURRENT_SOURCE_DIR}/currency_settings.ini
+ ${CMAKE_CURRENT_SOURCE_DIR}/gameopt_settings.ini
+ ${CMAKE_CURRENT_SOURCE_DIR}/misc_settings.ini
+ ${CMAKE_CURRENT_SOURCE_DIR}/settings.ini
+ ${CMAKE_CURRENT_SOURCE_DIR}/win32_settings.ini
+ ${CMAKE_CURRENT_SOURCE_DIR}/window_settings.ini
+)
+
+# Generate a command and target to create the settings table
+add_custom_command_timestamp(OUTPUT ${TABLE_BINARY_DIR}/settings.h
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${TABLE_BINARY_DIR}
+ COMMAND settingsgen
+ -o ${TABLE_BINARY_DIR}/settings.h
+ -b ${CMAKE_SOURCE_DIR}/src/table/settings.h.preamble
+ -a ${CMAKE_SOURCE_DIR}/src/table/settings.h.postamble
+ ${TABLE_INI_SOURCE_FILES}
+ DEPENDS settingsgen ${TABLE_INI_SOURCE_FILES}
+ ${CMAKE_SOURCE_DIR}/src/table/settings.h.preamble
+ ${CMAKE_SOURCE_DIR}/src/table/settings.h.postamble
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Generating table/settings.h"
+)
+add_custom_target_timestamp(table_settings
+ DEPENDS
+ ${TABLE_BINARY_DIR}/settings.h
+)
+
+add_library(settings
+ INTERFACE
+)
+target_include_directories(settings
+ INTERFACE
+ ${GENERATED_BINARY_DIR}
+)
+add_dependencies(settings
+ table_settings
+)
+add_library(openttd::settings ALIAS settings)
+
+add_files(
+ airport_defaults.h
+ airport_movement.h
+ airporttile_ids.h
+ airporttiles.h
+ animcursors.h
+ autorail.h
+ bridge_land.h
+ build_industry.h
+ cargo_const.h
+ clear_land.h
+ control_codes.h
+ elrail_data.h
+ engines.h
+ genland.h
+ heightmap_colours.h
+ industry_land.h
+ landscape_sprite.h
+ newgrf_debug_data.h
+ object_land.h
+ palette_convert.h
+ palettes.h
+ pricebase.h
+ railtypes.h
+ road_land.h
+ roadtypes.h
+ roadveh_movement.h
+ sprites.h
+ station_land.h
+ strgen_tables.h
+ string_colours.h
+ town_land.h
+ townname.h
+ track_land.h
+ train_cmd.h
+ tree_land.h
+ unicode.h
+ water_land.h
+)
diff --git a/src/video/CMakeLists.txt b/src/video/CMakeLists.txt
new file mode 100644
index 000000000..c6251e939
--- /dev/null
+++ b/src/video/CMakeLists.txt
@@ -0,0 +1,35 @@
+add_subdirectory(cocoa)
+
+if (NOT OPTION_DEDICATED)
+ add_files(
+ allegro_v.cpp
+ allegro_v.h
+ CONDITION Allegro_FOUND
+ )
+
+ add_files(
+ sdl_v.cpp
+ sdl_v.h
+ CONDITION SDL_FOUND
+ )
+
+ add_files(
+ sdl2_v.cpp
+ sdl2_v.h
+ CONDITION SDL2_FOUND
+ )
+
+ add_files(
+ win32_v.cpp
+ win32_v.h
+ CONDITION WIN32
+ )
+endif (NOT OPTION_DEDICATED)
+
+add_files(
+ dedicated_v.cpp
+ dedicated_v.h
+ null_v.cpp
+ null_v.h
+ video_driver.hpp
+)
diff --git a/src/video/cocoa/CMakeLists.txt b/src/video/cocoa/CMakeLists.txt
new file mode 100644
index 000000000..4fff132f3
--- /dev/null
+++ b/src/video/cocoa/CMakeLists.txt
@@ -0,0 +1,8 @@
+add_files(
+ cocoa_keys.h
+ cocoa_v.h
+ cocoa_v.mm
+ event.mm
+ wnd_quartz.mm
+ CONDITION APPLE
+)
diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt
new file mode 100644
index 000000000..18ecd529e
--- /dev/null
+++ b/src/widgets/CMakeLists.txt
@@ -0,0 +1,61 @@
+add_files(
+ ai_widget.h
+ airport_widget.h
+ autoreplace_widget.h
+ bootstrap_widget.h
+ bridge_widget.h
+ build_vehicle_widget.h
+ cheat_widget.h
+ company_widget.h
+ console_widget.h
+ date_widget.h
+ depot_widget.h
+ dock_widget.h
+ dropdown.cpp
+ dropdown_func.h
+ dropdown_type.h
+ dropdown_widget.h
+ engine_widget.h
+ error_widget.h
+ fios_widget.h
+ framerate_widget.h
+ genworld_widget.h
+ goal_widget.h
+ graph_widget.h
+ group_widget.h
+ highscore_widget.h
+ industry_widget.h
+ intro_widget.h
+ link_graph_legend_widget.h
+ main_widget.h
+ misc_widget.h
+ music_widget.h
+ network_chat_widget.h
+ network_content_widget.h
+ network_widget.h
+ newgrf_debug_widget.h
+ newgrf_widget.h
+ news_widget.h
+ object_widget.h
+ order_widget.h
+ osk_widget.h
+ rail_widget.h
+ road_widget.h
+ screenshot_widget.h
+ settings_widget.h
+ sign_widget.h
+ smallmap_widget.h
+ station_widget.h
+ statusbar_widget.h
+ story_widget.h
+ subsidy_widget.h
+ terraform_widget.h
+ timetable_widget.h
+ toolbar_widget.h
+ town_widget.h
+ transparency_widget.h
+ tree_widget.h
+ vehicle_widget.h
+ viewport_widget.h
+ waypoint_widget.h
+)