aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEleni Maria Stea <elene.mst@gmail.com>2021-07-03 17:12:30 +0300
committerjeremyk-lunarg <jeremyk@lunarg.com>2021-07-07 11:00:01 -0600
commit8b86fbac17b9f990f653f534e9cc57b34c5572eb (patch)
tree945f21f9fb1a072c60e9d311bfa391d881c0c40c
parent697cc6c387fd3019c37a01d6d18309916d1cc44d (diff)
downloadusermoji-8b86fbac17b9f990f653f534e9cc57b34c5572eb.tar.xz
vulkaninfo/cube: added support for FreeBSD
Made some changes for Vulkan-Tools to compile on FreeBSD.
-rw-r--r--cube/cube.cpp2
-rw-r--r--cube/gettime.h2
-rw-r--r--vulkaninfo/vulkaninfo.h10
3 files changed, 7 insertions, 7 deletions
diff --git a/cube/cube.cpp b/cube/cube.cpp
index e7826d8e..f5db1f69 100644
--- a/cube/cube.cpp
+++ b/cube/cube.cpp
@@ -3256,7 +3256,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCmdLine,
return (int)msg.wParam;
}
-#elif __linux__
+#elif defined(__linux__) || defined(__FreeBSD__)
int main(int argc, char **argv) {
Demo demo;
diff --git a/cube/gettime.h b/cube/gettime.h
index 0139c7ae..4be0d851 100644
--- a/cube/gettime.h
+++ b/cube/gettime.h
@@ -26,7 +26,7 @@
#include <windows.h>
-#elif defined(__unix__) || defined(__linux) || defined(__linux__) || defined(__ANDROID__) || defined(__EPOC32__) || defined(__QNX__)
+#elif defined(__unix__) || defined(__linux) || defined(__linux__) || defined(__FreeBSD__) || defined(__ANDROID__) || defined(__EPOC32__) || defined(__QNX__)
#include <time.h>
diff --git a/vulkaninfo/vulkaninfo.h b/vulkaninfo/vulkaninfo.h
index 72854cf2..b4505b8c 100644
--- a/vulkaninfo/vulkaninfo.h
+++ b/vulkaninfo/vulkaninfo.h
@@ -66,7 +66,7 @@
#endif
#endif // _WIN32
-#if defined(__linux__) || defined(__APPLE__)
+#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
#include <dlfcn.h>
#endif
@@ -262,7 +262,7 @@ auto GetVector(const char *func_name, F &&f, Ts &&... ts) -> std::vector<T> {
// ----------- Instance Setup ------- //
struct VkDll {
VkResult Initialize() {
-#if defined(__linux__)
+#if defined(__linux__) || defined(__FreeBSD__)
library = dlopen("libvulkan.so", RTLD_NOW | RTLD_LOCAL);
if (!library) library = dlopen("libvulkan.so.1", RTLD_NOW | RTLD_LOCAL);
#elif defined(_WIN32)
@@ -274,7 +274,7 @@ struct VkDll {
return VK_SUCCESS;
}
void Close() {
-#if defined(__linux__)
+#if defined(__linux__) || defined(__FreeBSD__)
dlclose(library);
#elif defined(_WIN32)
FreeLibrary(library);
@@ -429,13 +429,13 @@ struct VkDll {
private:
template <typename T>
void Load(T &func_dest, const char *func_name) {
-#if defined(__linux__)
+#if defined(__linux__) || defined(__FreeBSD__)
func_dest = reinterpret_cast<T>(dlsym(library, func_name));
#elif defined(_WIN32)
func_dest = reinterpret_cast<T>(GetProcAddress(library, func_name));
#endif
}
-#if defined(__linux__)
+#if defined(__linux__) || defined(__FreeBSD__)
void *library;
#elif defined(_WIN32)
HMODULE library;