From f407785f10ecabfecc89b201162e22adba90f396 Mon Sep 17 00:00:00 2001 From: Julian Smith Date: Mon, 12 Aug 2019 17:53:31 +0100 Subject: [PATCH] Fixes for building on OpenBSD. --- CMakeLists.txt | 4 ++++ simgear/canvas/ShivaVG/src/shConfig.h | 5 +++++ simgear/canvas/ShivaVG/src/shDefs.h | 4 ++-- simgear/misc/strutils.cxx | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a48cb4b..cf5c425c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -521,6 +521,10 @@ include(CheckCXXFeatures) # ahead of system-installed libs include_directories(BEFORE ${PROJECT_BINARY_DIR}/simgear) +if(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") + include_directories("/usr/X11R6/include") +endif() + add_definitions(-DHAVE_CONFIG_H) # configure a header file to pass some of the CMake settings diff --git a/simgear/canvas/ShivaVG/src/shConfig.h b/simgear/canvas/ShivaVG/src/shConfig.h index 6ed402e7..77be46ac 100644 --- a/simgear/canvas/ShivaVG/src/shConfig.h +++ b/simgear/canvas/ShivaVG/src/shConfig.h @@ -31,6 +31,11 @@ // FreeBSD #define VG_API_FREEBSD +#elif defined(__OpenBSD__) + + // FreeBSD + #define VG_API_OPENBSD + #else // Unsupported system diff --git a/simgear/canvas/ShivaVG/src/shDefs.h b/simgear/canvas/ShivaVG/src/shDefs.h index ee1774b5..f4355b18 100644 --- a/simgear/canvas/ShivaVG/src/shDefs.h +++ b/simgear/canvas/ShivaVG/src/shDefs.h @@ -34,7 +34,7 @@ #include #include -#if !defined(VG_API_MACOSX) && !defined(__FreeBSD__) +#if !defined(VG_API_MACOSX) && !defined(__FreeBSD__) && !defined(__OpenBSD__) # include #endif @@ -161,7 +161,7 @@ SHfloat getMaxFloat(); /* OpenGL headers */ -#if defined(VG_API_LINUX) || defined(VG_API_FREEBSD) +#if defined(VG_API_LINUX) || defined(VG_API_FREEBSD) || defined(VG_API_OPENBSD) #include #include #elif defined(VG_API_MACOSX) diff --git a/simgear/misc/strutils.cxx b/simgear/misc/strutils.cxx index 6d2cbeaa..5062e242 100644 --- a/simgear/misc/strutils.cxx +++ b/simgear/misc/strutils.cxx @@ -1043,7 +1043,7 @@ std::string error_string(int errnum) retcode = strerror_s(buf, sizeof(buf), errnum); #elif defined(_GNU_SOURCE) return std::string(strerror_r(errnum, buf, sizeof(buf))); -#elif (_POSIX_C_SOURCE >= 200112L) || defined(SG_MAC) || defined(__FreeBSD__) +#elif (_POSIX_C_SOURCE >= 200112L) || defined(SG_MAC) || defined(__FreeBSD__) || defined(__OpenBSD__) int retcode; // POSIX.1-2001 and POSIX.1-2008 retcode = strerror_r(errnum, buf, sizeof(buf));