[Bf-blender-cvs] [92d77b2] master: makesrna: move extern prototypes into own header

Campbell Barton noreply at git.blender.org
Thu Mar 12 14:05:40 CET 2015


Commit: 92d77b250ee11dcbace4eaa4464bf4a7e13627ec
Author: Campbell Barton
Date:   Fri Mar 13 00:03:01 2015 +1100
Branches: master
https://developer.blender.org/rB92d77b250ee11dcbace4eaa4464bf4a7e13627ec

makesrna: move extern prototypes into own header

Patch T36049 by @jeske

===================================================================

M	source/blender/makesrna/intern/CMakeLists.txt
M	source/blender/makesrna/intern/makesrna.c

===================================================================

diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index ec82fca..fa7fd6d 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -124,6 +124,9 @@ set(APISRC
 )
 
 string(REGEX REPLACE "rna_([a-zA-Z0-9_-]*).c" "${CMAKE_CURRENT_BINARY_DIR}/rna_\\1_gen.c" GENSRC "${DEFSRC}")
+list(APPEND GENSRC
+	"${CMAKE_CURRENT_BINARY_DIR}/rna_prototypes_gen.h"
+)
 set_source_files_properties(${GENSRC} PROPERTIES GENERATED TRUE)
 
 # --------------------------
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index 14c3986..e007541 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -3372,7 +3372,9 @@ static void rna_generate(BlenderRNA *brna, FILE *f, const char *filename, const
 	fprintf(f, "#include \"RNA_types.h\"\n");
 	fprintf(f, "#include \"rna_internal.h\"\n\n");
 
-	rna_generate_prototypes(brna, f);
+
+	/* include the generated prototypes header */
+	fprintf(f, "#include \"rna_prototypes_gen.h\"\n\n");
 
 	fprintf(f, "#include \"%s\"\n", filename);
 	if (api_filename)
@@ -3967,6 +3969,26 @@ static int rna_preprocess(const char *outfile)
 
 	status = (DefRNA.error != 0);
 
+	/* create rna prototype header file */
+	strcpy(deffile, outfile);
+	strcat(deffile, "rna_prototypes_gen.h");
+	if (status) {
+		make_bad_file(deffile, __LINE__);
+	}
+	file = fopen(deffile, "w");
+	if (!file) {
+		fprintf(stderr, "Unable to open file: %s\n", deffile);
+		status = 1;
+	}
+	else {
+		fprintf(file,
+		    "/* Automatically generated function declarations for the Data API.\n"
+		    " * Do not edit manually, changes will be overwritten.              */\n\n");
+		rna_generate_prototypes(brna, file);
+		fclose(file);
+		status = (DefRNA.error != 0);
+	}
+
 	/* create rna_gen_*.c files */
 	for (i = 0; PROCESS_ITEMS[i].filename; i++) {
 		strcpy(deffile, outfile);




More information about the Bf-blender-cvs mailing list