CMake Build: option to compile without opennl/superlu.

This commit is contained in:
Campbell Barton
2013-11-25 15:33:41 +11:00
parent 295116ea6b
commit 2b4c68b902
15 changed files with 181 additions and 61 deletions

View 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}")

View 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')

View 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)

View 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)

View 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()

View File

@@ -34,10 +34,12 @@
#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 */

View 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}")

View 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);
}

View File

@@ -46,13 +46,14 @@
#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 */

View 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}")

View 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"
@@ -47,6 +45,10 @@
#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 */

View 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}")

View 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;
}

View 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,

View 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()