diff options
author | Campbell Barton <campbell@blender.org> | 2022-06-07 07:21:19 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-06-08 06:29:32 +0300 |
commit | 8edd1d8aa597514d5089f8cf2aa640ec14c1e389 (patch) | |
tree | ef4513243ab47a0cbc27d298e96d462c8f22396d /source/blender/editors/io | |
parent | a1d2efd190038c7615bd3bb459dc86c8b3a8ecdc (diff) |
CMake: optionally disable OBJ, STL & GPencil SVG support
The following CMake options have been added (enabled by default),
except for the lite build configuration.
- WITH_IO_STL
- WITH_IO_WAVEFRONT_OBJ
- WITH_IO_GPENCIL (for grease pencil SVG importing).
Note that it was already possible to disable grease pencil export
by disabling WITH_PUGIXML & WITH_HARU.
This is intended to keep the lite builds fast and small for building,
linking & execution.
Reviewed By: iyadahmed2001, aras_p, antoniov, mont29
Ref D15141
Diffstat (limited to 'source/blender/editors/io')
-rw-r--r-- | source/blender/editors/io/CMakeLists.txt | 25 | ||||
-rw-r--r-- | source/blender/editors/io/io_gpencil_export.c | 54 | ||||
-rw-r--r-- | source/blender/editors/io/io_gpencil_import.c | 40 | ||||
-rw-r--r-- | source/blender/editors/io/io_gpencil_utils.c | 14 | ||||
-rw-r--r-- | source/blender/editors/io/io_obj.c | 46 | ||||
-rw-r--r-- | source/blender/editors/io/io_ops.c | 14 | ||||
-rw-r--r-- | source/blender/editors/io/io_stl_ops.c | 24 |
7 files changed, 129 insertions, 88 deletions
diff --git a/source/blender/editors/io/CMakeLists.txt b/source/blender/editors/io/CMakeLists.txt index 98438c3e959..a716c00d5d9 100644 --- a/source/blender/editors/io/CMakeLists.txt +++ b/source/blender/editors/io/CMakeLists.txt @@ -49,8 +49,6 @@ set(SRC set(LIB bf_blenkernel bf_blenlib - bf_wavefront_obj - bf_stl ) if(WITH_OPENCOLLADA) @@ -60,6 +58,27 @@ if(WITH_OPENCOLLADA) add_definitions(-DWITH_COLLADA) endif() +if(WITH_IO_WAVEFRONT_OBJ) + list(APPEND LIB + bf_wavefront_obj + ) + add_definitions(-DWITH_IO_WAVEFRONT_OBJ) +endif() + +if(WITH_IO_STL) + list(APPEND LIB + bf_stl + ) + add_definitions(-DWITH_IO_STL) +endif() + +if(WITH_IO_GPENCIL) + list(APPEND LIB + bf_gpencil + ) + add_definitions(-DWITH_IO_GPENCIL) +endif() + if(WITH_ALEMBIC) list(APPEND LIB bf_alembic @@ -82,6 +101,4 @@ 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_export.c b/source/blender/editors/io/io_gpencil_export.c index 7ac05fcca3e..6e5ae9f3cba 100644 --- a/source/blender/editors/io/io_gpencil_export.c +++ b/source/blender/editors/io/io_gpencil_export.c @@ -5,36 +5,38 @@ * \ingroup editor/io */ -#include "BLI_path_util.h" -#include "BLI_string.h" +#ifdef WITH_IO_GPENCIL -#include "DNA_gpencil_types.h" -#include "DNA_space_types.h" +# include "BLI_path_util.h" +# include "BLI_string.h" -#include "BKE_gpencil.h" -#include "BKE_main.h" -#include "BKE_report.h" -#include "BKE_screen.h" +# include "DNA_gpencil_types.h" +# include "DNA_space_types.h" -#include "BLT_translation.h" +# include "BKE_gpencil.h" +# include "BKE_main.h" +# include "BKE_report.h" +# include "BKE_screen.h" -#include "RNA_access.h" -#include "RNA_define.h" +# include "BLT_translation.h" -#include "UI_interface.h" -#include "UI_resources.h" +# include "RNA_access.h" +# include "RNA_define.h" -#include "WM_api.h" -#include "WM_types.h" +# include "UI_interface.h" +# include "UI_resources.h" -#include "DEG_depsgraph.h" -#include "DEG_depsgraph_query.h" +# include "WM_api.h" +# include "WM_types.h" -#include "io_gpencil.h" +# include "DEG_depsgraph.h" +# include "DEG_depsgraph_query.h" -#include "gpencil_io.h" +# include "io_gpencil.h" -#if defined(WITH_PUGIXML) || defined(WITH_HARU) +# include "gpencil_io.h" + +# if defined(WITH_PUGIXML) || defined(WITH_HARU) /* Definition of enum elements to export. */ /* Common props for exporting. */ static void gpencil_export_common_props_definition(wmOperatorType *ot) @@ -87,10 +89,10 @@ static void set_export_filepath(bContext *C, wmOperator *op, const char *extensi RNA_string_set(op->ptr, "filepath", filepath); } } -#endif +# endif /* <-------- SVG single frame export. --------> */ -#ifdef WITH_PUGIXML +# ifdef WITH_PUGIXML static bool wm_gpencil_export_svg_common_check(bContext *UNUSED(C), wmOperator *op) { char filepath[FILE_MAX]; @@ -241,10 +243,10 @@ void WM_OT_gpencil_export_svg(wmOperatorType *ot) "Clip Camera", "Clip drawings to camera size when export in camera view"); } -#endif +# endif /* <-------- PDF single frame export. --------> */ -#ifdef WITH_HARU +# ifdef WITH_HARU static bool wm_gpencil_export_pdf_common_check(bContext *UNUSED(C), wmOperator *op) { @@ -406,4 +408,6 @@ void WM_OT_gpencil_export_pdf(wmOperatorType *ot) "Frames", "Which frames to include in the export"); } -#endif +# endif /* WITH_HARU */ + +#endif /* WITH_IO_GPENCIL */ diff --git a/source/blender/editors/io/io_gpencil_import.c b/source/blender/editors/io/io_gpencil_import.c index 8bed32ad6c3..45f5441616f 100644 --- a/source/blender/editors/io/io_gpencil_import.c +++ b/source/blender/editors/io/io_gpencil_import.c @@ -5,34 +5,36 @@ * \ingroup editor/io */ -#include "BLI_path_util.h" +#ifdef WITH_IO_GPENCIL -#include "DNA_gpencil_types.h" -#include "DNA_space_types.h" +# include "BLI_path_util.h" -#include "BKE_context.h" -#include "BKE_gpencil.h" -#include "BKE_report.h" +# include "DNA_gpencil_types.h" +# include "DNA_space_types.h" -#include "BLT_translation.h" +# include "BKE_context.h" +# include "BKE_gpencil.h" +# include "BKE_report.h" -#include "RNA_access.h" -#include "RNA_define.h" +# include "BLT_translation.h" -#include "UI_interface.h" -#include "UI_resources.h" +# include "RNA_access.h" +# include "RNA_define.h" -#include "WM_api.h" -#include "WM_types.h" +# include "UI_interface.h" +# include "UI_resources.h" -#include "DEG_depsgraph.h" -#include "DEG_depsgraph_query.h" +# include "WM_api.h" +# include "WM_types.h" -#include "ED_gpencil.h" +# include "DEG_depsgraph.h" +# include "DEG_depsgraph_query.h" -#include "io_gpencil.h" +# include "ED_gpencil.h" -#include "gpencil_io.h" +# include "io_gpencil.h" + +# include "gpencil_io.h" /* <-------- SVG single frame import. --------> */ static bool wm_gpencil_import_svg_common_check(bContext *UNUSED(C), wmOperator *op) @@ -174,3 +176,5 @@ void WM_OT_gpencil_import_svg(wmOperatorType *ot) 0.001f, 100.0f); } + +#endif /* WITH_IO_GPENCIL */ diff --git a/source/blender/editors/io/io_gpencil_utils.c b/source/blender/editors/io/io_gpencil_utils.c index fa5fcd79b96..9a88daef1a1 100644 --- a/source/blender/editors/io/io_gpencil_utils.c +++ b/source/blender/editors/io/io_gpencil_utils.c @@ -5,14 +5,16 @@ * \ingroup editor/io */ -#include "DNA_space_types.h" +#ifdef WITH_IO_GPENCIL -#include "BKE_context.h" -#include "BKE_screen.h" +# include "DNA_space_types.h" -#include "WM_api.h" +# include "BKE_context.h" +# include "BKE_screen.h" -#include "io_gpencil.h" +# include "WM_api.h" + +# include "io_gpencil.h" ARegion *get_invoke_region(bContext *C) { @@ -46,3 +48,5 @@ View3D *get_invoke_view3d(bContext *C) return NULL; } + +#endif /* WITH_IO_GPENCIL */ diff --git a/source/blender/editors/io/io_obj.c b/source/blender/editors/io/io_obj.c index 05bccce7948..a8eed136df3 100644 --- a/source/blender/editors/io/io_obj.c +++ b/source/blender/editors/io/io_obj.c @@ -4,37 +4,39 @@ * \ingroup editor/io */ -#include "DNA_space_types.h" +#ifdef WITH_IO_WAVEFRONT_OBJ -#include "BKE_context.h" -#include "BKE_main.h" -#include "BKE_report.h" +# include "DNA_space_types.h" -#include "BLI_path_util.h" -#include "BLI_string.h" -#include "BLI_utildefines.h" +# include "BKE_context.h" +# include "BKE_main.h" +# include "BKE_report.h" -#include "BLT_translation.h" +# include "BLI_path_util.h" +# include "BLI_string.h" +# include "BLI_utildefines.h" -#include "ED_outliner.h" +# include "BLT_translation.h" -#include "MEM_guardedalloc.h" +# include "ED_outliner.h" -#include "RNA_access.h" -#include "RNA_define.h" +# include "MEM_guardedalloc.h" -#include "UI_interface.h" -#include "UI_resources.h" +# include "RNA_access.h" +# include "RNA_define.h" -#include "WM_api.h" -#include "WM_types.h" +# include "UI_interface.h" +# include "UI_resources.h" -#include "DEG_depsgraph.h" +# include "WM_api.h" +# include "WM_types.h" -#include "IO_orientation.h" -#include "IO_path_util_types.h" -#include "IO_wavefront_obj.h" -#include "io_obj.h" +# include "DEG_depsgraph.h" + +# include "IO_orientation.h" +# include "IO_path_util_types.h" +# include "IO_wavefront_obj.h" +# include "io_obj.h" static const EnumPropertyItem io_obj_export_evaluation_mode[] = { {DAG_EVAL_RENDER, "DAG_EVAL_RENDER", 0, "Render", "Export objects as they appear in render"}, @@ -472,3 +474,5 @@ void WM_OT_obj_import(struct wmOperatorType *ot) prop = RNA_def_string(ot->srna, "filter_glob", "*.obj;*.mtl", 0, "Extension Filter", ""); RNA_def_property_flag(prop, PROP_HIDDEN); } + +#endif /* WITH_IO_WAVEFRONT_OBJ */ diff --git a/source/blender/editors/io/io_ops.c b/source/blender/editors/io/io_ops.c index 098186a75e3..0340d0598d5 100644 --- a/source/blender/editors/io/io_ops.c +++ b/source/blender/editors/io/io_ops.c @@ -42,14 +42,14 @@ void ED_operatortypes_io(void) WM_operatortype_append(WM_OT_usd_export); #endif +#ifdef WITH_IO_GPENCIL WM_operatortype_append(WM_OT_gpencil_import_svg); - -#ifdef WITH_PUGIXML +# ifdef WITH_PUGIXML WM_operatortype_append(WM_OT_gpencil_export_svg); -#endif - -#ifdef WITH_HARU +# endif +# ifdef WITH_HARU WM_operatortype_append(WM_OT_gpencil_export_pdf); +# endif #endif WM_operatortype_append(CACHEFILE_OT_open); @@ -59,8 +59,12 @@ void ED_operatortypes_io(void) WM_operatortype_append(CACHEFILE_OT_layer_remove); WM_operatortype_append(CACHEFILE_OT_layer_move); +#ifdef WITH_IO_WAVEFRONT_OBJ WM_operatortype_append(WM_OT_obj_export); WM_operatortype_append(WM_OT_obj_import); +#endif +#ifdef WITH_IO_STL WM_operatortype_append(WM_OT_stl_import); +#endif } diff --git a/source/blender/editors/io/io_stl_ops.c b/source/blender/editors/io/io_stl_ops.c index d5993bc4f37..7db32cd6f18 100644 --- a/source/blender/editors/io/io_stl_ops.c +++ b/source/blender/editors/io/io_stl_ops.c @@ -4,21 +4,23 @@ * \ingroup editor/io */ -#include "BKE_context.h" -#include "BKE_report.h" +#ifdef WITH_IO_STL -#include "WM_api.h" -#include "WM_types.h" +# include "BKE_context.h" +# include "BKE_report.h" -#include "DNA_space_types.h" +# include "WM_api.h" +# include "WM_types.h" -#include "ED_outliner.h" +# include "DNA_space_types.h" -#include "RNA_access.h" -#include "RNA_define.h" +# include "ED_outliner.h" -#include "IO_stl.h" -#include "io_stl_ops.h" +# include "RNA_access.h" +# include "RNA_define.h" + +# include "IO_stl.h" +# include "io_stl_ops.h" static int wm_stl_import_invoke(bContext *C, wmOperator *op, const wmEvent *event) { @@ -127,3 +129,5 @@ void WM_OT_stl_import(struct wmOperatorType *ot) prop = RNA_def_string(ot->srna, "filter_glob", "*.stl", 0, "Extension Filter", ""); RNA_def_property_flag(prop, PROP_HIDDEN); } + +#endif /* WITH_IO_STL */ |