makesdna: centralize DNA header list.

There's currently 4 places that need to be edited when adding
a DNA header, and as you can imagine, this has gotten out of
sync quite a bit.

source/blender/CMakeLists.txt - 84 headers
source/blender/makesdna/intern/CMakeLists.txt - 33 headers
source/blender/makesdna/intern/makesdna.c@includefiles - 77 headers
source/blender/makesdna/intern/makesdna.c@Disabletypes - 76 headers

This diff makes source/blender/CMakeLists.txt the only place
where we need to keep track of dna headers, less maintenance
less mistakes. For all old places there is now a comment reminding
people of the new location.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D13048
This commit is contained in:
Ray molenkamp 2022-05-18 15:09:19 -06:00
parent 699944572f
commit 89ccff62d2
Notes: blender-bot 2023-02-14 09:02:41 +01:00
Referenced by issue #98444, Regression: image.save_render() command changes color profile and file type when saving.
3 changed files with 58 additions and 194 deletions

View File

@ -89,6 +89,42 @@ set(SRC_DNA_INC
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_xr_types.h
)
set(SRC_DNA_DEFAULTS_INC
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_armature_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_asset_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_brush_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_cachefile_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_camera_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_collection_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_curves_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_curve_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_fluid_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_gpencil_modifier_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_image_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_lattice_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_lightprobe_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_light_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_linestyle_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_material_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_mesh_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_meta_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_modifier_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_movieclip_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_object_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_particle_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_pointcloud_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_scene_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_simulation_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_space_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_speaker_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_texture_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_vec_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_view3d_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_volume_defaults.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_world_defaults.h
)
add_subdirectory(datatoc)
add_subdirectory(editors)
add_subdirectory(windowmanager)

View File

