1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-24 00:45:52 +00:00

- Unbreak the build on i386 [1] and respect CXXFLAGS [2]

- Convert REINPLACE_CMD's that no longer could remain trivial due to [2]
  to regular patch files
- Mute numerous warnings of `__aligned()' macro being redefined as they
  severely clutter build logs
- Restrict to Intel CPUs due to heavy use of their SIMD instructions

Reported by:	pkg-fallout [1]
This commit is contained in:
Alexey Dokuchaev 2015-10-19 08:18:41 +00:00
parent 0ba112295a
commit b7afb7abb9
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=399640
5 changed files with 123 additions and 6 deletions

View File

@ -15,6 +15,9 @@ LICENSE= APACHE20
LIB_DEPENDS= libMagick++-6.so:${PORTSDIR}/graphics/ImageMagick \
libIlmImf.so:${PORTSDIR}/graphics/OpenEXR
ONLY_FOR_ARCHS= i386 amd64
ONLY_FOR_ARCHS_REASON= heavy use of SSE instructions
BROKEN_FreeBSD_9= does not build (insufficient C++11 support)
USE_GITHUB= yes
@ -28,23 +31,24 @@ CMAKE_ARGS= -DRTCORE_TASKING_SYSTEM:STRING=INTERNAL \
-DENABLE_ISPC_SUPPORT:BOOL=OFF \
-DCOMPILER:STRING=${CHOSEN_COMPILER_TYPE:tu}
CXXFLAGS+= -msse2 # required on i386
PLIST_SUB+= VERSION=${DISTVERSION}
post-patch:
# MAP_NORESERVE was never implemented in FreeBSD and retired in r273250
@${REINPLACE_CMD} -e 's,MAP_NORESERVE,0,' \
${WRKSRC}/common/sys/alloc.cpp
@${REINPLACE_CMD} -e 's,_blsr_u64,_&,' \
${WRKSRC}/common/sys/intrinsics.h
@${REINPLACE_CMD} -e '/__aligned/s,^,//,' \
${WRKSRC}/common/sys/platform.h
@${REINPLACE_CMD} -e 's,__UNIX__) &&.*,__LINUX__),' \
${WRKSRC}/tests/benchmark.cpp
@${REINPLACE_CMD} -e '/share\/doc/,+2 { \
s,share/doc/embree-[^)]*,${DOCSDIR_REL}, ; \
s,bin/,, ; } ' ${WRKSRC}/common/cmake/package.cmake
# Do not force particular compiler binaries (obey the framework)
@${REINPLACE_CMD} -e '/_COMPILER/s,^,#,' \
${WRKSRC}/common/cmake/clang.cmake \
${WRKSRC}/common/cmake/gcc.cmake
@${REINPLACE_CMD} -e '/encodeRGB8_to_JPEG/s,size_t \*,unsigned \
long *,' ${WRKSRC}/tutorials/common/image/image.h \
${WRKSRC}/tutorials/common/image/jpeg.cpp
post-install:
${LN} -sf libembree.so.${DISTVERSION} \

View File

@ -0,0 +1,18 @@
--- common/cmake/clang.cmake.orig 2015-09-17 06:11:18 UTC
+++ common/cmake/clang.cmake
@@ -23,11 +23,11 @@ SET(FLAGS_AVX "-mavx")
SET(FLAGS_AVX2 "-mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
SET(FLAGS_AVX512 "-mavx512")
-SET(CMAKE_CXX_COMPILER "clang++")
-SET(CMAKE_C_COMPILER "clang")
-SET(CMAKE_CXX_FLAGS "-fPIC -std=c++11 -fno-strict-aliasing -Wno-narrowing -Wno-deprecated-register")
+#SET(CMAKE_CXX_COMPILER "clang++")
+#SET(CMAKE_C_COMPILER "clang")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++11 -fno-strict-aliasing -Wno-narrowing -Wno-deprecated-register")
SET(CMAKE_CXX_FLAGS_DEBUG "-DDEBUG -g -O0")
-SET(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3")
+SET(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-DDEBUG -g -O3")
SET(CMAKE_EXE_LINKER_FLAGS "")

View File

@ -0,0 +1,18 @@
--- common/cmake/gcc.cmake.orig 2015-09-17 06:11:18 UTC
+++ common/cmake/gcc.cmake
@@ -23,11 +23,11 @@ SET(FLAGS_AVX "-mavx")
SET(FLAGS_AVX2 "-mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
SET(FLAGS_AVX512 "-mavx512f -mavx512pf -mavx512er -mavx512cd")
-SET(CMAKE_CXX_COMPILER "g++")
-SET(CMAKE_C_COMPILER "gcc")
-SET(CMAKE_CXX_FLAGS "-fPIC -std=c++11 -fno-strict-aliasing -Wno-narrowing")
+#SET(CMAKE_CXX_COMPILER "g++")
+#SET(CMAKE_C_COMPILER "gcc")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++11 -fno-strict-aliasing -Wno-narrowing")
SET(CMAKE_CXX_FLAGS_DEBUG "-DDEBUG -g -O0")
-SET(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3")
+SET(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-DDEBUG -g -O3")
SET(CMAKE_EXE_LINKER_FLAGS "")

View File

@ -0,0 +1,62 @@
--- common/sys/intrinsics.h.orig 2015-09-17 06:11:18 UTC
+++ common/sys/intrinsics.h
@@ -361,6 +361,7 @@ namespace embree
#endif
}
+#if defined(__X86_64__)
__forceinline unsigned __bsf(unsigned v)
{
#if defined(__AVX2__)
@@ -369,6 +370,7 @@ namespace embree
unsigned r = 0; asm ("bsf %1,%0" : "=r"(r) : "r"(v)); return r;
#endif
}
+#endif
__forceinline size_t __bsf(size_t v) {
#if defined(__AVX2__)
@@ -389,12 +391,14 @@ namespace embree
return i;
}
+#if defined(__X86_64__)
__forceinline unsigned int __bscf(unsigned int& v)
{
unsigned int i = __bsf(v);
v &= v-1;
return i;
}
+#endif
__forceinline size_t __bscf(size_t& v)
{
@@ -411,6 +415,7 @@ namespace embree
#endif
}
+#if defined(__X86_64__)
__forceinline unsigned __bsr(unsigned v) {
#if defined(__AVX2__)
return 31 - _lzcnt_u32(v);
@@ -418,6 +423,7 @@ namespace embree
unsigned r = 0; asm ("bsr %1,%0" : "=r"(r) : "r"(v)); return r;
#endif
}
+#endif
__forceinline size_t __bsr(size_t v) {
#if defined(__AVX2__)
@@ -443,7 +449,11 @@ namespace embree
__forceinline size_t __blsr(size_t v) {
#if defined(__AVX2__)
- return _blsr_u64(v);
+#if defined(__X86_64__)
+ return __blsr_u64(v);
+#else
+ return __blsr_u32(v);
+#endif
#else
return v & (v-1);
#endif

View File

@ -0,0 +1,15 @@
--- kernels/xeon/bvh4/bvh4_rotate.cpp.orig 2015-09-17 06:11:18 UTC
+++ kernels/xeon/bvh4/bvh4_rotate.cpp
@@ -104,7 +104,11 @@ namespace embree
/*! find best other child */
float4 area0123 = float4(extract<0>(min0),extract<0>(min1),extract<0>(min2),extract<0>(min3)) - float4(childArea[c2]);
int pos[4] = { pos0,pos1,pos2,pos3 };
- bool4 valid = int4(int(depth+1))+cdepth <= int4(BVH4::maxBuildDepth); // only select swaps that fulfill depth constraints
+ // Ensure that we have a variable to avoid linking problems on i386.
+ // On amd64 sizeof(size_t) == 8, so previously temporary was created
+ // for the int4(BVH4::maxBuildDepth) call.
+ const size_t mbd = BVH4::maxBuildDepth;
+ bool4 valid = int4(int(depth+1))+cdepth <= int4(mbd); // only select swaps that fulfill depth constraints
valid &= int4(c2) != int4(step);
if (none(valid)) continue;
size_t c1 = select_min(valid,area0123);