Skip to content

Commit

Permalink
CMAKE: Add the MapPack
Browse files Browse the repository at this point in the history
  • Loading branch information
kai-li-wop committed Dec 3, 2024
1 parent d2e89ca commit 4f5b3d5
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
32 changes: 32 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,22 @@ function(shader_validation GAME SHADER PADPACK)
endforeach()
endfunction()

function(shader_validation GAME SHADER MAPPACK)
set(PK3DIRS scripts.pk3dir mappack.pk3dir)
foreach(PK3DIR ${PK3DIRS})
set(SHADERPATH "${CMAKE_CURRENT_SOURCE_DIR}/${PK3DIR}/scripts/${SHADER}")
if (EXISTS ${SHADERPATH})
set(targetname "shader-${GAME}-${SHADER}")
get_filename_component(targetname ${targetname} NAME_WLE)
get_filename_component(filename ${SHADERPATH} NAME)
add_test(NAME ${targetname}
COMMAND $<TARGET_FILE:shadertool> "${CMAKE_CURRENT_SOURCE_DIR}" "${SHADERPATH}" "${MAPPACK}"
WORKING_DIRECTORY "$<TARGET_FILE_DIR:shadertool>"
)
endif()
endforeach()
endfunction()

function(bsp_validation GAME BSP PADPACK)
set(PK3DIRS maps.pk3dir padpack.pk3dir)
foreach(PK3DIR ${PK3DIRS})
Expand All @@ -158,6 +174,22 @@ function(bsp_validation GAME BSP PADPACK)
endforeach()
endfunction()

function(bsp_validation GAME BSP MAPPACK)
set(PK3DIRS maps.pk3dir mappack.pk3dir)
foreach(PK3DIR ${PK3DIRS})
set(BSPPATH "${CMAKE_CURRENT_SOURCE_DIR}/${PK3DIR}/maps/${BSP}")
if (EXISTS ${BSPPATH})
set(targetname "bsp-${GAME}-${BSP}")
get_filename_component(targetname ${targetname} NAME_WLE)
get_filename_component(filename ${BSPPATH} NAME)
add_test(NAME ${targetname}
COMMAND $<TARGET_FILE:bsptool> "${CMAKE_CURRENT_SOURCE_DIR}" "${BSPPATH}" "${MAPPACK}"
WORKING_DIRECTORY "$<TARGET_FILE_DIR:bsptool>"
)
endif()
endforeach()
endfunction()

function(compress_pk3 TARGET)
add_custom_target(pk3-${TARGET})
foreach (PK3DIR ${ARGN})
Expand Down
15 changes: 15 additions & 0 deletions wop/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
set(PK3DIRS
botfiles
gfx
mappack
maps
menu
models
Expand Down Expand Up @@ -65,6 +66,13 @@ foreach (SHADER ${PADPACK_SHADERS})
shader_validation(wop ${SHADER} 1)
endforeach()

set(MAPPACK_SHADERS
wop_mappack-levelshots.shader
)
foreach (SHADER ${MAPPACK_SHADERS})
shader_validation(wop ${SHADER} 2)
endforeach()

set(BSPS
wop_airplane.bsp
wop_anteroom.bsp
Expand Down Expand Up @@ -126,3 +134,10 @@ set(PADPACK_BSPS
foreach (BSP ${PADPACK_BSPS})
bsp_validation(wop ${BSP} 1)
endforeach()

set(MAPPACK_BSPS
wop_coloor.bsp
)
foreach (BSP ${MAPPACK_BSPS})
bsp_validation(wop ${BSP} 2)
endforeach()

0 comments on commit 4f5b3d5

Please sign in to comment.