Skip to content

Commit b7894d1

Browse files
committed
re-apply commit
1 parent d056b62 commit b7894d1

File tree

4 files changed

+5
-14
lines changed

4 files changed

+5
-14
lines changed

example_packages/features_demo/fpm.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ release.preprocess.cpp.macros = "RELEASE"
1919

2020
# Compiler-specific features
2121
debug.gfortran.flags = "-Wall -fcheck=bounds"
22-
release.gfortran.flags = "-march=native"
22+
release.gfortran.flags = "-mtune=generic -funroll-loops"
2323

2424
# Platform-specific features
2525
linux.preprocess.cpp.macros = "LINUX_BUILD"

example_packages/features_per_compiler/app/main.f90

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,17 +126,8 @@ function check_gfortran_flags(options, debug_on, release_on, fast_on, strict_on)
126126
end if
127127

128128
if (release_on) then
129-
! Check for either -march or -mcpu (Apple Silicon uses -mcpu; -match=native may be re-resolved by gcc)
130-
if (.not. (index(options, '-march') > 0 .or. index(options, '-mcpu') > 0)) then
131-
print '(a)', ' ✗ Release: neither -march=native nor -mcpu found'
132-
failed_count = failed_count + 1
133-
else
134-
if (index(options, '-march=native') > 0) then
135-
print '(a)', ' ✓ Release: -march found'
136-
else
137-
print '(a)', ' ✓ Release: -mcpu found'
138-
end if
139-
end if
129+
! Check for -mtune flag (portable tuning flag that works on all platforms)
130+
if (.not. check_flag(options, '-mtune', 'Release', '-mtune')) failed_count = failed_count + 1
140131
if (.not. check_flag(options, '-funroll-loops', 'Release', '-funroll-loops')) failed_count = failed_count + 1
141132
end if
142133

example_packages/features_per_compiler/fpm.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ debug.preprocess.cpp.macros = "DEBUG"
3434

3535
# Release feature with base optimization, then per-compiler extensions
3636
release.flags = "-O3" # Base optimization for ALL compilers (applied first)
37-
release.gfortran.flags = "-march=native -funroll-loops"
37+
release.gfortran.flags = "-mtune=generic -funroll-loops"
3838
release.ifort.flags = "-unroll" # Unix/Linux/macOS Intel
3939
release.ifx.flags = "-unroll" # Intel oneAPI
4040

example_packages/features_with_dependency/fpm.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ linux_specific.preprocess.cpp.macros = ["WITH_DEMO","LINUX_FEATURES"]
3030

3131
# Feature combining compiler and dependency features
3232
gfortran_optimized.gfortran.dependencies.features_demo = { path = "../features_demo", features = ["release", "gfortran"] }
33-
gfortran_optimized.gfortran.flags = "-O3 -march=native"
33+
gfortran_optimized.gfortran.flags = "-O3 -mtune=generic -funroll-loops"
3434
gfortran_optimized.preprocess.cpp.macros = ["WITH_DEMO"]
3535

3636

0 commit comments

Comments
 (0)