代码拉取完成,页面将自动刷新
cmake_minimum_required(VERSION 2.6)
set (TARGET_NAME "26_texture_mapping")
project(${TARGET_NAME})
set(CMAKE_CXX_STANDARD 20)
# GLSLC command to compile shaders to SPIR-V
find_program(GLSLC glslc)
# set(shader_path ${CMAKE_HOME_DIRECTORY}/assets/shaders/)
set(shader_path ${CMAKE_HOME_DIRECTORY}/)
file(GLOB shaders RELATIVE ${CMAKE_SOURCE_DIR} "${shader_path}*.vert" "${shader_path}*.frag")
add_executable(${TARGET_NAME} 26_texture_mapping.cpp stb_image.h ${shaders})
find_package(Vulkan REQUIRED)
target_include_directories(${TARGET_NAME} PUBLIC ${Vulkan_INCLUDE_DIRES})
target_link_libraries(${TARGET_NAME} Vulkan::Vulkan)
list(APPEND CMAKE_PREFIX_PATH "C:\\temp\\glm-0.9.9.8\\glm\\cmake")
find_package(glm CONFIG REQUIRED)
#target_link_libraries(${TARGET_NAME} glm)
target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS})
list(APPEND CMAKE_PREFIX_PATH "C:\\temp\\glfw-test")
find_package(glfw3 CONFIG REQUIRED)
target_link_libraries(${TARGET_NAME} glfw)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${TARGET_NAME})
message("CMAKE_CURRENT_SOURCE_DIR : " ${CMAKE_CURRENT_SOURCE_DIR})
message("CMAKE_HOME_DIRECTORY : " ${CMAKE_HOME_DIRECTORY})
foreach(shader ${shaders})
set(input_glsl "${CMAKE_HOME_DIRECTORY}/${shader}")
set(output_spv "${input_glsl}.spv")
execute_process(COMMAND "glslc" "${input_glsl}" "-o" "${output_spv}")
# Compile shaders
add_custom_command(TARGET ${PROJECT_NAME} PRE_BUILD
COMMAND "glslc" "${input_glsl}" "-o" "${output_spv}")
endforeach()
# Compile shaders
# add_custom_command(TARGET ${PROJECT_NAME} PRE_BUILD
# COMMAND /bin/sh ${CMAKE_SOURCE_DIR}/resources/shaders/compile.sh)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。