From 5e5be5095906b8b3afb5801aaa93904ce6a2d7c4 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Sat, 8 Feb 2020 00:14:13 +1100 Subject: [PATCH] cmake: find OSL --- CMakeLists.txt | 4 +- app/CMakeLists.txt | 1 - app/render/backend/osl/oslbackend.cpp | 3 + app/render/backend/osl/oslbackend.h | 2 +- app/render/backend/osl/oslworker.cpp | 9 +++ app/render/backend/videorenderbackend.cpp | 1 + cmake/FindOpenShadingLanguage.cmake | 98 +++++++++++++++++++++++ 7 files changed, 114 insertions(+), 4 deletions(-) create mode 100644 cmake/FindOpenShadingLanguage.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 498a83fea..919c22a25 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,12 +37,12 @@ if(UNIX AND NOT APPLE AND NOT DEFINED OpenGL_GL_PREFERENCE) set(OpenGL_GL_PREFERENCE LEGACY) endif() -find_package(OpenGL REQUIRED) - find_package(OpenColorIO REQUIRED) find_package(OpenImageIO REQUIRED) +find_package(OpenShadingLanguage REQUIRED) + find_package(Qt5 5.6 REQUIRED COMPONENTS Core diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 704a9ab28..1cbec6e8c 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -91,7 +91,6 @@ target_include_directories( target_link_libraries(${OLIVE_TARGET} PRIVATE - OpenGL::GL Qt5::Core Qt5::Gui Qt5::Widgets diff --git a/app/render/backend/osl/oslbackend.cpp b/app/render/backend/osl/oslbackend.cpp index 14a1b87ba..4d6d89ee6 100644 --- a/app/render/backend/osl/oslbackend.cpp +++ b/app/render/backend/osl/oslbackend.cpp @@ -1,5 +1,6 @@ #include "oslbackend.h" +#include #include #include @@ -34,6 +35,8 @@ bool OSLBackend::InitInternal() bool OSLBackend::CompileInternal() { + //OSL::ShadingSystem; + return true; } diff --git a/app/render/backend/osl/oslbackend.h b/app/render/backend/osl/oslbackend.h index 2613c39fa..49f43f29f 100644 --- a/app/render/backend/osl/oslbackend.h +++ b/app/render/backend/osl/oslbackend.h @@ -18,7 +18,7 @@ protected: virtual void DecompileInternal() override; - virtual void ParamsChangedEvent() override; + //virtual void ParamsChangedEvent() override; }; diff --git a/app/render/backend/osl/oslworker.cpp b/app/render/backend/osl/oslworker.cpp index 4953f2e46..86312e482 100644 --- a/app/render/backend/osl/oslworker.cpp +++ b/app/render/backend/osl/oslworker.cpp @@ -14,12 +14,21 @@ OSLWorker::OSLWorker(VideoRenderFrameCache *frame_cache, QObject *parent) : void OSLWorker::FrameToValue(StreamPtr stream, FramePtr frame, NodeValueTable *table) { + Q_UNUSED(stream) + Q_UNUSED(frame) + Q_UNUSED(table) } void OSLWorker::RunNodeAccelerated(const Node *node, const TimeRange &range, const NodeValueDatabase &input_params, NodeValueTable *output_params) { + Q_UNUSED(node) + Q_UNUSED(range) + Q_UNUSED(input_params) + Q_UNUSED(output_params) } void OSLWorker::TextureToBuffer(const QVariant &tex_in, QByteArray &buffer) { + Q_UNUSED(tex_in) + Q_UNUSED(buffer) } diff --git a/app/render/backend/videorenderbackend.cpp b/app/render/backend/videorenderbackend.cpp index d69ebc57e..d74bdb72d 100644 --- a/app/render/backend/videorenderbackend.cpp +++ b/app/render/backend/videorenderbackend.cpp @@ -300,6 +300,7 @@ void VideoRenderBackend::ThreadCompletedFrame(NodeDependency path, qint64 job_ti { if (!only_signal_last_frame_requested_ || last_time_requested_ == path.in() || frame_cache_.TimeToHash(last_time_requested_) == hash) { Q_UNUSED(job_time) + Q_UNUSED(value) //EmitCachedFrameReady(path.in(), value, job_time); } diff --git a/cmake/FindOpenShadingLanguage.cmake b/cmake/FindOpenShadingLanguage.cmake new file mode 100644 index 000000000..824d0f905 --- /dev/null +++ b/cmake/FindOpenShadingLanguage.cmake @@ -0,0 +1,98 @@ +# - Find OpenShadingLanguage library +# Find the native OpenShadingLanguage includes and library +# This module defines +# OSL_INCLUDE_DIRS, where to find OSL headers, Set when +# OSL_INCLUDE_DIR is found. +# OSL_LIBRARIES, libraries to link against to use OSL. +# OSL_ROOT_DIR, the base directory to search for OSL. +# This can also be an environment variable. +# OSL_COMPILER, full path to OSL script compiler. +# OSL_FOUND, if false, do not try to use OSL. +# OSL_LIBRARY_VERSION_MAJOR, OSL_LIBRARY_VERSION_MINOR, the major +# and minor versions of OSL library if found. +# +#============================================================================= +# Copyright 2014 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 OSL_ROOT_DIR was defined in the environment, use it. +IF(NOT OSL_ROOT_DIR AND NOT $ENV{OSL_ROOT_DIR} STREQUAL "") + SET(OSL_ROOT_DIR $ENV{OSL_ROOT_DIR}) +ENDIF() + +SET(_osl_FIND_COMPONENTS + oslcomp + oslexec + oslquery +) + +SET(_osl_SEARCH_DIRS + ${OSL_ROOT_DIR} + /usr/local + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt/lib/osl +) + +FIND_PATH(OSL_INCLUDE_DIR + NAMES + OSL/oslversion.h + HINTS + ${_osl_SEARCH_DIRS} + PATH_SUFFIXES + include +) + +SET(_osl_LIBRARIES) +FOREACH(COMPONENT ${_osl_FIND_COMPONENTS}) + STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT) + + FIND_LIBRARY(OSL_${UPPERCOMPONENT}_LIBRARY + NAMES + ${COMPONENT} + HINTS + ${_osl_SEARCH_DIRS} + PATH_SUFFIXES + lib64 lib + ) + LIST(APPEND _osl_LIBRARIES "${OSL_${UPPERCOMPONENT}_LIBRARY}") +ENDFOREACH() + +FIND_PROGRAM(OSL_COMPILER oslc + HINTS ${_osl_SEARCH_DIRS} + PATH_SUFFIXES bin) + +# handle the QUIETLY and REQUIRED arguments and set OSL_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(OSL DEFAULT_MSG _osl_LIBRARIES OSL_INCLUDE_DIR OSL_COMPILER) + +IF(OSL_FOUND) + SET(OSL_LIBRARIES ${_osl_LIBRARIES}) + SET(OSL_INCLUDE_DIRS ${OSL_INCLUDE_DIR}) + + FILE(STRINGS "${OSL_INCLUDE_DIR}/OSL/oslversion.h" OSL_LIBRARY_VERSION_MAJOR + REGEX "^[ \t]*#define[ \t]+OSL_LIBRARY_VERSION_MAJOR[ \t]+[0-9]+.*$") + FILE(STRINGS "${OSL_INCLUDE_DIR}/OSL/oslversion.h" OSL_LIBRARY_VERSION_MINOR + REGEX "^[ \t]*#define[ \t]+OSL_LIBRARY_VERSION_MINOR[ \t]+[0-9]+.*$") + STRING(REGEX REPLACE ".*#define[ \t]+OSL_LIBRARY_VERSION_MAJOR[ \t]+([.0-9]+).*" + "\\1" OSL_LIBRARY_VERSION_MAJOR ${OSL_LIBRARY_VERSION_MAJOR}) + STRING(REGEX REPLACE ".*#define[ \t]+OSL_LIBRARY_VERSION_MINOR[ \t]+([.0-9]+).*" + "\\1" OSL_LIBRARY_VERSION_MINOR ${OSL_LIBRARY_VERSION_MINOR}) +ENDIF(OSL_FOUND) + +MARK_AS_ADVANCED( + OSL_INCLUDE_DIR +) +FOREACH(COMPONENT ${_osl_FIND_COMPONENTS}) + STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT) + MARK_AS_ADVANCED(OSL_${UPPERCOMPONENT}_LIBRARY) +ENDFOREACH()