ref: 55336dee6437d8224f80cb320d03651791cadbc9
parent: b401098a6737f03b9ef66ffdb63c0d9f02f82b12
parent: 8062596d23e32787296f2eca24e51ca7e1291f4a
author: Ethan Hugg <[email protected]>
date: Sun Jan 26 15:41:11 EST 2014
Merge pull request #221 from mstorsjo/freebsd Update building on FreeBSD
--- a/build/platform-freebsd.mk
+++ b/build/platform-freebsd.mk
@@ -1,5 +1,10 @@
ASM = nasm
-CFLAGS += -fPIC
+CFLAGS += -fPIC -DMT_ENABLED
LDFLAGS += -lpthread
-ASMFLAGS += -f elf -DNOPREFIX
+ASMFLAGS += -DNOPREFIX
+ifeq ($(ENABLE64BIT), Yes)
+ASMFLAGS += -f elf64
+else
+ASMFLAGS += -f elf
+endif
--- a/codec/common/WelsThreadLib.cpp
+++ b/codec/common/WelsThreadLib.cpp
@@ -44,7 +44,17 @@
#define _GNU_SOURCE
#endif
#include <sched.h>
+#elif !defined(_WIN32)
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#include <sys/param.h>
+#include <unistd.h>
+#ifdef __APPLE__
+#define HW_NCPU_NAME "hw.logicalcpu"
+#else
+#define HW_NCPU_NAME "hw.ncpu"
#endif
+#endif
#include "WelsThreadLib.h"
#include <stdio.h>
@@ -182,12 +192,6 @@
#elif defined(__GNUC__)
-#ifdef __APPLE__
-#include <sys/sysctl.h>
-#include <sys/param.h>
-#include <unistd.h>
-#endif//__APPLE__
-
void WelsSleep (uint32_t dwMilliseconds) {
usleep (dwMilliseconds * 1000); // microseconds
}
@@ -465,7 +469,7 @@
size_t len = sizeof (pInfo->ProcessorCount);
- if (sysctlbyname ("hw.logicalcpu", &pInfo->ProcessorCount, &len, NULL, 0) == -1)
+ if (sysctlbyname (HW_NCPU_NAME, &pInfo->ProcessorCount, &len, NULL, 0) == -1)
pInfo->ProcessorCount = 1;
return WELS_THREAD_ERROR_OK;