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

external_libs.cmake « cmake « cycles « intern - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: df88b91f5ac0e49225fcc9f474f91f82bdb3bc8a (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
###########################################################################
# Precompiled libraries tips and hints, for find_package().

if(CYCLES_STANDALONE_REPOSITORY)
	if(APPLE OR WIN32)
		include(precompiled_libs)
	endif()
endif()

###########################################################################
# GLUT

if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI)
	set(GLUT_ROOT_PATH ${CYCLES_GLUT})

	find_package(GLUT)
	message(STATUS "GLUT_FOUND=${GLUT_FOUND}")

	include_directories(
		SYSTEM
		${GLUT_INCLUDE_DIR}
	)
endif()

###########################################################################
# GLEW

# Workaround for unconventional variable name use in Blender.
if(NOT CYCLES_STANDALONE_REPOSITORY)
	set(GLEW_INCLUDE_DIR "${GLEW_INCLUDE_PATH}")
endif()

if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI)
	set(CYCLES_APP_GLEW_LIBRARY ${BLENDER_GLEW_LIBRARIES})
endif()

###########################################################################
# CUDA

if(WITH_CYCLES_CUDA_BINARIES OR NOT WITH_CUDA_DYNLOAD)
	find_package(CUDA) # Try to auto locate CUDA toolkit
	if(CUDA_FOUND)
		message(STATUS "CUDA nvcc = ${CUDA_NVCC_EXECUTABLE}")
	else()
		message(STATUS "CUDA compiler not found, disabling WITH_CYCLES_CUDA_BINARIES")
		set(WITH_CYCLES_CUDA_BINARIES OFF)
		if(NOT WITH_CUDA_DYNLOAD)
			message(STATUS "Additionally falling back to dynamic CUDA load")
			set(WITH_CUDA_DYNLOAD ON)
		endif()
	endif()
endif()

# Packages which are being found by Blender when building from inside Blender
# source code. but which we need to take care of when building Cycles from a
# standalone repository
if(CYCLES_STANDALONE_REPOSITORY)
	# PThreads
	# TODO(sergey): Bloody exception, handled in precompiled_libs.cmake.
	if(NOT WIN32)
		set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
		find_package(Threads REQUIRED)
		set(PTHREADS_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
	endif()

	####
	# OpenGL

	# TODO(sergey): We currently re-use the same variable name as we use
	# in Blender. Ideally we need to make it CYCLES_GL_LIBRARIES.
	find_package(OpenGL REQUIRED)
	find_package(GLEW REQUIRED)
	list(APPEND BLENDER_GL_LIBRARIES
		"${OPENGL_gl_LIBRARY}"
		"${OPENGL_glu_LIBRARY}"
		"${GLEW_LIBRARY}"
	)

	####
	# OpenImageIO
	find_package(OpenImageIO REQUIRED)
	if(OPENIMAGEIO_PUGIXML_FOUND)
		set(PUGIXML_INCLUDE_DIR "${OPENIMAGEIO_INCLUDE_DIR/OpenImageIO}")
		set(PUGIXML_LIBRARIES "")
	else()
		find_package(PugiXML REQUIRED)
	endif()

	# OIIO usually depends on OpenEXR, so find this library
	# but don't make it required.
	find_package(OpenEXR)

	####
	# OpenShadingLanguage
	if(WITH_CYCLES_OSL)
		find_package(OpenShadingLanguage REQUIRED)
		find_package(LLVM REQUIRED)
	endif()

	####
	# Boost
	set(__boost_packages filesystem regex system thread date_time)
	if(WITH_CYCLES_NETWORK)
		list(APPEND __boost_packages serialization)
	endif()
	if(WITH_CYCLES_OSL)
		# TODO(sergey): This is because of the way how our precompiled
		# libraries works, could be different for someone's else libs..
		if(APPLE OR MSVC)
			list(APPEND __boost_packages wave)
		elseif(NOT (${OSL_LIBRARY_VERSION_MAJOR} EQUAL "1" AND ${OSL_LIBRARY_VERSION_MINOR} LESS "6"))
			list(APPEND __boost_packages wave)
		endif()
	endif()
	find_package(Boost 1.48 COMPONENTS ${__boost_packages} REQUIRED)
	if(NOT Boost_FOUND)
		# Try to find non-multithreaded if -mt not found, this flag
		# doesn't matter for us, it has nothing to do with thread
		# safety, but keep it to not disturb build setups.
		set(Boost_USE_MULTITHREADED OFF)
		find_package(Boost 1.48 COMPONENTS ${__boost_packages})
	endif()
	unset(__boost_packages)
	set(BOOST_INCLUDE_DIR ${Boost_INCLUDE_DIRS})
	set(BOOST_LIBRARIES ${Boost_LIBRARIES})
	set(BOOST_LIBPATH ${Boost_LIBRARY_DIRS})
	set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")

	####
	# Logging
	if(WITH_CYCLES_LOGGING)
		find_package(Glog REQUIRED)
		find_package(Gflags REQUIRED)
	endif()

	unset(_lib_DIR)
else()
	set(LLVM_LIBRARIES ${LLVM_LIBRARY})
endif()