Skip to content

Commit b90d1bb

Browse files
authored
Merge pull request #21 from HeDo88TH/fix-segfault
Prevents crashes on different CPU architectures
2 parents e0256f9 + a00ba58 commit b90d1bb

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Install dependencies
1818
run: sudo apt-get update && sudo apt install -y --fix-missing --no-install-recommends git build-essential software-properties-common cmake libtbb-dev libboost-system-dev libboost-serialization-dev libpdal-dev libeigen3-dev
1919
- name: Build
20-
run: mkdir build && cd build && cmake -DWITH_GBT=ON .. && make -j$(nproc)
20+
run: mkdir build && cd build && cmake -DWITH_GBT=ON -DPORTABLE_BUILD=ON .. && make -j$(nproc)
2121
- name: Archive compiled binaries
2222
run: cd build && tar -czvf opc.tar.gz pcclassify pctrain
2323
- name: Upload Distribution Files

CMakeLists.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ SET(WITH_GBT OFF CACHE BOOL "Build GBT support")
55
SET(WITH_PDAL ON CACHE BOOL "Build PDAL readers support")
66
SET(BUILD_PCTRAIN ON CACHE BOOL "Build pctrain")
77
SET(BUILD_PCCLASSIFY ON CACHE BOOL "Build pcclassify")
8-
8+
SET(PORTABLE_BUILD OFF CACHE BOOL "Build portable binaries")
99

1010
if(NOT CMAKE_BUILD_TYPE)
1111
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
@@ -23,8 +23,14 @@ if (NOT WIN32 AND NOT APPLE)
2323
endif()
2424

2525
if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "GNU"))
26-
if( NOT ((${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64") OR (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64")) )
27-
add_compile_options(-march=native)
26+
if(NOT ((${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64") OR (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64")))
27+
if(NOT PORTABLE_BUILD)
28+
message("Building with native optimizations")
29+
add_compile_options(-march=native)
30+
else()
31+
message("Building portable binaries")
32+
add_compile_options(-march=nehalem)
33+
endif()
2834
endif()
2935
endif()
3036

0 commit comments

Comments
 (0)