Remove usage WITH_CYCLES_CUDA_BINARIES in code, use check for
[blender.git] / intern / cycles / CMakeLists.txt
1
2 set(CYCLES_INSTALL_PATH "scripts/addons/cycles")
3 set(WITH_CYCLES_BLENDER ON)
4
5 # External Libraries
6
7 include(cmake/external_libs.cmake)
8
9 # Build Flags
10
11 if(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
12         set(WITH_CYCLES_OPTIMIZED_KERNEL ON)
13 endif()
14
15 if(WIN32 AND MSVC)
16         set(CYCLES_OPTIMIZED_KERNEL_FLAGS "/arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc")
17         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast -D_CRT_SECURE_NO_WARNINGS /EHsc")
18 elseif(CMAKE_COMPILER_IS_GNUCC)
19         set(CYCLES_OPTIMIZED_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3 -mfpmath=sse")
20         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math")
21 endif()
22
23 # for OSL
24 if(WIN32 AND MSVC)
25         set(RTTI_DISABLE_FLAGS "/GR- -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
26 elseif(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_C_COMPILER_ID MATCHES "Clang"))
27         set(RTTI_DISABLE_FLAGS "-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
28 endif()
29
30 # Definitions and Includes
31
32 add_definitions(${BOOST_DEFINITIONS} ${OPENIMAGEIO_DEFINITIONS})
33
34 add_definitions(-DCCL_NAMESPACE_BEGIN=namespace\ ccl\ {)
35 add_definitions(-DCCL_NAMESPACE_END=})
36
37 if(WITH_CYCLES_OPTIMIZED_KERNEL)
38         add_definitions(-DWITH_OPTIMIZED_KERNEL)
39 endif()
40
41 if(WITH_CYCLES_NETWORK)
42         add_definitions(-DWITH_NETWORK)
43 endif()
44
45 if(WITH_CYCLES_OSL)
46         add_definitions(-DWITH_OSL)
47         include_directories(${OSL_INCLUDES})
48 endif()
49
50 add_definitions(-DWITH_OPENCL)
51 add_definitions(-DWITH_CUDA)
52 add_definitions(-DWITH_MULTI)
53
54 include_directories(
55         SYSTEM
56         ${BOOST_INCLUDE_DIR}
57         ${OPENIMAGEIO_INCLUDE_DIRS}
58         ${OPENIMAGEIO_INCLUDE_DIRS}/OpenImageIO
59         ${OPENEXR_INCLUDE_DIR})
60
61 # Subdirectories
62
63 if(WITH_CYCLES_BLENDER)
64         add_subdirectory(blender)
65 endif()
66
67 if(WITH_CYCLES_TEST OR WITH_CYCLES_NETWORK)
68         add_subdirectory(app)
69 endif()
70
71 add_subdirectory(bvh)
72 add_subdirectory(device)
73 add_subdirectory(doc)
74 add_subdirectory(kernel)
75 add_subdirectory(render)
76 add_subdirectory(subd)
77 add_subdirectory(util)
78