BSD compatibility
- separate Makefile for BSD make - auto-compile will detect BSD and pass the correct parameters to make - C PoW builds on OpenBSD and detects number of cores
This commit is contained in:
parent
6c907e2046
commit
75f715bfe4
14
src/bitmsghash/Makefile.bsd
Normal file
14
src/bitmsghash/Makefile.bsd
Normal file
|
@ -0,0 +1,14 @@
|
|||
all: bitmsghash.so
|
||||
|
||||
powtest:
|
||||
./testpow.py
|
||||
|
||||
bitmsghash.so: bitmsghash.o
|
||||
${CXX} bitmsghash.o -shared -fPIC -lpthread -lcrypto $(LDFLAGS) -o bitmsghash.so
|
||||
|
||||
bitmsghash.o:
|
||||
${CXX} -Wall -O3 -march=native -fPIC $(CCFLAGS) -c bitmsghash.cpp
|
||||
|
||||
clean:
|
||||
rm -f bitmsghash.o bitmsghash.so
|
||||
|
|
@ -75,6 +75,10 @@ void getnumthreads()
|
|||
DWORD_PTR dwProcessAffinity, dwSystemAffinity;
|
||||
#elif __linux__
|
||||
cpu_set_t dwProcessAffinity;
|
||||
#elif __OpenBSD__
|
||||
int mib[2], core_count = 0;
|
||||
int dwProcessAffinity = 0;
|
||||
size_t len2;
|
||||
#else
|
||||
int dwProcessAffinity = 0;
|
||||
int32_t core_count = 0;
|
||||
|
@ -86,6 +90,12 @@ void getnumthreads()
|
|||
GetProcessAffinityMask(GetCurrentProcess(), &dwProcessAffinity, &dwSystemAffinity);
|
||||
#elif __linux__
|
||||
sched_getaffinity(0, len, &dwProcessAffinity);
|
||||
#elif __OpenBSD__
|
||||
len2 = sizeof(core_count);
|
||||
mib[0] = CTL_HW;
|
||||
mib[1] = HW_NCPU;
|
||||
if (sysctl(mib, 2, &core_count, &len2, 0, 0) == 0)
|
||||
numthreads = core_count;
|
||||
#else
|
||||
if (sysctlbyname("hw.logicalcpu", &core_count, &len, 0, 0) == 0)
|
||||
numthreads = core_count;
|
||||
|
|
|
@ -174,7 +174,12 @@ def buildCPoW():
|
|||
notifyBuild(False)
|
||||
return
|
||||
try:
|
||||
call(["make", "-C", os.path.join(paths.codePath(), "bitmsghash")])
|
||||
if "bsd" in sys.platform:
|
||||
# BSD make
|
||||
call(["make", "-C", os.path.join(paths.codePath(), "bitmsghash"), '-f', 'Makefile.bsd'])
|
||||
else:
|
||||
# GNU make
|
||||
call(["make", "-C", os.path.join(paths.codePath(), "bitmsghash")])
|
||||
if os.path.exists(os.path.join(paths.codePath(), "bitmsghash", "bitmsghash.so")):
|
||||
init()
|
||||
notifyBuild(True)
|
||||
|
|
Loading…
Reference in New Issue
Block a user