@ -25,9 +25,10 @@ package("vulkan-hpp")
add_versions ( " v1.3.279 " , " 6fb8def27290f8b87d7835457a9c68190aed9a9a " )
add_versions ( " v1.3.280 " , " e35acfe75215116029298aebf681170559a4fe6a " )
add_versions ( " v1.3.281 " , " 88d508b32f207ba85b37fe22fe3732322d1c248d " )
add_versions ( " v1.3.282 " , " 4bf2835dd1a530291cd2b340a58dd7e369d5c86c " )
add_versions ( " v1.3.283 " , " 2fbc146feefa43b8201af4b01eb3570110f9fa32 " )
add_configs ( " modules " , { description = " Build with C++20 modules support. " , default = false , type = " boolean " } )
add_configs ( " msvc_modules " , { description = " If 'modules' enabled, and you wish to use MSVC on the package, enable this to avoid a known bug of MSVC. " , default = false , type = " boolean " } )
on_load ( function ( package )
if not package : config ( " modules " ) then
@ -38,8 +39,8 @@ package("vulkan-hpp")
end
end )
-- TODO: add android, windows|x86, mingw|i386 target
on_install ( " windows|x64 " , " linux " , " macosx " , " mingw|x86_64 " , " iphoneos " , function ( package )
on_install ( " windows|x86 " , " windows|x 64 " , " linux " , " macosx " , " mingw " , " android " , " iphoneos " , function ( package )
local arch_prev
local plat_prev
if ( package : is_plat ( " mingw " ) or package : is_cross ( ) ) and package.plat_set then
@ -64,41 +65,32 @@ package("vulkan-hpp")
os.cp ( " Vulkan-Headers/include " , package : installdir ( ) )
os.cp ( " vulkan/*.hpp " , package : installdir ( path.join ( " include " , " vulkan " ) ) )
else
if package : config ( " msvc_modules " ) then
io.writefile ( " xmake.lua " , [ [
target ( " vulkan-hpp " )
set_kind ( " moduleonly " )
set_languages ( " c++20 " )
set_toolchains ( " msvc " )
add_cxflags ( " /EHsc " )
add_headerfiles ( " Vulkan-Headers/include/(**.h) " )
add_headerfiles ( " Vulkan/(**.h) " )
add_headerfiles ( " Vulkan-Headers/include/(**.hpp) " )
add_headerfiles ( " Vulkan/(**.hpp) " )
add_includedirs ( " Vulkan " )
add_includedirs ( " Vulkan-Headers/include " )
add_files ( " Vulkan/vulkan.cppm " )
add_defines ( " VULKAN_HPP_NO_SMART_HANDLE " )
] ] )
else
io.writefile ( " xmake.lua " , [ [
target ( " vulkan-hpp " )
set_kind ( " static " )
set_languages ( " c++20 " )
add_headerfiles ( " Vulkan-Headers/include/(**.h) " )
add_headerfiles ( " Vulkan/(**.h) " )
add_headerfiles ( " Vulkan-Headers/include/(**.hpp) " )
add_headerfiles ( " Vulkan/(**.hpp) " )
add_includedirs ( " Vulkan " )
add_includedirs ( " Vulkan-Headers/include " )
add_files ( " Vulkan/vulkan.cppm " , { public = true } )
] ] )
end
io.writefile ( " xmake.lua " , [ [
target ( " vulkan-hpp " )
set_kind ( " static " )
set_languages ( " c++20 " )
add_headerfiles ( " Vulkan-Headers/include/(**.h) " )
add_headerfiles ( " Vulkan/(**.h) " )
add_headerfiles ( " Vulkan-Headers/include/(**.hpp) " )
add_headerfiles ( " Vulkan/(**.hpp) " )
add_includedirs ( " Vulkan " )
add_includedirs ( " Vulkan-Headers/include " )
add_files ( " Vulkan/vulkan.cppm " , { public = true } )
] ] )
local configs = { }
import ( " package.tools.xmake " ) . install ( package , configs )
end
end )
on_test ( function ( package )
assert ( package : has_cxxincludes ( " vulkan/vulkan.hpp " , { configs = { languages = " c++14 " } } ) )
assert ( package : check_cxxsnippets ( { test = [ [
void test ( ) {
vk :: ApplicationInfo ai ;
ai.pApplicationName = " Test " ;
ai.applicationVersion = VK_MAKE_API_VERSION ( 1 , 0 , 0 , 0 ) ;
ai.pEngineName = " Test " ;
ai.engineVersion = VK_MAKE_API_VERSION ( 1 , 0 , 0 , 0 ) ;
ai.apiVersion = VK_API_VERSION_1_0 ;
}
] ] } , { includes = " vulkan/vulkan.hpp " , configs = { languages = " c++14 " } } ) )
end )