Skip to content

Commit

Permalink
Merge pull request #21 from HeDo88TH/fix-segfault
Browse files Browse the repository at this point in the history
Prevents crashes on different CPU architectures
  • Loading branch information
pierotofy authored May 18, 2023
2 parents e0256f9 + a00ba58 commit b90d1bb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Install dependencies
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
- name: Build
run: mkdir build && cd build && cmake -DWITH_GBT=ON .. && make -j$(nproc)
run: mkdir build && cd build && cmake -DWITH_GBT=ON -DPORTABLE_BUILD=ON .. && make -j$(nproc)
- name: Archive compiled binaries
run: cd build && tar -czvf opc.tar.gz pcclassify pctrain
- name: Upload Distribution Files
Expand Down
12 changes: 9 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SET(WITH_GBT OFF CACHE BOOL "Build GBT support")
SET(WITH_PDAL ON CACHE BOOL "Build PDAL readers support")
SET(BUILD_PCTRAIN ON CACHE BOOL "Build pctrain")
SET(BUILD_PCCLASSIFY ON CACHE BOOL "Build pcclassify")

SET(PORTABLE_BUILD OFF CACHE BOOL "Build portable binaries")

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
Expand All @@ -23,8 +23,14 @@ if (NOT WIN32 AND NOT APPLE)
endif()

if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "GNU"))
if( NOT ((${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64") OR (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64")) )
add_compile_options(-march=native)
if(NOT ((${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64") OR (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64")))
if(NOT PORTABLE_BUILD)
message("Building with native optimizations")
add_compile_options(-march=native)
else()
message("Building portable binaries")
add_compile_options(-march=nehalem)
endif()
endif()
endif()

Expand Down

0 comments on commit b90d1bb

Please sign in to comment.