Fix for OSL shader install paths.
[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_bump.osl
9         node_camera.osl
10         node_checker_texture.osl
11         node_combine_rgb.osl
12         node_convert_from_color.osl
13         node_convert_from_float.osl
14         node_convert_from_normal.osl
15         node_convert_from_point.osl
16         node_convert_from_vector.osl
17         node_diffuse_bsdf.osl
18         node_emission.osl
19         node_environment_texture.osl
20         node_fresnel.osl
21         node_gamma.osl
22         node_gradient_texture.osl
23         node_brightness.osl
24         node_geometry.osl
25         node_glass_bsdf.osl
26         node_glossy_bsdf.osl
27         node_hsv.osl
28         node_image_texture.osl
29         node_invert.osl
30         node_light_path.osl
31         node_magic_texture.osl
32         node_mapping.osl
33         node_math.osl
34         node_mix.osl
35         node_mix_closure.osl
36         node_musgrave_texture.osl
37         node_normal.osl
38         node_noise_texture.osl
39         node_output_displacement.osl
40         node_output_surface.osl
41         node_output_volume.osl
42         node_separate_rgb.osl
43         node_sky_texture.osl
44         node_texture_coordinate.osl
45         node_translucent_bsdf.osl
46         node_transparent_bsdf.osl
47         node_value.osl
48         node_vector_math.osl
49         node_velvet_bsdf.osl
50         node_voronoi_texture.osl
51         node_ward_bsdf.osl
52         node_wave_texture.osl
53 )
54
55 set(SRC_OSL_HEADERS
56         node_texture.h
57         node_color.h
58         node_fresnel.h
59         stdosl.h
60         oslutil.h
61 )
62
63 set(SRC_OSO
64
65 )
66
67 # TODO, add a module to compile OSL
68 foreach(_file ${SRC_OSL})
69         set(_OSL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${_file})
70         string(REPLACE ".osl" ".oso" _OSO_FILE ${_OSL_FILE})  # TODO, replace extension only
71         string(REPLACE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} _OSO_FILE ${_OSO_FILE})
72         add_custom_command(
73                 OUTPUT ${_OSO_FILE} 
74                 COMMAND ${OSL_COMPILER} -O2 ${_OSL_FILE}
75                 DEPENDS ${_OSL_FILE} ${SRC_OSL_HEADERS})
76         list(APPEND SRC_OSO
77                 ${_OSO_FILE}
78         )
79         
80         unset(_OSL_FILE)
81         unset(_OSO_FILE)
82 endforeach()
83
84 add_custom_target(shader ALL DEPENDS ${SRC_OSO} ${SRC_OSL_HEADERS})
85
86 # CMAKE_CURRENT_SOURCE_DIR is already included in OSO paths
87 delayed_install("" "${SRC_OSO}" ${CYCLES_INSTALL_PATH}/shader)