Cleanup for OSL linking in cmake: Move cmake OSL library search and path definition...
authorLukas Toenne <lukas.toenne@googlemail.com>
Mon, 10 Sep 2012 06:18:20 +0000 (06:18 +0000)
committerLukas Toenne <lukas.toenne@googlemail.com>
Mon, 10 Sep 2012 06:18:20 +0000 (06:18 +0000)
CMakeLists.txt
build_files/cmake/macros.cmake
intern/cycles/cmake/external_libs.cmake
intern/cycles/kernel/osl/CMakeLists.txt
source/creator/CMakeLists.txt

index 6bb5d8af627c0221794c3503b53bfcded4af24ae..c6d8d8d2a8776e6f5c70f070f0387b93b6a3899b 100644 (file)
@@ -672,6 +672,31 @@ if(UNIX AND NOT APPLE)
                endif()
        endif()
 
+       if(WITH_CYCLES_OSL)
+               set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
+       
+               message(STATUS "CYCLES_OSL = ${CYCLES_OSL}")
+       
+               find_library(OSL_LIB_EXEC NAMES oslexec PATHS ${CYCLES_OSL}/lib ${CYCLES_OSL}/dist)
+               find_library(OSL_LIB_COMP NAMES oslcomp PATHS ${CYCLES_OSL}/lib ${CYCLES_OSL}/dist)
+               find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib ${CYCLES_OSL}/dist)
+               # WARNING! depends on correct order of OSL libs linking
+               list(APPEND OSL_LIBRARIES ${OSL_LIB_COMP} ${OSL_LIB_EXEC} ${OSL_LIB_QUERY})
+               find_path(OSL_INCLUDES OSL/oslclosure.h PATHS ${CYCLES_OSL}/include ${CYCLES_OSL}/dist)
+               find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin ${CYCLES_OSL}/dist)
+       
+               if(OSL_INCLUDES AND OSL_LIBRARIES AND OSL_COMPILER)
+                       set(OSL_FOUND TRUE)
+                       message(STATUS "OSL includes = ${OSL_INCLUDES}")
+                       message(STATUS "OSL library = ${OSL_LIBRARIES}")
+                       message(STATUS "OSL compiler = ${OSL_COMPILER}")
+               else()
+                       message(STATUS "OSL not found")
+               endif()
+       
+               include_directories(${OSL_INCLUDES} ${OSL_INCLUDES}/OSL ${OSL_INCLUDES}/../../../src/liboslexec)
+       endif()
+
        # OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
        set(PLATFORM_LINKLIBS "-lutil -lc -lm -lpthread -lstdc++")
 
index 62e1e83326c7f4c069f880795f3892b4a8f9d1a3..97ce84142e98965e92cae1ea361edd9f33c71506 100644 (file)
@@ -367,6 +367,9 @@ macro(setup_liblinks
        if(WITH_MOD_CLOTH_ELTOPO)
                target_link_libraries(${target} ${LAPACK_LIBRARIES})
        endif()
+       if(WITH_CYCLES_OSL)
+               target_link_libraries(${target} ${OSL_LIBRARIES})
+       endif()
        if(WIN32 AND NOT UNIX)
                target_link_libraries(${target} ${PTHREADS_LIBRARIES})
        endif()
index 4f547a5b6448eefeef60bf57c9b0f33016cb7ac8..332d3d747155c848cf64152ed54e016dc5b29e69 100644 (file)
@@ -17,32 +17,6 @@ else()
        set(CYCLES_GLEW_LIBRARY extern_glew)
 endif()
 
-###########################################################################
-# OpenShadingLanguage
-
-if(WITH_CYCLES_OSL)
-
-       set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
-
-       message(STATUS "CYCLES_OSL = ${CYCLES_OSL}")
-
-       find_library(OSL_LIBRARIES NAMES oslexec oslcomp oslquery PATHS ${CYCLES_OSL}/lib ${CYCLES_OSL}/dist)
-       find_path(OSL_INCLUDES OSL/oslclosure.h PATHS ${CYCLES_OSL}/include ${CYCLES_OSL}/dist)
-       find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin ${CYCLES_OSL}/dist)
-
-       if(OSL_INCLUDES AND OSL_LIBRARIES AND OSL_COMPILER)
-               set(OSL_FOUND TRUE)
-               message(STATUS "OSL includes = ${OSL_INCLUDES}")
-               message(STATUS "OSL library = ${OSL_LIBRARIES}")
-               message(STATUS "OSL compiler = ${OSL_COMPILER}")
-       else()
-               message(STATUS "OSL not found")
-       endif()
-
-       include_directories(${OSL_INCLUDES} ${OSL_INCLUDES}/OSL ${OSL_INCLUDES}/../../../src/liboslexec)
-
-endif()
-
 ###########################################################################
 # Partio
 
index ea675456e6de9042a3cebfd0de6b6da629f5c161..d4ea8b12f5a271e3d1757d419553a7f4b525618e 100644 (file)
@@ -43,7 +43,3 @@ include_directories(${INC})
 add_library(cycles_kernel_osl ${SRC} ${HEADER_SRC})
 
 add_subdirectory(nodes)
-
-if(WITH_CYCLES_OSL)
-       target_link_libraries(cycles_kernel_osl ${OSL_LIBRARIES})
-endif()
index 664219f7a93bb7607f612cc0fd28f0a340cd82a0..0229079c13c43b473198cfac426f6116e7b8c07e 100644 (file)
@@ -790,7 +790,6 @@ if(WITH_CYCLES)
                cycles_kernel
                cycles_util
                cycles_subd)
-       
        if(WITH_CYCLES_OSL)
                list(APPEND BLENDER_LINK_LIBS cycles_kernel_osl)
        endif()