Skip to content

Commit

Permalink
These things here work on FreeBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
LadySerenaKitty committed Feb 6, 2024
1 parent 97718c3 commit 12cdfe3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
4 changes: 0 additions & 4 deletions BuildTools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
14 changes: 13 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -520,6 +528,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")

Expand Down
4 changes: 4 additions & 0 deletions Platforms/Linux/src/LinuxPlatformMisc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@

#include <pthread.h>

#ifdef PLATFORM_FREEBSD
# include <pthread_np.h>
#endif

namespace Diligent
{

Expand Down
2 changes: 2 additions & 0 deletions ThirdParty/DirectXShaderCompiler/dxc/WinAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,9 @@
#define __stdcall
#define __vectorcall
#define __thiscall
#ifndef PLATFORM_FREEBSD
#define __fastcall
#endif
#define __clrcall
#endif // __GNUC__

Expand Down

0 comments on commit 12cdfe3

Please sign in to comment.