CMake Build: option to compile without opennl/superlu.
authorCampbell Barton <ideasman42@gmail.com>
Mon, 25 Nov 2013 04:33:41 +0000 (15:33 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 25 Nov 2013 04:36:19 +0000 (15:36 +1100)
15 files changed:
CMakeLists.txt
SConstruct
build_files/cmake/config/blender_lite.cmake
intern/CMakeLists.txt
source/blender/bmesh/CMakeLists.txt
source/blender/bmesh/operators/bmo_smooth_laplacian.c
source/blender/editors/armature/CMakeLists.txt
source/blender/editors/armature/armature_skinning.c
source/blender/editors/armature/meshlaplacian.c
source/blender/editors/uvedit/CMakeLists.txt
source/blender/editors/uvedit/uvedit_parametrizer.c
source/blender/modifiers/CMakeLists.txt
source/blender/modifiers/intern/MOD_laplaciandeform.c
source/blender/modifiers/intern/MOD_laplaciansmooth.c
source/creator/CMakeLists.txt

index a7f6b879555370ff643509cdfa854f859890082b..4cd4dee2a9ec148b073959738d8b299f57443d11 100644 (file)
@@ -254,6 +254,7 @@ option(WITH_FREESTYLE     "Enable Freestyle (advanced edges rendering)" ON)
 # Misc
 option(WITH_INPUT_NDOF "Enable NDOF input devices (SpaceNavigator and friends)" ON)
 option(WITH_RAYOPTIMIZATION    "Enable use of SIMD (SSE) optimizations for the raytracer" ON)
+option(WITH_OPENNL        "Enable use of Open Numerical Library" ON)
 if(UNIX AND NOT APPLE)
        option(WITH_INSTALL_PORTABLE "Install redistributeable runtime, otherwise install into CMAKE_INSTALL_PREFIX" ON)
        option(WITH_STATIC_LIBS "Try to link with static libraries, as much as possible, to make blender more portable across distributions" OFF)
@@ -2306,6 +2307,9 @@ if(FIRST_RUN)
        info_cfg_option(WITH_MOD_FLUID)
        info_cfg_option(WITH_MOD_OCEANSIM)
 
+       info_cfg_text("Other:")
+       info_cfg_option(WITH_OPENNL)
+
        # debug
        message(STATUS "HAVE_STDBOOL_H = ${HAVE_STDBOOL_H}")
 
index 8c27424f617d539dfc8d46bf7e69a5d11de66f3b..edf9cda6cd47570a5ecabed67453fb0cb01d821f 100644 (file)
@@ -487,6 +487,7 @@ else:
 # TODO, make optional (as with CMake)
 env['CPPFLAGS'].append('-DWITH_AUDASPACE')
 env['CPPFLAGS'].append('-DWITH_AVI')
+env['CPPFLAGS'].append('-DWITH_OPENNL')
 env['CPPFLAGS'].append('-DWITH_BOOL_COMPAT')
 if env['OURPLATFORM'] in ('win32-vc', 'win64-vc') and env['MSVC_VERSION'] == '11.0':
     env['CPPFLAGS'].append('-D_ALLOW_KEYWORD_MACROS')
index e9ff31fc6c5339015e93e69007d8a8f313cb1398..ca9aadd649c10092501a551b6cece2b5772e075c 100644 (file)
@@ -45,6 +45,7 @@ set(WITH_OPENAL              OFF CACHE BOOL "" FORCE)
 set(WITH_OPENCOLLADA         OFF CACHE BOOL "" FORCE)
 set(WITH_OPENCOLORIO         OFF CACHE BOOL "" FORCE)
 set(WITH_OPENMP              OFF CACHE BOOL "" FORCE)
+set(WITH_OPENNL              OFF CACHE BOOL "" FORCE)
 set(WITH_PYTHON_INSTALL      OFF CACHE BOOL "" FORCE)
 set(WITH_RAYOPTIMIZATION     OFF CACHE BOOL "" FORCE)
 set(WITH_SDL                 OFF CACHE BOOL "" FORCE)
index c45e66cd77bc59650c1c12d703f046bf841140ce..b7aff03a7105e294a392b57f2dccf20fe32fedb6 100644 (file)
@@ -29,7 +29,6 @@ add_subdirectory(ghost)
 add_subdirectory(guardedalloc)
 add_subdirectory(memutil)
 add_subdirectory(opencolorio)
-add_subdirectory(opennl)
 add_subdirectory(mikktspace)
 add_subdirectory(raskter)
 
@@ -81,6 +80,10 @@ if(WITH_COMPOSITOR)
        add_subdirectory(opencl)
 endif()
 
+if(WITH_OPENNL)
+       add_subdirectory(opennl)
+endif()
+
 # only windows needs utf16 converter
 if(WIN32)
        add_subdirectory(utfconv)
index b80a10b43feddc7f009f46ee285f3c6d1e56d558..afb8b07b1a601cdad0f25d433d05d9b08d0c4a7c 100644 (file)
@@ -31,7 +31,6 @@ set(INC
        ../makesdna
        ../../../intern/guardedalloc
        ../../../extern/rangetree
-       ../../../intern/opennl/extern
 )
 
 set(INC_SYS
@@ -160,6 +159,13 @@ if(WITH_INTERNATIONAL)
        add_definitions(-DWITH_INTERNATIONAL)
 endif()
 
+if(WITH_OPENNL)
+       add_definitions(-DWITH_OPENNL)
+       list(APPEND INC_SYS
+               ../../../intern/opennl/extern
+       )
+endif()
+
 if(WITH_FREESTYLE)
        add_definitions(-DWITH_FREESTYLE)
 endif()
index 3f04e23aa7389fe36d4e7b9d750ed16a5a05eda4..16e70e8c1559cfe7e388c5caa2e4f3ea59376e75 100644 (file)
 
 #include "bmesh.h"
 
-#include "ONL_opennl.h"
-
 #include "intern/bmesh_operators_private.h" /* own include */
 
+#ifdef WITH_OPENNL
+
+#include "ONL_opennl.h"
+
 // #define SMOOTH_LAPLACIAN_AREA_FACTOR 4.0f  /* UNUSED */
 // #define SMOOTH_LAPLACIAN_EDGE_FACTOR 2.0f  /* UNUSED */
 #define SMOOTH_LAPLACIAN_MAX_EDGE_PERCENTAGE 1.8f
@@ -572,3 +574,13 @@ void bmo_smooth_laplacian_vert_exec(BMesh *bm, BMOperator *op)
 
        delete_laplacian_system(sys);
 }
+
+#else  /* WITH_OPENNL */
+
+#ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wunused-parameter"
+#endif
+
+void bmo_smooth_laplacian_vert_exec(BMesh *bm, BMOperator *op) {}
+
+#endif  /* WITH_OPENNL */
index 1a0841f5342c690c9af1110bf477d8c74fc8ec3a..ca2dc1b66e2985376be9bae8c804a8e209433b8a 100644 (file)
@@ -27,7 +27,6 @@ set(INC
        ../../makesrna
        ../../windowmanager
        ../../../../intern/guardedalloc
-       ../../../../intern/opennl/extern
 )
 
 set(INC_SYS
@@ -67,4 +66,11 @@ if(WITH_INTERNATIONAL)
        add_definitions(-DWITH_INTERNATIONAL)
 endif()
 
+if(WITH_OPENNL)
+       add_definitions(-DWITH_OPENNL)
+       list(APPEND INC_SYS
+               ../../../../intern/opennl/extern
+       )
+endif()
+
 blender_add_lib(bf_editor_armature "${SRC}" "${INC}" "${INC_SYS}")
index 5f15d15d478e8a1956d63f368141e994a83416e1..7ec0acf12d196fb88cfbb2e4ad12e46350b018a6 100644 (file)
@@ -386,9 +386,13 @@ static void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob,
        /* compute the weights based on gathered vertices and bones */
        if (heat) {
                const char *error = NULL;
+
+#ifdef WITH_OPENNL
                heat_bone_weighting(ob, mesh, verts, numbones, dgrouplist, dgroupflip,
                                    root, tip, selected, &error);
-               
+#else
+               error = "Built without OpenNL";
+#endif
                if (error) {
                        BKE_report(reports, RPT_WARNING, error);
                }
index 16d7f9c9420570909997597892e4cbd187db774b..3b285e123317fd5636d698686a5945d39be49101 100644 (file)
 #include "BLI_polardecomp.h"
 #endif
 
-#include "ONL_opennl.h"
-
 #include "ED_mesh.h"
 #include "ED_armature.h"
 
 #include "meshlaplacian.h"
 
+#ifdef WITH_OPENNL
+
+#include "ONL_opennl.h"
 
 /* ************* XXX *************** */
 static void waitcursor(int UNUSED(val)) {}
@@ -2006,3 +2007,13 @@ void mesh_deform_bind(Scene *scene, MeshDeformModifierData *mmd, float *vertexco
        waitcursor(0);
 }
 
+#else  /* WITH_OPENNL */
+
+#ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wunused-parameter"
+#endif
+
+void mesh_deform_bind(Scene *scene, MeshDeformModifierData *mmd, float *vertexcos, int totvert, float cagemat[4][4]) {}
+void *modifier_mdef_compact_influences_link_kludge = modifier_mdef_compact_influences;
+
+#endif  /* WITH_OPENNL */
index 62d4b01cab765d0de7bb4394413ef3bdc89b1bad..45edbde74825967bfc099516aa8ff9c50a88f9de 100644 (file)
@@ -28,7 +28,6 @@ set(INC
        ../../makesrna
        ../../windowmanager
        ../../../../intern/guardedalloc
-       ../../../../intern/opennl/extern
 )
 
 set(INC_SYS
@@ -51,4 +50,11 @@ if(WITH_INTERNATIONAL)
        add_definitions(-DWITH_INTERNATIONAL)
 endif()
 
+if(WITH_OPENNL)
+       add_definitions(-DWITH_OPENNL)
+       list(APPEND INC_SYS
+               ../../../../intern/opennl/extern
+       )
+endif()
+
 blender_add_lib(bf_editor_uvedit "${SRC}" "${INC}" "${INC_SYS}")
index 2d33a2d3937729db7cc0310380d39aede9cbcff5..e5c3510db4b74ee2452c93dc7f78f3f18441e4dc 100644 (file)
@@ -35,8 +35,6 @@
 #include "BLI_boxpack2d.h"
 #include "BLI_convexhull2d.h"
 
-#include "ONL_opennl.h"
-
 #include "uvedit_intern.h"
 #include "uvedit_parametrizer.h"
 
 
 #include "BLI_sys_types.h"  /* for intptr_t support */
 
+#ifdef WITH_OPENNL
+
+#include "ONL_opennl.h"
+
 /* Utils */
 
 #if 0
@@ -4715,3 +4717,36 @@ void param_flush_restore(ParamHandle *handle)
        }
 }
 
+#else  /* WITH_OPENNL */
+
+#ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wunused-parameter"
+#endif
+
+/* stubs */
+void param_face_add(ParamHandle *handle, ParamKey key, int nverts,
+                    ParamKey *vkeys, float **co, float **uv,
+                    ParamBool *pin, ParamBool *select, float normal[3]) {}
+void param_edge_set_seam(ParamHandle *handle,
+                         ParamKey *vkeys) {}
+void param_aspect_ratio(ParamHandle *handle, float aspx, float aspy) {}
+ParamHandle *param_construct_begin(void) { return NULL; }
+void param_construct_end(ParamHandle *handle, ParamBool fill, ParamBool impl) {}
+void param_delete(ParamHandle *handle) {}
+
+void param_stretch_begin(ParamHandle *handle) {}
+void param_stretch_blend(ParamHandle *handle, float blend) {}
+void param_stretch_iter(ParamHandle *handle) {}
+void param_stretch_end(ParamHandle *handle) {}
+
+void param_pack(ParamHandle *handle, float margin, bool do_rotate) {}
+void param_average(ParamHandle *handle) {}
+
+void param_flush(ParamHandle *handle) {}
+void param_flush_restore(ParamHandle *handle) {}
+
+void param_lscm_begin(ParamHandle *handle, ParamBool live, ParamBool abf) {}
+void param_lscm_solve(ParamHandle *handle) {}
+void param_lscm_end(ParamHandle *handle) {}
+
+#endif  /* WITH_OPENNL */
index 450501c9db5a4b594a17adc84bb740d9d06a85c2..4eb15c0fbdbd61190d077f6e6b568a24dd333b99 100644 (file)
@@ -36,7 +36,6 @@ set(INC
        ../render/extern/include
        ../../../intern/elbeem/extern
        ../../../intern/guardedalloc
-       ../../../intern/opennl/extern
 )
 
 set(INC_SYS
@@ -146,4 +145,11 @@ if(WITH_INTERNATIONAL)
        add_definitions(-DWITH_INTERNATIONAL)
 endif()
 
+if(WITH_OPENNL)
+       add_definitions(-DWITH_OPENNL)
+       list(APPEND INC_SYS
+               ../../../intern/opennl/extern
+       )
+endif()
+
 blender_add_lib(bf_modifiers "${SRC}" "${INC}" "${INC_SYS}")
index 3b909a4b2094bd629b0bb9f1e248e0354799a83e..a8a6f1a1cb90fe5d4a58a73ccb6971a1e8fe8569 100644 (file)
@@ -41,7 +41,6 @@
 
 #include "MOD_util.h"
 
-#include "ONL_opennl.h"
 
 enum {
        LAPDEFORM_SYSTEM_NOT_CHANGE = 0,
@@ -54,6 +53,10 @@ enum {
        LAPDEFORM_SYSTEM_CHANGE_NOT_VALID_GROUP,
 };
 
+#ifdef WITH_OPENNL
+
+#include "ONL_opennl.h"
+
 typedef struct LaplacianSystem {
        bool is_matrix_computed;
        bool has_solution;
@@ -766,6 +769,14 @@ static void LaplacianDeformModifier_do(
        }
 }
 
+#else  /* WITH_OPENNL */
+static void LaplacianDeformModifier_do(
+        LaplacianDeformModifierData *lmd, Object *ob, DerivedMesh *dm,
+        float (*vertexCos)[3], int numVerts)
+{
+       (void)lmd, (void)ob, (void)dm, (void)vertexCos, (void)numVerts;
+}
+#endif  /* WITH_OPENNL */
 
 static void initData(ModifierData *md)
 {
@@ -831,11 +842,12 @@ static void deformVertsEM(
 static void freeData(ModifierData *md)
 {
        LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)md;
+#ifdef WITH_OPENNL
        LaplacianSystem *sys = (LaplacianSystem *)lmd->cache_system;
-
        if (sys) {
                deleteLaplacianSystem(sys);
        }
+#endif
        MEM_SAFE_FREE(lmd->vertexco);
        lmd->total_verts = 0;
 }
index 3843ee6f535e46559e113da579eda9e6a01f201e..f97818a02d4664fc4599ab4700049b19b227c771 100644 (file)
@@ -50,6 +50,8 @@
 #include "MOD_modifiertypes.h"
 #include "MOD_util.h"
 
+#ifdef WITH_OPENNL
+
 #include "ONL_opennl.h"
 
 #if 0
@@ -195,52 +197,6 @@ static LaplacianSystem *init_laplacian_system(int a_numEdges, int a_numFaces, in
        return sys;
 }
 
-static void init_data(ModifierData *md)
-{
-       LaplacianSmoothModifierData *smd = (LaplacianSmoothModifierData *) md;
-       smd->lambda = 0.01f;
-       smd->lambda_border = 0.01f;
-       smd->repeat = 1;
-       smd->flag = MOD_LAPLACIANSMOOTH_X | MOD_LAPLACIANSMOOTH_Y | MOD_LAPLACIANSMOOTH_Z | MOD_LAPLACIANSMOOTH_PRESERVE_VOLUME | MOD_LAPLACIANSMOOTH_NORMALIZED;
-       smd->defgrp_name[0] = '\0';
-}
-
-static void copy_data(ModifierData *md, ModifierData *target)
-{
-       LaplacianSmoothModifierData *smd = (LaplacianSmoothModifierData *) md;
-       LaplacianSmoothModifierData *tsmd = (LaplacianSmoothModifierData *) target;
-
-       tsmd->lambda = smd->lambda;
-       tsmd->lambda_border = smd->lambda_border;
-       tsmd->repeat = smd->repeat;
-       tsmd->flag = smd->flag;
-       BLI_strncpy(tsmd->defgrp_name, smd->defgrp_name, sizeof(tsmd->defgrp_name));
-}
-
-static bool is_disabled(ModifierData *md, int UNUSED(useRenderParams))
-{
-       LaplacianSmoothModifierData *smd = (LaplacianSmoothModifierData *) md;
-       short flag;
-
-       flag = smd->flag & (MOD_LAPLACIANSMOOTH_X | MOD_LAPLACIANSMOOTH_Y | MOD_LAPLACIANSMOOTH_Z);
-
-       /* disable if modifier is off for X, Y and Z or if factor is 0 */
-       if (flag == 0) return 1;
-
-       return 0;
-}
-
-static CustomDataMask required_data_mask(Object *UNUSED(ob), ModifierData *md)
-{
-       LaplacianSmoothModifierData *smd = (LaplacianSmoothModifierData *)md;
-       CustomDataMask dataMask = 0;
-
-       /* ask for vertexgroups if we need them */
-       if (smd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
-
-       return dataMask;
-}
-
 static float average_area_quad_v3(float *v1, float *v2, float *v3, float *v4)
 {
        float areaq;
@@ -663,7 +619,61 @@ static void laplaciansmoothModifier_do(
        nlDeleteContext(sys->context);
        sys->context = NULL;
        delete_laplacian_system(sys);
+}
+
+#else  /* WITH_OPENNL */
+static void laplaciansmoothModifier_do(
+        LaplacianSmoothModifierData *smd, Object *ob, DerivedMesh *dm,
+        float (*vertexCos)[3], int numVerts)
+{
+       (void)smd, (void)ob, (void)dm, (void)vertexCos, (void)numVerts;
+}
+#endif  /* WITH_OPENNL */
 
+static void init_data(ModifierData *md)
+{
+       LaplacianSmoothModifierData *smd = (LaplacianSmoothModifierData *) md;
+       smd->lambda = 0.01f;
+       smd->lambda_border = 0.01f;
+       smd->repeat = 1;
+       smd->flag = MOD_LAPLACIANSMOOTH_X | MOD_LAPLACIANSMOOTH_Y | MOD_LAPLACIANSMOOTH_Z | MOD_LAPLACIANSMOOTH_PRESERVE_VOLUME | MOD_LAPLACIANSMOOTH_NORMALIZED;
+       smd->defgrp_name[0] = '\0';
+}
+
+static void copy_data(ModifierData *md, ModifierData *target)
+{
+       LaplacianSmoothModifierData *smd = (LaplacianSmoothModifierData *) md;
+       LaplacianSmoothModifierData *tsmd = (LaplacianSmoothModifierData *) target;
+
+       tsmd->lambda = smd->lambda;
+       tsmd->lambda_border = smd->lambda_border;
+       tsmd->repeat = smd->repeat;
+       tsmd->flag = smd->flag;
+       BLI_strncpy(tsmd->defgrp_name, smd->defgrp_name, sizeof(tsmd->defgrp_name));
+}
+
+static bool is_disabled(ModifierData *md, int UNUSED(useRenderParams))
+{
+       LaplacianSmoothModifierData *smd = (LaplacianSmoothModifierData *) md;
+       short flag;
+
+       flag = smd->flag & (MOD_LAPLACIANSMOOTH_X | MOD_LAPLACIANSMOOTH_Y | MOD_LAPLACIANSMOOTH_Z);
+
+       /* disable if modifier is off for X, Y and Z or if factor is 0 */
+       if (flag == 0) return 1;
+
+       return 0;
+}
+
+static CustomDataMask required_data_mask(Object *UNUSED(ob), ModifierData *md)
+{
+       LaplacianSmoothModifierData *smd = (LaplacianSmoothModifierData *)md;
+       CustomDataMask dataMask = 0;
+
+       /* ask for vertexgroups if we need them */
+       if (smd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
+
+       return dataMask;
 }
 
 static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
index cb745d46fa43fc95f42a660d8082107b7534fdb9..2a355bd56066e8967f2d295b36b704cbb7a2b628 100644 (file)
@@ -932,7 +932,6 @@ endif()
                bf_editor_io
 
                bf_render
-               bf_intern_opennl
                bf_python
                bf_python_ext
                bf_python_mathutils
@@ -1061,6 +1060,10 @@ endif()
                list(APPEND BLENDER_SORTED_LIBS bf_intern_locale)
        endif()
 
+       if(WITH_OPENNL)
+               list_insert_after(BLENDER_SORTED_LIBS "bf_render" "bf_intern_opennl")
+       endif()
+
        if(WITH_BULLET)
                list_insert_after(BLENDER_SORTED_LIBS "bf_blenkernel" "bf_intern_rigidbody")
        endif()