build: create a dynamic libvulkan.so
This commit is contained in:
parent
154e3b039b
commit
45953b9dcf
@ -61,7 +61,7 @@ endif()
|
|||||||
|
|
||||||
|
|
||||||
##-----------------------------------------------------------------------------
|
##-----------------------------------------------------------------------------
|
||||||
add_library (cruft-vk-load STATIC
|
list (APPEND VK_LOAD_SOURCES
|
||||||
load/fwd.hpp
|
load/fwd.hpp
|
||||||
${GENERATED_PREFIX}/load/vtable.hpp
|
${GENERATED_PREFIX}/load/vtable.hpp
|
||||||
${GENERATED_PREFIX}/load/dispatch.cpp
|
${GENERATED_PREFIX}/load/dispatch.cpp
|
||||||
@ -74,14 +74,23 @@ add_library (cruft-vk-load STATIC
|
|||||||
load/vtable.cpp
|
load/vtable.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories (cruft-vk-load
|
|
||||||
PUBLIC
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/specs/include/vulkan"
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries (cruft-vk-load cruft-json cruft)
|
add_library (vulkan SHARED ${VK_LOAD_SOURCES})
|
||||||
|
set_target_properties(vulkan PROPERTIES VERSION 1.1.98)
|
||||||
|
set_target_properties(vulkan PROPERTIES SOVERSION 1)
|
||||||
|
|
||||||
|
add_library (cruft-vk-load STATIC ${VK_LOAD_SOURCES})
|
||||||
|
|
||||||
|
foreach (lib vulkan cruft-vk-load)
|
||||||
|
target_include_directories (${lib}
|
||||||
|
PUBLIC
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/specs/include/vulkan"
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries (${lib} cruft-json cruft)
|
||||||
|
endforeach ()
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
list (APPEND sources
|
list (APPEND sources
|
||||||
@ -189,9 +198,11 @@ foreach (t info hello)
|
|||||||
set_target_properties(vk_${t} PROPERTIES
|
set_target_properties(vk_${t} PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY
|
RUNTIME_OUTPUT_DIRECTORY
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/tools")
|
"${CMAKE_CURRENT_BINARY_DIR}/tools")
|
||||||
target_link_libraries (vk_${t} cruft-vk glfw)
|
|
||||||
endforeach ()
|
endforeach ()
|
||||||
|
|
||||||
|
target_link_libraries (vk_info cruft-vk cruft-vk-load)
|
||||||
|
target_link_libraries (vk_hello cruft-vk glfw)
|
||||||
|
|
||||||
|
|
||||||
##-----------------------------------------------------------------------------
|
##-----------------------------------------------------------------------------
|
||||||
add_dependencies (vk_hello hello.vert.spv hello.frag.spv)
|
add_dependencies (vk_hello hello.vert.spv hello.frag.spv)
|
||||||
|
@ -13,5 +13,5 @@
|
|||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
|
|
||||||
namespace cruft::vk::load {
|
namespace cruft::vk::load {
|
||||||
std::ostream& operator<< (std::ostream&, icd_t const&);
|
std::ostream& operator<< [[gnu::visibility("default")]] (std::ostream&, icd_t const&);
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ namespace cruft::vk::load {
|
|||||||
|
|
||||||
|
|
||||||
std::vector<icd_t>
|
std::vector<icd_t>
|
||||||
enumerate (void);
|
enumerate [[gnu::visibility("default")]] (void);
|
||||||
|
|
||||||
|
|
||||||
struct vendor_table {
|
struct vendor_table {
|
||||||
@ -31,7 +31,7 @@ namespace cruft::vk::load {
|
|||||||
void* (*vk_icdGetPhysicalDeviceProcAddr) (VkInstance, char const*) = nullptr;
|
void* (*vk_icdGetPhysicalDeviceProcAddr) (VkInstance, char const*) = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
class vendor {
|
class [[gnu::visibility("default")]] vendor {
|
||||||
public:
|
public:
|
||||||
vendor (icd_t const&);
|
vendor (icd_t const&);
|
||||||
vendor (::cruft::library &&);
|
vendor (::cruft::library &&);
|
||||||
|
@ -429,7 +429,7 @@ class Command(Type):
|
|||||||
return f"{{ name: '{self.name}', result: '{self.result}', param: {self.params} }}"
|
return f"{{ name: '{self.name}', result: '{self.result}', param: {self.params} }}"
|
||||||
|
|
||||||
def declare(self):
|
def declare(self):
|
||||||
return 'extern "C" %(result)s %(name)s (%(params)s) noexcept;' % {
|
return 'extern "C" %(result)s %(name)s [[gnu::visibility("default")]] (%(params)s) noexcept;' % {
|
||||||
'name': rename(self.name),
|
'name': rename(self.name),
|
||||||
'result': self.result,
|
'result': self.result,
|
||||||
'params': ", ".join(p.param for p in self.params)
|
'params': ", ".join(p.param for p in self.params)
|
||||||
@ -837,8 +837,8 @@ def write_load(dst: TextIO, q: List[Type], reg: Registry):
|
|||||||
|
|
||||||
dst.write("""
|
dst.write("""
|
||||||
struct vendor_table;
|
struct vendor_table;
|
||||||
extern cruft::vk::load::vendor_table const *v_table;
|
extern cruft::vk::load::vendor_table const *v_table [[gnu::visibility("default")]];
|
||||||
extern cruft::vk::load::instance_table const *i_table;
|
extern cruft::vk::load::instance_table const *i_table [[gnu::visibility("default")]];
|
||||||
}
|
}
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user