mirror of
https://github.com/dhewm/dhewm3.git
synced 2025-03-20 17:51:02 +00:00
CMake: Make source files listing in VS usable
For some reason CMake thinks it's a great default to display all the source files of a project in Visual Studio as a flat list (instead of in the directory structure they're physically in). source_group(TREE ...) *per project/"target"* helps. Also, so far there was no reason to list or otherwise use header files in CMakeLists.txt - but for them to turn up in VS they must be added to the source lists. I've done that, but I'm sloppily globbing them instead of adding each headder manually like it's done for the source files (because it doesn't matter if a header that's not really used turns up in those lists)
This commit is contained in:
parent
6a507c6a5b
commit
bd39f9ecf2
1 changed files with 53 additions and 0 deletions
|
@ -363,6 +363,17 @@ set(src_renderer
|
|||
renderer/tr_turboshadow.cpp
|
||||
)
|
||||
|
||||
# I'm a bit sloppy with headers and just glob them in..
|
||||
# they're only handled in CMake at all so they turn up in Visual Studio solutions..
|
||||
|
||||
# globs all the headers from ${PATHPREFIX}/ and adds them to ${SRCLIST}
|
||||
function(add_globbed_headers SRCLIST PATHPREFIX)
|
||||
file(GLOB_RECURSE tmp_hdrs RELATIVE "${CMAKE_SOURCE_DIR}" "${PATHPREFIX}/*.h")
|
||||
set(${SRCLIST} ${tmp_hdrs} ${${SRCLIST}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
add_globbed_headers(src_renderer "renderer")
|
||||
|
||||
set(src_framework
|
||||
framework/CVarSystem.cpp
|
||||
framework/CmdSystem.cpp
|
||||
|
@ -396,6 +407,8 @@ set(src_framework
|
|||
framework/minizip/unzip.cpp
|
||||
)
|
||||
|
||||
add_globbed_headers(src_framework "framework")
|
||||
|
||||
set(src_cm
|
||||
cm/CollisionModel_contacts.cpp
|
||||
cm/CollisionModel_contents.cpp
|
||||
|
@ -407,6 +420,8 @@ set(src_cm
|
|||
cm/CollisionModel_translate.cpp
|
||||
)
|
||||
|
||||
add_globbed_headers(src_cm "cm")
|
||||
|
||||
set(src_dmap
|
||||
tools/compilers/dmap/dmap.cpp
|
||||
tools/compilers/dmap/facebsp.cpp
|
||||
|
@ -424,6 +439,8 @@ set(src_dmap
|
|||
tools/compilers/dmap/usurface.cpp
|
||||
)
|
||||
|
||||
add_globbed_headers(src_dmap "tools/compilers/dmap")
|
||||
|
||||
set(src_aas
|
||||
tools/compilers/aas/AASBuild.cpp
|
||||
tools/compilers/aas/AASBuild_file.cpp
|
||||
|
@ -440,6 +457,8 @@ set(src_aas
|
|||
tools/compilers/aas/BrushBSP.cpp
|
||||
)
|
||||
|
||||
add_globbed_headers(src_aas "tools/compilers/aas")
|
||||
|
||||
set(src_roq
|
||||
tools/compilers/roqvq/NSBitmapImageRep.cpp
|
||||
tools/compilers/roqvq/codec.cpp
|
||||
|
@ -447,10 +466,14 @@ set(src_roq
|
|||
tools/compilers/roqvq/roqParam.cpp
|
||||
)
|
||||
|
||||
add_globbed_headers(src_roq "tools/compilers/roqvq")
|
||||
|
||||
set(src_renderbump
|
||||
tools/compilers/renderbump/renderbump.cpp
|
||||
)
|
||||
|
||||
add_globbed_headers(src_renderbump "tools/compilers/renderbump")
|
||||
|
||||
set(src_snd
|
||||
sound/snd_cache.cpp
|
||||
sound/snd_decoder.cpp
|
||||
|
@ -462,6 +485,8 @@ set(src_snd
|
|||
sound/snd_world.cpp
|
||||
)
|
||||
|
||||
add_globbed_headers(src_snd "sound")
|
||||
|
||||
set(src_ui
|
||||
ui/BindWindow.cpp
|
||||
ui/ChoiceWindow.cpp
|
||||
|
@ -484,10 +509,14 @@ set(src_ui
|
|||
ui/Winvar.cpp
|
||||
)
|
||||
|
||||
add_globbed_headers(src_ui "ui")
|
||||
|
||||
set(src_tools
|
||||
tools/guied/GEWindowWrapper_stub.cpp
|
||||
)
|
||||
|
||||
# TODO: add_globbed_headers(src_tools "tools/guied")
|
||||
|
||||
set(src_idlib
|
||||
idlib/bv/Bounds.cpp
|
||||
idlib/bv/Frustum.cpp
|
||||
|
@ -539,6 +568,8 @@ set(src_idlib
|
|||
idlib/Heap.cpp
|
||||
)
|
||||
|
||||
add_globbed_headers(src_idlib "idlib")
|
||||
|
||||
set(src_game
|
||||
game/AF.cpp
|
||||
game/AFEntity.cpp
|
||||
|
@ -611,6 +642,8 @@ set(src_game
|
|||
game/physics/Push.cpp
|
||||
)
|
||||
|
||||
add_globbed_headers(src_game "game")
|
||||
|
||||
set(src_d3xp
|
||||
d3xp/AF.cpp
|
||||
d3xp/AFEntity.cpp
|
||||
|
@ -685,6 +718,8 @@ set(src_d3xp
|
|||
d3xp/physics/Force_Grab.cpp
|
||||
)
|
||||
|
||||
add_globbed_headers(src_d3xp "d3xp")
|
||||
|
||||
set(src_core
|
||||
${src_renderer}
|
||||
${src_framework}
|
||||
|
@ -766,6 +801,14 @@ elseif(WIN32)
|
|||
sys/win32/win_syscon.cpp
|
||||
sys/win32/SDL_win32_main.c
|
||||
)
|
||||
|
||||
# adding the few relevant headers in sys/ manually..
|
||||
set(src_sys_base ${src_sys_base}
|
||||
sys/platform.h
|
||||
sys/sys_local.h
|
||||
sys/sys_public.h
|
||||
sys/win32/win_local.h
|
||||
)
|
||||
|
||||
set(src_sys_core
|
||||
sys/glimp.cpp
|
||||
|
@ -804,6 +847,8 @@ else()
|
|||
endif()
|
||||
endif()
|
||||
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX neo FILES ${src_idlib})
|
||||
|
||||
if(CORE)
|
||||
add_executable(${DHEWM3BINARY} WIN32 MACOSX_BUNDLE
|
||||
${src_core}
|
||||
|
@ -811,6 +856,8 @@ if(CORE)
|
|||
${src_sys_core}
|
||||
)
|
||||
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX neo FILES ${src_core} ${src_sys_base} ${src_sys_core})
|
||||
|
||||
set_target_properties(${DHEWM3BINARY} PROPERTIES COMPILE_DEFINITIONS "__DOOM_DLL__")
|
||||
set_target_properties(${DHEWM3BINARY} PROPERTIES LINK_FLAGS "${ldflags}")
|
||||
set_target_properties(${DHEWM3BINARY} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${PROJECT_SOURCE_DIR}/sys/osx/Info.plist)
|
||||
|
@ -844,6 +891,8 @@ if(DEDICATED)
|
|||
${src_stub_gl}
|
||||
${src_sys_base}
|
||||
)
|
||||
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX neo FILES ${src_core} ${src_sys_base} ${src_stub_openal} ${src_stub_gl})
|
||||
|
||||
set_target_properties(${DHEWM3BINARY}ded PROPERTIES COMPILE_DEFINITIONS "ID_DEDICATED;__DOOM_DLL__")
|
||||
set_target_properties(${DHEWM3BINARY}ded PROPERTIES LINK_FLAGS "${ldflags}")
|
||||
|
@ -875,6 +924,9 @@ if(BASE)
|
|||
else()
|
||||
add_library(base SHARED ${src_game})
|
||||
endif()
|
||||
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX neo FILES ${src_game})
|
||||
|
||||
set_target_properties(base PROPERTIES PREFIX "")
|
||||
set_target_properties(base PROPERTIES COMPILE_DEFINITIONS "GAME_DLL")
|
||||
set_target_properties(base PROPERTIES COMPILE_FLAGS "-I${CMAKE_SOURCE_DIR}/game")
|
||||
|
@ -902,6 +954,7 @@ if(D3XP)
|
|||
else()
|
||||
add_library(d3xp SHARED ${src_d3xp})
|
||||
endif()
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX neo FILES ${src_d3xp})
|
||||
set_target_properties(d3xp PROPERTIES PREFIX "")
|
||||
set_target_properties(d3xp PROPERTIES COMPILE_DEFINITIONS "GAME_DLL;_D3XP;CTF")
|
||||
set_target_properties(d3xp PROPERTIES COMPILE_FLAGS "-I${CMAKE_SOURCE_DIR}/d3xp")
|
||||
|
|
Loading…
Reference in a new issue