mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Merge pull request #609 from asuessenbach/windows
Add some workarounds to not include windows.h on _WIN32 platform.
This commit is contained in:
commit
ae3460a715
@ -1404,6 +1404,15 @@ void VulkanHppGenerator::appendDispatchLoaderDynamic( std::string & str )
|
|||||||
{
|
{
|
||||||
str += R"(
|
str += R"(
|
||||||
#if VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL
|
#if VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL
|
||||||
|
# if defined( _WIN32 )
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
extern "C" __declspec( dllimport ) void * __stdcall LoadLibraryA( char const * lpLibFileName );
|
||||||
|
extern "C" __declspec( dllimport ) int __stdcall FreeLibrary( void * hLibModule );
|
||||||
|
extern "C" __declspec( dllimport ) void * __stdcall GetProcAddress( void * hModule, char const * lpProcName );
|
||||||
|
} // namespace detail
|
||||||
|
# endif
|
||||||
|
|
||||||
class DynamicLoader
|
class DynamicLoader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -1418,9 +1427,9 @@ void VulkanHppGenerator::appendDispatchLoaderDynamic( std::string & str )
|
|||||||
# if defined( __linux__ ) || defined( __APPLE__ )
|
# if defined( __linux__ ) || defined( __APPLE__ )
|
||||||
m_library = dlopen( vulkanLibraryName.c_str(), RTLD_NOW | RTLD_LOCAL );
|
m_library = dlopen( vulkanLibraryName.c_str(), RTLD_NOW | RTLD_LOCAL );
|
||||||
# elif defined( _WIN32 )
|
# elif defined( _WIN32 )
|
||||||
m_library = LoadLibrary( vulkanLibraryName.c_str() );
|
m_library = detail::LoadLibraryA( vulkanLibraryName.c_str() );
|
||||||
# else
|
# else
|
||||||
VULKAN_HPP_ASSERT( false && "unsupported platform" );
|
# error unsupported platform
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1434,9 +1443,9 @@ void VulkanHppGenerator::appendDispatchLoaderDynamic( std::string & str )
|
|||||||
# elif defined( __APPLE__ )
|
# elif defined( __APPLE__ )
|
||||||
m_library = dlopen( "libvulkan.dylib", RTLD_NOW | RTLD_LOCAL );
|
m_library = dlopen( "libvulkan.dylib", RTLD_NOW | RTLD_LOCAL );
|
||||||
# elif defined( _WIN32 )
|
# elif defined( _WIN32 )
|
||||||
m_library = LoadLibrary( TEXT( "vulkan-1.dll" ) );
|
m_library = detail::LoadLibraryA( "vulkan-1.dll" );
|
||||||
# else
|
# else
|
||||||
VULKAN_HPP_ASSERT( false && "unsupported platform" );
|
# error unsupported platform
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1475,7 +1484,9 @@ void VulkanHppGenerator::appendDispatchLoaderDynamic( std::string & str )
|
|||||||
# if defined( __linux__ ) || defined( __APPLE__ )
|
# if defined( __linux__ ) || defined( __APPLE__ )
|
||||||
dlclose( m_library );
|
dlclose( m_library );
|
||||||
# elif defined( _WIN32 )
|
# elif defined( _WIN32 )
|
||||||
FreeLibrary( m_library );
|
detail::FreeLibrary( m_library );
|
||||||
|
# else
|
||||||
|
# error unsupported platform
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1486,7 +1497,9 @@ void VulkanHppGenerator::appendDispatchLoaderDynamic( std::string & str )
|
|||||||
# if defined( __linux__ ) || defined( __APPLE__ )
|
# if defined( __linux__ ) || defined( __APPLE__ )
|
||||||
return (T)dlsym( m_library, function );
|
return (T)dlsym( m_library, function );
|
||||||
# elif defined( _WIN32 )
|
# elif defined( _WIN32 )
|
||||||
return (T)GetProcAddress( m_library, function );
|
return (T)detail::GetProcAddress( m_library, function );
|
||||||
|
# else
|
||||||
|
# error unsupported platform
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1494,10 +1507,8 @@ void VulkanHppGenerator::appendDispatchLoaderDynamic( std::string & str )
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_success;
|
bool m_success;
|
||||||
#if defined(__linux__) || defined(__APPLE__)
|
# if defined( __linux__ ) || defined( __APPLE__ ) || defined( _WIN32 )
|
||||||
void * m_library;
|
void * m_library;
|
||||||
#elif defined(_WIN32)
|
|
||||||
HMODULE m_library;
|
|
||||||
# else
|
# else
|
||||||
# error unsupported platform
|
# error unsupported platform
|
||||||
# endif
|
# endif
|
||||||
@ -7811,10 +7822,6 @@ int main( int argc, char ** argv )
|
|||||||
# if defined(__linux__) || defined(__APPLE__)
|
# if defined(__linux__) || defined(__APPLE__)
|
||||||
# include <dlfcn.h>
|
# include <dlfcn.h>
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# if defined(_WIN32)
|
|
||||||
# include <windows.h>
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 201711 <= __cpp_impl_three_way_comparison
|
#if 201711 <= __cpp_impl_three_way_comparison
|
||||||
|
@ -69,10 +69,6 @@
|
|||||||
# if defined( __linux__ ) || defined( __APPLE__ )
|
# if defined( __linux__ ) || defined( __APPLE__ )
|
||||||
# include <dlfcn.h>
|
# include <dlfcn.h>
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# if defined( _WIN32 )
|
|
||||||
# include <windows.h>
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 201711 <= __cpp_impl_three_way_comparison
|
#if 201711 <= __cpp_impl_three_way_comparison
|
||||||
@ -96704,6 +96700,15 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL
|
#if VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL
|
||||||
|
# if defined( _WIN32 )
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
extern "C" __declspec( dllimport ) void * __stdcall LoadLibraryA( char const * lpLibFileName );
|
||||||
|
extern "C" __declspec( dllimport ) int __stdcall FreeLibrary( void * hLibModule );
|
||||||
|
extern "C" __declspec( dllimport ) void * __stdcall GetProcAddress( void * hModule, char const * lpProcName );
|
||||||
|
} // namespace detail
|
||||||
|
# endif
|
||||||
|
|
||||||
class DynamicLoader
|
class DynamicLoader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -96718,9 +96723,9 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
# if defined( __linux__ ) || defined( __APPLE__ )
|
# if defined( __linux__ ) || defined( __APPLE__ )
|
||||||
m_library = dlopen( vulkanLibraryName.c_str(), RTLD_NOW | RTLD_LOCAL );
|
m_library = dlopen( vulkanLibraryName.c_str(), RTLD_NOW | RTLD_LOCAL );
|
||||||
# elif defined( _WIN32 )
|
# elif defined( _WIN32 )
|
||||||
m_library = LoadLibrary( vulkanLibraryName.c_str() );
|
m_library = detail::LoadLibraryA( vulkanLibraryName.c_str() );
|
||||||
# else
|
# else
|
||||||
VULKAN_HPP_ASSERT( false && "unsupported platform" );
|
# error unsupported platform
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -96734,9 +96739,9 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
# elif defined( __APPLE__ )
|
# elif defined( __APPLE__ )
|
||||||
m_library = dlopen( "libvulkan.dylib", RTLD_NOW | RTLD_LOCAL );
|
m_library = dlopen( "libvulkan.dylib", RTLD_NOW | RTLD_LOCAL );
|
||||||
# elif defined( _WIN32 )
|
# elif defined( _WIN32 )
|
||||||
m_library = LoadLibrary( TEXT( "vulkan-1.dll" ) );
|
m_library = detail::LoadLibraryA( "vulkan-1.dll" );
|
||||||
# else
|
# else
|
||||||
VULKAN_HPP_ASSERT( false && "unsupported platform" );
|
# error unsupported platform
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96776,7 +96781,9 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
# if defined( __linux__ ) || defined( __APPLE__ )
|
# if defined( __linux__ ) || defined( __APPLE__ )
|
||||||
dlclose( m_library );
|
dlclose( m_library );
|
||||||
# elif defined( _WIN32 )
|
# elif defined( _WIN32 )
|
||||||
FreeLibrary( m_library );
|
detail::FreeLibrary( m_library );
|
||||||
|
# else
|
||||||
|
# error unsupported platform
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96787,7 +96794,9 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
# if defined( __linux__ ) || defined( __APPLE__ )
|
# if defined( __linux__ ) || defined( __APPLE__ )
|
||||||
return (T)dlsym( m_library, function );
|
return (T)dlsym( m_library, function );
|
||||||
# elif defined( _WIN32 )
|
# elif defined( _WIN32 )
|
||||||
return (T)GetProcAddress( m_library, function );
|
return (T)detail::GetProcAddress( m_library, function );
|
||||||
|
# else
|
||||||
|
# error unsupported platform
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96798,10 +96807,8 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_success;
|
bool m_success;
|
||||||
# if defined( __linux__ ) || defined( __APPLE__ )
|
# if defined( __linux__ ) || defined( __APPLE__ ) || defined( _WIN32 )
|
||||||
void * m_library;
|
void * m_library;
|
||||||
# elif defined( _WIN32 )
|
|
||||||
HMODULE m_library;
|
|
||||||
# else
|
# else
|
||||||
# error unsupported platform
|
# error unsupported platform
|
||||||
# endif
|
# endif
|
||||||
|
Loading…
Reference in New Issue
Block a user