[Bf-blender-cvs] [5b0c1be87f0] temp-gpencil-io: GPencil: Add compiler flags for new libraries
Antonio Vazquez
noreply at git.blender.org
Wed Feb 10 15:44:23 CET 2021
Commit: 5b0c1be87f0c8426d9b005057d89fb0a7a924088
Author: Antonio Vazquez
Date: Wed Feb 10 15:44:19 2021 +0100
Branches: temp-gpencil-io
https://developer.blender.org/rB5b0c1be87f0c8426d9b005057d89fb0a7a924088
GPencil: Add compiler flags for new libraries
This makes the code compilable when the libraries are disabled.
===================================================================
M source/blender/editors/io/CMakeLists.txt
M source/blender/editors/io/io_gpencil.h
M source/blender/editors/io/io_gpencil_export.c
M source/blender/editors/io/io_ops.c
M source/blender/io/gpencil/CMakeLists.txt
===================================================================
diff --git a/source/blender/editors/io/CMakeLists.txt b/source/blender/editors/io/CMakeLists.txt
index 3ff06fda6a7..d45c7ca9b75 100644
--- a/source/blender/editors/io/CMakeLists.txt
+++ b/source/blender/editors/io/CMakeLists.txt
@@ -84,6 +84,14 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
+if(WITH_PUGIXML)
+ add_definitions(-DWITH_PUGIXML)
+endif()
+
+if(WITH_HARU)
+ add_definitions(-DWITH_HARU)
+endif()
+
list(APPEND LIB bf_gpencil)
blender_add_lib(bf_editor_io "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/io/io_gpencil.h b/source/blender/editors/io/io_gpencil.h
index 21219d551b7..98cb8b13310 100644
--- a/source/blender/editors/io/io_gpencil.h
+++ b/source/blender/editors/io/io_gpencil.h
@@ -32,8 +32,12 @@ struct wmOperatorType;
void WM_OT_gpencil_import_svg(struct wmOperatorType *ot);
+#ifdef WITH_PUGIXML
void WM_OT_gpencil_export_svg(struct wmOperatorType *ot);
+#endif
+#ifdef WITH_HARU
void WM_OT_gpencil_export_pdf(struct wmOperatorType *ot);
+#endif
struct ARegion *get_invoke_region(struct bContext *C);
struct View3D *get_invoke_view3d(struct bContext *C);
diff --git a/source/blender/editors/io/io_gpencil_export.c b/source/blender/editors/io/io_gpencil_export.c
index a3f07ec97d0..9c409ccf3ff 100644
--- a/source/blender/editors/io/io_gpencil_export.c
+++ b/source/blender/editors/io/io_gpencil_export.c
@@ -59,36 +59,6 @@
#include "gpencil_io.h"
-static bool wm_gpencil_export_svg_common_check(bContext *UNUSED(C), wmOperator *op)
-{
-
- char filepath[FILE_MAX];
- RNA_string_get(op->ptr, "filepath", filepath);
-
- if (!BLI_path_extension_check(filepath, ".svg")) {
- BLI_path_extension_ensure(filepath, FILE_MAX, ".svg");
- RNA_string_set(op->ptr, "filepath", filepath);
- return true;
- }
-
- return false;
-}
-
-static bool wm_gpencil_export_pdf_common_check(bContext *UNUSED(C), wmOperator *op)
-{
-
- char filepath[FILE_MAX];
- RNA_string_get(op->ptr, "filepath", filepath);
-
- if (!BLI_path_extension_check(filepath, ".pdf")) {
- BLI_path_extension_ensure(filepath, FILE_MAX, ".pdf");
- RNA_string_set(op->ptr, "filepath", filepath);
- return true;
- }
-
- return false;
-}
-
static void ui_gpencil_export_common_settings(uiLayout *layout, PointerRNA *imfptr)
{
uiLayout *box, *row, *col, *sub;
@@ -107,6 +77,23 @@ static void ui_gpencil_export_common_settings(uiLayout *layout, PointerRNA *imfp
uiItemR(sub, imfptr, "use_clip_camera", 0, NULL, ICON_NONE);
}
+/* <-------- SVG single frame export. --------> */
+#ifdef WITH_PUGIXML
+static bool wm_gpencil_export_svg_common_check(bContext *UNUSED(C), wmOperator *op)
+{
+
+ char filepath[FILE_MAX];
+ RNA_string_get(op->ptr, "filepath", filepath);
+
+ if (!BLI_path_extension_check(filepath, ".svg")) {
+ BLI_path_extension_ensure(filepath, FILE_MAX, ".svg");
+ RNA_string_set(op->ptr, "filepath", filepath);
+ return true;
+ }
+
+ return false;
+}
+
static void gpencil_export_common_props_svg(wmOperatorType *ot)
{
static const EnumPropertyItem gpencil_export_select_items[] = {
@@ -150,7 +137,6 @@ static void gpencil_export_common_props_svg(wmOperatorType *ot)
100.0f);
}
-/* <-------- SVG single frame export. --------> */
static int wm_gpencil_export_svg_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
UNUSED_VARS(event);
@@ -309,8 +295,25 @@ void WM_OT_gpencil_export_svg(wmOperatorType *ot)
gpencil_export_common_props_svg(ot);
}
+#endif
/* <-------- PDF single frame export. --------> */
+#ifdef WITH_HARU
+static bool wm_gpencil_export_pdf_common_check(bContext *UNUSED(C), wmOperator *op)
+{
+
+ char filepath[FILE_MAX];
+ RNA_string_get(op->ptr, "filepath", filepath);
+
+ if (!BLI_path_extension_check(filepath, ".pdf")) {
+ BLI_path_extension_ensure(filepath, FILE_MAX, ".pdf");
+ RNA_string_set(op->ptr, "filepath", filepath);
+ return true;
+ }
+
+ return false;
+}
+
static int wm_gpencil_export_pdf_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
UNUSED_VARS(event);
@@ -523,3 +526,4 @@ void WM_OT_gpencil_export_pdf(wmOperatorType *ot)
"Frames",
"Frames included in the export");
}
+#endif
diff --git a/source/blender/editors/io/io_ops.c b/source/blender/editors/io/io_ops.c
index 7961fc0b5da..9fa34a1c55d 100644
--- a/source/blender/editors/io/io_ops.c
+++ b/source/blender/editors/io/io_ops.c
@@ -56,8 +56,14 @@ void ED_operatortypes_io(void)
#endif
WM_operatortype_append(WM_OT_gpencil_import_svg);
+
+#ifdef WITH_PUGIXML
WM_operatortype_append(WM_OT_gpencil_export_svg);
+#endif
+
+#ifdef WITH_HARU
WM_operatortype_append(WM_OT_gpencil_export_pdf);
+#endif
WM_operatortype_append(CACHEFILE_OT_open);
WM_operatortype_append(CACHEFILE_OT_reload);
diff --git a/source/blender/io/gpencil/CMakeLists.txt b/source/blender/io/gpencil/CMakeLists.txt
index fdb1509d28f..b760230a850 100644
--- a/source/blender/io/gpencil/CMakeLists.txt
+++ b/source/blender/io/gpencil/CMakeLists.txt
@@ -36,8 +36,6 @@ set(INC
)
set(INC_SYS
- ${PUGIXML_INCLUDE_DIR}
- ${HARU_INCLUDE_DIRS}
)
set(SRC
@@ -57,22 +55,44 @@ set(SRC
intern/gpencil_io_import_svg.cc
intern/gpencil_io_export_base.h
- intern/gpencil_io_export_svg.h
- intern/gpencil_io_export_pdf.h
intern/gpencil_io_export_base.cc
- intern/gpencil_io_export_svg.cc
- intern/gpencil_io_export_pdf.cc
)
set(LIB
bf_blenkernel
bf_blenlib
bf_io_common
-
- ${PUGIXML_LIBRARIES}
- ${HARU_LIBRARIES}
)
+if(WITH_PUGIXML)
+ list(APPEND SRC
+ intern/gpencil_io_export_svg.h
+ intern/gpencil_io_export_svg.cc
+ )
+ list(APPEND INC
+ ${PUGIXML_INCLUDE_DIR}
+ )
+ list(APPEND LIB
+ ${PUGIXML_LIBRARIES}
+ )
+ add_definitions(-DWITH_PUGIXML)
+endif()
+
+if(WITH_HARU)
+ list(APPEND SRC
+ intern/gpencil_io_export_pdf.h
+ intern/gpencil_io_export_pdf.cc
+ )
+ list(APPEND INC
+ ${HARU_INCLUDE_DIRS}
+ )
+ list(APPEND LIB
+ ${HARU_LIBRARIES}
+ )
+ add_definitions(-DWITH_HARU)
+endif()
+
+
list(APPEND LIB
${BOOST_LIBRARIES}
)
More information about the Bf-blender-cvs
mailing list