OSL cmake cleanup:
authorLukas Toenne <lukas.toenne@googlemail.com>
Mon, 10 Sep 2012 08:38:51 +0000 (08:38 +0000)
committerLukas Toenne <lukas.toenne@googlemail.com>
Mon, 10 Sep 2012 08:38:51 +0000 (08:38 +0000)
* Removed unused lib and include directories (also one bad 'src' include that wouldn't work anyway)
* Copied cmake library finding to APPLE and WIN32 sections. These may need some adjustment for their respective OS.

CMakeLists.txt

index c6d8d8d2a8776e6f5c70f070f0387b93b6a3899b..f97724d591ebc7a8e8c1b0cea4b7cb3c6505a9a7 100644 (file)
@@ -677,13 +677,13 @@ if(UNIX AND NOT APPLE)
        
                message(STATUS "CYCLES_OSL = ${CYCLES_OSL}")
        
        
                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)
+               find_library(OSL_LIB_EXEC NAMES oslexec PATHS ${CYCLES_OSL}/lib)
+               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})
                # 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)
+               find_path(OSL_INCLUDES OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
+               find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
        
                if(OSL_INCLUDES AND OSL_LIBRARIES AND OSL_COMPILER)
                        set(OSL_FOUND TRUE)
        
                if(OSL_INCLUDES AND OSL_LIBRARIES AND OSL_COMPILER)
                        set(OSL_FOUND TRUE)
@@ -694,7 +694,7 @@ if(UNIX AND NOT APPLE)
                        message(STATUS "OSL not found")
                endif()
        
                        message(STATUS "OSL not found")
                endif()
        
-               include_directories(${OSL_INCLUDES} ${OSL_INCLUDES}/OSL ${OSL_INCLUDES}/../../../src/liboslexec)
+               include_directories(${OSL_INCLUDES})
        endif()
 
        # OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
        endif()
 
        # OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
@@ -841,6 +841,31 @@ elseif(WIN32)
                add_definitions(-D__SSE__ -D__MMX__)
        endif()
 
                add_definitions(-D__SSE__ -D__MMX__)
        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)
+               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})
+               find_path(OSL_INCLUDES OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
+               find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
+       
+               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})
+       endif()
+
        if(MSVC)
                set(PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid)
 
        if(MSVC)
                set(PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid)
 
@@ -1457,6 +1482,31 @@ elseif(APPLE)
                set(OPENIMAGEIO_DEFINITIONS "-DOIIO_STATIC_BUILD")
        endif()
 
                set(OPENIMAGEIO_DEFINITIONS "-DOIIO_STATIC_BUILD")
        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)
+               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})
+               find_path(OSL_INCLUDES OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
+               find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
+       
+               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})
+       endif()
+
        set(EXETYPE MACOSX_BUNDLE)
 
        set(CMAKE_C_FLAGS_DEBUG "-fno-strict-aliasing -g")
        set(EXETYPE MACOSX_BUNDLE)
 
        set(CMAKE_C_FLAGS_DEBUG "-fno-strict-aliasing -g")