Skip to content

Commit

Permalink
Merge pull request #106 from martin-g/overwriteable-compilation-flags
Browse files Browse the repository at this point in the history
Issue #104 - Use -march=native as default
  • Loading branch information
AndreaGuarracino authored Nov 2, 2022
2 parents f3af892 + e0cd07a commit 79bae82
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_and_test_on_push.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
on: [ push ]
on: [ push, pull_request ]

name: build and test

Expand Down Expand Up @@ -62,6 +62,6 @@ jobs:
libjemalloc-dev
run: |
cd /seqwish
cmake -H. -DCMAKE_BUILD_TYPE=Release -Bbuild && cmake --build build -- -j 2
cmake -H. -DCMAKE_BUILD_TYPE=Release -DEXTRA_FLAGS="-march=armv8-a" -Bbuild && cmake --build build -- -j 2
file bin/seqwish
cd test && make test
9 changes: 6 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ endif()
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
message(STATUS "CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")

if(NOT DEFINED EXTRA_FLAGS)
set(EXTRA_FLAGS "-march=native" CACHE STRING
"Extra compilation flags for C and CXX." FORCE)
endif()

if (${CMAKE_BUILD_TYPE} MATCHES Release)
set(EXTRA_FLAGS "-Ofast -march=native")
set(EXTRA_FLAGS "-Ofast ${EXTRA_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG") # reset CXX_FLAGS to replace -O3 with -Ofast
else()
set(EXTRA_FLAGS "-march=haswell")
endif ()

if (${CMAKE_BUILD_TYPE} MATCHES Debug)
Expand Down

0 comments on commit 79bae82

Please sign in to comment.