Cycles: attempted fix for error building with sse/mtune optimization flags.
[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(GCC_OPTIM_FLAGS "-ffast-math -msse -msse2 -msse3")
13 endif()
14
15 if(APPLE)
16         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_OPTIM_FLAGS}")
17         set(RTTI_DISABLE_FLAGS "-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
18 endif()
19
20 if(WIN32)
21         if(MSVC)
22                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Ox /Ot /arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /EHsc /fp:fast")
23                 set(RTTI_DISABLE_FLAGS "/GR- -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
24         elseif(CMAKE_COMPILER_IS_GNUCC)
25                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_OPTIM_FLAGS}")
26                 set(RTTI_DISABLE_FLAGS "-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
27         endif()
28 endif()
29
30 if(UNIX AND NOT APPLE)
31         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_OPTIM_FLAGS}")
32         set(RTTI_DISABLE_FLAGS "-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
33 endif()
34
35 # Definitions and Includes
36
37 add_definitions(${BOOST_DEFINITIONS} ${OPENIMAGEIO_DEFINITIONS})
38
39 add_definitions(-DCCL_NAMESPACE_BEGIN=namespace\ ccl\ {)
40 add_definitions(-DCCL_NAMESPACE_END=})
41
42 if(WITH_CYCLES_NETWORK)
43   add_definitions(-DWITH_NETWORK)
44 endif()
45
46 if(WITH_CYCLES_OSL)
47   add_definitions(-DWITH_OSL)
48 endif()
49
50 if(WITH_CYCLES_PARTIO)
51   add_definitions(-DWITH_PARTIO)
52 endif()
53
54 if(WITH_CYCLES_CUDA_BINARIES)
55   add_definitions(-DWITH_CUDA_BINARIES)
56 endif()
57
58 add_definitions(-DWITH_OPENCL)
59 add_definitions(-DWITH_CUDA)
60 add_definitions(-DWITH_MULTI)
61
62 include_directories(
63         ${BOOST_INCLUDE_DIR}
64         ${OPENIMAGEIO_INCLUDE_DIRS}
65         ${OPENIMAGEIO_INCLUDE_DIRS}/OpenImageIO)
66
67 # Subdirectories
68
69 if(WITH_CYCLES_BLENDER)
70         add_subdirectory(blender)
71 endif(WITH_CYCLES_BLENDER)
72
73 add_subdirectory(app)
74 add_subdirectory(bvh)
75 add_subdirectory(device)
76 add_subdirectory(doc)
77 add_subdirectory(kernel)
78 add_subdirectory(render)
79 add_subdirectory(subd)
80 add_subdirectory(util)
81