Refactor: Build generated DNA files as C++

Pull Request: https://projects.blender.org/blender/blender/pulls/134469
This commit is contained in:
Brecht Van Lommel
2025-02-09 19:05:01 +01:00
parent 83c94c6537
commit 2fb6a30b23
2 changed files with 9 additions and 17 deletions

View File

@@ -13,10 +13,6 @@
struct SDNA; struct SDNA;
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* DNAstr contains the prebuilt SDNA structure defining the layouts of the types * DNAstr contains the prebuilt SDNA structure defining the layouts of the types
* used by this version of Blender. It is defined in a file dna.c, which is * used by this version of Blender. It is defined in a file dna.c, which is
@@ -254,7 +250,3 @@ void DNA_sdna_alias_data_ensure_structs_map(struct SDNA *sdna);
# define DNA_struct_member_exists(sdna, stype, vartype, name) \ # define DNA_struct_member_exists(sdna, stype, vartype, name) \
DNA_struct_member_exists_with_alias(sdna, stype, vartype, name) DNA_struct_member_exists_with_alias(sdna, stype, vartype, name)
#endif #endif
#ifdef __cplusplus
}
#endif

View File

@@ -98,18 +98,18 @@ if(WIN32 AND NOT UNIX)
endif() endif()
endif() endif()
# Output dna.c # Output dna.cc
add_custom_command( add_custom_command(
OUTPUT OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/dna.c ${CMAKE_CURRENT_BINARY_DIR}/dna.cc
${CMAKE_CURRENT_BINARY_DIR}/dna_type_offsets.h ${CMAKE_CURRENT_BINARY_DIR}/dna_type_offsets.h
${CMAKE_CURRENT_BINARY_DIR}/dna_verify.c ${CMAKE_CURRENT_BINARY_DIR}/dna_verify.cc
COMMAND COMMAND
${CMAKE_COMMAND} -E env ${PLATFORM_ENV_BUILD} ${CMAKE_COMMAND} -E env ${PLATFORM_ENV_BUILD}
"$<TARGET_FILE:makesdna>" "$<TARGET_FILE:makesdna>"
${CMAKE_CURRENT_BINARY_DIR}/dna.c ${CMAKE_CURRENT_BINARY_DIR}/dna.cc
${CMAKE_CURRENT_BINARY_DIR}/dna_type_offsets.h ${CMAKE_CURRENT_BINARY_DIR}/dna_type_offsets.h
${CMAKE_CURRENT_BINARY_DIR}/dna_verify.c ${CMAKE_CURRENT_BINARY_DIR}/dna_verify.cc
${CMAKE_SOURCE_DIR}/source/blender/makesdna/ ${CMAKE_SOURCE_DIR}/source/blender/makesdna/
DEPENDS makesdna DEPENDS makesdna
) )
@@ -121,8 +121,8 @@ set(SRC
dna_defaults.c dna_defaults.c
dna_genfile.cc dna_genfile.cc
dna_utils.cc dna_utils.cc
${CMAKE_CURRENT_BINARY_DIR}/dna.c ${CMAKE_CURRENT_BINARY_DIR}/dna.cc
${CMAKE_CURRENT_BINARY_DIR}/dna_verify.c ${CMAKE_CURRENT_BINARY_DIR}/dna_verify.cc
${SRC_DNA_INC} ${SRC_DNA_INC}
${CMAKE_CURRENT_BINARY_DIR}/dna_type_offsets.h ${CMAKE_CURRENT_BINARY_DIR}/dna_type_offsets.h
@@ -131,9 +131,9 @@ set(SRC
) )
set_source_files_properties( set_source_files_properties(
${CMAKE_CURRENT_BINARY_DIR}/dna.c ${CMAKE_CURRENT_BINARY_DIR}/dna.cc
${CMAKE_CURRENT_BINARY_DIR}/dna_type_offsets.h ${CMAKE_CURRENT_BINARY_DIR}/dna_type_offsets.h
${CMAKE_CURRENT_BINARY_DIR}/dna_verify.c ${CMAKE_CURRENT_BINARY_DIR}/dna_verify.cc
PROPERTIES GENERATED TRUE PROPERTIES GENERATED TRUE
) )