From 7190c571f95e51e90cd7f661043e4d7dd18ad56a Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sun, 7 Mar 2021 18:35:46 +1000 Subject: [PATCH] CMake: Build system support for FreeBSD --- CMakeLists.txt | 8 ++++++-- CMakeModules/FindLIBEVDEV.cmake | 1 + dep/discord-rpc/CMakeLists.txt | 2 +- dep/vulkan-loader/CMakeLists.txt | 1 + 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 26441da48..e83ac4d4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.10) project(duckstation C CXX) message("CMake Version: ${CMAKE_VERSION}") +message("CMake System Name: ${CMAKE_SYSTEM_NAME}") # Pull in modules. set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeModules/") @@ -11,6 +12,9 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") set(LINUX TRUE) set(SUPPORTS_X11 TRUE) set(SUPPORTS_WAYLAND TRUE) +elseif(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") + set(FREEBSD TRUE) + set(SUPPORTS_X11 TRUE) endif() # Set minimum OS version for macOS. 10.14 should work. @@ -34,10 +38,10 @@ endif() if(SUPPORTS_WAYLAND) option(USE_WAYLAND "Support Wayland window system" OFF) endif() -if(LINUX OR ANDROID) +if((LINUX OR FREEBSD) OR ANDROID) option(USE_EGL "Support EGL OpenGL context creation" ON) endif() -if(LINUX AND NOT ANDROID) +if((LINUX OR FREEBSD) AND NOT ANDROID) option(USE_DRMKMS "Support DRM/KMS OpenGL contexts" OFF) option(USE_FBDEV "Support FBDev OpenGL contexts" OFF) option(USE_EVDEV "Support EVDev controller interface" ON) diff --git a/CMakeModules/FindLIBEVDEV.cmake b/CMakeModules/FindLIBEVDEV.cmake index f01e41a56..b560a27f6 100644 --- a/CMakeModules/FindLIBEVDEV.cmake +++ b/CMakeModules/FindLIBEVDEV.cmake @@ -12,6 +12,7 @@ FIND_PATH( HINTS ${PC_LIBEVDEV_INCLUDEDIR} ${PC_LIBEVDEV_INCLUDE_DIRS} /usr/include /usr/local/include + /usr/local/include/libevdev-1.0 ${LIBEVDEV_PATH_INCLUDES} ) diff --git a/dep/discord-rpc/CMakeLists.txt b/dep/discord-rpc/CMakeLists.txt index ca73ad02e..b7a251113 100644 --- a/dep/discord-rpc/CMakeLists.txt +++ b/dep/discord-rpc/CMakeLists.txt @@ -25,7 +25,7 @@ elseif(APPLE) src/connection_unix.cpp src/discord_register_osx.m ) -elseif(CMAKE_SYSTEM_NAME STREQUAL Linux) +elseif(LINUX OR FREEBSD) target_sources(discord-rpc PRIVATE src/connection_unix.cpp src/discord_register_linux.cpp diff --git a/dep/vulkan-loader/CMakeLists.txt b/dep/vulkan-loader/CMakeLists.txt index 7341af2aa..89fdb6322 100644 --- a/dep/vulkan-loader/CMakeLists.txt +++ b/dep/vulkan-loader/CMakeLists.txt @@ -28,6 +28,7 @@ target_link_libraries(vulkan-loader PRIVATE ${CMAKE_DL_LIBS}) if(USE_X11) target_compile_definitions(vulkan-loader PUBLIC "VULKAN_USE_X11=1") + target_include_directories(vulkan-loader PUBLIC "${X11_INCLUDE_DIR}") endif() if(USE_WAYLAND)