From 2fb6a30b23c5a5bfa21736cfac3141022baf0c8b Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 9 Feb 2025 19:05:01 +0100 Subject: [PATCH] Refactor: Build generated DNA files as C++ Pull Request: https://projects.blender.org/blender/blender/pulls/134469 --- source/blender/makesdna/DNA_genfile.h | 8 -------- source/blender/makesdna/intern/CMakeLists.txt | 18 +++++++++--------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/source/blender/makesdna/DNA_genfile.h b/source/blender/makesdna/DNA_genfile.h index 186d1fdb887..aaee664a2ec 100644 --- a/source/blender/makesdna/DNA_genfile.h +++ b/source/blender/makesdna/DNA_genfile.h @@ -13,10 +13,6 @@ struct SDNA; -#ifdef __cplusplus -extern "C" { -#endif - /** * 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 @@ -254,7 +250,3 @@ void DNA_sdna_alias_data_ensure_structs_map(struct SDNA *sdna); # define DNA_struct_member_exists(sdna, stype, vartype, name) \ DNA_struct_member_exists_with_alias(sdna, stype, vartype, name) #endif - -#ifdef __cplusplus -} -#endif diff --git a/source/blender/makesdna/intern/CMakeLists.txt b/source/blender/makesdna/intern/CMakeLists.txt index 85fba24977a..399c406dabd 100644 --- a/source/blender/makesdna/intern/CMakeLists.txt +++ b/source/blender/makesdna/intern/CMakeLists.txt @@ -98,18 +98,18 @@ if(WIN32 AND NOT UNIX) endif() endif() -# Output dna.c +# Output dna.cc add_custom_command( 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_verify.c + ${CMAKE_CURRENT_BINARY_DIR}/dna_verify.cc COMMAND ${CMAKE_COMMAND} -E env ${PLATFORM_ENV_BUILD} "$" - ${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_verify.c + ${CMAKE_CURRENT_BINARY_DIR}/dna_verify.cc ${CMAKE_SOURCE_DIR}/source/blender/makesdna/ DEPENDS makesdna ) @@ -121,8 +121,8 @@ set(SRC dna_defaults.c dna_genfile.cc dna_utils.cc - ${CMAKE_CURRENT_BINARY_DIR}/dna.c - ${CMAKE_CURRENT_BINARY_DIR}/dna_verify.c + ${CMAKE_CURRENT_BINARY_DIR}/dna.cc + ${CMAKE_CURRENT_BINARY_DIR}/dna_verify.cc ${SRC_DNA_INC} ${CMAKE_CURRENT_BINARY_DIR}/dna_type_offsets.h @@ -131,9 +131,9 @@ set(SRC ) 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_verify.c + ${CMAKE_CURRENT_BINARY_DIR}/dna_verify.cc PROPERTIES GENERATED TRUE )