Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevents crashes on different CPU architectures #21

Merged
merged 4 commits into from
May 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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