-
Notifications
You must be signed in to change notification settings - Fork 374
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
Use CMake variables/names in our cmake macros #6014
Changes from 29 commits
33b76e7
08b9bf6
3134589
c0a92a2
ffb4480
52d0a52
86333ee
0fd792d
7695869
cb4eb27
2fb7b18
0e4e417
fce4c7e
78c1438
0d902f5
d1bbc7a
f4ee575
7b28bad
4cf71b7
809525f
dfe1ade
1107d6b
f76c5f8
7f9228a
7f5b078
f2e04d4
18b455d
5330bd8
198c7b8
cdfebee
9e6f04e
81d80e0
3af01f9
a4c868a
73b395a
253dd26
94d6a36
8771928
4d44ecd
19bd6d5
435ce72
fe1b459
bc35c3b
6def04a
42c41fc
10f1bac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,3 @@ if (NOT DEBUG) | |
e3sm_remove_flags("${ITEM}" "-O") | ||
endforeach() | ||
endif() | ||
|
||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
cmake_policy(SET CMP0057 NEW) | ||
cmake_minimum_required(VERSION 3.5) | ||
project(cime LANGUAGES C Fortran) | ||
include(../Macros.cmake) | ||
include(${CMAKE_CURRENT_BINARY_DIR}/../Macros.cmake) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,15 @@ | ||
if (DEBUG) | ||
string(APPEND CFLAGS " -O0 -g") | ||
string(APPEND FFLAGS " -O0 -g") | ||
string(APPEND CXXFLAGS " -O0 -g") | ||
string(APPEND CPPDEFS " -DYAKL_DEBUG") | ||
endif() | ||
string(APPEND CMAKE_C_FLAGS_DEBUG " -O0 -g") | ||
string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -O0 -g") | ||
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -O0 -g") | ||
string(APPEND CPPDEFS_DEBUG " -DYAKL_DEBUG") | ||
if (compile_threaded) | ||
string(APPEND FFLAGS " -fopenmp") | ||
string(APPEND CFLAGS " -fopenmp") | ||
string(APPEND CXXFLAGS " -fopenmp") | ||
string(APPEND LDFLAGS " -fopenmp") | ||
string(APPEND CMAKE_Fortran_FLAGS " -fopenmp") | ||
string(APPEND CMAKE_C_FLAGS " -fopenmp") | ||
string(APPEND CMAKE_CXX_FLAGS " -fopenmp") | ||
string(APPEND CMAKE_EXE_LINKER_FLAGS " -fopenmp") | ||
endif() | ||
string(APPEND CPPDEFS " -DNO_R16 -DCPRAMD -DFORTRANUNDERSCORE") | ||
string(APPEND FFLAGS_NOOPT " -O0") | ||
set(HAS_F2008_CONTIGUOUS "FALSE") | ||
string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -O0") | ||
set(MPICC "cc") | ||
set(MPICXX "CC") | ||
set(MPIFC "ftn") | ||
set(SUPPORTS_CXX "TRUE") | ||
set(CXX_LINKER "FORTRAN") | ||
string(APPEND CXX_LIBS " -lstdc++") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,18 @@ | ||
if (COMP_NAME STREQUAL gptl) | ||
string(APPEND CPPDEFS " -DHAVE_NANOTIME -DBIT64 -DHAVE_SLASHPROC -DHAVE_GETTIMEOFDAY") | ||
endif() | ||
if (NOT DEBUG) | ||
string(APPEND CFLAGS " -O2 -g") | ||
string(APPEND CXXFLAGS " -O2 -g") | ||
string(APPEND FFLAGS " -O2 -g") | ||
endif() | ||
string(APPEND CMAKE_C_FLAGS_RELEASE " -O2 -g") | ||
string(APPEND CMAKE_CXX_FLAGS_RELEASE " -O2 -g") | ||
string(APPEND CMAKE_Fortran_FLAGS_RELEASE " -O2 -g") | ||
#string(APPEND FFLAGS " -march=znver3") | ||
set(SCC "clang") | ||
set(SCXX "clang++") | ||
set(SFC "flang") | ||
|
||
if (COMP_NAME STREQUAL cism) | ||
string(APPEND CMAKE_OPTS " -D CISM_GNU=ON") | ||
endif() | ||
|
||
string(APPEND FC_AUTO_R8 " -fdefault-real-8") | ||
string(APPEND FFLAGS " -Mflushz ") | ||
string(APPEND FIXEDFLAGS " -Mfixed") | ||
string(APPEND FREEFLAGS " -Mfreeform") | ||
string(APPEND CMAKE_Fortran_FLAGS " -Mflushz ") | ||
string(APPEND CMAKE_Fortran_FORMAT_FIXED_FLAG " -Mfixed") | ||
string(APPEND CMAKE_Fortran_FORMAT_FREE_FLAG " -Mfreeform") | ||
if (compile_threaded) | ||
string(APPEND FFLAGS " -mp") | ||
string(APPEND LDFLAGS " -mp") | ||
string(APPEND CMAKE_Fortran_FLAGS " -mp") | ||
string(APPEND CMAKE_EXE_LINKER_FLAGS " -mp") | ||
endif() |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,25 +2,18 @@ if (COMP_NAME STREQUAL gptl) | |
string(APPEND CPPDEFS " -DHAVE_NANOTIME -DBIT64 -DHAVE_SLASHPROC -DHAVE_GETTIMEOFDAY") | ||
endif() | ||
set(PIO_FILESYSTEM_HINTS "lustre") | ||
if (NOT DEBUG) | ||
string(APPEND CFLAGS " -O2 -g") | ||
string(APPEND CXXFLAGS " -O2 -g") | ||
string(APPEND FFLAGS " -O2") | ||
endif() | ||
string(APPEND CMAKE_C_FLAGS_RELEASE " -O2 -g") | ||
string(APPEND CMAKE_CXX_FLAGS_RELEASE " -O2 -g") | ||
string(APPEND CMAKE_Fortran_FLAGS_RELEASE " -O2") | ||
#string(APPEND FFLAGS " -march=znver3") | ||
set(SCC "clang") | ||
set(SCXX "clang++") | ||
set(SFC "flang") | ||
|
||
if (COMP_NAME STREQUAL cism) | ||
string(APPEND CMAKE_OPTS " -D CISM_GNU=ON") | ||
endif() | ||
|
||
string(APPEND FC_AUTO_R8 " -fdefault-real-8") | ||
string(APPEND FFLAGS " -Mflushz ") | ||
string(APPEND FIXEDFLAGS " -Mfixed") | ||
string(APPEND FREEFLAGS " -Mfreeform") | ||
string(APPEND CMAKE_Fortran_FLAGS " -Mflushz ") | ||
string(APPEND CMAKE_Fortran_FORMAT_FIXED_FLAG " -Mfixed") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice. This is a CMake supported/handled variable, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. I think CMake can probably handle this automatically but I'm not 100% on that so I kept it. |
||
string(APPEND CMAKE_Fortran_FORMAT_FREE_FLAG " -Mfreeform") | ||
if (compile_threaded) | ||
string(APPEND FFLAGS " -mp") | ||
string(APPEND LDFLAGS " -mp") | ||
string(APPEND CMAKE_Fortran_FLAGS " -mp") | ||
string(APPEND CMAKE_EXE_LINKER_FLAGS " -mp") | ||
endif() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,18 @@ | ||
if (COMP_NAME STREQUAL gptl) | ||
string(APPEND CPPDEFS " -DHAVE_NANOTIME -DBIT64 -DHAVE_SLASHPROC -DHAVE_GETTIMEOFDAY") | ||
endif() | ||
if (NOT DEBUG) | ||
string(APPEND CFLAGS " -O2 -g") | ||
string(APPEND CXXFLAGS " -O2 -g") | ||
string(APPEND FFLAGS " -O2") | ||
endif() | ||
string(APPEND CMAKE_C_FLAGS_RELEASE " -O2 -g") | ||
string(APPEND CMAKE_CXX_FLAGS_RELEASE " -O2 -g") | ||
string(APPEND CMAKE_Fortran_FLAGS_RELEASE " -O2") | ||
#string(APPEND FFLAGS " -march=znver3") | ||
set(SCC "clang") | ||
set(SCXX "clang++") | ||
set(SFC "flang") | ||
|
||
if (COMP_NAME STREQUAL cism) | ||
string(APPEND CMAKE_OPTS " -D CISM_GNU=ON") | ||
endif() | ||
|
||
string(APPEND FC_AUTO_R8 " -fdefault-real-8") | ||
string(APPEND FFLAGS " -Mflushz ") | ||
string(APPEND FIXEDFLAGS " -Mfixed") | ||
string(APPEND FREEFLAGS " -Mfreeform") | ||
string(APPEND CMAKE_Fortran_FLAGS " -Mflushz ") | ||
string(APPEND CMAKE_Fortran_FORMAT_FIXED_FLAG " -Mfixed") | ||
string(APPEND CMAKE_Fortran_FORMAT_FREE_FLAG " -Mfreeform") | ||
if (compile_threaded) | ||
string(APPEND FFLAGS " -mp") | ||
string(APPEND LDFLAGS " -mp") | ||
string(APPEND CMAKE_Fortran_FLAGS " -mp") | ||
string(APPEND CMAKE_EXE_LINKER_FLAGS " -mp") | ||
endif() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,18 @@ | ||
if (DEBUG) | ||
string(APPEND CFLAGS " -O0 -g") | ||
string(APPEND FFLAGS " -O0 -g") | ||
string(APPEND CXXFLAGS " -O0 -g") | ||
string(APPEND CPPDEFS " -DYAKL_DEBUG") | ||
endif() | ||
string(APPEND CMAKE_C_FLAGS_DEBUG " -O0 -g") | ||
string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -O0 -g") | ||
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -O0 -g") | ||
string(APPEND CPPDEFS_DEBUG " -DYAKL_DEBUG") | ||
if (compile_threaded) | ||
string(APPEND FFLAGS " -fopenmp") | ||
string(APPEND CFLAGS " -fopenmp") | ||
string(APPEND CXXFLAGS " -fopenmp") | ||
string(APPEND LDFLAGS " -fopenmp") | ||
string(APPEND CMAKE_Fortran_FLAGS " -fopenmp") | ||
string(APPEND CMAKE_C_FLAGS " -fopenmp") | ||
string(APPEND CMAKE_CXX_FLAGS " -fopenmp") | ||
string(APPEND CMAKE_EXE_LINKER_FLAGS " -fopenmp") | ||
endif() | ||
string(APPEND CPPDEFS " -DNO_R16 -DCPRAMD -DFORTRANUNDERSCORE") | ||
string(APPEND FFLAGS_NOOPT " -O0") | ||
set(HAS_F2008_CONTIGUOUS "FALSE") | ||
string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -O0") | ||
set(MPICC "cc") | ||
set(MPICXX "CC") | ||
set(MPIFC "ftn") | ||
set(SCC "cc") | ||
set(SCXX "CC") | ||
set(SFC "ftn") | ||
set(SUPPORTS_CXX "TRUE") | ||
set(CXX_LINKER "FORTRAN") | ||
string(APPEND CXX_LIBS " -lstdc++") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,19 @@ | ||
if (compile_threaded) | ||
string(APPEND CFLAGS " -h omp") | ||
endif() | ||
if (DEBUG) | ||
string(APPEND CFLAGS " -g -O0") | ||
string(APPEND CMAKE_C_FLAGS " -h omp") | ||
endif() | ||
string(APPEND CMAKE_C_FLAGS_DEBUG " -g -O0") | ||
string(APPEND CPPDEFS " -DFORTRANUNDERSCORE -DNO_R16 -DCPRCRAY") | ||
string(APPEND FC_AUTO_R8 " -s real64") | ||
string(APPEND FFLAGS " -f free -em") | ||
string(APPEND CMAKE_Fortran_FLAGS " -f free -em") | ||
if (compile_threaded) | ||
string(APPEND FFLAGS " -h omp") | ||
string(APPEND CMAKE_Fortran_FLAGS " -h omp") | ||
endif() | ||
if (NOT compile_threaded) | ||
string(APPEND FFLAGS " -M1077") | ||
endif() | ||
if (DEBUG) | ||
string(APPEND FFLAGS " -g -O0") | ||
string(APPEND CMAKE_Fortran_FLAGS " -M1077") | ||
endif() | ||
string(APPEND FFLAGS_NOOPT " -O0") | ||
string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -g -O0") | ||
string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -O0") | ||
set(HAS_F2008_CONTIGUOUS "TRUE") | ||
string(APPEND LDFLAGS " -Wl,--allow-multiple-definition") | ||
string(APPEND CMAKE_EXE_LINKER_FLAGS " -Wl,--allow-multiple-definition") | ||
if (compile_threaded) | ||
string(APPEND LDFLAGS " -h omp") | ||
string(APPEND CMAKE_EXE_LINKER_FLAGS " -h omp") | ||
endif() | ||
set(SUPPORTS_CXX "TRUE") | ||
set(CXX_LINKER "FORTRAN") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,11 @@ | ||
if (NOT DEBUG) | ||
string(APPEND CFLAGS " -O1") | ||
string(APPEND FFLAGS " -O1") | ||
endif() | ||
string(APPEND CMAKE_C_FLAGS_RELEASE " -O1") | ||
string(APPEND CMAKE_Fortran_FLAGS_RELEASE " -O1") | ||
if (COMP_NAME STREQUAL eam) | ||
string(APPEND FFLAGS " -vector0") | ||
string(APPEND CMAKE_Fortran_FLAGS " -vector0") | ||
endif() | ||
set(CXX_LINKER "CXX") | ||
string(APPEND KOKKOS_OPTIONS " -DKokkos_INTERNAL_GCC_TOOLCHAIN=/opt/gcc/9.3.0/snos") | ||
if (compile_threaded) | ||
string(APPEND CXXFLAGS " -fopenmp") | ||
endif() | ||
if (DEBUG) | ||
string(APPEND CXXFLAGS " -g -Wall") | ||
endif() | ||
if (NOT DEBUG) | ||
string(APPEND CXXFLAGS " -O1") | ||
string(APPEND CMAKE_CXX_FLAGS " -fopenmp") | ||
endif() | ||
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -g -Wall") | ||
string(APPEND CMAKE_CXX_FLAGS_RELEASE " -O1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these messages supposed to stay, or are they here just for debugging purposes while you are doing the port?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They need to stay. This hacky stuff is how we translate processed cmake macros into Makefile macros. Nothing we have is using the Makefile macros directly anymore, but they are still useful for querying macro vars which we do in a few places when "crossing" build systems (cmake -> autoconf for example) in some of the sharelib builds.