Skip to content

Commit 12cdfe3

Browse files
These things here work on FreeBSD
1 parent 97718c3 commit 12cdfe3

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

BuildTools/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,3 @@ elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
99
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
1010
set(CLANG_FORMAT_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}/FormatValidation/clang-format_mac_10.0.0" CACHE INTERNAL "clang-format executable path")
1111
endif()
12-
13-
if (NOT EXISTS ${CLANG_FORMAT_EXECUTABLE})
14-
message(FATAL_ERROR "clang-format executable is not found.")
15-
endif()

CMakeLists.txt

+13-1
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ else()
125125
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
126126
set(PLATFORM_LINUX TRUE CACHE INTERNAL "Target platform: Linux")
127127
message("Target platform: Linux " ${ARCH})
128+
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
129+
set(PLATFORM_LINUX TRUE CACHE INTERNAL "Target platform: Linux")
130+
set(PLATFORM_FREEBSD TRUE CACHE INTERNAL "Target platform: FreeBSD")
131+
message("Target platform: FreeBSD " ${ARCH})
128132
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
129133
if(IOS)
130134
set(PLATFORM_IOS TRUE CACHE INTERNAL "Target platform: iOS")
@@ -197,7 +201,11 @@ elseif(PLATFORM_LINUX)
197201
set(GL_SUPPORTED TRUE CACHE INTERNAL "OpenGL is supported on Linux platform")
198202
set(VULKAN_SUPPORTED TRUE CACHE INTERNAL "Vulkan is supported on Linux platform")
199203
set(ARCHIVER_SUPPORTED TRUE CACHE INTERNAL "Archiver is supported on Linux platform")
200-
target_compile_definitions(Diligent-PublicBuildSettings INTERFACE PLATFORM_LINUX=1)
204+
if(PLATFORM_FREEBSD)
205+
target_compile_definitions(Diligent-PublicBuildSettings INTERFACE PLATFORM_LINUX=1 PLATFORM_FREEBSD=1)
206+
else()
207+
target_compile_definitions(Diligent-PublicBuildSettings INTERFACE PLATFORM_LINUX=1)
208+
endif()
201209
elseif(PLATFORM_MACOS)
202210
set(GL_SUPPORTED TRUE CACHE INTERNAL "OpenGL is supported on MacOS platform")
203211
set(VULKAN_SUPPORTED TRUE CACHE INTERNAL "Vulkan is enabled through MoltenVK on MacOS platform")
@@ -520,6 +528,10 @@ else()
520528
set(DILIGENT_INSTALL_PDB OFF)
521529
endif()
522530

531+
if(PLATFORM_FREEBSD AND EXISTS /usr/local/include)
532+
target_include_directories(Diligent-BuildSettings SYSTEM AFTER INTERFACE /usr/local/include)
533+
endif()
534+
523535
file(RELATIVE_PATH DILIGENT_CORE_DIR "${CMAKE_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
524536
SET(DILIGENT_CORE_DIR ${DILIGENT_CORE_DIR} CACHE INTERNAL "Diligent Core installation directory")
525537

Platforms/Linux/src/LinuxPlatformMisc.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828

2929
#include <pthread.h>
3030

31+
#ifdef PLATFORM_FREEBSD
32+
# include <pthread_np.h>
33+
#endif
34+
3135
namespace Diligent
3236
{
3337

ThirdParty/DirectXShaderCompiler/dxc/WinAdapter.h

+2
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,9 @@
286286
#define __stdcall
287287
#define __vectorcall
288288
#define __thiscall
289+
#ifndef PLATFORM_FREEBSD
289290
#define __fastcall
291+
#endif
290292
#define __clrcall
291293
#endif // __GNUC__
292294

0 commit comments

Comments
 (0)