#include <assert.h>
#include <string.h>
-#if (DE_OS == DE_OS_OSX) || (DE_OS == DE_OS_IOS)
+#if (DE_OS == DE_OS_OSX) || (DE_OS == DE_OS_IOS) || defined(__FreeBSD__)
# include <signal.h>
# include <stdlib.h>
#endif
}
#elif ((DE_OS == DE_OS_WIN32) && (DE_COMPILER == DE_COMPILER_CLANG))
_assert(reason, file, line);
+#elif (DE_OS == DE_OS_OSX) || (DE_OS == DE_OS_IOS) || defined(__FreeBSD__)
+ fprintf(stderr, "Assertion '%s' failed at %s:%d\n", reason, file, line);
+ raise(SIGTRAP);
+ abort();
#elif (DE_OS == DE_OS_UNIX)
__assert_fail(reason, file, (unsigned int)line, "Unknown function");
#elif (DE_OS == DE_OS_QNX)
__assert(reason, file, (unsigned int)line, "Unknown function");
#elif (DE_OS == DE_OS_SYMBIAN)
__assert("Unknown function", file, line, reason);
-#elif (DE_OS == DE_OS_OSX) || (DE_OS == DE_OS_IOS)
- fprintf(stderr, "Assertion '%s' failed at %s:%d\n", reason, file, line);
- raise(SIGTRAP);
- abort();
#elif (DE_OS == DE_OS_ANDROID)
__android_log_print(ANDROID_LOG_ERROR, "delibs", "Assertion '%s' failed at %s:%d", reason, file, line);
__assert(file, line, reason);
#if (DE_OS == DE_OS_UNIX) || ((DE_OS == DE_OS_ANDROID) && (DE_ANDROID_API >= 21))
# define DE_ALIGNED_MALLOC DE_ALIGNED_MALLOC_POSIX
-# include <malloc.h>
+# if defined(__FreeBSD__)
+# include <stdlib.h>
+# else
+# include <malloc.h>
+# endif
#elif (DE_OS == DE_OS_WIN32)
# define DE_ALIGNED_MALLOC DE_ALIGNED_MALLOC_WIN32
# include <malloc.h>
deUint32 deGetNumAvailableLogicalCores (void)
{
+#if !defined(__FreeBSD__)
unsigned long mask = 0;
const unsigned int maskSize = sizeof(mask);
long ret;
}
else
{
+#endif
#if defined(_SC_NPROCESSORS_ONLN)
const long count = sysconf(_SC_NPROCESSORS_ONLN);
#else
return 1;
#endif
+
+#if !defined(__FreeBSD__)
}
+#endif
}
#else
add_library(qphelper STATIC ${QPHELPER_SRCS})
target_link_libraries(qphelper ${QPHELPER_LIBS})
+# freebsd needs libexecinfo for backtrace symbols
+if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
+ target_link_libraries(qphelper execinfo)
+endif ()
+
# Should qpInfo.c attempt to include qpReleaseInfo.inl
set(USE_RELEASE_INFO_FILE OFF)