Cycles OSL: some build system tweaks to avoid global includes and definitions,
[blender.git] / intern / cycles / kernel / osl / nodes / CMakeLists.txt
1
2 # OSL node shaders
3
4 set(SRC_OSL
5         node_add_closure.osl
6         node_attribute.osl
7         node_background.osl
8         node_brick_texture.osl
9         node_bump.osl
10         node_camera.osl
11         node_checker_texture.osl
12         node_combine_rgb.osl
13         node_convert_from_color.osl
14         node_convert_from_float.osl
15         node_convert_from_normal.osl
16         node_convert_from_point.osl
17         node_convert_from_vector.osl
18         node_diffuse_bsdf.osl
19         node_emission.osl
20         node_environment_texture.osl
21         node_fresnel.osl
22         node_gamma.osl
23         node_gradient_texture.osl
24         node_brightness.osl
25         node_geometry.osl
26         node_glass_bsdf.osl
27         node_glossy_bsdf.osl
28         node_holdout.osl
29         node_hsv.osl
30         node_image_texture.osl
31         node_invert.osl
32         node_layer_weight.osl
33         node_light_path.osl
34         node_light_falloff.osl
35         node_magic_texture.osl
36         node_mapping.osl
37         node_math.osl
38         node_mix.osl
39         node_mix_closure.osl
40         node_musgrave_texture.osl
41         node_normal.osl
42         node_noise_texture.osl
43         node_object_info.osl
44         node_output_displacement.osl
45         node_output_surface.osl
46         node_output_volume.osl
47         node_particle_info.osl
48         node_rgb_ramp.osl
49         node_separate_rgb.osl
50         node_sky_texture.osl
51         node_texture_coordinate.osl
52         node_translucent_bsdf.osl
53         node_transparent_bsdf.osl
54         node_value.osl
55         node_vector_math.osl
56         node_velvet_bsdf.osl
57         node_voronoi_texture.osl
58         node_ward_bsdf.osl
59         node_wave_texture.osl
60 )
61
62 set(SRC_OSL_HEADERS
63         node_texture.h
64         node_color.h
65         node_fresnel.h
66         stdosl.h
67         oslutil.h
68 )
69
70 set(SRC_OSO
71
72 )
73
74 # TODO, add a module to compile OSL
75 foreach(_file ${SRC_OSL})
76         set(_OSL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${_file})
77         string(REPLACE ".osl" ".oso" _OSO_FILE ${_OSL_FILE})  # TODO, replace extension only
78         string(REPLACE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} _OSO_FILE ${_OSO_FILE})
79         add_custom_command(
80                 OUTPUT ${_OSO_FILE} 
81                 COMMAND ${OSL_COMPILER} -O2 ${_OSL_FILE}
82                 DEPENDS ${_OSL_FILE} ${SRC_OSL_HEADERS})
83         list(APPEND SRC_OSO
84                 ${_OSO_FILE}
85         )
86         
87         unset(_OSL_FILE)
88         unset(_OSO_FILE)
89 endforeach()
90
91 add_custom_target(cycles_osl_shaders ALL DEPENDS ${SRC_OSO} ${SRC_OSL_HEADERS})
92
93 # CMAKE_CURRENT_SOURCE_DIR is already included in OSO paths
94 delayed_install("" "${SRC_OSO}" ${CYCLES_INSTALL_PATH}/shader)