diff options
author | Jens Verwiebe <info@jensverwiebe.de> | 2012-09-24 23:06:28 +0400 |
---|---|---|
committer | Jens Verwiebe <info@jensverwiebe.de> | 2012-09-24 23:06:28 +0400 |
commit | 87a8aea3138b2f633cc9febae1d13887bda91173 (patch) | |
tree | 3afe0076f12c245382906732ce14f3a00ac2f171 | |
parent | 17dc6e7c041adad57a6b038975aa3d2e7ba967ca (diff) |
OSL/cmake: the non-intrusive parts, so other os-maintainers can take code over
-rw-r--r-- | CMakeLists.txt | 80 | ||||
-rw-r--r-- | intern/cycles/CMakeLists.txt | 3 |
2 files changed, 74 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 62240515c4a..e6402cc2a79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -647,7 +647,7 @@ if(UNIX AND NOT APPLE) else() set(Boost_USE_MULTITHREADED ON) endif() - find_package(Boost 1.34 COMPONENTS filesystem regex system thread) + find_package(Boost 1.34 COMPONENTS filesystem python3 regex system thread) mark_as_advanced(Boost_DIR) # why doesnt boost do this? endif() @@ -1079,9 +1079,11 @@ elseif(WIN32) endif() set(BOOST_LIBRARIES optimized libboost_date_time-${BOOST_POSTFIX} optimized libboost_filesystem-${BOOST_POSTFIX} - optimized libboost_regex-${BOOST_POSTFIX} optimized libboost_system-${BOOST_POSTFIX} optimized libboost_thread-${BOOST_POSTFIX} + optimized libboost_python3-${BOOST_POSTFIX} optimized libboost_regex-${BOOST_POSTFIX} + optimized libboost_system-${BOOST_POSTFIX} optimized libboost_thread-${BOOST_POSTFIX} debug libboost_date_time-${BOOST_DEBUG_POSTFIX} debug libboost_filesystem-${BOOST_DEBUG_POSTFIX} - debug libboost_regex-${BOOST_DEBUG_POSTFIX} debug libboost_system-${BOOST_DEBUG_POSTFIX} debug libboost_thread-${BOOST_DEBUG_POSTFIX}) + debug libboost_python3-${BOOST_DEBUG_POSTFIX} debug libboost_regex-${BOOST_DEBUG_POSTFIX} + debug libboost_system-${BOOST_DEBUG_POSTFIX} debug libboost_thread-${BOOST_DEBUG_POSTFIX}) set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB") endif() @@ -1257,9 +1259,11 @@ elseif(WIN32) endif() set(BOOST_LIBRARIES optimized boost_date_time-${BOOST_POSTFIX} boost_filesystem-${BOOST_POSTFIX} - boost_regex-${BOOST_POSTFIX} boost_system-${BOOST_POSTFIX} boost_thread-${BOOST_POSTFIX} + boost_python3-${BOOST_POSTFIX} boost_regex-${BOOST_POSTFIX} + boost_system-${BOOST_POSTFIX} boost_thread-${BOOST_POSTFIX} debug boost_date_time-${BOOST_DEBUG_POSTFIX} boost_filesystem-${BOOST_DEBUG_POSTFIX} - boost_regex-${BOOST_DEBUG_POSTFIX} boost_system-${BOOST_DEBUG_POSTFIX} boost_thread-${BOOST_DEBUG_POSTFIX}) + boost_python3-${BOOST_POSTFIX} boost_regex-${BOOST_DEBUG_POSTFIX} + boost_system-${BOOST_DEBUG_POSTFIX} boost_thread-${BOOST_DEBUG_POSTFIX}) set(BOOST_LIBPATH ${BOOST}/lib) set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB -DBOOST_THREAD_USE_LIB ") endif() @@ -1513,7 +1517,7 @@ elseif(APPLE) if(WITH_BOOST) set(BOOST ${LIBDIR}/boost) set(BOOST_INCLUDE_DIR ${BOOST}/include) - set(BOOST_LIBRARIES boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt) + set(BOOST_LIBRARIES boost_date_time-mt boost_filesystem-mt boost_python3-mt boost_regex-mt boost_system-mt boost_thread-mt) set(BOOST_LIBPATH ${BOOST}/lib) set(BOOST_DEFINITIONS) endif() @@ -1521,7 +1525,7 @@ elseif(APPLE) if(WITH_OPENIMAGEIO) set(OPENIMAGEIO ${LIBDIR}/openimageio) set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include) - set(OPENIMAGEIO_LIBRARIES OpenImageIO ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARY} ${OPENEXR_LIBRARIES} ${ZLIB_LIBRARIES}) + set(OPENIMAGEIO_LIBRARIES -force_load ${OPENIMAGEIO}/lib/libOpenImageIO.a ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARY} ${OPENEXR_LIBRARIES} ${ZLIB_LIBRARIES}) set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib ${JPEG_LIBPATH} ${PNG_LIBPATH} ${TIFF_LIBPATH} ${OPENEXR_LIBPATH} ${ZLIB_LIBPATH}) set(OPENIMAGEIO_DEFINITIONS "-DOIIO_STATIC_BUILD") endif() @@ -1543,7 +1547,7 @@ elseif(APPLE) find_library(OSL_LIB_COMP NAMES oslcomp PATHS ${CYCLES_OSL}/lib) find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib) # WARNING! depends on correct order of OSL libs linking - list(APPEND OSL_LIBRARIES ${OSL_LIB_COMP} ${OSL_LIB_EXEC} ${OSL_LIB_QUERY}) + list(APPEND OSL_LIBRARIES ${OSL_LIB_COMP} -force_load ${OSL_LIB_EXEC} ${OSL_LIB_QUERY}) find_path(OSL_INCLUDES OSL/oslclosure.h PATHS ${CYCLES_OSL}/include) find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin) @@ -1557,6 +1561,66 @@ elseif(APPLE) endif() include_directories(${OSL_INCLUDES}) + + + # LLVM library setup, needed for osl + + set(LLVM_DIRECTORY "${LIBDIR}/llvm") + set(LLVM_STATIC YES) + if (LLVM_DIRECTORY) + set (LLVM_CONFIG "${LLVM_DIRECTORY}/bin/llvm-config") + else () + set (LLVM_CONFIG llvm-config) + endif () + execute_process (COMMAND ${LLVM_CONFIG} --version + OUTPUT_VARIABLE LLVM_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process (COMMAND ${LLVM_CONFIG} --prefix + OUTPUT_VARIABLE LLVM_DIRECTORY + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process (COMMAND ${LLVM_CONFIG} --libdir + OUTPUT_VARIABLE LLVM_LIB_DIR + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process (COMMAND ${LLVM_CONFIG} --includedir + OUTPUT_VARIABLE LLVM_INCLUDES + OUTPUT_STRIP_TRAILING_WHITESPACE) + find_library ( LLVM_LIBRARY + NAMES libLLVMAnalysis.a # first of a whole bunch of libs to get + PATHS ${LLVM_LIB_DIR}) + message (STATUS "LLVM version = ${LLVM_VERSION}") + message (STATUS "LLVM dir = ${LLVM_DIRECTORY}") + message (STATUS "LLVM includes = ${LLVM_INCLUDES}") + message (STATUS "LLVM lib dir = ${LLVM_LIB_DIR}") + + if (LLVM_LIBRARY AND LLVM_INCLUDES AND LLVM_DIRECTORY AND LLVM_LIB_DIR) + # ensure include directory is added (in case of non-standard locations + include_directories (BEFORE "${LLVM_INCLUDES}") + string (REGEX REPLACE "\\." "" OSL_LLVM_VERSION ${LLVM_VERSION}) + message (STATUS "LLVM OSL_LLVM_VERSION = ${OSL_LLVM_VERSION}") + add_definitions ("-DOSL_LLVM_VERSION=${OSL_LLVM_VERSION}") + if (LLVM_STATIC) + # if static LLVM libraries were requested, use llvm-config to generate + # the list of what libraries we need, and substitute that in the right + # way for LLVM_LIBRARY. + set (LLVM_LIBRARY "") + execute_process (COMMAND ${LLVM_CONFIG} --libs + OUTPUT_VARIABLE llvm_library_list + OUTPUT_STRIP_TRAILING_WHITESPACE) + string (REPLACE "-l" "" llvm_library_list ${llvm_library_list}) + string (REPLACE " " ";" llvm_library_list ${llvm_library_list}) + foreach (f ${llvm_library_list}) + list (APPEND LLVM_LIBRARY "${LLVM_LIB_DIR}/lib${f}.a") + endforeach () + endif () + string (REPLACE ";" " " LLVM_LIBRARY "${LLVM_LIBRARY}") + message (STATUS "LLVM library = ${LLVM_LIBRARY}") + else () + message (FATAL_ERROR "LLVM not found.") + endif () + set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${LLVM_LIBRARY}") + + # end LLVM library setup + endif() set(EXETYPE MACOSX_BUNDLE) diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt index 90eeb4b4758..f4e44fd91d3 100644 --- a/intern/cycles/CMakeLists.txt +++ b/intern/cycles/CMakeLists.txt @@ -59,7 +59,8 @@ include_directories( SYSTEM ${BOOST_INCLUDE_DIR} ${OPENIMAGEIO_INCLUDE_DIRS} - ${OPENIMAGEIO_INCLUDE_DIRS}/OpenImageIO) + ${OPENIMAGEIO_INCLUDE_DIRS}/OpenImageIO + ${OPENEXR}/include) # Subdirectories |