mirror of
https://github.com/mwpenny/portal64-still-alive.git
synced 2024-11-23 04:19:50 +00:00
CMake: link generated code
This commit is contained in:
parent
1d0b22df61
commit
6c625e39e6
@ -211,6 +211,18 @@ _add_extract_frame_command(
|
||||
# glob pitfalls do not apply here.
|
||||
file(GLOB_RECURSE TEXTURE_SCRIPTS "*.ims")
|
||||
|
||||
function(_get_texture_script_file_list TEXTURE_SCRIPT PROPERTY_NAME PARENT_DIR OUTPUT)
|
||||
get_source_file_property(FILE_LIST ${TEXTURE_SCRIPT} ${PROPERTY_NAME})
|
||||
|
||||
if (FILE_LIST)
|
||||
list(TRANSFORM FILE_LIST PREPEND "${PARENT_DIR}/" OUTPUT_VARIABLE FILE_LIST)
|
||||
list(TRANSFORM FILE_LIST APPEND ".png" OUTPUT_VARIABLE FILE_LIST)
|
||||
list(APPEND ${OUTPUT} ${FILE_LIST})
|
||||
endif()
|
||||
|
||||
return(PROPAGATE ${OUTPUT})
|
||||
endfunction()
|
||||
|
||||
function(_add_texture_transform_command TEXTURE_SCRIPT OUTPUT_LIST)
|
||||
cmake_path(
|
||||
RELATIVE_PATH TEXTURE_SCRIPT
|
||||
@ -258,18 +270,6 @@ function(_add_texture_transform_command TEXTURE_SCRIPT OUTPUT_LIST)
|
||||
return(PROPAGATE ${OUTPUT_LIST})
|
||||
endfunction()
|
||||
|
||||
function(_get_texture_script_file_list TEXTURE_SCRIPT PROPERTY_NAME PARENT_DIR OUTPUT)
|
||||
get_source_file_property(FILE_LIST ${TEXTURE_SCRIPT} ${PROPERTY_NAME})
|
||||
|
||||
if (FILE_LIST)
|
||||
list(TRANSFORM FILE_LIST PREPEND "${PARENT_DIR}/" OUTPUT_VARIABLE FILE_LIST)
|
||||
list(TRANSFORM FILE_LIST APPEND ".png" OUTPUT_VARIABLE FILE_LIST)
|
||||
list(APPEND ${OUTPUT} ${FILE_LIST})
|
||||
endif()
|
||||
|
||||
return(PROPAGATE ${OUTPUT})
|
||||
endfunction()
|
||||
|
||||
# Add commands for transforming converted PNG textures (crop, scale, etc.).
|
||||
# There are some special cases due to some conversion scripts reading textures
|
||||
# other than those they are named after (combining multiple textures), or
|
||||
@ -370,10 +370,13 @@ foreach(TEXTURE_SCRIPT ${TEXTURE_SCRIPTS})
|
||||
_add_texture_transform_command(${TEXTURE_SCRIPT} TEXTURES_TRANSFORMED)
|
||||
endforeach()
|
||||
|
||||
add_custom_target(
|
||||
all_textures
|
||||
add_custom_target(textures
|
||||
DEPENDS ${TEXTURES_TRANSFORMED}
|
||||
)
|
||||
set_target_properties(textures PROPERTIES
|
||||
# Enable dependents to easily depend on transformed textures
|
||||
OUTPUTS ${TEXTURES_TRANSFORMED}
|
||||
)
|
||||
|
||||
#########################
|
||||
## Material generation ##
|
||||
@ -401,7 +404,7 @@ function(_add_material_generate_command INPUT_FILE OUTPUT_LIST)
|
||||
set(OUTPUT_FILE_H "${CMAKE_BINARY_DIR}/${RELATIVE_DIR}/${MATERIAL_NAME}.h")
|
||||
set(OUTPUT_FILE_C "${CMAKE_BINARY_DIR}/${RELATIVE_DIR}/${MATERIAL_NAME}_mat.c")
|
||||
|
||||
# Depend on all textures for simplicity. Materials are cheap to rebuild.
|
||||
# Depend on all textures for simplicity
|
||||
set(DEPENDENCY_FILES ${INPUT_FILE} ${TEXTURES_TRANSFORMED})
|
||||
|
||||
get_source_file_property(DEP_FILE_LIST ${INPUT_FILE} ADDITIONAL_DEPS)
|
||||
@ -412,7 +415,7 @@ function(_add_material_generate_command INPUT_FILE OUTPUT_LIST)
|
||||
# TODO: add dependency on skeletool once it is built with CMake
|
||||
add_custom_command(
|
||||
DEPENDS
|
||||
all_textures ${DEPENDENCY_FILES}
|
||||
${DEPENDENCY_FILES}
|
||||
OUTPUT
|
||||
${OUTPUT_FILE_H} ${OUTPUT_FILE_C}
|
||||
COMMAND
|
||||
@ -463,7 +466,12 @@ foreach(MATERIAL ${MATERIALS})
|
||||
_add_material_generate_command(${MATERIAL} GENERATED_MATERIALS)
|
||||
endforeach()
|
||||
|
||||
add_custom_target(
|
||||
materials
|
||||
add_custom_target(generated_materials
|
||||
DEPENDS ${GENERATED_MATERIALS}
|
||||
)
|
||||
|
||||
add_library(materials INTERFACE)
|
||||
add_dependencies(materials generated_materials)
|
||||
target_sources(materials INTERFACE
|
||||
${GENERATED_MATERIALS}
|
||||
)
|
||||
|
@ -1,3 +1,6 @@
|
||||
set(GEN_DYNAMIC_MODEL_LIST "${PROJECT_SOURCE_DIR}/tools/models/generate_dynamic_model_list.js")
|
||||
set(GEN_DYNAMIC_ANIM_MODEL_LIST "${PROJECT_SOURCE_DIR}/tools/models/generate_dynamic_animated_model_list.js")
|
||||
|
||||
cmake_path(
|
||||
RELATIVE_PATH CMAKE_CURRENT_SOURCE_DIR
|
||||
BASE_DIRECTORY "${PROJECT_SOURCE_DIR}"
|
||||
@ -71,9 +74,6 @@ set(MODEL_DEFAULT_MATERIALS
|
||||
${ASSETS_DIR}/materials/objects.skm.yaml
|
||||
)
|
||||
|
||||
set(GEN_DYNAMIC_MODEL_LIST "${PROJECT_SOURCE_DIR}/tools/models/generate_dynamic_model_list.js")
|
||||
set(GEN_DYNAMIC_ANIM_MODEL_LIST "${PROJECT_SOURCE_DIR}/tools/models/generate_dynamic_animated_model_list.js")
|
||||
|
||||
function(_add_model_export_command MODEL_NAME OUTPUT_VARIABLE)
|
||||
set(INPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${MODEL_NAME}.blend")
|
||||
set(OUTPUT_FILE "${CMAKE_BINARY_DIR}/${RELATIVE_CURRENT_DIR}/${MODEL_NAME}.fbx")
|
||||
@ -127,6 +127,8 @@ function(_add_model_generate_command MODEL_NAME MODEL_FBX OUTPUT_LIST)
|
||||
|
||||
add_custom_command(
|
||||
DEPENDS
|
||||
# Need to depend on textures since some models embed them
|
||||
textures "$<TARGET_PROPERTY:textures,OUTPUTS>"
|
||||
${CONVERT_ASSET} ${MODEL_FBX} ${MODEL_FLAGS} ${MODEL_MATERIALS}
|
||||
OUTPUT
|
||||
${OUTPUT_FILE_H} ${OUTPUT_FILE_GEO_C} ${OUTPUT_FILE_ANIM_C}
|
||||
@ -156,7 +158,6 @@ function(_add_model_generate_command MODEL_NAME MODEL_FBX OUTPUT_LIST)
|
||||
return(PROPAGATE ${OUTPUT_LIST})
|
||||
endfunction()
|
||||
|
||||
|
||||
# Add commands for exporting model files
|
||||
# There are some special cases for models which use non-default materials
|
||||
|
||||
@ -192,8 +193,7 @@ foreach(MODEL ${MODELS})
|
||||
_add_model_generate_command(${MODEL} ${MODEL_FBX} MODEL_GENERATED_FILES)
|
||||
endforeach()
|
||||
|
||||
add_custom_target(
|
||||
models
|
||||
add_custom_target(generated_models
|
||||
DEPENDS ${MODEL_GENERATED_FILES}
|
||||
)
|
||||
|
||||
@ -257,12 +257,24 @@ add_custom_command(
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
add_custom_target(
|
||||
model_lists
|
||||
DEPENDS
|
||||
${MODEL_GENERATED_FILES}
|
||||
${DYNAMIC_MODEL_LIST_H}
|
||||
${DYNAMIC_MODEL_LIST_C}
|
||||
${DYNAMIC_ANIMATED_MODEL_LIST_H}
|
||||
${DYNAMIC_ANIMATED_MODEL_LIST_C}
|
||||
set(MODEL_LIST_FILES
|
||||
${DYNAMIC_MODEL_LIST_H}
|
||||
${DYNAMIC_MODEL_LIST_C}
|
||||
${DYNAMIC_ANIMATED_MODEL_LIST_H}
|
||||
${DYNAMIC_ANIMATED_MODEL_LIST_C}
|
||||
)
|
||||
|
||||
add_custom_target(model_lists
|
||||
DEPENDS
|
||||
${MODEL_LIST_FILES}
|
||||
)
|
||||
|
||||
add_library(models INTERFACE)
|
||||
add_dependencies(models
|
||||
generated_models
|
||||
model_lists
|
||||
)
|
||||
target_sources(models INTERFACE
|
||||
${MODEL_GENERATED_FILES}
|
||||
${MODEL_LIST_FILES}
|
||||
)
|
@ -3,6 +3,9 @@
|
||||
set(PAK_SOUND_DIR "${PAK_DIR}/sound")
|
||||
set(PAK_MODIFIED_SOUND_DIR "${PAK_MODIFIED_DIR}/sound")
|
||||
|
||||
set(JSOX "${PROJECT_SOURCE_DIR}/tools/sound/jsox.js")
|
||||
set(GEN_SOUND_IDS "${PROJECT_SOURCE_DIR}/tools/sound/generate_sound_ids.js")
|
||||
|
||||
cmake_path(
|
||||
RELATIVE_PATH CMAKE_CURRENT_SOURCE_DIR
|
||||
BASE_DIRECTORY "${PROJECT_SOURCE_DIR}"
|
||||
@ -186,8 +189,6 @@ set(INSTRUMENT_BANKS
|
||||
weapons/physcannon/energy_sing_loop4.ins
|
||||
)
|
||||
|
||||
set(JSOX "${PROJECT_SOURCE_DIR}/tools/sound/jsox.js")
|
||||
|
||||
# TODO: remove
|
||||
function(_add_sound_transform_command_direct SOUND_NAME ARGS OUTPUT_LIST)
|
||||
set(INPUT_FILE "${PAK_SOUND_DIR}/${SOUND_NAME}.wav")
|
||||
@ -218,27 +219,6 @@ function(_add_sound_transform_command_direct SOUND_NAME ARGS OUTPUT_LIST)
|
||||
return(PROPAGATE ${OUTPUT_LIST})
|
||||
endfunction()
|
||||
|
||||
function(_add_sound_transform_command SOUND_SCRIPT OUTPUT_LIST)
|
||||
cmake_path(
|
||||
REMOVE_EXTENSION SOUND_SCRIPT
|
||||
OUTPUT_VARIABLE SOUND_NAME
|
||||
)
|
||||
|
||||
# TODO: change output to PAK_MODIFIED_SOUND_DIR once makefile is no longer in use
|
||||
set(SOUND_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/${SOUND_SCRIPT}")
|
||||
set(INPUT_FILE "${PAK_SOUND_DIR}/${SOUND_NAME}.wav")
|
||||
set(OUTPUT_FILE "${CMAKE_BINARY_DIR}/${RELATIVE_CURRENT_DIR}/${SOUND_NAME}.wav")
|
||||
|
||||
if(SOUND_SCRIPT MATCHES ".*\.jsox")
|
||||
_add_sound_transform_command_jsox(${SOUND_SCRIPT} ${INPUT_FILE} ${OUTPUT_FILE})
|
||||
else()
|
||||
_add_sound_transform_command_sox(${SOUND_SCRIPT} ${INPUT_FILE} ${OUTPUT_FILE})
|
||||
endif()
|
||||
|
||||
list(APPEND ${OUTPUT_LIST} ${OUTPUT_FILE})
|
||||
return(PROPAGATE ${OUTPUT_LIST})
|
||||
endfunction()
|
||||
|
||||
function(_add_sound_transform_command_sox SOUND_SCRIPT INPUT_FILE OUTPUT_FILE)
|
||||
cmake_path(
|
||||
GET OUTPUT_FILE PARENT_PATH
|
||||
@ -274,6 +254,27 @@ function(_add_sound_transform_command_jsox SOUND_SCRIPT INPUT_FILE OUTPUT_FILE)
|
||||
)
|
||||
endfunction()
|
||||
|
||||
function(_add_sound_transform_command SOUND_SCRIPT OUTPUT_LIST)
|
||||
cmake_path(
|
||||
REMOVE_EXTENSION SOUND_SCRIPT
|
||||
OUTPUT_VARIABLE SOUND_NAME
|
||||
)
|
||||
|
||||
# TODO: change output to PAK_MODIFIED_SOUND_DIR once makefile is no longer in use
|
||||
set(SOUND_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/${SOUND_SCRIPT}")
|
||||
set(INPUT_FILE "${PAK_SOUND_DIR}/${SOUND_NAME}.wav")
|
||||
set(OUTPUT_FILE "${CMAKE_BINARY_DIR}/${RELATIVE_CURRENT_DIR}/${SOUND_NAME}.wav")
|
||||
|
||||
if(SOUND_SCRIPT MATCHES ".*\.jsox")
|
||||
_add_sound_transform_command_jsox(${SOUND_SCRIPT} ${INPUT_FILE} ${OUTPUT_FILE})
|
||||
else()
|
||||
_add_sound_transform_command_sox(${SOUND_SCRIPT} ${INPUT_FILE} ${OUTPUT_FILE})
|
||||
endif()
|
||||
|
||||
list(APPEND ${OUTPUT_LIST} ${OUTPUT_FILE})
|
||||
return(PROPAGATE ${OUTPUT_LIST})
|
||||
endfunction()
|
||||
|
||||
function(_add_music_transform_command MUSIC_SCRIPT OUTPUT_LIST)
|
||||
cmake_path(
|
||||
REMOVE_EXTENSION MUSIC_SCRIPT
|
||||
@ -337,8 +338,7 @@ endforeach()
|
||||
|
||||
function(_add_sound_convert_command INPUT_FILE OUTPUT_LIST)
|
||||
cmake_path(
|
||||
REPLACE_EXTENSION INPUT_FILE
|
||||
".aifc"
|
||||
REPLACE_EXTENSION INPUT_FILE ".aifc"
|
||||
OUTPUT_VARIABLE OUTPUT_FILE
|
||||
)
|
||||
|
||||
@ -366,8 +366,7 @@ foreach(TRANSFORMED_SOUND ${SOUNDS_TRANSFORMED})
|
||||
_add_sound_convert_command(${TRANSFORMED_SOUND} SOUNDS_CONVERTED)
|
||||
endforeach()
|
||||
|
||||
add_custom_target(
|
||||
all_sounds
|
||||
add_custom_target(sounds
|
||||
DEPENDS ${SOUNDS_CONVERTED}
|
||||
)
|
||||
|
||||
@ -375,8 +374,6 @@ add_custom_target(
|
||||
## Sound table generation ##
|
||||
############################
|
||||
|
||||
set(GEN_SOUND_IDS "${PROJECT_SOURCE_DIR}/tools/sound/generate_sound_ids.js")
|
||||
|
||||
set(SOUND_TABLE_DEPENDENCIES ${SOUNDS_CONVERTED})
|
||||
set(SOUND_TABLE_INPUTS "")
|
||||
|
||||
@ -401,8 +398,7 @@ foreach(CONVERTED_SOUND ${SOUNDS_CONVERTED})
|
||||
OUTPUT_VARIABLE INS_BANK
|
||||
)
|
||||
cmake_path(
|
||||
REPLACE_EXTENSION INS_BANK
|
||||
".ins"
|
||||
REPLACE_EXTENSION INS_BANK ".ins"
|
||||
OUTPUT_VARIABLE INS_BANK
|
||||
)
|
||||
|
||||
@ -416,11 +412,15 @@ endforeach()
|
||||
|
||||
set(SOUND_TABLE_SOUNDS "${CMAKE_BINARY_DIR}/${RELATIVE_CURRENT_DIR}/sounds.sounds")
|
||||
set(SOUND_TABLE_TBL "${CMAKE_BINARY_DIR}/${RELATIVE_CURRENT_DIR}/sounds.sounds.tbl")
|
||||
set(SOUND_DATA_TABLE_FILES
|
||||
${SOUND_TABLE_SOUNDS}
|
||||
${SOUND_TABLE_TBL}
|
||||
)
|
||||
add_custom_command(
|
||||
DEPENDS
|
||||
all_sounds ${SOUND_TABLE_DEPENDENCIES}
|
||||
${SOUND_TABLE_DEPENDENCIES}
|
||||
OUTPUT
|
||||
${SOUND_TABLE_SOUNDS} ${SOUND_TABLE_TBL}
|
||||
${SOUND_DATA_TABLE_FILES}
|
||||
COMMAND
|
||||
${SFZ2N64} -o ${SOUND_TABLE_SOUNDS} ${SOUND_TABLE_INPUTS}
|
||||
COMMENT
|
||||
@ -432,27 +432,34 @@ set(BUILD_AUDIO_DIR "${CMAKE_BINARY_DIR}/src/audio")
|
||||
set(CLIPS_H "${BUILD_AUDIO_DIR}/clips.h")
|
||||
set(LANGUAGES_H "${BUILD_AUDIO_DIR}/languages.h")
|
||||
set(LANGUAGES_C "${BUILD_AUDIO_DIR}/languages.c")
|
||||
set(SOUND_LOOKUP_TABLE_FILES
|
||||
${CLIPS_H}
|
||||
${LANGUAGES_H}
|
||||
${LANGUAGES_C}
|
||||
)
|
||||
add_custom_command(
|
||||
DEPENDS
|
||||
all_sounds ${GEN_SOUND_IDS} ${SOUND_TABLE_DEPENDENCIES}
|
||||
${GEN_SOUND_IDS} ${SOUND_TABLE_DEPENDENCIES}
|
||||
OUTPUT
|
||||
${CLIPS_H} ${LANGUAGES_H} ${LANGUAGES_C}
|
||||
${SOUND_LOOKUP_TABLE_FILES}
|
||||
COMMAND
|
||||
${NODEJS} ${GEN_SOUND_IDS} -o ${BUILD_AUDIO_DIR} -p SOUNDS_ ${SOUND_TABLE_INPUTS}
|
||||
WORKING_DIRECTORY
|
||||
# TODO: Update once script is refactored
|
||||
${PROJECT_SOURCE_DIR}
|
||||
COMMENT
|
||||
"Generating sound lookup tables"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
add_custom_target(
|
||||
sound_tables
|
||||
add_custom_target(sound_tables
|
||||
DEPENDS
|
||||
# Sound data
|
||||
${SOUND_TABLE_SOUNDS}
|
||||
${SOUND_TABLE_TBL}
|
||||
|
||||
# Lookup tables
|
||||
${CLIPS_H}
|
||||
${LANGUAGES_H}
|
||||
${LANGUAGES_C}
|
||||
${SOUND_DATA_TABLE_FILES}
|
||||
${SOUND_LOOKUP_TABLE_FILES}
|
||||
)
|
||||
|
||||
add_library(sound_lookup_tables INTERFACE)
|
||||
add_dependencies(sound_lookup_tables sound_tables)
|
||||
target_sources(sound_lookup_tables INTERFACE
|
||||
${SOUND_LOOKUP_TABLE_FILES}
|
||||
)
|
||||
|
@ -1,3 +1,22 @@
|
||||
set(EXPORT_LEVEL ${PROJECT_SOURCE_DIR}/tools/level_scripts/export_level.lua)
|
||||
set(EXPORT_SCRIPTS
|
||||
${EXPORT_LEVEL}
|
||||
${PROJECT_SOURCE_DIR}/tools/level_scripts/animation.lua
|
||||
${PROJECT_SOURCE_DIR}/tools/level_scripts/collision_export.lua
|
||||
${PROJECT_SOURCE_DIR}/tools/level_scripts/dynamic_collision_export.lua
|
||||
${PROJECT_SOURCE_DIR}/tools/level_scripts/entities.lua
|
||||
${PROJECT_SOURCE_DIR}/tools/level_scripts/portal_surfaces.lua
|
||||
${PROJECT_SOURCE_DIR}/tools/level_scripts/room_export.lua
|
||||
${PROJECT_SOURCE_DIR}/tools/level_scripts/signals.lua
|
||||
${PROJECT_SOURCE_DIR}/tools/level_scripts/static_export.lua
|
||||
${PROJECT_SOURCE_DIR}/tools/level_scripts/trigger.lua
|
||||
${PROJECT_SOURCE_DIR}/tools/level_scripts/util.lua
|
||||
${PROJECT_SOURCE_DIR}/tools/level_scripts/world.lua
|
||||
${PROJECT_SOURCE_DIR}/tools/level_scripts/yaml_loader.lua
|
||||
)
|
||||
|
||||
set(GEN_LEVEL_LIST "${PROJECT_SOURCE_DIR}/tools/models/generate_level_list.js")
|
||||
|
||||
cmake_path(
|
||||
RELATIVE_PATH CMAKE_CURRENT_SOURCE_DIR
|
||||
BASE_DIRECTORY "${PROJECT_SOURCE_DIR}"
|
||||
@ -26,25 +45,6 @@ set(LEVEL_MATERIALS
|
||||
${ASSETS_DIR}/materials/static.skm.yaml
|
||||
)
|
||||
|
||||
set(EXPORT_LEVEL ${PROJECT_SOURCE_DIR}/tools/level_scripts/export_level.lua)
|
||||
set(EXPORT_SCRIPTS
|
||||
${EXPORT_LEVEL}
|
||||
${PROJECT_SOURCE_DIR}/tools/level_scripts/animation.lua
|
||||
${PROJECT_SOURCE_DIR}/tools/level_scripts/collision_export.lua
|
||||
${PROJECT_SOURCE_DIR}/tools/level_scripts/dynamic_collision_export.lua
|
||||
${PROJECT_SOURCE_DIR}/tools/level_scripts/entities.lua
|
||||
${PROJECT_SOURCE_DIR}/tools/level_scripts/portal_surfaces.lua
|
||||
${PROJECT_SOURCE_DIR}/tools/level_scripts/room_export.lua
|
||||
${PROJECT_SOURCE_DIR}/tools/level_scripts/signals.lua
|
||||
${PROJECT_SOURCE_DIR}/tools/level_scripts/static_export.lua
|
||||
${PROJECT_SOURCE_DIR}/tools/level_scripts/trigger.lua
|
||||
${PROJECT_SOURCE_DIR}/tools/level_scripts/util.lua
|
||||
${PROJECT_SOURCE_DIR}/tools/level_scripts/world.lua
|
||||
${PROJECT_SOURCE_DIR}/tools/level_scripts/yaml_loader.lua
|
||||
)
|
||||
|
||||
set(GEN_LEVEL_LIST "${PROJECT_SOURCE_DIR}/tools/models/generate_level_list.js")
|
||||
|
||||
function(_add_level_export_command LEVEL_NAME OUTPUT_VARIABLE)
|
||||
set(INPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${LEVEL_NAME}/${LEVEL_NAME}.blend")
|
||||
set(OUTPUT_FILE "${CMAKE_BINARY_DIR}/${RELATIVE_CURRENT_DIR}/${LEVEL_NAME}/${LEVEL_NAME}.fbx")
|
||||
@ -82,6 +82,10 @@ function(_add_level_generate_command LEVEL_NAME LEVEL_FBX OUTPUT_LIST)
|
||||
|
||||
set(OUTPUT_FILE_H "${OUTPUT_FILE_NO_EXTENSION}.h")
|
||||
set(OUTPUT_FILE_GEO_C "${OUTPUT_FILE_NO_EXTENSION}_geo.c")
|
||||
set(OUTPUT_FILES
|
||||
${OUTPUT_FILE_H}
|
||||
${OUTPUT_FILE_GEO_C}
|
||||
)
|
||||
|
||||
# TODO: not all levels have animations
|
||||
# set(OUTPUT_FILE_ANIM_C "${OUTPUT_FILE_NO_EXTENSION}_anim.c")
|
||||
@ -97,7 +101,7 @@ function(_add_level_generate_command LEVEL_NAME LEVEL_FBX OUTPUT_LIST)
|
||||
DEPENDS
|
||||
${EXPORT_SCRIPTS} ${LEVEL_FBX} ${LEVEL_YAML} ${LEVEL_MATERIALS}
|
||||
OUTPUT
|
||||
${OUTPUT_FILE_H} ${OUTPUT_FILE_GEO_C} ${OUTPUT_FILE_ANIM_C}
|
||||
${OUTPUT_FILES}
|
||||
COMMAND
|
||||
${SKELETOOL64}
|
||||
--script ${EXPORT_LEVEL}
|
||||
@ -114,11 +118,7 @@ function(_add_level_generate_command LEVEL_NAME LEVEL_FBX OUTPUT_LIST)
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
list(APPEND ${OUTPUT_LIST}
|
||||
${OUTPUT_FILE_H}
|
||||
${OUTPUT_FILE_GEO_C}
|
||||
${OUTPUT_FILE_ANIM_C}
|
||||
)
|
||||
list(APPEND ${OUTPUT_LIST} ${OUTPUT_FILES})
|
||||
return(PROPAGATE ${OUTPUT_LIST})
|
||||
endfunction()
|
||||
|
||||
@ -131,8 +131,7 @@ foreach(LEVEL ${LEVELS})
|
||||
_add_level_generate_command(${LEVEL} ${LEVEL_FBX} LEVEL_GENERATED_FILES)
|
||||
endforeach()
|
||||
|
||||
add_custom_target(
|
||||
all_levels
|
||||
add_custom_target(generated_levels
|
||||
DEPENDS ${LEVEL_GENERATED_FILES}
|
||||
)
|
||||
|
||||
@ -158,7 +157,16 @@ add_custom_command(
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
add_custom_target(
|
||||
level_list
|
||||
add_custom_target(level_list
|
||||
DEPENDS ${LEVEL_LIST}
|
||||
)
|
||||
|
||||
add_library(levels INTERFACE)
|
||||
add_dependencies(levels
|
||||
generated_levels
|
||||
level_list
|
||||
)
|
||||
target_sources(levels INTERFACE
|
||||
${LEVEL_GENERATED_FILES}
|
||||
${LEVEL_LIST}
|
||||
)
|
||||
|
@ -7,9 +7,12 @@ target_include_directories(portal PRIVATE
|
||||
)
|
||||
|
||||
# Generated code
|
||||
add_dependencies(portal
|
||||
target_link_libraries(portal
|
||||
levels
|
||||
materials
|
||||
sound_tables
|
||||
models
|
||||
sound_lookup_tables
|
||||
)
|
||||
|
||||
# TODO: rework when including models in compilation
|
||||
level_list
|
||||
|
@ -54,7 +54,9 @@ function formatSoundName(soundFilename, index) {
|
||||
}
|
||||
|
||||
function formatFile(outputFilename, soundFilenames) {
|
||||
const defineName = outputFilename.replace(invalidCharactersRegex, '_').toUpperCase();
|
||||
const relativeOutput = path.relative(process.cwd(), outputFilename);
|
||||
const defineName = relativeOutput.replace(invalidCharactersRegex, '_').toUpperCase();
|
||||
|
||||
return `#ifndef ${defineName}
|
||||
#define ${defineName}
|
||||
|
||||
|
@ -37,7 +37,6 @@ function(_add_vpk_extract_command VPK_LIST OUTPUT_LIST)
|
||||
MAIN_VPK_NAME
|
||||
)
|
||||
set(MAIN_VPK_STAMP "${PAK_DIR}/${MAIN_VPK_NAME}.stamp")
|
||||
list(APPEND VPK_STAMP_FILES ${MAIN_VPK_STAMP})
|
||||
|
||||
add_custom_command(
|
||||
DEPENDS
|
||||
@ -65,7 +64,6 @@ _add_vpk_extract_command(VPKS_PORTAL VPK_STAMP_FILES)
|
||||
_add_vpk_extract_command(VPKS_HL2_MISC VPK_STAMP_FILES)
|
||||
_add_vpk_extract_command(VPKS_HL2_SOUND_MISC VPK_STAMP_FILES)
|
||||
|
||||
add_custom_target(
|
||||
extract_vpks
|
||||
add_custom_target(extract_vpks
|
||||
DEPENDS ${VPK_STAMP_FILES}
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user