Skip to content

Commit

Permalink
Use target_compile_definitions. Make w3emc PP variable use the same f…
Browse files Browse the repository at this point in the history
…ormat as ip. #23
  • Loading branch information
DavidHuber-NOAA committed Nov 20, 2023
1 parent bab6d7b commit 8a68f5a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
7 changes: 4 additions & 3 deletions src/enkf_chgres_recenter_nc.fd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ utils.f90
if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fp-model precise")
endif()
if(ip_VERSION VERSION_GREATER_EQUAL 4.0.0)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -DIP_V4")
endif()

set(exe_name enkf_chgres_recenter_nc.x)
add_executable(${exe_name} ${fortran_src})
Expand All @@ -26,4 +23,8 @@ if(OpenMP_Fortran_FOUND)
target_link_libraries(${exe_name} PRIVATE OpenMP::OpenMP_Fortran)
endif()

if(ip_VERSION VERSION_GREATER_EQUAL 4.0.0)
target_compile_definitions(${exe_name} PRIVATE "IP_V4")
endif()

install(TARGETS ${exe_name} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
8 changes: 4 additions & 4 deletions src/fbwndgfs.fd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8 -fdefault-integer-8 -fconvert=big-endian")
endif()

if(w3emc_VERSION VERSION_GREATER_EQUAL 2.10)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -DW3EMC_210")
endif()

set(exe_name fbwndgfs.x)
add_executable(${exe_name} ${fortran_src})
target_link_libraries(${exe_name} PRIVATE bacio::bacio_8
ip::ip_8
sp::sp_8
w3emc::w3emc_8)

if(w3emc_VERSION VERSION_GREATER_EQUAL 2.10)
target_compile_definitions(${exe_name} PRIVATE "W3EMC_V2_10")
endif()

install(TARGETS ${exe_name} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2 changes: 1 addition & 1 deletion src/fbwndgfs.fd/fbwndgfs.F
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@
DO 110 J = 1,NRSTNS
C CALL GDSWIZ(KGDS,-1,1,FILL,XPTS(J),YPTS(J),
C & ALON(J),ALAT(J),IRET,0,DUM,DUM)
#ifdef W3EMC_210
#ifdef W3EMC_V2_10
CALL GDSWZD_GRIB1(KGDS,-1,1,FILL,XPTS(J),YPTS(J),
& ALON(J),ALAT(J),IRET)
#else
Expand Down
8 changes: 4 additions & 4 deletions src/mkgfsawps.fd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$")
set_source_files_properties(${fortran_src_free} PROPERTIES COMPILE_FLAGS "-ffree-form")
endif()

if(ip_VERSION VERSION_GREATER_EQUAL 4.0.0)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -DIP_V4")
endif()

set(exe_name mkgfsawps.x)
add_executable(${exe_name} ${fortran_src})
target_link_libraries(${exe_name} PRIVATE bacio::bacio_4
Expand All @@ -24,4 +20,8 @@ if(OpenMP_Fortran_FOUND)
target_link_libraries(${exe_name} PRIVATE OpenMP::OpenMP_Fortran)
endif()

if(ip_VERSION VERSION_GREATER_EQUAL 4.0.0)
target_compile_definitions(${exe_name} PRIVATE "IP_V4")
endif()

install(TARGETS ${exe_name} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

0 comments on commit 8a68f5a

Please sign in to comment.