Skip to content

Commit fc4bf60

Browse files
committed
Fix windows build. Add kernel embedding
1 parent 8839782 commit fc4bf60

File tree

13 files changed

+98
-13
lines changed

13 files changed

+98
-13
lines changed

CMakeLists.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ option(RR_NO_TESTS "Don't add any unit tests and remove any test functionality f
1111
option(RR_ENABLE_STATIC "Create static libraries rather than dynamic" OFF)
1212
option(RR_SHARED_CALC "Link Calc(compute abstraction layer) dynamically" OFF)
1313
option(RR_ENABLE_RAYMASK "Enable ray masking in intersection kernels" OFF)
14-
option(RR_TUTORIALS "Add tutorials projects" OFF)
14+
#option(RR_TUTORIALS "Add tutorials projects" OFF)
1515
option(RR_SAFE_MATH "use safe math" OFF)
16+
mark_as_advanced(FORCE RR_USE_VULKAN)
1617

1718
#global settings
1819
if (WIN32)
@@ -64,9 +65,4 @@ if (NOT RR_NO_TESTS)
6465
add_subdirectory(UnitTest)
6566
endif (NOT RR_NO_TESTS)
6667

67-
if (RR_TUTORIALS)
68-
# add_subdirectory(Tutorials)
69-
endif (RR_TUTORIALS)
70-
71-
7268

Calc/CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if (RR_USE_OPENCL)
99
elseif (RR_USE_VULKAN)
1010
list(APPEND SOURCES
1111
src/calc_vkw.cpp
12-
src/device_vkw.cpp)
12+
src/device_vkw.cpp)
1313
endif (RR_USE_OPENCL)
1414

1515
if (RR_SHARED_CALC)
@@ -33,3 +33,11 @@ endif (UNIX)
3333
if (RR_USE_OPENCL)
3434
target_link_libraries(Calc PUBLIC CLW)
3535
endif (RR_USE_OPENCL)
36+
37+
if (RR_USE_VULKAN)
38+
#Need to add Anvil to include path
39+
target_include_directories(Calc
40+
PRIVATE ${RadeonRaysSDK_SOURCE_DIR}/Anvil/deps
41+
PRIVATE ${RadeonRaysSDK_SOURCE_DIR}/Anvil/include)
42+
target_link_libraries(Calc PUBLIC Vulkan::Vulkan)
43+
endif (RR_USE_VULKAN)

RadeonRays/CMakeLists.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ set(SOURCES
122122
${UTIL_SOURCES}
123123
${WORLD_SOURCES})
124124

125+
if (RR_EMBED_KERNELS)
126+
add_subdirectory(src/kernels)
127+
endif (RR_EMBED_KERNELS)
128+
125129
#Declare RadeonRays library
126130
if (RR_ENABLE_STATIC)
127131
add_library(RadeonRays STATIC ${SOURCES})
@@ -131,6 +135,12 @@ else (NOT RR_ENABLE_STATIC)
131135
target_compile_definitions(RadeonRays PUBLIC RR_STATIC_LIBRARY=0)
132136
endif(RR_ENABLE_STATIC)
133137

