Welcome to mirror list, hosted at ThFree Co, Russian Federation.

opensubdiv.cmake « cmake « build_environment « build_files - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d183b9f02b72317a48295d7189a06e70d77d1a32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****

set(OPENSUBDIV_EXTRA_ARGS
  -DNO_EXAMPLES=ON
  -DNO_REGRESSION=ON
  -DNO_PYTHON=ON
  -DNO_MAYA=ON
  -DNO_PTEX=ON
  -DNO_DOC=ON
  -DNO_CLEW=OFF
  -DNO_OPENCL=OFF
  -DNO_TUTORIALS=ON
  -DGLEW_INCLUDE_DIR=${LIBDIR}/glew/include
  -DGLEW_LIBRARY=${LIBDIR}/glew/lib/libGLEW${LIBEXT}
  -DGLFW_INCLUDE_DIR=${LIBDIR}/glfw/include
  -DGLFW_LIBRARIES=${LIBDIR}/glfw/lib/glfw3${LIBEXT}
)

if(WIN32)
  set(OPENSUBDIV_EXTRA_ARGS
    ${OPENSUBDIV_EXTRA_ARGS}
    -DTBB_INCLUDE_DIR=${LIBDIR}/tbb/include
    -DTBB_LIBRARIES=${LIBDIR}/tbb/lib/tbb.lib
    -DCLEW_INCLUDE_DIR=${LIBDIR}/clew/include/CL
    -DCLEW_LIBRARY=${LIBDIR}/clew/lib/clew${LIBEXT}
    -DCUEW_INCLUDE_DIR=${LIBDIR}/cuew/include
    -DCUEW_LIBRARY=${LIBDIR}/cuew/lib/cuew${LIBEXT}
  )
  if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
    set(OPENSUBDIV_EXTRA_ARGS
      ${OPENSUBDIV_EXTRA_ARGS}
      -DNO_CUDA=OFF
    )
  else()
    set(OPENSUBDIV_EXTRA_ARGS
      ${OPENSUBDIV_EXTRA_ARGS}
      -DNO_CUDA=ON
    )
  endif()

else()
  set(OPENSUBDIV_EXTRA_ARGS
    ${OPENSUBDIV_EXTRA_ARGS}
    -DNO_CUDA=ON
    -DCUEW_INCLUDE_DIR=${LIBDIR}/cuew/include
    -DCLEW_INCLUDE_DIR=${LIBDIR}/clew/include/CL
    -DCLEW_LIBRARY=${LIBDIR}/clew/lib/static/${LIBPREFIX}clew${LIBEXT}
  )
endif()

ExternalProject_Add(external_opensubdiv
  URL ${OPENSUBDIV_URI}
  DOWNLOAD_DIR ${DOWNLOAD_DIR}
  URL_HASH MD5=${OPENSUBDIV_HASH}
  PREFIX ${BUILD_DIR}/opensubdiv
  CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/opensubdiv -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${OPENSUBDIV_EXTRA_ARGS}
  INSTALL_DIR ${LIBDIR}/opensubdiv
)

if(WIN32)
  if(BUILD_MODE STREQUAL Release)
    ExternalProject_Add_Step(external_opensubdiv after_install
      COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/opensubdiv/lib ${HARVEST_TARGET}/opensubdiv/lib
      COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/opensubdiv/include ${HARVEST_TARGET}/opensubdiv/include
      DEPENDEES install
    )
  endif()
  if(BUILD_MODE STREQUAL Debug)
    ExternalProject_Add_Step(external_opensubdiv after_install
      COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opensubdiv/lib/osdCPU.lib ${HARVEST_TARGET}/opensubdiv/lib/osdCPU_d.lib
      COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opensubdiv/lib/osdGPU.lib ${HARVEST_TARGET}/opensubdiv/lib/osdGPU_d.lib
      DEPENDEES install
    )
  endif()
endif()

add_dependencies(
  external_opensubdiv
  external_glew
  external_glfw
  external_clew
  external_cuew
  external_tbb
)