@ -13,6 +13,19 @@ blender_include_dirs(
..
)
set(dna_header_include_file "${CMAKE_CURRENT_BINARY_DIR}/dna_includes_all.h")
set(dna_header_string_file "${CMAKE_CURRENT_BINARY_DIR}/dna_includes_as_strings.h")
set(DNA_INCLUDE_TEXT "/* Do not edit manually, changes will be overwritten. */\n")
set(DNA_FILE_LIST "/* Do not edit manually, changes will be overwritten. */\n")
foreach(header ${SRC_DNA_INC})
get_filename_component(dna_header_file ${header} NAME)
string(APPEND DNA_INCLUDE_TEXT "#include \"${header}\"\n")
string(APPEND DNA_FILE_LIST "\t\"${dna_header_file}\",\n")
endforeach()
file(GENERATE OUTPUT ${dna_header_include_file} CONTENT "${DNA_INCLUDE_TEXT}")
file(GENERATE OUTPUT ${dna_header_string_file} CONTENT "${DNA_FILE_LIST}")
# -----------------------------------------------------------------------------
# Build makesdna executable
@ -29,6 +42,8 @@ set(SRC
../../../../intern/guardedalloc/intern/mallocn.c
../../../../intern/guardedalloc/intern/mallocn_guarded_impl.c
../../../../intern/guardedalloc/intern/mallocn_lockfree_impl.c
${dna_header_include_file}
${dna_header_string_file}
)
# SRC_DNA_INC is defined in the parent dir
@ -115,40 +130,7 @@ set(SRC
../../blenlib/intern/hash_mm2a.c
../../blenlib/intern/listbase.c
../DNA_armature_defaults.h
../DNA_asset_defaults.h
../DNA_brush_defaults.h
../DNA_cachefile_defaults.h
../DNA_camera_defaults.h
../DNA_collection_defaults.h
../DNA_curve_defaults.h
../DNA_curves_defaults.h
../DNA_defaults.h
../DNA_fluid_defaults.h
../DNA_gpencil_modifier_defaults.h
../DNA_image_defaults.h
../DNA_lattice_defaults.h
../DNA_light_defaults.h
../DNA_lightprobe_defaults.h
../DNA_linestyle_defaults.h
../DNA_material_defaults.h
../DNA_mesh_defaults.h
../DNA_meta_defaults.h
../DNA_modifier_defaults.h
../DNA_modifier_types.h
../DNA_movieclip_defaults.h
../DNA_object_defaults.h
../DNA_particle_defaults.h
../DNA_pointcloud_defaults.h
../DNA_scene_defaults.h
../DNA_simulation_defaults.h
../DNA_space_defaults.h
../DNA_speaker_defaults.h
../DNA_texture_defaults.h
../DNA_vec_defaults.h
../DNA_view3d_defaults.h
../DNA_volume_defaults.h
../DNA_world_defaults.h
${SRC_DNA_DEFAULTS_INC}
)
set(LIB

View File

@ -43,91 +43,10 @@
#define SDNA_MAX_FILENAME_LENGTH 255
/* Included the path relative from /source/blender/ here,
* so we can move headers around with more freedom. */
/* The include file below is automatically generated from the SRC_DNA_INC
+ * variable in 'source/blender/CMakeLists.txt'. */
static const char *includefiles[] = {
/* if you add files here, please add them at the end
* of makesdna.c (this file) as well */
"DNA_listBase.h",
"DNA_vec_types.h",
"DNA_ID.h",
"DNA_ipo_types.h",
"DNA_key_types.h",
"DNA_text_types.h",
"DNA_packedFile_types.h",
"DNA_gpu_types.h",
"DNA_camera_types.h",
"DNA_image_types.h",
"DNA_texture_types.h",
"DNA_light_types.h",
"DNA_material_types.h",
"DNA_vfont_types.h",
"DNA_meta_types.h",
"DNA_curve_types.h",
"DNA_mesh_types.h",
"DNA_meshdata_types.h",
"DNA_modifier_types.h",
"DNA_lineart_types.h",
"DNA_lattice_types.h",
"DNA_object_types.h",
"DNA_object_force_types.h",
"DNA_object_fluidsim_types.h",
"DNA_world_types.h",
"DNA_scene_types.h",
"DNA_view3d_types.h",
"DNA_view2d_types.h",
"DNA_space_types.h",
"DNA_userdef_types.h",
"DNA_screen_types.h",
"DNA_sdna_types.h",
"DNA_fileglobal_types.h",
"DNA_sequence_types.h",
"DNA_session_uuid_types.h",
"DNA_effect_types.h",
"DNA_outliner_types.h",
"DNA_sound_types.h",
"DNA_collection_types.h",
"DNA_armature_types.h",
"DNA_action_types.h",
"DNA_constraint_types.h",
"DNA_nla_types.h",
"DNA_node_types.h",
"DNA_color_types.h",
"DNA_brush_types.h",
"DNA_customdata_types.h",
"DNA_particle_types.h",
"DNA_cloth_types.h",
"DNA_gpencil_types.h",
"DNA_gpencil_modifier_types.h",
"DNA_shader_fx_types.h",
"DNA_windowmanager_types.h",
"DNA_anim_types.h",
"DNA_boid_types.h",
"DNA_fluid_types.h",
"DNA_speaker_types.h",
"DNA_movieclip_types.h",
"DNA_tracking_types.h",
"DNA_dynamicpaint_types.h",
"DNA_mask_types.h",
"DNA_rigidbody_types.h",
"DNA_freestyle_types.h",
"DNA_linestyle_types.h",
"DNA_cachefile_types.h",
"DNA_layer_types.h",
"DNA_workspace_types.h",
"DNA_lightprobe_types.h",
"DNA_curveprofile_types.h",
"DNA_xr_types.h",
"DNA_curves_types.h",
"DNA_pointcloud_types.h",
"DNA_volume_types.h",
"DNA_simulation_types.h",
"DNA_pointcache_types.h",
"DNA_uuid_types.h",
"DNA_asset_types.h",
/* see comment above before editing! */
#include "dna_includes_as_strings.h"
/* empty string to indicate end of includefiles */
"",
};
@ -1617,82 +1536,9 @@ int main(int argc, char **argv)
# pragma GCC poison long
#endif
#include "DNA_ID.h"
#include "DNA_action_types.h"
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
#include "DNA_asset_types.h"
#include "DNA_boid_types.h"
#include "DNA_brush_types.h"
#include "DNA_cachefile_types.h"
#include "DNA_camera_types.h"
#include "DNA_cloth_types.h"
#include "DNA_collection_types.h"
#include "DNA_color_types.h"
#include "DNA_constraint_types.h"
#include "DNA_curve_types.h"
#include "DNA_curveprofile_types.h"
#include "DNA_curves_types.h"
#include "DNA_customdata_types.h"
#include "DNA_dynamicpaint_types.h"
#include "DNA_effect_types.h"
#include "DNA_fileglobal_types.h"
#include "DNA_fluid_types.h"
#include "DNA_freestyle_types.h"
#include "DNA_gpencil_modifier_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_image_types.h"
#include "DNA_ipo_types.h"
#include "DNA_key_types.h"
#include "DNA_lattice_types.h"
#include "DNA_layer_types.h"
#include "DNA_light_types.h"
#include "DNA_lightprobe_types.h"
#include "DNA_lineart_types.h"
#include "DNA_linestyle_types.h"
#include "DNA_listBase.h"
#include "DNA_mask_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_meta_types.h"
#include "DNA_modifier_types.h"
#include "DNA_movieclip_types.h"
#include "DNA_nla_types.h"
#include "DNA_node_types.h"
#include "DNA_object_fluidsim_types.h"
#include "DNA_object_force_types.h"
#include "DNA_object_types.h"
#include "DNA_outliner_types.h"
#include "DNA_packedFile_types.h"
#include "DNA_particle_types.h"
#include "DNA_pointcache_types.h"
#include "DNA_pointcloud_types.h"
#include "DNA_rigidbody_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_sdna_types.h"
#include "DNA_sequence_types.h"
#include "DNA_session_uuid_types.h"
#include "DNA_shader_fx_types.h"
#include "DNA_simulation_types.h"
#include "DNA_sound_types.h"
#include "DNA_space_types.h"
#include "DNA_speaker_types.h"
#include "DNA_text_types.h"
#include "DNA_texture_types.h"
#include "DNA_tracking_types.h"
#include "DNA_userdef_types.h"
#include "DNA_uuid_types.h"
#include "DNA_vec_types.h"
#include "DNA_vfont_types.h"
#include "DNA_view2d_types.h"
#include "DNA_view3d_types.h"
#include "DNA_volume_types.h"
#include "DNA_windowmanager_types.h"
#include "DNA_workspace_types.h"
#include "DNA_world_types.h"
#include "DNA_xr_types.h"
/* The include file below is automatically generated from the SRC_DNA_INC
* variable in 'source/blender/CMakeLists.txt'. */
#include "dna_includes_all.h"
/* end of list */