From f72ae4c43f7392285027bb977f197035b51d87f4 Mon Sep 17 00:00:00 2001 From: Jessica Hawkwell Date: Tue, 6 Feb 2024 04:05:25 -0600 Subject: [PATCH] These things here work on FreeBSD --- BuildTools/CMakeLists.txt | 4 ---- CMakeLists.txt | 14 +++++++++++++- Platforms/Linux/src/LinuxPlatformMisc.cpp | 4 ++++ ThirdParty/DirectXShaderCompiler/dxc/WinAdapter.h | 2 ++ 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/BuildTools/CMakeLists.txt b/BuildTools/CMakeLists.txt index 539bfb4c0..1326031ec 100644 --- a/BuildTools/CMakeLists.txt +++ b/BuildTools/CMakeLists.txt @@ -9,7 +9,3 @@ elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") set(CLANG_FORMAT_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}/FormatValidation/clang-format_mac_10.0.0" CACHE INTERNAL "clang-format executable path") endif() - -if (NOT EXISTS ${CLANG_FORMAT_EXECUTABLE}) - message(FATAL_ERROR "clang-format executable is not found.") -endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fb18ddd5..80bb7f9a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -125,6 +125,10 @@ else() elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") set(PLATFORM_LINUX TRUE CACHE INTERNAL "Target platform: Linux") message("Target platform: Linux " ${ARCH}) + elseif(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") + set(PLATFORM_LINUX TRUE CACHE INTERNAL "Target platform: Linux") + set(PLATFORM_FREEBSD TRUE CACHE INTERNAL "Target platform: FreeBSD") + message("Target platform: FreeBSD " ${ARCH}) elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") if(IOS) set(PLATFORM_IOS TRUE CACHE INTERNAL "Target platform: iOS") @@ -197,7 +201,11 @@ elseif(PLATFORM_LINUX) set(GL_SUPPORTED TRUE CACHE INTERNAL "OpenGL is supported on Linux platform") set(VULKAN_SUPPORTED TRUE CACHE INTERNAL "Vulkan is supported on Linux platform") set(ARCHIVER_SUPPORTED TRUE CACHE INTERNAL "Archiver is supported on Linux platform") - target_compile_definitions(Diligent-PublicBuildSettings INTERFACE PLATFORM_LINUX=1) + if(PLATFORM_FREEBSD) + target_compile_definitions(Diligent-PublicBuildSettings INTERFACE PLATFORM_LINUX=1 PLATFORM_FREEBSD=1) + else() + target_compile_definitions(Diligent-PublicBuildSettings INTERFACE PLATFORM_LINUX=1) + endif() elseif(PLATFORM_MACOS) set(GL_SUPPORTED TRUE CACHE INTERNAL "OpenGL is supported on MacOS platform") set(VULKAN_SUPPORTED TRUE CACHE INTERNAL "Vulkan is enabled through MoltenVK on MacOS platform") @@ -514,6 +522,10 @@ else() set(DILIGENT_INSTALL_PDB OFF) endif() +if(PLATFORM_FREEBSD AND EXISTS /usr/local/include) + target_include_directories(Diligent-BuildSettings SYSTEM AFTER INTERFACE /usr/local/include) +endif() + file(RELATIVE_PATH DILIGENT_CORE_DIR "${CMAKE_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") SET(DILIGENT_CORE_DIR ${DILIGENT_CORE_DIR} CACHE INTERNAL "Diligent Core installation directory") diff --git a/Platforms/Linux/src/LinuxPlatformMisc.cpp b/Platforms/Linux/src/LinuxPlatformMisc.cpp index e522d7f57..d2f70f883 100644 --- a/Platforms/Linux/src/LinuxPlatformMisc.cpp +++ b/Platforms/Linux/src/LinuxPlatformMisc.cpp @@ -28,6 +28,10 @@ #include +#ifdef PLATFORM_FREEBSD +# include +#endif + namespace Diligent { diff --git a/ThirdParty/DirectXShaderCompiler/dxc/WinAdapter.h b/ThirdParty/DirectXShaderCompiler/dxc/WinAdapter.h index 2872d7b05..0cb36cd97 100644 --- a/ThirdParty/DirectXShaderCompiler/dxc/WinAdapter.h +++ b/ThirdParty/DirectXShaderCompiler/dxc/WinAdapter.h @@ -286,7 +286,9 @@ #define __stdcall #define __vectorcall #define __thiscall +#ifndef PLATFORM_FREEBSD #define __fastcall +#endif #define __clrcall #endif // __GNUC__