libcruft-vk/CMakeLists.txt
Danny Robson 863cdf4a35 spec-tool: add python based xml to hpp converter
XSLT1 is too hard to work with, and Khronos have an annoying tendency to
generate their spec such that it's not in dependency order. So we're
switching to python, and performing basic depedency analysis within a
new tool.

This should allow us to do more extensive type modifications and
annotations.
2017-09-04 15:08:54 +10:00

116 lines
2.9 KiB
CMake

###############################################################################
cmake_minimum_required(VERSION 3.7.0)
project(cruft-vulkan CXX)
list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include (nc)
###############################################################################
include (FindVulkan)
if (NOT Vulkan_FOUND)
message (FATAL_ERROR "Vulkan client library not found")
endif ()
##-----------------------------------------------------------------------------
find_package(PythonInterp 3 REQUIRED)
###############################################################################
include_directories ("${CMAKE_CURRENT_BINARY_DIR}")
##-----------------------------------------------------------------------------
add_custom_command (
OUTPUT
"${CMAKE_CURRENT_BINARY_DIR}/vk.hpp"
COMMENT
"[spec.py] vk.hpp"
COMMAND
"${PYTHON_EXECUTABLE}"
"${CMAKE_CURRENT_SOURCE_DIR}/tools/spec.py"
"${CMAKE_CURRENT_SOURCE_DIR}/vk.xml"
"${CMAKE_CURRENT_BINARY_DIR}/vk.hpp"
DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/tools/spec.py"
"${CMAKE_CURRENT_SOURCE_DIR}/vk.xml"
)
##-----------------------------------------------------------------------------
list (APPEND sources
vk.hpp
fwd.hpp
object.cpp
object.hpp
buffer.cpp
buffer.hpp
command_buffer.cpp
command_buffer.hpp
command_pool.cpp
command_pool.hpp
device.cpp
device.hpp
device_memory.cpp
device_memory.hpp
event.cpp
event.hpp
except.cpp
except.hpp
fence.cpp
fence.hpp
framebuffer.cpp
framebuffer.hpp
instance.cpp
instance.hpp
image.cpp
image.hpp
ostream.cpp
ostream.hpp
physical_device.cpp
physical_device.hpp
pipeline.cpp
pipeline.hpp
pipeline_cache.cpp
pipeline_cache.hpp
queue.cpp
queue.hpp
render_pass.cpp
render_pass.hpp
semaphore.cpp
semaphore.hpp
shader_module.cpp
shader_module.hpp
traits.hpp
)
##-----------------------------------------------------------------------------
add_library (cruft-vk STATIC ${sources})
target_link_libraries (cruft-vk cruft-util vulkan)
###############################################################################
get_directory_property (HAS_PARENT PARENT_DIRECTORY)
if (HAS_PARENT)
set (CRUFT_VK_FOUND 1 PARENT_SCOPE)
endif ()
###############################################################################
foreach (t info)
add_executable (vk_${t} "tools/${t}.cpp")
set_target_properties(vk_${t} PROPERTIES
OUTPUT_NAME
${t})
set_target_properties(vk_${t} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY
"${CMAKE_CURRENT_BINARY_DIR}/tools")
target_link_libraries (vk_${t} cruft-vk)
endforeach ()
###############################################################################
configure_file(libcruft-vk-system.pc.in libcruft-vk.pc)
configure_file(Doxyfile.in Doxyfile)