CMake: add all headers to target sources

This can help with CMake IDE integration and file indexing.
This commit is contained in:
Louis Gombert 2024-08-09 17:00:30 +02:00
parent 05e873ade4
commit 60c5dbf1fe
26 changed files with 144 additions and 54 deletions

View File

@ -1,3 +1,6 @@
set(HEADERS
gr.h
lib2d.h)
set(CPPS set(CPPS
font.cpp font.cpp
hardsurf.cpp hardsurf.cpp
@ -9,7 +12,7 @@ set(CPPS
viewport.cpp viewport.cpp
) )
add_library(2dlib STATIC ${CPPS}) add_library(2dlib STATIC ${HEADERS} ${CPPS})
target_link_libraries(2dlib PRIVATE target_link_libraries(2dlib PRIVATE
cfile cfile
mem mem

View File

@ -1,10 +1,14 @@
set(HEADERS
adecode.h
aencode.h
audio_encode.h)
set(CPPS set(CPPS
adecode.cpp adecode.cpp
aencode.cpp aencode.cpp
encoder.cpp encoder.cpp
) )
add_library(AudioEncode STATIC ${CPPS}) add_library(AudioEncode STATIC ${HEADERS} ${CPPS})
target_link_libraries(AudioEncode PRIVATE target_link_libraries(AudioEncode PRIVATE
libacm libacm
) )

View File

@ -1,7 +1,28 @@
set(HEADERS set(HEADERS
aiambient.h
AIGoal.h AIGoal.h
AIMain.h AIMain.h
BOA.h
Briefing.h
BriefingParse.h
ConfigItem.h
CtlCfgElem.h
D3ForceFeedback.h
DeathInfo.h
DllWrappers.h
Inventory.h
LoadLevel.h
Mission.h
NewPyroGauges.h
ObjScript.h
PilotPicsAPI.h
SmallViews.h
TelCom.h
TelComAutoMap.h
TelComCargo.h
TelComEffects.h
TelComEfxStructs.h
TelComGoals.h
aiambient.h
aipath.h aipath.h
aistruct.h aistruct.h
aistruct_external.h aistruct_external.h
@ -11,31 +32,25 @@ set(HEADERS
attach.h attach.h
audiotaunts.h audiotaunts.h
bnode.h bnode.h
BOA.h
Briefing.h
BriefingParse.h
bsp.h bsp.h
buddymenu.h buddymenu.h
cinematics.h cinematics.h
cockpit.h cockpit.h
config.h config.h
ConfigItem.h
controls.h controls.h
credits.h credits.h
CtlCfgElem.h
ctlconfig.h ctlconfig.h
ctlconfigtxt.h ctlconfigtxt.h
D3ForceFeedback.h d3movie.h
d3music.h
d3serial.h d3serial.h
damage.h damage.h
damage_external.h damage_external.h
DeathInfo.h
deathinfo_external.h deathinfo_external.h
debuggraph.h debuggraph.h
descent.h descent.h
difficulty.h difficulty.h
difficulty_external.h difficulty_external.h
DllWrappers.h
door.h door.h
doorway.h doorway.h
fireball.h fireball.h
@ -56,23 +71,19 @@ set(HEADERS
hotspotmap.h hotspotmap.h
hud.h hud.h
init.h init.h
Inventory.h
levelgoal.h levelgoal.h
levelgoal_external.h levelgoal_external.h
lighting.h lighting.h
lightmap_info.h lightmap_info.h
list.h list.h
LoadLevel.h
localization.h localization.h
marker.h marker.h
matcen.h matcen.h
matcen_external.h matcen_external.h
menu.h menu.h
Mission.h
mission_download.h mission_download.h
mmItem.h mmItem.h
multi.h multi.h
multisafe.h
multi_client.h multi_client.h
multi_dll_mgr.h multi_dll_mgr.h
multi_external.h multi_external.h
@ -80,7 +91,7 @@ set(HEADERS
multi_server.h multi_server.h
multi_ui.h multi_ui.h
multi_world_state.h multi_world_state.h
NewPyroGauges.h multisafe.h
newui.h newui.h
newui_core.h newui_core.h
object.h object.h
@ -88,12 +99,10 @@ set(HEADERS
object_lighting.h object_lighting.h
objinfo.h objinfo.h
objinit.h objinit.h
ObjScript.h
osiris_dll.h osiris_dll.h
osiris_predefs.h osiris_predefs.h
osiris_share.h osiris_share.h
pilot.h pilot.h
PilotPicsAPI.h
pilot_class.h pilot_class.h
player.h player.h
player_external.h player_external.h
@ -113,7 +122,6 @@ set(HEADERS
screens.h screens.h
ship.h ship.h
slew.h slew.h
SmallViews.h
soar.h soar.h
soar_helpers.h soar_helpers.h
sounds.h sounds.h
@ -122,12 +130,6 @@ set(HEADERS
splinter.h splinter.h
stringtable.h stringtable.h
subtitles.h subtitles.h
TelCom.h
TelComAutoMap.h
TelComCargo.h
TelComEffects.h
TelComEfxStructs.h
TelComGoals.h
terrain.h terrain.h
trigger.h trigger.h
vclip.h vclip.h

View File

@ -1,8 +1,8 @@
set(HEADERS iff.h) set(HEADERS
NewBitmap.h
iff.h)
set(CPPS set(CPPS
NewBitmap.cpp NewBitmap.cpp
NewBitmap.h
bitmain.cpp bitmain.cpp
bumpmap.cpp bumpmap.cpp
iff.cpp iff.cpp

View File

@ -1,10 +1,14 @@
set(HEADERS
cfile.h
hogfile.h
inffile.h)
set(CPPS set(CPPS
cfile.cpp cfile.cpp
hogfile.cpp hogfile.cpp
inffile.cpp inffile.cpp
) )
add_library(cfile STATIC ${CPPS}) add_library(cfile STATIC ${HEADERS} ${CPPS})
target_link_libraries(cfile PRIVATE target_link_libraries(cfile PRIVATE
ddio ddio
mem mem

View File

@ -1,3 +1,7 @@
set(HEADERS
debug.h
debugbreak.h
mono.h)
set(CPPS set(CPPS
debug.cpp debug.cpp
$<$<PLATFORM_ID:Darwin,Linux>: $<$<PLATFORM_ID:Darwin,Linux>:
@ -10,7 +14,7 @@ set(CPPS
> >
) )
add_library(ddebug STATIC ${CPPS}) add_library(ddebug STATIC ${HEADERS} ${CPPS})
add_dependencies(ddebug get_git_hash) add_dependencies(ddebug get_git_hash)
target_include_directories(ddebug PUBLIC target_include_directories(ddebug PUBLIC
$<BUILD_INTERFACE: $<BUILD_INTERFACE:

View File

@ -1,3 +1,9 @@
set(HEADERS
chrono_timer.h
ddio.h
ddio_common.h
ddio_lnx.h
ddio_win.h)
set(CPPS set(CPPS
chrono_timer.cpp chrono_timer.cpp
ddio.cpp ddio.cpp
@ -17,7 +23,7 @@ set(CPPS
winfile.cpp winfile.cpp
> >
) )
add_library(ddio STATIC ${CPPS}) add_library(ddio STATIC ${HEADERS} ${CPPS})
target_link_libraries(ddio PRIVATE target_link_libraries(ddio PRIVATE
SDL2::SDL2 SDL2::SDL2
ddebug ddebug

View File

@ -1,4 +1,5 @@
set(HEADERS) set(HEADERS
fix.h)
set(CPPS set(CPPS
fix.cpp) fix.cpp)

View File

@ -1,10 +1,13 @@
set(HEADERS
grtext.h
grtextlib.h)
set(CPPS set(CPPS
grfont.cpp grfont.cpp
grtext.cpp grtext.cpp
textaux.cpp textaux.cpp
) )
add_library(grtext STATIC ${CPPS}) add_library(grtext STATIC ${HEADERS} ${CPPS})
target_link_libraries(grtext PRIVATE target_link_libraries(grtext PRIVATE
ddio ddio
mem mem

View File

@ -1,3 +1,9 @@
set(HEADERS
decoders.h
movie_sound.h
mve_audio.h
mvelib.h
sound_interface.h)
set(CPPS set(CPPS
decoder8.cpp decoder8.cpp
decoder16.cpp decoder16.cpp
@ -7,7 +13,7 @@ set(CPPS
mveplay.cpp mveplay.cpp
) )
add_library(libmve STATIC ${CPPS}) add_library(libmve STATIC ${HEADERS} ${CPPS})
target_link_libraries(libmve PRIVATE target_link_libraries(libmve PRIVATE
ddio ddio
SDL2::SDL2 SDL2::SDL2

View File

@ -1,3 +1,8 @@
set(HEADERS
linux_fix.h
lnxapp.h
lnxcontroller.h
registry.h)
set(CPPS set(CPPS
lnxcon.cpp lnxcon.cpp
lnxcon_raw.cpp lnxcon_raw.cpp
@ -8,7 +13,7 @@ set(CPPS
registry.cpp registry.cpp
) )
add_library(linux STATIC ${CPPS}) add_library(linux STATIC ${HEADERS} ${CPPS})
target_link_libraries(linux PRIVATE target_link_libraries(linux PRIVATE
cfile cfile
) )

View File

@ -2,9 +2,7 @@ set(HEADERS md5.h)
set(CPPS set(CPPS
md5.cpp) md5.cpp)
set(PLATFORMCPPS) add_library(md5 STATIC ${HEADERS} ${CPPS})
add_library(md5 STATIC ${HEADERS} ${CPPS} ${PLATFORMCPPS})
if(BUILD_TESTING) if(BUILD_TESTING)
add_subdirectory(tests) add_subdirectory(tests)

View File

@ -1,8 +1,7 @@
set(CPPS set(HEADERS mem.h)
mem.cpp set(CPPS mem.cpp)
)
add_library(mem STATIC ${CPPS}) add_library(mem STATIC ${HEADERS} ${CPPS})
target_compile_definitions(mem PUBLIC target_compile_definitions(mem PUBLIC
$<$<BOOL:${ENABLE_MEM_RTL}>:MEM_USE_RTL> $<$<BOOL:${ENABLE_MEM_RTL}>:MEM_USE_RTL>
) )

View File

@ -1,3 +1,10 @@
set(HEADERS
log.h
logfile.h
pserror.h
psglob.h
psrand.h
pstring.h)
set(CPPS set(CPPS
error.cpp error.cpp
logfile.cpp logfile.cpp
@ -7,7 +14,7 @@ set(CPPS
pstring.cpp pstring.cpp
) )
add_library(misc STATIC ${CPPS}) add_library(misc STATIC ${HEADERS} ${CPPS})
target_link_libraries(misc PRIVATE target_link_libraries(misc PRIVATE
ddebug ddebug
SDL2::SDL2 SDL2::SDL2

View File

@ -1,9 +1,11 @@
set(HEADERS
polymodel.h)
set(CPPS set(CPPS
newstyle.cpp newstyle.cpp
polymodel.cpp polymodel.cpp
) )
add_library(model STATIC ${CPPS}) add_library(model STATIC ${HEADERS} ${CPPS})
target_link_libraries(model PRIVATE target_link_libraries(model PRIVATE
cfile cfile
mem mem

View File

@ -1,4 +1,6 @@
set(HEADERS) set(HEADERS
music.h
musiclib.h)
set(CPPS set(CPPS
omflex.cpp omflex.cpp
sequencer.cpp sequencer.cpp

View File

@ -1,6 +1,9 @@
set(HEADERS
lanclient.h
lanstrings.h)
set(CPPS lanclient.cpp) set(CPPS lanclient.cpp)
add_library(Direct_TCP_IP MODULE ${CPPS}) add_library(Direct_TCP_IP MODULE ${HEADERS} ${CPPS})
set_target_properties(Direct_TCP_IP PROPERTIES PREFIX "") set_target_properties(Direct_TCP_IP PROPERTIES PREFIX "")
set_target_properties(Direct_TCP_IP PROPERTIES CXX_VISIBILITY_PRESET "hidden") set_target_properties(Direct_TCP_IP PROPERTIES CXX_VISIBILITY_PRESET "hidden")
set_target_properties(Direct_TCP_IP PROPERTIES OUTPUT_NAME "Direct TCP~IP") set_target_properties(Direct_TCP_IP PROPERTIES OUTPUT_NAME "Direct TCP~IP")

View File

@ -1,3 +1,10 @@
set(HEADERS
chat_api.h
mt_net.h
mtclient.h
mtgametrack.h
mtpilottrack.h
mtstrings.h)
set(CPPS set(CPPS
chat_api.cpp chat_api.cpp
mt_net.cpp mt_net.cpp
@ -6,7 +13,7 @@ set(CPPS
mtpilottracker.cpp mtpilottracker.cpp
) )
add_library(Parallax_Online MODULE ${CPPS}) add_library(Parallax_Online MODULE ${HEADERS} ${CPPS})
set_target_properties(Parallax_Online PROPERTIES PREFIX "") set_target_properties(Parallax_Online PROPERTIES PREFIX "")
set_target_properties(Parallax_Online PROPERTIES CXX_VISIBILITY_PRESET "hidden") set_target_properties(Parallax_Online PROPERTIES CXX_VISIBILITY_PRESET "hidden")
set_target_properties(Parallax_Online PROPERTIES OUTPUT_NAME "Parallax Online") set_target_properties(Parallax_Online PROPERTIES OUTPUT_NAME "Parallax Online")

View File

@ -1,4 +1,6 @@
set(HEADERS coop.h) set(HEADERS
coop.h
coopstr.h)
set(CPPS coop.cpp) set(CPPS coop.cpp)
set(NETGAME_MODULE coop) set(NETGAME_MODULE coop)

View File

@ -1,3 +1,7 @@
set(HEADERS
collide.h
findintersection.h
physics.h)
set(CPPS set(CPPS
collide.cpp collide.cpp
findintersection.cpp findintersection.cpp
@ -5,7 +9,7 @@ set(CPPS
physics.cpp physics.cpp
) )
add_library(physics STATIC ${CPPS}) add_library(physics STATIC ${HEADERS} ${CPPS})
target_link_libraries(physics PRIVATE target_link_libraries(physics PRIVATE
ddio ddio
mem mem

View File

@ -1,7 +1,9 @@
set(HEADERS
rtperformance.h)
set(CPPS set(CPPS
rtperformance.cpp) rtperformance.cpp)
add_library(rtperformance STATIC ${CPPS}) add_library(rtperformance STATIC ${HEADERS} ${CPPS})
target_link_libraries(rtperformance PRIVATE target_link_libraries(rtperformance PRIVATE
ddio ddio
) )

View File

@ -1,5 +1,11 @@
set(CMAKE_FOLDER "scripts") set(CMAKE_FOLDER "scripts")
set(HEADERS
AIGame3_External.h
linux_lib.h
osiris_common.h
osiris_import.h
osiris_vector.h)
set(CPPS set(CPPS
$<$<PLATFORM_ID:Darwin,Linux>: $<$<PLATFORM_ID:Darwin,Linux>:
linux_lib.cpp linux_lib.cpp
@ -69,7 +75,7 @@ set(SCRIPTS
#) #)
foreach(SCRIPT ${SCRIPTS}) foreach(SCRIPT ${SCRIPTS})
add_library(${SCRIPT} MODULE ${CPPS} "${SCRIPT}.cpp") add_library(${SCRIPT} MODULE ${CPPS} ${HEADERS} "${SCRIPT}.cpp")
target_link_libraries(${SCRIPT} target_link_libraries(${SCRIPT}
fix fix
misc misc

View File

@ -1,3 +1,15 @@
set(HEADERS
auddev.h
ddsndgeometry.h
ds3dlib.h
ds3dlib_internal.h
hlsoundlib.h
mixer.h
sdlsound.h
sndrender.h
soundload.h
ssl_lib.h
vmanpset.h)
set(CPPS set(CPPS
hlsoundlib.cpp hlsoundlib.cpp
sndrender.cpp sndrender.cpp
@ -9,7 +21,7 @@ set(CPPS
sdlsound.cpp sdlsound.cpp
) )
add_library(sndlib STATIC ${CPPS}) add_library(sndlib STATIC ${HEADERS} ${CPPS})
target_link_libraries(sndlib PRIVATE target_link_libraries(sndlib PRIVATE
cfile cfile
ddio ddio

View File

@ -1,4 +1,5 @@
set(HEADERS) set(HEADERS
streamaudio.h)
set(CPPS set(CPPS
osfarchive.cpp osfarchive.cpp
streamaudio.cpp streamaudio.cpp

View File

@ -1,3 +1,9 @@
set(HEADERS
UIlib.h
ui.h
uidraw.h
uires.h
uisys.h)
set(CPPS set(CPPS
UIButton.cpp UIButton.cpp
UICombo.cpp UICombo.cpp
@ -16,7 +22,7 @@ set(CPPS
UIWindow.cpp UIWindow.cpp
) )
add_library(ui STATIC ${CPPS}) add_library(ui STATIC ${HEADERS} ${CPPS})
target_link_libraries(ui PRIVATE target_link_libraries(ui PRIVATE
ddio ddio
grtext grtext

View File

@ -1,3 +1,4 @@
set(HEADERS unzip.h)
set(CPPS unzip.cpp) set(CPPS unzip.cpp)
add_library(unzip STATIC ${HEADERS} ${CPPS}) add_library(unzip STATIC ${HEADERS} ${CPPS})