[Bf-blender-cvs] [1fe78b1] alembic_pointcache: Library linking for Alembic.
Lukas Tönne
noreply at git.blender.org
Thu Oct 16 16:52:24 CEST 2014
Commit: 1fe78b1378c5c285e80b688170f1754fb0cdeb2f
Author: Lukas Tönne
Date: Tue Oct 1 16:27:04 2013 +0200
Branches: alembic_pointcache
https://developer.blender.org/rB1fe78b1378c5c285e80b688170f1754fb0cdeb2f
Library linking for Alembic.
===================================================================
M CMakeLists.txt
A build_files/cmake/Modules/FindAlembic.cmake
M build_files/cmake/macros.cmake
===================================================================
diff --git a/CMakeLists.txt b/CMakeLists.txt
index abca0ee..78b79fe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -464,11 +464,12 @@ if(NOT WITH_BOOST)
set_and_warn(WITH_CYCLES OFF)
set_and_warn(WITH_MOD_BOOLEAN OFF)
set_and_warn(WITH_AUDASPACE OFF)
+ set_and_warn(WITH_ALEMBIC OFF)
set_and_warn(WITH_INTERNATIONAL OFF)
set_and_warn(WITH_OPENAL OFF) # depends on AUDASPACE
set_and_warn(WITH_GAMEENGINE OFF) # depends on AUDASPACE
-elseif(WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_MOD_BOOLEAN OR WITH_AUDASPACE OR WITH_INTERNATIONAL)
+elseif(WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_MOD_BOOLEAN OR WITH_AUDASPACE OR WITH_ALEMBIC OR WITH_INTERNATIONAL)
# Keep enabled
else()
# Enabled but we don't need it
@@ -878,6 +879,13 @@ if(UNIX AND NOT APPLE)
endif()
endif()
+ if(WITH_ALEMBIC)
+ find_package_wrapper(Alembic)
+
+ set(ALEMBIC_LIBRARIES ${ALEMBIC_LIBRARIES} ${BOOST_LIBRARIES})
+ set(ALEMBIC_DEFINITIONS "")
+ endif()
+
# OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
set(PLATFORM_LINKLIBS "-lutil -lc -lm -lpthread")
@@ -1830,6 +1838,12 @@ if(WITH_CYCLES)
endif()
endif()
+if(WITH_ALEMBIC)
+ if(NOT WITH_BOOST)
+ message(FATAL_ERROR "Alembic requires WITH_BOOST, the library may not have been found. Configure BOOST or disable WITH_ALEMBIC")
+ endif()
+endif()
+
if(WITH_INTERNATIONAL)
if(NOT WITH_BOOST)
message(FATAL_ERROR "Internationalization requires WITH_BOOST, the library may not have been found. Configure BOOST or disable WITH_INTERNATIONAL")
diff --git a/build_files/cmake/Modules/FindAlembic.cmake b/build_files/cmake/Modules/FindAlembic.cmake
new file mode 100644
index 0000000..343ea83
--- /dev/null
+++ b/build_files/cmake/Modules/FindAlembic.cmake
@@ -0,0 +1,71 @@
+# - Find Alembic library
+# Find the native Alembic includes and library
+# This module defines
+# ALEMBIC_INCLUDE_DIRS, where to find openimageio.h, Set when
+# OPENIMAGEIO_INCLUDE_DIR is found.
+# OPENIMAGEIO_LIBRARIES, libraries to link against to use OpenImageIO.
+# OPENIMAGEIO_ROOT_DIR, The base directory to search for OpenImageIO.
+# This can also be an environment variable.
+# OPENIMAGEIO_FOUND, If false, do not try to use OpenImageIO.
+#
+# also defined, but not for general use are
+# OPENIMAGEIO_LIBRARY, where to find the OpenImageIO library.
+
+#=============================================================================
+# Copyright 2011 Blender Foundation.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+# If ALEMBIC_ROOT_DIR was defined in the environment, use it.
+IF(NOT ALEMBIC_ROOT_DIR AND NOT $ENV{ALEMBIC_ROOT_DIR} STREQUAL "")
+ SET(ALEMBIC_ROOT_DIR $ENV{ALEMBIC_ROOT_DIR})
+ENDIF()
+
+SET(_alembic_SEARCH_DIRS
+ ${ALEMBIC_ROOT_DIR}
+ /usr/local
+ /sw # Fink
+ /opt/local # DarwinPorts
+ /opt/csw # Blastwave
+ /opt/lib/alembic
+)
+
+FIND_PATH(ALEMBIC_INCLUDE_DIR
+ NAMES
+ Alembic/Abc/All.h
+ HINTS
+ ${_alembic_SEARCH_DIRS}
+ PATH_SUFFIXES
+ include
+)
+
+FIND_LIBRARY(ALEMBIC_LIBRARY
+ NAMES
+ AlembicAbc AlembicAbcCoreAbstract
+ HINTS
+ ${_alembic_SEARCH_DIRS}
+ PATH_SUFFIXES
+ lib/static
+ )
+
+# handle the QUIETLY and REQUIRED arguments and set OPENIMAGEIO_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Alembic DEFAULT_MSG
+ ALEMBIC_LIBRARY ALEMBIC_INCLUDE_DIR)
+
+IF(ALEMBIC_FOUND)
+ SET(ALEMBIC_LIBRARIES ${ALEMBIC_LIBRARY})
+ SET(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
+ENDIF(ALEMBIC_FOUND)
+
+MARK_AS_ADVANCED(
+ ALEMBIC_INCLUDE_DIR
+ ALEMBIC_LIBRARY
+)
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 0bf31f7..571f2fc 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -268,6 +268,9 @@ macro(SETUP_LIBDIRS)
if(WITH_LLVM)
link_directories(${LLVM_LIBPATH})
endif()
+ if(WITH_ALEMBIC)
+ link_directories(${ALEMBIC_LIBPATH})
+ endif()
if(WITH_MEM_JEMALLOC)
link_directories(${JEMALLOC_LIBPATH})
endif()
@@ -406,6 +409,9 @@ macro(setup_liblinks
if(WITH_LLVM)
target_link_libraries(${target} ${LLVM_LIBRARY})
endif()
+ if(WITH_ALEMBIC)
+ target_link_libraries(${target} ${ALEMBIC_LIBRARIES})
+ endif()
if(WIN32 AND NOT UNIX)
target_link_libraries(${target} ${PTHREADS_LIBRARIES})
endif()
More information about the Bf-blender-cvs
mailing list