2 add_compile_options ( "${PROJECT_COMPILE_OPTIONS}" )
3 add_compile_definitions( "${PROJECT_COMPILE_DEFINITIONS}" )
5 #!TODO ORGANIZE THIS FOLDER
6 set( FOLDER_COMPILE_TARGET registry )
9 ${FOLDER_COMPILE_TARGET}
12 set( GEN_COMMS gen_comms.stub )
13 if ( ${USE_RSL_LITE} )
14 message( STATUS "Setting gen_comms to RSL_LITE" )
15 set( GEN_COMMS ${PROJECT_SOURCE_DIR}/external/RSL_LITE/gen_comms.c )
17 # Account for the weird makefile nonsense of copying things around
18 set_source_files_properties(
20 TARGET_DIRECTORY ${FOLDER_COMPILE_TARGET}
27 ${FOLDER_COMPILE_TARGET}
54 # set_target_properties(
55 # ${FOLDER_COMPILE_TARGET}
57 # Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${FOLDER_COMPILE_TARGET}
61 target_include_directories( ${FOLDER_COMPILE_TARGET}
63 ${CMAKE_CURRENT_SOURCE_DIR}
67 TARGETS ${FOLDER_COMPILE_TARGET}
68 RUNTIME DESTINATION bin/
69 ARCHIVE DESTINATION lib/
70 LIBRARY DESTINATION lib/
73 # Extra stuff for weird registry stuff
74 set( REGISTRY_FILE "NO_REGISTRY_FILE_SET" )
75 if ( ${WRF_CORE} STREQUAL "ARW" )
78 set( REGISTRY_FILE ${PROJECT_SOURCE_DIR}/Registry/Registry.EM_CHEM )
80 # This check does nothing
81 # elseif ( ${WRF_DFI_RADAR} )
82 # set( REGISTRY_FILE ${PROJECT_SOURCE_DIR}/Registry/Registry.EM )
85 set( REGISTRY_FILE ${PROJECT_SOURCE_DIR}/Registry/Registry.EM )
89 elseif ( ${WRF_CORE} STREQUAL "PLUS" )
90 set( REGISTRY_FILE ${PROJECT_SOURCE_DIR}/Registry/Registry.tladj )
92 elseif ( ${WRF_CORE} STREQUAL "CONVERT" )
93 set( REGISTRY_FILE ${PROJECT_SOURCE_DIR}/Registry/Registry.CONVERT )
95 elseif ( ${WRF_CORE} STREQUAL "DA" OR ${WRF_CORE} STREQUAL "DA_4D_VAR" )
97 set( REGISTRY_FILE ${PROJECT_SOURCE_DIR}/Registry/Registry.wrfchemvar )
99 set( REGISTRY_FILE ${PROJECT_SOURCE_DIR}/Registry/Registry.wrfvar )
104 set( dealloc_source )
105 foreach( n RANGE 0 11 )
109 ${CMAKE_BINARY_DIR}/inc/deallocs_${n}.F
114 foreach( n RANGE 0 31 )
118 ${CMAKE_BINARY_DIR}/inc/allocs_${n}.F
122 wrf_expand_definitions(
123 RESULT_VAR REGISTRY_DEFS
124 DEFINITIONS ${PROJECT_COMPILE_DEFINITIONS}
127 # How this is not a bigger thing or not resolved is beyond me
128 # https://gitlab.kitware.com/cmake/cmake/-/issues/18005
129 # Also the suggestion does not work
132 ${CMAKE_BINARY_DIR}/inc/nl_config.inc
133 ${CMAKE_BINARY_DIR}/frame/module_state_description.F
137 "Generating registry code..."
140 # Replicate what exists in project directory for registry
142 ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/Registry
144 ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/inc
146 ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/frame
148 ${CMAKE_BINARY_DIR}/tools/registry ${REGISTRY_DEFS} -DNEW_BDYS ${REGISTRY_FILE} > ${CMAKE_BINARY_DIR}/registry.log 2>&1
149 #!TODO Just have the registry code actually check for failure or better yet rewrite the
150 # registry code to not be so obfuscating
152 ${CMAKE_COMMAND} -E compare_files ${CMAKE_BINARY_DIR}/inc/nl_config.inc ${CMAKE_BINARY_DIR}/inc/nl_config.inc
154 ${FOLDER_COMPILE_TARGET}
162 ${CMAKE_BINARY_DIR}/inc/nl_config.inc
163 ${CMAKE_BINARY_DIR}/frame/module_state_description.F
171 ${CMAKE_BINARY_DIR}/frame/module_state_description.F