Skip to content

Commit

Permalink
[Pxr] Add CMake dependency lookups for python modules.
Browse files Browse the repository at this point in the history
This adds a PyOpenGL lookup module, makes the dependency
in usdview explicit and does the same for jinja2 and usdGenSchema.

Fixes #91

(Internal change: 1669990)
  • Loading branch information
superfunc authored and pixar-oss committed Nov 7, 2016
1 parent 28c078f commit b382c6c
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 6 deletions.
3 changes: 2 additions & 1 deletion cmake/defaults/Packages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,12 @@ if (PXR_BUILD_IMAGING)
find_package(X11)
# --PySide
find_package(PySide)
# --PyOpenGL
find_package(PyOpenGL)
endif()

# Third Party Plugin Package Requirements
# ----------------------------------------------

if (PXR_BUILD_KATANA_PLUGIN)
find_package(KatanaAPI REQUIRED)
find_package(Boost
Expand Down
3 changes: 1 addition & 2 deletions cmake/modules/FindJinja2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
# KIND, either express or implied. See the Apache License for the specific
# language governing permissions and limitations under the Apache License.
#
# - Find Modo libraries
#
# Jinja2 is a python library, ensure that it is available for use with our
# specified version of Python.
#
Expand All @@ -37,6 +35,7 @@ execute_process(
jinja2ImportResult
)
if (jinja2ImportResult EQUAL 0)
message(STATUS "Found Jinja2")
set(JINJA2_FOUND True)
endif()

Expand Down
41 changes: 41 additions & 0 deletions cmake/modules/FindPyOpenGL.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#
# Copyright 2016 Pixar
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
#
# 6. Trademarks. This License does not grant permission to use the trade
# names, trademarks, service marks, or product names of the Licensor
# and its affiliates, except as required to comply with Section 4(c) of
# the License and to reproduce the content of the NOTICE file.
#
# You may obtain a copy of the Apache License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Apache License with the above modification is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the Apache License for the specific
# language governing permissions and limitations under the Apache License.
#
# PyOpenGL is a python library, ensure that it is available for use with our
# specified version of Python.
#

if (NOT PYTHON_EXECUTABLE)
return()
endif()

execute_process(
COMMAND
"${PYTHON_EXECUTABLE}" "-c" "from OpenGL import *"
RESULT_VARIABLE
pyopenglImportResult
)
if (pyopenglImportResult EQUAL 0)
message(STATUS "Found PyOpenGL")
set(PYOPENGL_FOUND True)
endif()
10 changes: 7 additions & 3 deletions pxr/usd/lib/usd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ pxr_shared_library(usd
generatedSchema.usda
)

pxr_python_bins(
usdGenSchema
)
if (NOT JINJA2_FOUND)
message(WARNING "Skipping building usdGenSchema due to missing dependency: Jinja2")
else()
pxr_python_bins(
usdGenSchema
)
endif()
3 changes: 3 additions & 0 deletions pxr/usdImaging/lib/usdviewq/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ set(PXR_PACKAGE usdviewq)
if (NOT PYSIDE_FOUND)
message(WARNING "Not building ${PXR_PACKAGE} because of missing dependency: PySide")
return()
elseif(NOT PYOPENGL_FOUND)
message(WARNING "Not building ${PXR_PACKAGE} because of missing dependency: PyOpenGL")
return()
endif()

pxr_shared_library(usdviewq
Expand Down

0 comments on commit b382c6c

Please sign in to comment.