138+
if (RR_EMBED_KERNELS)
139+
target_compile_definitions(RadeonRays PRIVATE RR_EMBED_KERNELS=1)
140+
add_dependencies(RadeonRays RadeonRaysKernelCache)
141+
target_include_directories(RadeonRays PRIVATE ${RadeonRays_BINARY_DIR})
142+
endif (RR_EMBED_KERNELS)
143+
134144
#Configure RadeonRays build
135145
target_include_directories(RadeonRays PUBLIC include)
136146
target_include_directories(RadeonRays
@@ -159,7 +169,13 @@ if (RR_USE_OPENCL)
159169
endif (RR_USE_OPENCL)
160170

161171
if (RR_USE_VULKAN)
162-
target_link_libraries(RadeonRays PUBLIC Vulkan::Vulkan Anvil Thread::Threads)
172+
#Need to add Anvil to include path
173+
174+
target_include_directories(RadeonRays
175+
PRIVATE ${RadeonRaysSDK_SOURCE_DIR}/Anvil/deps
176+
PRIVATE ${RadeonRaysSDK_SOURCE_DIR}/Anvil/include)
177+
178+
target_link_libraries(RadeonRays PUBLIC Vulkan::Vulkan Anvil Threads::Threads)
163179
endif (RR_USE_VULKAN)
164180

165181
if (UNIX)

RadeonRays/src/accelerator/hlbvh.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ THE SOFTWARE.
3636

3737
#ifdef RR_EMBED_KERNELS
3838
#if USE_OPENCL
39-
# include "RadeonRays/src/kernelcache/kernels_cl.h"
39+
# include "kernels_cl.h"
40+
#endif
41+
#if USE_VULKAN
42+
# include "kernels_vk.h"
4043
#endif
4144
#endif // RR_EMBED_KERNELS
4245

RadeonRays/src/intersector/intersector.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,11 @@ namespace RadeonRays
163163

164164
#ifdef RR_EMBED_KERNELS
165165
#if USE_OPENCL
166-
# include "RadeonRays/src/kernelcache/kernels_cl.h"
166+
# include "kernels_cl.h"
167167
#endif
168168

169169
#if USE_VULKAN
170-
# include <RadeonRays/src/kernelcache/kernels_vk.h>
170+
# include "kernels_vk.h"
171171
#endif
172172
#endif // RR_EMBED_KERNELS
173173

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
add_custom_command(
2+
OUTPUT ${RadeonRays_BINARY_DIR}/kernels_cl.h
3+
COMMAND ${PYTHON_EXECUTABLE} ${STRINGIFY_SCRIPT} ${RadeonRays_SOURCE_DIR}/src/kernels/CL/ .cl opencl > ${RadeonRays_BINARY_DIR}/kernels_cl.h
4+
MAIN_DEPENDENCY ${SHADER}
5+
COMMENT "Generating RadeonRays OpenCL kernel cache"
6+
VERBATIM)
7+
add_custom_target(RadeonRaysKernelCache DEPENDS "${RadeonRays_BINARY_DIR}/kernels_cl.h")
8+

RadeonRays/src/kernels/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
if (RR_USE_OPENCL)
2+
add_subdirectory(CL)
3+
elseif (RR_USE_VULKAN)
4+
add_subdirectory(GLSL)
5+
endif (RR_USE_OPENCL)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
add_custom_command(
2+
OUTPUT ${RadeonRays_BINARY_DIR}/kernels_vk.h
3+
COMMAND ${PYTHON_EXECUTABLE} ${STRINGIFY_SCRIPT} ${RadeonRays_SOURCE_DIR}/src/kernels/GLSL/ .comp vulkan > ${RadeonRays_BINARY_DIR}/kernels_vk.h
4+
MAIN_DEPENDENCY ${SHADER}
5+
COMMENT "Generating RadeonRays Vulkan kernel cache"
6+
VERBATIM)
7+
add_custom_target(RadeonRaysKernelCache DEPENDS "${RadeonRays_BINARY_DIR}/kernels_vk.h")
8+

Tutorials/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#add_subdirectory(Tools)
2+
#add_subdirectory(CornellBox)
3+
#add_subdirectory(CornellBoxShadow)
4+
#add_subdirectory(Triangle)
5+
#add_subdirectory(TriangleLight)

Tutorials/CornellBox/CMakeLists.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
project (TutorialCornellBox CXX)
2+
3+
set(SOURCES main.cpp
4+
$<TARGET_OBJECTS:TutorialTools>)
5+
6+
#message(FATAL_ERROR $<TARGET_OBJECTS:TutorialTools>)
7+
8+
add_executable(TutorialCornellBox ${SOURCES})
9+
target_compile_features(TutorialCornellBox PRIVATE cxx_std_11)
10+
target_link_libraries(TutorialCornellBox PRIVATE RadeonRays)
11+
if (APPLE OR UNIX)
12+
target_link_libraries(TutorialCornellBox PRIVATE OpenGL::GL GLUT::GLUT GLEW::GLEW ${OIIO_LIBS})
13+
elseif (WIN32)
14+
target_include_directories(TutorialCornellBox
15+
PRIVATE ${GLUT_INCLUDES}
16+
PRIVATE ${GLEW_INCLUDES}
17+
PRIVATE ${OIIO_INCLUDES})
18+
target_link_libraries(TutorialCornellBox PRIVATE OpenGL::GL ${GLUT_LIBS} ${GLEW_LIBS} ${OIIO_LIBS})
19+
endif (APPLE OR UNIX)

0 commit comments

Comments
 (0)