1 Star 1 Fork 0

sandman/d3d11_vulkan_sharing

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
CMakeLists.txt 1.68 KB
一键复制 编辑 原始数据 按行查看 历史
sandman 提交于 2022-11-21 17:36 . initial version
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)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/tisandman/d3d11_vulkan_sharing.git
git@gitee.com:tisandman/d3d11_vulkan_sharing.git
tisandman
d3d11_vulkan_sharing
d3d11_vulkan_sharing
master

搜索帮助