Add support for import files

This will check and copy import files whenever we regenerate the build system
This commit is contained in:
Vincent Stumpf 2023-04-22 20:57:14 +00:00
parent b3c47f043e
commit e1b9b0d9b3
4 changed files with 136 additions and 0 deletions

22
3rdparty/cmake/CopyImportFiles.cmake vendored Normal file
View File

@ -0,0 +1,22 @@
function(copy_import_files SRC_DIR DST_DIR FILE_LIST)
file(MAKE_DIRECTORY ${DST_DIR})
file(GLOB FILES_IMPORTED
LIST_DIRECTORIES false
RELATIVE ${DST_DIR}/ ${DST_DIR}/*)
# message("files to import are: " "${FILE_LIST}")
# message("Already made fs are: " "${FILES_IMPORTED}")
list(REMOVE_ITEM FILE_LIST ${FILES_IMPORTED})
# message(" rest of files are: " ${FILE_LIST})
foreach(FILE ${FILE_LIST})
message("Importing ${FILE}")
file(COPY ${SRC_DIR}/${FILE} DESTINATION ${DST_DIR})
endforeach()
endfunction()

View File

@ -58,5 +58,12 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib/${suffixInsta
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
# For windows, we need to copy scripts over
if (WIN32)
endif()
add_subdirectory(db)
add_subdirectory(conf)
add_subdirectory(3rdparty)
add_subdirectory(src)

35
conf/CMakeLists.txt Normal file
View File

@ -0,0 +1,35 @@
include(CopyImportFiles)
set(CONF_FILES_TO_IMPORT
"atcommands.yml"
"battle_conf.txt"
"char_conf.txt"
"groups.yml"
"inter_conf.txt"
"inter_server.yml"
"log_conf.txt"
"login_conf.txt"
"map_conf.txt"
"packet_conf.txt"
"script_conf.txt"
"web_conf.txt")
copy_import_files(${CMAKE_CURRENT_SOURCE_DIR}/import-tmpl/
${CMAKE_CURRENT_SOURCE_DIR}/import
"${CONF_FILES_TO_IMPORT}")
set(MSG_FILES_TO_IMPORT
"map_msg_chn_conf.txt"
"map_msg_eng_conf.txt"
"map_msg_frn_conf.txt"
"map_msg_grm_conf.txt"
"map_msg_idn_conf.txt"
"map_msg_mal_conf.txt"
"map_msg_por_conf.txt"
"map_msg_rus_conf.txt"
"map_msg_spn_conf.txt"
"map_msg_tha_conf.txt")
copy_import_files(${CMAKE_CURRENT_SOURCE_DIR}/msg_conf/import-tmpl/
${CMAKE_CURRENT_SOURCE_DIR}/msg_conf/import
"${MSG_FILES_TO_IMPORT}")

72
db/CMakeLists.txt Normal file
View File

@ -0,0 +1,72 @@
include(CopyImportFiles)
# Why do we list all the files instead of using glob?
# This way, if we add a new file, the build system will know to regenerate
# and the new file will be copied over.
set(DB_FILES_TO_IMPORT
"abra_db.yml"
"achievement_db.yml"
"achievement_level_db.yml"
"attendance.yml"
"attr_fix.yml"
"battleground_db.yml"
"captcha_db.yml"
"castle_db.yml"
"const.yml"
"create_arrow_db.yml"
"elemental_db.yml"
"enchantgrade.yml"
"exp_guild.yml"
"exp_homun.yml"
"guild_skill_tree.yml"
"homunculus_db.yml"
"instance_db.yml"
"item_cash.yml"
"item_combos.yml"
"item_db.yml"
"item_enchant.yml"
"item_group_db.yml"
"item_noequip.txt"
"item_packages.yml"
"item_randomopt_db.yml"
"item_randomopt_group.yml"
"item_reform.yml"
"job_noenter_map.txt"
"job_stats.yml"
"laphine_synthesis.yml"
"laphine_upgrade.yml"
"level_penalty.yml"
"magicmushroom_db.yml"
"map_cache.dat"
"map_drops.yml"
"map_index.txt"
"mercenary_db.yml"
"mob_avail.yml"
"mob_chat_db.yml"
"mob_db.yml"
"mob_item_ratio.yml"
"mob_skill_db.txt"
"mob_summon.yml"
"pet_db.yml"
"produce_db.txt"
"quest_db.yml"
"refine.yml"
"reputation_group.yml"
"reputation.yml"
"size_fix.yml"
"skill_changematerial_db.txt"
"skill_damage_db.txt"
"skill_db.yml"
"skill_nocast_db.txt"
"skill_tree.yml"
"spellbook_db.yml"
"statpoint.yml"
"status_disabled.txt"
"status.yml"
"stylist.yml"
)
copy_import_files(${CMAKE_CURRENT_SOURCE_DIR}/import-tmpl/
${CMAKE_CURRENT_SOURCE_DIR}/import
"${DB_FILES_TO_IMPORT}")