2012-06-08 18:18:20 +00:00
|
|
|
#
|
2013-07-18 21:19:50 +00:00
|
|
|
# Copyright 2013 Pixar
|
2012-06-08 18:18:20 +00:00
|
|
|
#
|
2013-07-18 21:19:50 +00:00
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License
|
|
|
|
# and the following modification to it: Section 6 Trademarks.
|
|
|
|
# deleted and replaced with:
|
2012-06-08 18:18:20 +00:00
|
|
|
#
|
2013-07-18 21:19:50 +00:00
|
|
|
# 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 for reproducing
|
|
|
|
# the content of the NOTICE file.
|
2012-06-08 18:18:20 +00:00
|
|
|
#
|
2013-07-18 21:19:50 +00:00
|
|
|
# You may obtain a copy of the License at
|
2012-06-08 18:18:20 +00:00
|
|
|
#
|
2013-07-18 21:19:50 +00:00
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing,
|
|
|
|
# software distributed under the License is distributed on an
|
|
|
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
|
|
# either express or implied. See the License for the specific
|
|
|
|
# language governing permissions and limitations under the
|
|
|
|
# License.
|
2012-06-08 18:18:20 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
project(OpenSubdiv)
|
|
|
|
|
2013-04-23 21:47:46 +00:00
|
|
|
cmake_minimum_required(VERSION 2.8.6)
|
2012-06-08 18:18:20 +00:00
|
|
|
|
2013-02-01 18:09:55 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# Obtain OpenSubdiv API version from version.h file
|
|
|
|
if(EXISTS "${CMAKE_SOURCE_DIR}/opensubdiv/version.h")
|
2013-08-15 23:11:33 +00:00
|
|
|
file(STRINGS "${CMAKE_SOURCE_DIR}/opensubdiv/version.h"
|
2013-02-01 18:09:55 +00:00
|
|
|
OpenSubdiv_VERSION REGEX "^#define OPENSUBDIV_VERSION .*$")
|
|
|
|
string(REPLACE "#define OPENSUBDIV_VERSION " "" OpenSubdiv_VERSION ${OpenSubdiv_VERSION})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
|
2012-06-08 18:18:20 +00:00
|
|
|
message(STATUS "Compiling ${CMAKE_PROJECT_NAME} version ${OpenSubdiv_VERSION}")
|
|
|
|
message(STATUS "Using cmake version ${CMAKE_VERSION}")
|
|
|
|
|
2013-01-24 21:40:43 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
2012-06-08 18:18:20 +00:00
|
|
|
# Specify the default install path
|
2013-04-23 02:35:41 +00:00
|
|
|
if (NOT DEFINED CMAKE_INSTALL_PREFIX)
|
|
|
|
SET( CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}/ )
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (NOT DEFINED CMAKE_INCDIR_BASE)
|
2013-08-01 20:27:27 +00:00
|
|
|
set( CMAKE_INCDIR_BASE include/opensubdiv )
|
2013-04-23 02:35:41 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if (NOT DEFINED CMAKE_BINDIR_BASE)
|
|
|
|
set( CMAKE_BINDIR_BASE bin )
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (NOT DEFINED CMAKE_LIBDIR_BASE)
|
|
|
|
set( CMAKE_LIBDIR_BASE lib )
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (NOT DEFINED CMAKE_PLUGINDIR_BASE)
|
|
|
|
set( CMAKE_PLUGINDIR_BASE plugin )
|
|
|
|
endif()
|
2012-06-08 18:18:20 +00:00
|
|
|
|
2013-08-07 23:17:46 +00:00
|
|
|
if (NOT DEFINED CMAKE_DOCDIR_BASE)
|
|
|
|
set( CMAKE_DOCDIR_BASE share/doc/opensubdiv )
|
2013-09-17 01:56:40 +00:00
|
|
|
else()
|
|
|
|
if (IS_ABSOLUTE ${CMAKE_DOCDIR_BASE})
|
|
|
|
set( CMAKE_DOCDIR_BASE ${CMAKE_DOCDIR_BASE} )
|
|
|
|
else()
|
|
|
|
set( CMAKE_DOCDIR_BASE ${CMAKE_INSTALL_PREFIX}/${CMAKE_DOCDIR_BASE} )
|
|
|
|
endif()
|
2013-08-07 23:17:46 +00:00
|
|
|
endif()
|
|
|
|
|
2012-12-21 02:34:18 +00:00
|
|
|
# Allow install path to be overridden for cross-compile builds
|
|
|
|
if(LIBRARY_OUTPUT_PATH_ROOT)
|
2013-04-23 02:35:41 +00:00
|
|
|
SET( CMAKE_INSTALL_PREFIX ${LIBRARY_OUTPUT_PATH_ROOT}/ )
|
2012-12-21 02:34:18 +00:00
|
|
|
endif()
|
|
|
|
|
2012-06-08 18:18:20 +00:00
|
|
|
# Set the directory where the executables will be stored.
|
|
|
|
set(EXECUTABLE_OUTPUT_PATH
|
|
|
|
${PROJECT_BINARY_DIR}/bin
|
|
|
|
CACHE PATH
|
|
|
|
"Directory where executables will be stored"
|
|
|
|
)
|
|
|
|
|
|
|
|
# Set the directory where the libraries will be stored.
|
|
|
|
set(LIBRARY_OUTPUT_PATH
|
|
|
|
${PROJECT_BINARY_DIR}/lib
|
|
|
|
CACHE PATH
|
|
|
|
"Directory where all libraries will be stored"
|
|
|
|
)
|
|
|
|
|
|
|
|
# Specify the list of directories to search for cmake modules.
|
|
|
|
set(CMAKE_MODULE_PATH
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/cmake
|
|
|
|
)
|
|
|
|
|
2013-04-23 18:58:49 +00:00
|
|
|
list(APPEND CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
|
|
|
|
|
|
|
|
# add the automatically determined parts of the RPATH
|
|
|
|
# which point to directories outside the build tree to the install RPATH
|
|
|
|
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
|
|
|
|
2013-01-24 21:40:43 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# Detect Clang (until a cmake version provides built-in variables)
|
|
|
|
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
|
|
|
set(CMAKE_COMPILER_IS_CLANGCC 1)
|
2013-08-15 22:21:00 +00:00
|
|
|
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel")
|
|
|
|
set(CMAKE_COMPILER_IS_ICC 1)
|
2013-01-24 21:40:43 +00:00
|
|
|
endif()
|
|
|
|
|
2013-01-22 22:47:46 +00:00
|
|
|
|
2013-02-08 21:51:11 +00:00
|
|
|
set(OSD_COMPILER_FLAGS)
|
|
|
|
|
2013-01-24 21:40:43 +00:00
|
|
|
# Disable spurrious warnings in gcc builds and clang
|
2013-08-15 22:21:00 +00:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANGCC OR CMAKE_COMPILER_IS_ICC )
|
2013-01-24 21:40:43 +00:00
|
|
|
|
|
|
|
# Turn on all warnings
|
2013-02-08 21:51:11 +00:00
|
|
|
list(APPEND OSD_COMPILER_FLAGS -Wall)
|
2013-01-24 21:40:43 +00:00
|
|
|
|
|
|
|
# HBR uses the offsetof macro on a templated struct, which appears
|
|
|
|
# to spurriously set off this warning in both gccc and Clang
|
2013-02-08 21:51:11 +00:00
|
|
|
list(APPEND OSD_COMPILER_FLAGS -Wno-invalid-offsetof)
|
2013-05-17 19:44:30 +00:00
|
|
|
|
|
|
|
# HBR uses unions as an optimization for its memory allocation.
|
|
|
|
# Type casting between union members breaks strict aliasing rules from
|
|
|
|
# gcc 4.4.1 versions onwards. We disable the warning but keep aliasing
|
|
|
|
# optimization.
|
|
|
|
list(APPEND OSD_COMPILER_FLAGS -Wno-strict-aliasing)
|
2013-08-15 23:11:33 +00:00
|
|
|
|
2013-01-24 21:40:43 +00:00
|
|
|
# FAR and OSD have templated virtual function implementations that trigger
|
|
|
|
# a lot of hidden virtual function overloads (some of them spurrious).
|
|
|
|
# Disable those for now in Clang.
|
|
|
|
if(CMAKE_COMPILER_IS_CLANGCC)
|
2013-02-08 21:51:11 +00:00
|
|
|
list(APPEND OSD_COMPILER_FLAGS -Wno-overloaded-virtual)
|
2013-01-24 21:40:43 +00:00
|
|
|
endif()
|
|
|
|
|
2013-08-15 22:21:00 +00:00
|
|
|
# Intel's icc compiler requires some libraries linked
|
|
|
|
if(CMAKE_COMPILER_IS_ICC)
|
|
|
|
|
|
|
|
foreach (ICC_LIB iomp5 irng intlc)
|
|
|
|
|
2013-09-05 01:59:46 +00:00
|
|
|
if(CMAKE_SIZEOF_VOID_P MATCHES "8")
|
|
|
|
list(APPEND ICC_LIB_ARCH "intel64")
|
|
|
|
elseif(CMAKE_SIZEOF_VOID_P MATCHES "4")
|
|
|
|
list(APPEND ICC_LIB_ARCH "ia32")
|
|
|
|
endif()
|
|
|
|
|
2013-08-15 22:21:00 +00:00
|
|
|
find_library( ICC_${ICC_LIB}
|
|
|
|
NAMES
|
|
|
|
${ICC_LIB}
|
|
|
|
PATHS
|
|
|
|
${ICC_LOCATION}/lib
|
|
|
|
/opt/intel/lib/
|
|
|
|
PATH_SUFFIXES
|
2013-09-05 01:59:46 +00:00
|
|
|
${ICC_LIB_ARCH}
|
2013-08-15 22:21:00 +00:00
|
|
|
)
|
2013-08-15 23:11:33 +00:00
|
|
|
|
2013-08-15 22:21:00 +00:00
|
|
|
if (ICC_${ICC_LIB})
|
|
|
|
list(APPEND ICC_LIBRARIES ${ICC_${ICC_LIB}})
|
|
|
|
else()
|
|
|
|
message( FATAL_ERROR "${ICC_${ICC_LIB}} library not found - required by icc" )
|
|
|
|
endif()
|
|
|
|
|
|
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
|
2013-01-24 21:40:43 +00:00
|
|
|
elseif(MSVC)
|
|
|
|
|
|
|
|
# Turn on all warnings
|
2013-02-08 21:51:11 +00:00
|
|
|
list(APPEND OSD_COMPILER_FLAGS /Wall)
|
2013-08-15 23:11:33 +00:00
|
|
|
|
2013-01-24 21:40:43 +00:00
|
|
|
# MSVC is unfortunately not standard conforming with regards to
|
|
|
|
# the alternative names for logical and bitwise operators:
|
|
|
|
# http://stackoverflow.com/questions/555505/c-alternative-tokens
|
|
|
|
# http://stackoverflow.com/questions/6006526/c-writing-or-instead-of
|
|
|
|
#
|
|
|
|
# This can be solved by including iso646.h, but that is a rather
|
|
|
|
# unsatisfactory solution since we then always have to remember to
|
|
|
|
# include this header file. Instead we define these operators
|
|
|
|
# ourselves as command line arguments to cl.exe.
|
|
|
|
#
|
|
|
|
# An alternative would be to compile with the /Za option
|
|
|
|
# (but unfortunately that breaks other code):
|
|
|
|
# http://msdn.microsoft.com/en-us/library/0k0w269d.aspx
|
2013-02-08 21:51:11 +00:00
|
|
|
list(APPEND OSD_COMPILER_FLAGS
|
2013-01-24 21:40:43 +00:00
|
|
|
/Dand=&&
|
|
|
|
/Dand_eq=&=
|
|
|
|
/Dbitand=&
|
|
|
|
/Dbitor=|
|
|
|
|
/Dcompl=~
|
|
|
|
/Dnot=!
|
|
|
|
/Dnot_eq=!=
|
|
|
|
/Dor=||
|
|
|
|
/Dor_eq=|=
|
|
|
|
# nvcc does not seem to like a caret being the last character
|
|
|
|
# in a command line defined preprocessor symbol, so add an
|
|
|
|
# empty trailing comment to avoid this.
|
|
|
|
/Dxor=^/**/
|
|
|
|
/Dxor_eq=^=
|
2013-03-07 22:04:29 +00:00
|
|
|
)
|
2013-08-15 23:11:33 +00:00
|
|
|
|
2013-02-08 21:51:11 +00:00
|
|
|
|
|
|
|
list(APPEND OSD_COMPILER_FLAGS
|
2013-01-24 21:40:43 +00:00
|
|
|
/W3 # Use warning level recommended for production purposes.
|
|
|
|
/WX # Treat all compiler warnings as errors.
|
2013-02-10 02:02:49 +00:00
|
|
|
|
|
|
|
# these warnings are being triggered from inside VC's header files
|
|
|
|
# warning C4350: behavior change: 'member1' called instead of 'member2'
|
2013-02-14 17:44:11 +00:00
|
|
|
/wd4350
|
2013-02-10 02:02:49 +00:00
|
|
|
# warning C4548: expression before comma has no effect; expected expression with side-effect
|
2013-02-14 17:44:11 +00:00
|
|
|
/wd4548
|
2013-08-15 23:11:33 +00:00
|
|
|
|
2013-01-24 21:40:43 +00:00
|
|
|
# Make sure WinDef.h does not define min and max macros which
|
|
|
|
# will conflict with std::min() and std::max().
|
|
|
|
/DNOMINMAX
|
2013-08-15 23:11:33 +00:00
|
|
|
|
2013-01-24 21:40:43 +00:00
|
|
|
# Make sure the constants in <math.h> get defined.
|
|
|
|
/D_USE_MATH_DEFINES
|
2013-08-15 23:11:33 +00:00
|
|
|
|
2013-01-24 21:40:43 +00:00
|
|
|
# Do not enforce MSVC's safe CRT replacements.
|
|
|
|
/D_CRT_SECURE_NO_WARNINGS
|
2013-08-15 23:11:33 +00:00
|
|
|
|
2013-01-24 21:40:43 +00:00
|
|
|
# Disable checked iterators and iterator debugging. Visual Studio
|
|
|
|
# 2008 does not implement std::vector::data(), so we need to take the
|
|
|
|
# address of std::vector::operator[](0) to get the memory location of
|
|
|
|
# a vector's underlying data storage. This does not work for an empty
|
|
|
|
# vector if checked iterators or iterator debugging is enabled.
|
2013-08-15 23:11:33 +00:00
|
|
|
|
|
|
|
# XXXX manuelk : we can't force SECURE_SCL to 0 or client code has
|
|
|
|
# problems linking against OSD if their build is not also
|
|
|
|
# overriding SSCL to the same value.
|
|
|
|
# See : http://msdn.microsoft.com/en-us/library/vstudio/hh697468.aspx
|
2013-03-07 22:04:29 +00:00
|
|
|
#/D_SECURE_SCL=0
|
|
|
|
#/D_HAS_ITERATOR_DEBUGGING=0
|
|
|
|
)
|
2013-02-08 21:51:11 +00:00
|
|
|
|
2013-08-15 23:11:33 +00:00
|
|
|
# Turn off a duplicate LIBCMT linker warning
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS
|
2013-03-07 22:04:29 +00:00
|
|
|
"${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:libcmt.lib")
|
2013-08-15 23:11:33 +00:00
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS
|
2013-03-07 22:04:29 +00:00
|
|
|
"${CMAKE_SHARED_LINKER_FLAGS} /NODEFAULTLIB:libcmt.lib")
|
2013-02-08 21:51:11 +00:00
|
|
|
|
2013-01-10 18:47:50 +00:00
|
|
|
endif()
|
|
|
|
|
2013-08-14 23:38:13 +00:00
|
|
|
if(${SIMD} MATCHES "AVX")
|
|
|
|
list(APPEND OSD_COMPILER_FLAGS -xAVX)
|
2013-08-15 23:11:33 +00:00
|
|
|
endif()
|
2013-08-14 23:38:13 +00:00
|
|
|
|
2013-02-08 21:51:11 +00:00
|
|
|
add_definitions(${OSD_COMPILER_FLAGS})
|
|
|
|
|
2013-01-24 21:40:43 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
|
2012-06-08 18:18:20 +00:00
|
|
|
# Ignore rules that will re-run cmake (this will avoid constant
|
|
|
|
# reloading of the generated Visual Studio project).
|
|
|
|
set(CMAKE_SUPPRESS_REGENERATION TRUE)
|
|
|
|
|
2012-06-14 21:03:30 +00:00
|
|
|
# Check for dependencies
|
2013-01-24 21:40:43 +00:00
|
|
|
if(NOT NO_OMP)
|
|
|
|
find_package(OpenMP)
|
|
|
|
endif()
|
2013-08-15 23:11:33 +00:00
|
|
|
if(NOT NO_TBB)
|
|
|
|
find_package(TBB 4.0)
|
|
|
|
endif()
|
2012-06-14 21:03:30 +00:00
|
|
|
find_package(OpenGL)
|
2012-12-20 18:25:41 +00:00
|
|
|
find_package(OpenGLES)
|
2013-01-31 23:34:35 +00:00
|
|
|
find_package(OpenCL 1.1)
|
2013-07-12 01:55:17 +00:00
|
|
|
if(NOT NO_CUDA)
|
|
|
|
find_package(CUDA 4.0)
|
|
|
|
endif()
|
2013-08-07 18:16:00 +00:00
|
|
|
if(NOT ANDROID AND NOT IOS)
|
|
|
|
find_package(GLFW 2.7.0)
|
|
|
|
endif()
|
2013-01-31 23:34:35 +00:00
|
|
|
find_package(PTex 2.0)
|
2013-02-07 19:37:00 +00:00
|
|
|
find_package(PythonInterp 2.6)
|
|
|
|
find_package(SWIG 1.3.40)
|
2013-07-05 22:36:54 +00:00
|
|
|
find_package(Doxygen 1.8.4)
|
2013-07-04 17:47:56 +00:00
|
|
|
find_package(Docutils 0.6)
|
2013-07-19 02:44:54 +00:00
|
|
|
if (OPENGL_FOUND)
|
|
|
|
if (APPLE)
|
|
|
|
find_package(GLEW)
|
|
|
|
else()
|
2013-08-07 22:50:35 +00:00
|
|
|
find_package(GLEW REQUIRED)
|
|
|
|
endif()
|
2012-06-14 21:03:30 +00:00
|
|
|
endif()
|
|
|
|
|
2012-12-11 01:15:13 +00:00
|
|
|
if (WIN32)
|
|
|
|
find_package(DXSDK)
|
|
|
|
endif()
|
|
|
|
|
2013-02-02 20:53:33 +00:00
|
|
|
if (NOT NO_GCD AND APPLE)
|
|
|
|
set(GCD_FOUND 1)
|
|
|
|
endif()
|
|
|
|
|
2013-01-31 23:34:35 +00:00
|
|
|
find_package(Maya 201200)
|
2012-06-14 00:37:56 +00:00
|
|
|
|
2012-08-04 02:51:27 +00:00
|
|
|
# Warn about missing dependencies that will cause parts of OpenSubdiv to be
|
|
|
|
# disabled. Also, add preprocessor defines that can be used in the source
|
|
|
|
# code to determine if a specific dependency is present or not.
|
|
|
|
|
2013-02-02 20:53:33 +00:00
|
|
|
if(GCD_FOUND)
|
|
|
|
add_definitions( -DOPENSUBDIV_HAS_GCD )
|
|
|
|
endif()
|
|
|
|
|
2012-08-04 02:51:27 +00:00
|
|
|
if(OPENMP_FOUND)
|
|
|
|
add_definitions(
|
|
|
|
-DOPENSUBDIV_HAS_OPENMP
|
|
|
|
${OpenMP_CXX_FLAGS}
|
|
|
|
)
|
2013-08-15 22:21:00 +00:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_CXX_FLAGS}")
|
2012-08-04 02:51:27 +00:00
|
|
|
else()
|
|
|
|
message(WARNING
|
|
|
|
"OpenMP was not found : support for OMP parallel compute kernels "
|
|
|
|
"will be diabled in Osd. If your compiler supports OpenMP "
|
|
|
|
"directives, please refer to the FindOpenMP.cmake shared module "
|
|
|
|
"in your cmake installation.")
|
|
|
|
endif()
|
|
|
|
|
2013-08-15 23:11:33 +00:00
|
|
|
if(TBB_FOUND)
|
|
|
|
add_definitions(
|
|
|
|
-DOPENSUBDIV_HAS_TBB
|
|
|
|
${TBB_CXX_FLAGS}
|
|
|
|
)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TBB_CXX_FLAGS}")
|
|
|
|
else()
|
|
|
|
message(WARNING
|
|
|
|
"TBB was not found : support for TBB parallel compute kernels "
|
|
|
|
"will be diabled in Osd. If your compiler supports TBB "
|
|
|
|
"directives, please refer to the FindTBB.cmake shared module "
|
|
|
|
"in your cmake installation.")
|
|
|
|
endif()
|
|
|
|
|
2013-01-31 23:34:35 +00:00
|
|
|
if(GLFW_FOUND AND (GLFW_VERSION VERSION_EQUAL 3.0 OR GLFW_VERSION VERSION_GREATER 3.0))
|
|
|
|
add_definitions( -DGLFW_VERSION_3 )
|
|
|
|
endif()
|
|
|
|
|
2013-06-26 07:52:57 +00:00
|
|
|
# note: perhaps rename this to be more consistent, e.g. OPENSUBDIV_USES_GLEW
|
|
|
|
if(GLEW_FOUND)
|
|
|
|
add_definitions( -DOSD_USES_GLEW )
|
|
|
|
endif()
|
|
|
|
|
2012-12-11 01:15:13 +00:00
|
|
|
# note : (GLSL transform feedback kernels require GL 4.2)
|
|
|
|
if(GLEW_FOUND AND OPENGL_4_2_FOUND)
|
2012-08-04 02:51:27 +00:00
|
|
|
add_definitions(
|
2012-12-11 01:15:13 +00:00
|
|
|
-DOPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK
|
2012-08-04 02:51:27 +00:00
|
|
|
)
|
|
|
|
else()
|
|
|
|
message(WARNING
|
2012-12-11 01:15:13 +00:00
|
|
|
"OpenGL 4.2 was not found : support for GLSL transform feedback kernels "
|
2012-08-04 02:51:27 +00:00
|
|
|
"will be disabled in Osd. If you have an OpenGL SDK installed "
|
|
|
|
"(version 4.2 or above), please refer to the FindOpenGL.cmake "
|
|
|
|
"shared module in your cmake installation.")
|
|
|
|
endif()
|
|
|
|
|
2012-12-11 01:15:13 +00:00
|
|
|
# note : (GLSL compute shader kernels require GL 4.3)
|
|
|
|
if(GLEW_FOUND AND OPENGL_4_3_FOUND)
|
|
|
|
add_definitions(
|
|
|
|
-DOPENSUBDIV_HAS_GLSL_COMPUTE
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
message(WARNING
|
|
|
|
"OpenGL 4.3 was not found : support for GLSL compute shader kernels "
|
|
|
|
"will be disabled in Osd. If you have an OpenGL SDK installed "
|
|
|
|
"(version 4.3 or above), please refer to the FindOpenGL.cmake "
|
|
|
|
"shared module in your cmake installation.")
|
|
|
|
endif()
|
|
|
|
|
2012-12-20 18:25:41 +00:00
|
|
|
if(OPENGLES_FOUND)
|
|
|
|
add_definitions(
|
|
|
|
-DOPENSUBDIV_HAS_OPENGLES
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2012-08-04 02:51:27 +00:00
|
|
|
if(OPENCL_FOUND)
|
|
|
|
add_definitions(
|
|
|
|
-DOPENSUBDIV_HAS_OPENCL
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
message(WARNING
|
|
|
|
"OpenCL was not found : support for OpenCL parallel compute kernels "
|
|
|
|
"will be disabled in Osd. If you have the OpenCL SDK installed, "
|
|
|
|
"please refer to the FindOpenCL.cmake in ${PROJECT_SOURCE_DIR}/cmake.")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CUDA_FOUND)
|
|
|
|
add_definitions(
|
|
|
|
-DOPENSUBDIV_HAS_CUDA
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
message(WARNING
|
|
|
|
"CUDA was not found : support for CUDA parallel compute kernels "
|
|
|
|
"will be disabled in Osd. If you have the CUDA SDK installed, please "
|
|
|
|
"refer to the FindCUDA.cmake shared module in your cmake installation.")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(PTEX_FOUND)
|
|
|
|
add_definitions(
|
|
|
|
-DOPENSUBDIV_HAS_PTEX
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
message(WARNING
|
|
|
|
"Ptex was not found : the OpenSubdiv Ptex example will not be "
|
|
|
|
"available. If you do have Ptex installed and see this message, "
|
|
|
|
"please add your Ptex path to FindPTex.cmake in "
|
|
|
|
"${PROJECT_SOURCE_DIR}/cmake or set it through the PTEX_LOCATION "
|
|
|
|
"cmake command line argument or environment variable."
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(MAYA_FOUND)
|
|
|
|
add_definitions(
|
|
|
|
-DOPENSUBDIV_HAS_MAYA
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
message(WARNING
|
|
|
|
"Maya was not found : the OpenSubdiv mayaViwer plugin will not be "
|
|
|
|
"available. If you do have Maya installed and see this message, "
|
|
|
|
"please add your Maya path to FindMaya.cmake in "
|
|
|
|
"${PROJECT_SOURCE_DIR}/cmake or set it through the MAYA_LOCATION "
|
|
|
|
"cmake command line argument or environment variable."
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2012-06-21 01:20:41 +00:00
|
|
|
# Link examples & regressions dynamically against Osd
|
2012-12-11 01:15:13 +00:00
|
|
|
set( OSD_LINK_TARGET osd_dynamic_cpu osd_dynamic_gpu )
|
2012-06-21 01:20:41 +00:00
|
|
|
|
|
|
|
if (WIN32)
|
|
|
|
add_definitions(
|
2012-08-04 02:51:27 +00:00
|
|
|
# Link against the static version of GLEW.
|
2012-06-21 01:20:41 +00:00
|
|
|
-DGLEW_STATIC
|
|
|
|
)
|
|
|
|
# Link examples & regressions statically against Osd for
|
|
|
|
# Windows until all the kinks can be worked out.
|
2012-12-11 01:15:13 +00:00
|
|
|
set( OSD_LINK_TARGET osd_static_cpu osd_static_gpu )
|
|
|
|
|
|
|
|
if (DXSDK_FOUND)
|
|
|
|
add_definitions(
|
|
|
|
-DOPENSUBDIV_HAS_DX11SDK
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
message(WARNING
|
|
|
|
"DirectX11 SDK was not found. "
|
|
|
|
"If you do have DXSDK installed and see this message, "
|
|
|
|
"please add your sdk path to FindDirectX.cmake in "
|
|
|
|
"${PROJECT_SOURCE_DIR}/cmake or set it through the "
|
|
|
|
"DXSDK_LOCATION cmake command line argument or "
|
|
|
|
"environment variable."
|
|
|
|
)
|
|
|
|
endif()
|
2012-06-21 01:20:41 +00:00
|
|
|
endif()
|
2012-06-08 18:18:20 +00:00
|
|
|
|
2012-08-04 02:51:27 +00:00
|
|
|
|
2013-01-24 21:40:43 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# General-use macros
|
2012-08-04 02:51:27 +00:00
|
|
|
|
2013-07-05 22:36:54 +00:00
|
|
|
# Macro for processing public headers into the build area for doxygen processing
|
|
|
|
|
2013-07-12 01:55:17 +00:00
|
|
|
#set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
|
|
|
2013-07-05 22:36:54 +00:00
|
|
|
add_custom_target( public_headers )
|
|
|
|
|
|
|
|
macro(_add_doxy_headers headers)
|
2013-07-12 01:55:17 +00:00
|
|
|
if (NOT NO_DOC AND DOXYGEN_FOUND)
|
2013-07-09 17:00:40 +00:00
|
|
|
file(RELATIVE_PATH path ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} )
|
2013-07-05 22:36:54 +00:00
|
|
|
|
2013-07-09 17:00:40 +00:00
|
|
|
string(REPLACE "/" "_" targetpath ${path})
|
2013-07-05 22:36:54 +00:00
|
|
|
|
2013-07-09 17:00:40 +00:00
|
|
|
foreach (header ${headers})
|
2013-07-05 22:36:54 +00:00
|
|
|
|
2013-07-09 17:00:40 +00:00
|
|
|
set(infile ${CMAKE_CURRENT_SOURCE_DIR}/${header})
|
|
|
|
set(outfile ${CMAKE_BINARY_DIR}/public_headers/${path}/${header})
|
|
|
|
set(targetname "${targetpath}_${header}")
|
2013-07-05 22:36:54 +00:00
|
|
|
|
2013-07-09 17:00:40 +00:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT
|
|
|
|
${outfile}
|
|
|
|
COMMAND
|
|
|
|
${CMAKE_COMMAND}
|
|
|
|
ARGS
|
|
|
|
-E copy ${infile} ${outfile}
|
|
|
|
DEPENDS
|
|
|
|
${infile}
|
|
|
|
)
|
2013-07-05 22:36:54 +00:00
|
|
|
|
2013-07-09 17:00:40 +00:00
|
|
|
add_custom_target(${targetname} DEPENDS ${outfile})
|
2013-08-15 23:11:33 +00:00
|
|
|
|
2013-07-12 01:55:17 +00:00
|
|
|
#set_target_properties(${targetname} PROPERTIES FOLDER "public_headers/")
|
2013-07-05 22:36:54 +00:00
|
|
|
|
2013-07-09 17:00:40 +00:00
|
|
|
list(APPEND headerfiles ${targetname} )
|
|
|
|
endforeach()
|
2013-07-05 22:36:54 +00:00
|
|
|
|
2013-07-09 17:00:40 +00:00
|
|
|
add_dependencies( public_headers DEPENDS ${headerfiles} )
|
|
|
|
endif()
|
2013-07-05 22:36:54 +00:00
|
|
|
endmacro()
|
|
|
|
|
|
|
|
|
2013-09-17 01:16:28 +00:00
|
|
|
# Macro wrapper for adding a non-cuda dependent executable
|
|
|
|
macro(_add_executable target)
|
|
|
|
|
|
|
|
add_executable(${target} ${ARGN})
|
|
|
|
|
|
|
|
if(CMAKE_COMPILER_IS_ICC)
|
|
|
|
target_link_libraries(${target} ${ICC_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
|
2012-06-11 02:59:04 +00:00
|
|
|
# Macro for adding a cuda executable if cuda is found and a regular
|
|
|
|
# executable otherwise.
|
2012-08-04 02:51:27 +00:00
|
|
|
macro(_add_possibly_cuda_executable target)
|
2012-06-11 02:59:04 +00:00
|
|
|
if(CUDA_FOUND)
|
|
|
|
cuda_add_executable(${target} ${ARGN})
|
|
|
|
else()
|
|
|
|
add_executable(${target} ${ARGN})
|
|
|
|
endif()
|
2013-08-15 23:11:33 +00:00
|
|
|
|
2013-08-15 22:21:00 +00:00
|
|
|
if(CMAKE_COMPILER_IS_ICC)
|
|
|
|
target_link_libraries(${target} ${ICC_LIBRARIES})
|
|
|
|
endif()
|
2012-06-11 02:59:04 +00:00
|
|
|
endmacro()
|
|
|
|
|
2012-08-04 02:51:27 +00:00
|
|
|
|
2012-06-11 02:59:04 +00:00
|
|
|
# Macro for adding a cuda library if cuda is found and a regular
|
|
|
|
# library otherwise.
|
2012-08-04 02:51:27 +00:00
|
|
|
macro(_add_possibly_cuda_library target)
|
2012-06-11 02:59:04 +00:00
|
|
|
if(CUDA_FOUND)
|
|
|
|
cuda_add_library(${target} ${ARGN})
|
|
|
|
else()
|
|
|
|
add_library(${target} ${ARGN})
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
|
2013-09-17 01:16:28 +00:00
|
|
|
# Macro for adding a (potentially cuda) GLFW executable.
|
2013-01-29 23:54:18 +00:00
|
|
|
macro(_add_glfw_executable target)
|
2012-08-04 02:51:27 +00:00
|
|
|
|
|
|
|
_add_possibly_cuda_executable(${target} ${ARGN})
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
# Windows needs some of its dependency dll's copied into the same
|
|
|
|
# directory as the executable.
|
2013-01-29 23:54:18 +00:00
|
|
|
set( LIBRARIES ${GLFW_LIBRARIES})
|
2012-08-04 02:51:27 +00:00
|
|
|
foreach (LIB ${LIBRARIES} )
|
|
|
|
string(REPLACE ".lib" ".dll" DLL ${LIB})
|
|
|
|
string(REPLACE ".LIB" ".DLL" DLL ${DLL})
|
|
|
|
add_custom_command(
|
|
|
|
TARGET ${target} POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
|
|
${DLL}
|
|
|
|
$<TARGET_FILE_DIR:${target}>
|
|
|
|
)
|
|
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
endmacro()
|
|
|
|
|
2013-01-24 21:40:43 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# Build targets
|
2012-06-11 02:59:04 +00:00
|
|
|
|
2012-06-08 18:18:20 +00:00
|
|
|
add_subdirectory(opensubdiv)
|
|
|
|
|
2013-07-05 22:36:54 +00:00
|
|
|
if (NOT NO_REGRESSION AND NOT ANDROID AND NOT IOS) # XXXdyu
|
2012-12-20 18:25:41 +00:00
|
|
|
add_subdirectory(regression)
|
|
|
|
endif()
|
2012-06-09 00:06:35 +00:00
|
|
|
|
2013-07-05 22:36:54 +00:00
|
|
|
if (NOT NO_EXAMPLES)
|
|
|
|
add_subdirectory(examples)
|
|
|
|
endif()
|
2012-10-07 00:53:51 +00:00
|
|
|
|
2013-07-12 01:55:17 +00:00
|
|
|
if (NOT NO_PYTHON)
|
|
|
|
add_subdirectory(python)
|
|
|
|
endif()
|
|
|
|
|
2013-07-09 17:00:40 +00:00
|
|
|
if (NOT NO_DOC)
|
|
|
|
add_subdirectory(documentation)
|
|
|
|
endif()
|