ref: f8810f763c304449fbe81d792da13013aadb6e8d
parent: 097f3b07f2038e915329f6d2965b2b6002d56b18
author: Alex Mayfield <alexmax2742@gmail.com>
date: Wed May 2 17:23:00 EDT 2018
Chocolate Doom now builds
--- a/opl/CMakeLists.txt
+++ b/opl/CMakeLists.txt
@@ -9,5 +9,7 @@
opl_win32.c
ioperm_sys.c ioperm_sys.h
opl3.c opl3.h)
-target_include_directories(opl PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
+target_include_directories(opl
+ INTERFACE "."
+ PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
target_link_libraries(opl SDL2::mixer)
--- a/pcsound/CMakeLists.txt
+++ b/pcsound/CMakeLists.txt
@@ -5,5 +5,7 @@
pcsound_linux.c
pcsound_win32.c
pcsound_internal.h)
-target_include_directories(pcsound PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
+target_include_directories(pcsound
+ INTERFACE "."
+ PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
target_link_libraries(pcsound SDL2::mixer)
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -30,3 +30,85 @@
target_include_directories("${PROGRAM_PREFIX}server"
PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
target_link_libraries("${PROGRAM_PREFIX}server" SDL2::SDL2main SDL2::net)
+
+# Source files used by the game binaries (chocolate-doom, etc.)
+
+set(GAME_SOURCE_FILES
+ aes_prng.c aes_prng.h
+ d_event.c d_event.h
+ doomkeys.h
+ doomtype.h
+ d_iwad.c d_iwad.h
+ d_loop.c d_loop.h
+ d_mode.c d_mode.h
+ d_ticcmd.h
+ deh_str.c deh_str.h
+ gusconf.c gusconf.h
+ i_cdmus.c i_cdmus.h
+ i_endoom.c i_endoom.h
+ i_input.c i_input.h
+ i_joystick.c i_joystick.h
+ i_swap.h
+ i_midipipe.c i_midipipe.h
+ i_oplmusic.c
+ i_pcsound.c
+ i_sdlmusic.c
+ i_sdlsound.c
+ i_sound.c i_sound.h
+ i_timer.c i_timer.h
+ i_video.c i_video.h
+ i_videohr.c i_videohr.h
+ midifile.c midifile.h
+ mus2mid.c mus2mid.h
+ m_bbox.c m_bbox.h
+ m_cheat.c m_cheat.h
+ m_config.c m_config.h
+ m_controls.c m_controls.h
+ m_fixed.c m_fixed.h
+ net_client.c net_client.h
+ net_common.c net_common.h
+ net_dedicated.c net_dedicated.h
+ net_defs.h
+ net_gui.c net_gui.h
+ net_io.c net_io.h
+ net_loop.c net_loop.h
+ net_packet.c net_packet.h
+ net_query.c net_query.h
+ net_sdl.c net_sdl.h
+ net_server.c net_server.h
+ net_structrw.c net_structrw.h
+ sha1.c sha1.h
+ memio.c memio.h
+ tables.c tables.h
+ v_diskicon.c v_diskicon.h
+ v_video.c v_video.h
+ v_patch.h
+ w_checksum.c w_checksum.h
+ w_main.c w_main.h
+ w_wad.c w_wad.h
+ w_file.c w_file.h
+ w_file_stdc.c
+ w_file_posix.c
+ w_file_win32.c
+ w_merge.c w_merge.h
+ z_zone.c z_zone.h)
+
+set(DEHACKED_SOURCE_FILES
+ deh_defs.h
+ deh_io.c deh_io.h
+ deh_main.c deh_main.h
+ deh_mapping.c deh_mapping.h
+ deh_text.c)
+
+# Some games support dehacked patches, some don't:
+
+set(SOURCE_FILES ${COMMON_SOURCE_FILES} ${GAME_SOURCE_FILES})
+set(SOURCE_FILES_WITH_DEH ${SOURCE_FILES} ${DEHACKED_SOURCE_FILES})
+
+set(EXTRA_LIBS textscreen pcsound opl SDL2::SDL2main SDL2::SDL2 SDL2::mixer SDL2::net)
+
+add_executable("${PROGRAM_PREFIX}doom" ${SOURCE_FILES_WITH_DEH})
+
+target_include_directories("${PROGRAM_PREFIX}doom"
+ PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
+target_link_libraries("${PROGRAM_PREFIX}doom" doom ${EXTRA_LIBS})
--- a/src/doom/CMakeLists.txt
+++ b/src/doom/CMakeLists.txt
@@ -1,0 +1,71 @@
+add_library(doom STATIC
+ am_map.c am_map.h
+ deh_ammo.c
+ deh_bexstr.c
+ deh_cheat.c
+ deh_doom.c
+ deh_frame.c
+ deh_misc.c deh_misc.h
+ deh_ptr.c
+ deh_sound.c
+ deh_thing.c
+ deh_weapon.c
+ d_englsh.h
+ d_items.c d_items.h
+ d_main.c d_main.h
+ d_net.c
+ doomdata.h
+ doomdef.c doomdef.h
+ doomstat.c doomstat.h
+ d_player.h
+ dstrings.c dstrings.h
+ d_textur.h
+ d_think.h
+ f_finale.c f_finale.h
+ f_wipe.c f_wipe.h
+ g_game.c g_game.h
+ hu_lib.c hu_lib.h
+ hu_stuff.c hu_stuff.h
+ info.c info.h
+ m_menu.c m_menu.h
+ m_random.c m_random.h
+ p_ceilng.c
+ p_doors.c
+ p_enemy.c
+ p_floor.c
+ p_inter.c p_inter.h
+ p_lights.c
+ p_local.h
+ p_map.c
+ p_maputl.c
+ p_mobj.c p_mobj.h
+ p_plats.c
+ p_pspr.c p_pspr.h
+ p_saveg.c p_saveg.h
+ p_setup.c p_setup.h
+ p_sight.c
+ p_spec.c p_spec.h
+ p_switch.c
+ p_telept.c
+ p_tick.c p_tick.h
+ p_user.c
+ r_bsp.c r_bsp.h
+ r_data.c r_data.h
+ r_defs.h
+ r_draw.c r_draw.h
+ r_local.h
+ r_main.c r_main.h
+ r_plane.c r_plane.h
+ r_segs.c r_segs.h
+ r_sky.c r_sky.h
+ r_state.h
+ r_things.c r_things.h
+ s_sound.c s_sound.h
+ sounds.c sounds.h
+ statdump.c statdump.h
+ st_lib.c st_lib.h
+ st_stuff.c st_stuff.h
+ wi_stuff.c wi_stuff.h)
+
+target_include_directories(doom PRIVATE "../" "${CMAKE_CURRENT_BINARY_DIR}/../../")
+target_link_libraries(doom SDL2::SDL2 SDL2::mixer SDL2::net)
--- a/textscreen/CMakeLists.txt
+++ b/textscreen/CMakeLists.txt
@@ -22,5 +22,7 @@
txt_widget.c txt_widget.h
txt_window.c txt_window.h
txt_window_action.c txt_window_action.h)
-target_include_directories(textscreen PRIVATE "../src/")
+target_include_directories(textscreen
+ INTERFACE "."
+ PRIVATE "../src/")
target_link_libraries(textscreen SDL2::SDL2)