Home | History | Annotate | Download | only in smoke
      1 set (GLMINC_PREFIX ${PROJECT_SOURCE_DIR}/libs)
      2 
      3 macro(generate_dispatch_table out)
      4     add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${out}
      5         COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/generate-dispatch-table.py ${CMAKE_CURRENT_SOURCE_DIR}/${out}
      6         DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/generate-dispatch-table.py
      7         )
      8 endmacro()
      9 
     10 macro(glsl_to_spirv src)
     11     add_custom_command(OUTPUT ${src}.h
     12         COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/glsl-to-spirv ${CMAKE_CURRENT_SOURCE_DIR}/${src} ${src}.h ${GLSLANG_VALIDATOR}
     13         DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/glsl-to-spirv ${CMAKE_CURRENT_SOURCE_DIR}/${src} ${GLSLANG_VALIDATOR}
     14         )
     15 endmacro()
     16 
     17 generate_dispatch_table(HelpersDispatchTable.h)
     18 generate_dispatch_table(HelpersDispatchTable.cpp)
     19 glsl_to_spirv(Smoke.frag)
     20 glsl_to_spirv(Smoke.vert)
     21 glsl_to_spirv(Smoke.push_constant.vert)
     22 
     23 set(sources
     24     Game.h
     25     Helpers.h
     26     HelpersDispatchTable.cpp
     27     HelpersDispatchTable.h
     28     Smoke.cpp
     29     Smoke.h
     30     Smoke.frag.h
     31     Smoke.vert.h
     32     Smoke.push_constant.vert.h
     33     Main.cpp
     34     Meshes.cpp
     35     Meshes.h
     36     Meshes.teapot.h
     37     Simulation.cpp
     38     Simulation.h
     39     Shell.cpp
     40     Shell.h
     41     )
     42 
     43 set(definitions
     44     PRIVATE -DVK_NO_PROTOTYPES
     45     PRIVATE -DGLM_FORCE_RADIANS)
     46 
     47 set(includes
     48     PRIVATE ${GLMINC_PREFIX}
     49     PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
     50 
     51 set(libraries PRIVATE ${CMAKE_THREAD_LIBS_INIT})
     52 
     53 if(TARGET vulkan)
     54     list(APPEND definitions PRIVATE -DUNINSTALLED_LOADER="$<TARGET_FILE:vulkan>")
     55 endif()
     56 
     57 if(WIN32)
     58     list(APPEND definitions PRIVATE -DVK_USE_PLATFORM_WIN32_KHR)
     59     list(APPEND definitions PRIVATE -DWIN32_LEAN_AND_MEAN)
     60 
     61     list(APPEND sources ShellWin32.cpp ShellWin32.h)
     62 else()
     63     list(APPEND libraries PRIVATE -ldl -lrt)
     64 
     65     if(BUILD_WSI_XCB_SUPPORT)
     66         find_package(XCB REQUIRED)
     67 
     68         list(APPEND sources ShellXcb.cpp ShellXcb.h)
     69         list(APPEND definitions PRIVATE -DVK_USE_PLATFORM_XCB_KHR)
     70         list(APPEND includes PRIVATE ${XCB_INCLUDES})
     71         list(APPEND libraries PRIVATE ${XCB_LIBRARIES})
     72     elseif(BUILD_WSI_WAYLAND_SUPPORT)
     73         find_package(Wayland REQUIRED)
     74 
     75         list(APPEND sources ShellWayland.cpp ShellWayland.h)
     76         list(APPEND definitions PRIVATE -DVK_USE_PLATFORM_WAYLAND_KHR)
     77         list(APPEND includes PRIVATE ${WAYLAND_CLIENT_INCLUDE_DIR})
     78         list(APPEND libraries PRIVATE ${WAYLAND_CLIENT_LIBRARIES})
     79     endif()
     80 endif()
     81 
     82 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/demos)
     83 
     84 add_executable(smoketest ${sources})
     85 target_compile_definitions(smoketest ${definitions})
     86 target_include_directories(smoketest ${includes})
     87 target_link_libraries(smoketest ${libraries})
     88