提交 ee284a56 编写于 作者: J Jim

Merge pull request #424 from fryshorts/bsd-build-fixes

BSD build fixes
# Once done these will be defined:
#
# SYSINFO_FOUND
# SYSINFO_INCLUDE_DIRS
# SYSINFO_LIBRARIES
find_path(SYSINFO_INCLUDE_DIR
NAMES sys/sysinfo.h
PATHS
/usr/include /usr/local/include /opt/local/include)
find_library(SYSINFO_LIB
NAMES sysinfo libsysinfo
PATHS
/usr/lib /usr/local/lib /opt/local/lib)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(sysinfo DEFAULT_MSG SYSINFO_LIB SYSINFO_INCLUDE_DIR)
mark_as_advanced(SYSINFO_INCLUDE_DIR SYSINFO_LIB)
if(SYSINFO_FOUND)
set(SYSINFO_INCLUDE_DIRS ${SYSINFO_INCLUDE_DIR})
set(SYSINFO_LIBRARIES ${SYSINFO_LIB})
endif()
......@@ -43,8 +43,13 @@ endif()
if(NOT WIN32 AND NOT APPLE)
set(glad_PLATFORM_DEPS
-ldl
${X11_X11_LIB})
# only link to libdl on linux
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(glad_PLATFORM_DEPS
${glad_PLATFORM_DEPS}
-ldl)
endif()
endif()
target_link_libraries(glad
......
......@@ -95,7 +95,7 @@ if (MSVC)
endif()
if (NOT WIN32 AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX))
if (NOT WIN32 AND NOT APPLE)
set(CMAKE_C_FLAGS "-fPIC")
endif()
......
......@@ -77,6 +77,15 @@ elseif(UNIX)
util/threading-posix.c
util/pipe-posix.c
util/platform-nix.c)
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
# use the sysinfo compatibility library on bsd
find_package(Libsysinfo REQUIRED)
include_directories(${SYSINFO_INCLUDE_DIRS})
set(libobs_PLATFORM_DEPS
${libobs_PLATFORM_DEPS}
${SYSINFO_LIBRARIES})
endif()
endif()
if(MSVC)
......
......@@ -426,7 +426,7 @@ struct gs_window {
void *hwnd;
#elif defined(__APPLE__)
__unsafe_unretained id view;
#elif defined(__linux__)
#elif defined(__linux__) || defined(__FreeBSD__)
/* I'm not sure how portable defining id to uint32_t is. */
uint32_t id;
void* display;
......
......@@ -16,6 +16,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#ifdef __FreeBSD__
#define _WITH_GETLINE
#endif
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
......
......@@ -26,7 +26,6 @@
#if !defined(__APPLE__)
#include <sys/times.h>
#include <sys/vtimes.h>
#endif
#include "darray.h"
......
......@@ -26,6 +26,10 @@
#include <semaphore.h>
#endif
#if defined(__FreeBSD__)
#include <pthread_np.h>
#endif
#include "bmem.h"
#include "threading.h"
......@@ -256,6 +260,8 @@ void os_set_thread_name(const char *name)
{
#if defined(__APPLE__)
pthread_setname_np(name);
#elif defined(__FreeBSD__)
pthread_set_name_np(pthread_self(), name);
#elif !defined(__MINGW32__)
pthread_setname_np(pthread_self(), name);
#endif
......
......@@ -357,6 +357,8 @@ string OBSApp::GetVersionString() const
ver << "windows)";
#elif __APPLE__
ver << "mac)";
#elif __FreeBSD__
ver << "freebsd)";
#else /* assume linux for the time being */
ver << "linux)";
#endif
......
......@@ -15,6 +15,11 @@ elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
add_subdirectory(linux-v4l2)
add_subdirectory(linux-jack)
add_subdirectory(decklink/linux)
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD")
add_subdirectory(linux-capture)
add_subdirectory(linux-pulseaudio)
add_subdirectory(linux-v4l2)
add_subdirectory(linux-jack)
endif()
add_subdirectory(image-source)
......
......@@ -13,7 +13,10 @@ elseif(NOT JACK_FOUND)
return()
endif()
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/libobs")
include_directories(
SYSTEM "${CMAKE_SOURCE_DIR}/libobs"
${JACK_INCLUDE_DIR}
)
set(linux-jack_SOURCES
linux-jack.c
......
......@@ -13,7 +13,10 @@ elseif(NOT PULSEAUDIO_FOUND)
return()
endif()
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/libobs")
include_directories(
SYSTEM "${CMAKE_SOURCE_DIR}/libobs"
${PULSEAUDIO_INCLUDE_DIR}
)
set(linux-pulseaudio_SOURCES
linux-pulseaudio.c
......
......@@ -24,6 +24,11 @@ else()
add_definitions(-DHAVE_UDEV)
endif()
include_directories(
SYSTEM "${CMAKE_SOURCE_DIR}/libobs"
${LIBV4L2_INCLUDE_DIRS}
)
set(linux-v4l2_SOURCES
linux-v4l2.c
v4l2-input.c
......
......@@ -240,7 +240,7 @@ int_fast32_t v4l2_set_standard(int_fast32_t dev, int *standard)
int_fast32_t v4l2_enum_dv_timing(int_fast32_t dev, struct v4l2_dv_timings *dvt,
int index)
{
#ifndef VIDIOC_ENUM_DV_TIMINGS
#if !defined(VIDIOC_ENUM_DV_TIMINGS) || !defined(V4L2_IN_CAP_DV_TIMINGS)
UNUSED_PARAMETER(dev);
UNUSED_PARAMETER(dvt);
UNUSED_PARAMETER(index);
......
......@@ -43,7 +43,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* The new dv timing api was introduced in Linux 3.4
* Currently we simply disable dv timings when this is not defined */
#ifndef VIDIOC_ENUM_DV_TIMINGS
#if !defined(VIDIOC_ENUM_DV_TIMINGS) || !defined(V4L2_IN_CAP_DV_TIMINGS)
#define V4L2_IN_CAP_DV_TIMINGS 0
#endif
......@@ -269,7 +269,11 @@ static void v4l2_device_list(obs_property_t *prop, obs_data_t *settings)
size_t cur_device_index;
const char *cur_device_name;
#ifdef __FreeBSD__
dirp = opendir("/dev");
#else
dirp = opendir("/sys/class/video4linux");
#endif
if (!dirp)
return;
......@@ -285,6 +289,11 @@ static void v4l2_device_list(obs_property_t *prop, obs_data_t *settings)
uint32_t caps;
struct v4l2_capability video_cap;
#ifdef __FreeBSD__
if (strstr(dp->d_name, "video") == NULL)
continue;
#endif
if (dp->d_type == DT_DIR)
continue;
......@@ -949,7 +958,7 @@ static void *v4l2_create(obs_data_t *settings, obs_source_t *source)
#ifndef V4L2_CAP_DEVICE_CAPS
blog(LOG_WARNING, "Plugin built without device caps support!");
#endif
#ifndef VIDIOC_ENUM_DV_TIMINGS
#if !defined(VIDIOC_ENUM_DV_TIMINGS) || !defined(V4L2_IN_CAP_DV_TIMINGS)
blog(LOG_WARNING, "Plugin built without dv-timing support!");
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册