Fix Cycles gtests build on macOS.
[blender.git] / intern / cycles / test / CMakeLists.txt
1 if(WITH_GTESTS)
2         Include(GTestTesting)
3
4         # Otherwise we get warnings here that we cant fix in external projects
5         remove_strict_flags()
6 endif()
7
8 macro(CYCLES_TEST SRC EXTRA_LIBS)
9         if(WITH_GTESTS)
10                 BLENDER_SRC_GTEST("cycles_${SRC}" "${SRC}_test.cpp" "${EXTRA_LIBS}")
11         endif()
12 endmacro()
13
14 set(INC
15         .
16         ..
17         ../device
18         ../graph
19         ../kernel
20         ../render
21         ../util
22 )
23
24 set(ALL_CYCLES_LIBRARIES
25         cycles_device
26         cycles_kernel
27         cycles_render
28         cycles_bvh
29         cycles_graph
30         cycles_subd
31         cycles_util
32         extern_clew
33         ${BLENDER_GL_LIBRARIES}
34         ${BLENDER_GLEW_LIBRARIES}
35         ${CYCLES_APP_GLEW_LIBRARY}
36         ${OPENIMAGEIO_LIBRARIES}
37 )
38 if(WITH_CYCLES_OSL)
39         list(APPEND ALL_CYCLES_LIBRARIES
40                 cycles_kernel_osl
41                 ${OSL_LIBRARIES}
42                 ${LLVM_LIBRARIES}
43         )
44 endif()
45 if(WITH_IMAGE_OPENJPEG)
46         if(WITH_SYSTEM_OPENJPEG)
47                 list(APPEND ALL_CYCLES_LIBRARIES ${OPENJPEG_LIBRARIES})
48         else()
49                 list(APPEND ALL_CYCLES_LIBRARIES extern_openjpeg)
50         endif()
51 endif()
52 if(WITH_CYCLES_OPENSUBDIV)
53         add_definitions(-DWITH_OPENSUBDIV)
54         include_directories(
55                 SYSTEM
56                 ${OPENSUBDIV_INCLUDE_DIR}
57         )
58         list(APPEND ALL_CYCLES_LIBRARIES
59                 ${OPENSUBDIV_LIBRARIES}
60         )
61 endif()
62 if(WITH_CUDA_DYNLOAD)
63         list(APPEND ALL_CYCLES_LIBRARIES extern_cuew)
64 else()
65         list(APPEND ALL_CYCLES_LIBRARIES ${CUDA_CUDA_LIBRARY})
66 endif()
67 if(NOT CYCLES_STANDALONE_REPOSITORY)
68         list(APPEND ALL_CYCLES_LIBRARIES bf_intern_glew_mx bf_intern_guardedalloc ${GLEW_LIBRARY})
69 endif()
70
71 list(APPEND ALL_CYCLES_LIBRARIES
72         ${BOOST_LIBRARIES}
73         ${PNG_LIBRARIES}
74         ${JPEG_LIBRARIES}
75         ${ZLIB_LIBRARIES}
76         ${TIFF_LIBRARY}
77         ${OPENIMAGEIO_LIBRARIES}
78         ${OPENEXR_LIBRARIES}
79 )
80
81 include_directories(${INC})
82
83 link_directories(${OPENIMAGEIO_LIBPATH}
84                  ${BOOST_LIBPATH}
85                  ${PNG_LIBPATH}
86                  ${JPEG_LIBPATH}
87                  ${ZLIB_LIBPATH}
88                  ${TIFF_LIBPATH}
89                  ${OPENEXR_LIBPATH})
90
91 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}")
92 set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}")
93
94 CYCLES_TEST(render_graph_finalize "${ALL_CYCLES_LIBRARIES}")
95 CYCLES_TEST(util_aligned_malloc "cycles_util")
96 CYCLES_TEST(util_path "cycles_util;${BOOST_LIBRARIES};${OPENIMAGEIO_LIBRARIES}")
97 CYCLES_TEST(util_string "cycles_util;${BOOST_LIBRARIES}")
98 CYCLES_TEST(util_task "cycles_util;${BOOST_LIBRARIES}")