cmake_minimum_required(VERSION 2.8) get_filename_component(PROJNAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) SET(PROJNAME vk_${PROJNAME}_KHR) Project(${PROJNAME}) Message(STATUS "-------------------------------") Message(STATUS "Processing Project ${PROJNAME}:") ##################################################################################### _add_project_definitions(${PROJNAME}) ##################################################################################### # Source files for this project # file(GLOB SOURCE_FILES *.cpp *.hpp *.inl *.h *.c) file(GLOB EXTRA_COMMON "../common/*.*") list(APPEND COMMON_SOURCE_FILES ${EXTRA_COMMON}) include_directories("../common") ##################################################################################### # GLSL to SPIR-V custom build # # more than one file can be given: _compile_GLSL("GLSL_mesh.vert;GLSL_mesh.frag" "GLSL_mesh.spv" GLSL_SOURCES) # the SpirV validator is fine as long as files are for different pipeline stages (entry points still need to be main()) #_compile_GLSL( ) SET(VULKAN_TARGET_ENV vulkan1.2) UNSET(GLSL_SOURCES) UNSET(SPV_OUTPUT) file(GLOB_RECURSE GLSL_HEADER_FILES "shaders/*.h" "shaders/*.glsl") file(GLOB_RECURSE GLSL_SOURCE_FILES "shaders/*.comp" "shaders/*.frag" "shaders/*.vert" "shaders/*.rchit" "shaders/*.rahit" "shaders/*.rmiss" "shaders/*.rgen" "shaders/*.rcall" ) foreach(GLSL ${GLSL_SOURCE_FILES}) get_filename_component(FILE_NAME ${GLSL} NAME) _compile_GLSL(${GLSL} "shaders/${FILE_NAME}.spv" GLSL_SOURCES SPV_OUTPUT) endforeach(GLSL) list(APPEND GLSL_SOURCES ${GLSL_HEADER_FILES}) source_group(Shader_Files FILES ${GLSL_SOURCES}) ##################################################################################### # Executable # # if(WIN32 AND NOT GLUT_FOUND) # add_definitions(/wd4996) #remove printf warning # add_definitions(/wd4244) #remove double to float conversion warning # add_definitions(/wd4305) #remove double to float truncation warning # else() # add_definitions(-fpermissive) # endif() add_executable(${PROJNAME} ${SOURCE_FILES} ${COMMON_SOURCE_FILES} ${PACKAGE_SOURCE_FILES} ${GLSL_SOURCES} ${CUDA_FILES} ${CUBIN_SOURCES}) #_set_subsystem_console(${PROJNAME}) ##################################################################################### # common source code needed for this sample # source_group(common FILES ${COMMON_SOURCE_FILES} ${PACKAGE_SOURCE_FILES} ) source_group("Source Files" FILES ${SOURCE_FILES}) # if(UNIX) # set(UNIXLINKLIBS dl pthread) # else() # set(UNIXLINKLIBS) # endif() ##################################################################################### # Linkage # target_link_libraries(${PROJNAME} ${PLATFORM_LIBRARIES} shared_sources) foreach(DEBUGLIB ${LIBRARIES_DEBUG}) target_link_libraries(${PROJNAME} debug ${DEBUGLIB}) endforeach(DEBUGLIB) foreach(RELEASELIB ${LIBRARIES_OPTIMIZED}) target_link_libraries(${PROJNAME} optimized ${RELEASELIB}) endforeach(RELEASELIB) ##################################################################################### # copies binaries that need to be put next to the exe files (ZLib, etc.) # _copy_binaries_to_target( ${PROJNAME} ) install(FILES ${SPV_OUTPUT} CONFIGURATIONS Release DESTINATION "bin_${ARCH}/${PROJNAME}/shaders") install(FILES ${SPV_OUTPUT} CONFIGURATIONS Debug DESTINATION "bin_${ARCH}_debug/${PROJNAME}/shaders") install(FILES ${CUBIN_SOURCES} CONFIGURATIONS Release DESTINATION "bin_${ARCH}/${PROJNAME}") install(FILES ${CUBIN_SOURCES} CONFIGURATIONS Debug DESTINATION "bin_${ARCH}_debug/${PROJNAME}") install(DIRECTORY "../media" CONFIGURATIONS Release DESTINATION "bin_${ARCH}/${PROJNAME}") install(DIRECTORY "../media" CONFIGURATIONS Debug DESTINATION "bin_${ARCH}_debug/${PROJNAME}")