[MOAB-dev] r2612 - in MOAB/trunk: . cmake tools/iMesh

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Fri Jan 30 14:37:42 CST 2009


Author: kraftche
Date: 2009-01-30 14:37:42 -0600 (Fri, 30 Jan 2009)
New Revision: 2612

Added:
   MOAB/trunk/cmake/ITAPSFortranMangling.cmake
   MOAB/trunk/tools/iMesh/CMakeLists.txt
Modified:
   MOAB/trunk/CMakeLists.txt
Log:
Fix CMake build:
 - do not try to build refiner or mbcoupler unless parallel support is enabled
 - build iMesh C bindings
 - auto-generate iMesh *_protos.h


Modified: MOAB/trunk/CMakeLists.txt
===================================================================
--- MOAB/trunk/CMakeLists.txt	2009-01-30 19:38:21 UTC (rev 2611)
+++ MOAB/trunk/CMakeLists.txt	2009-01-30 20:37:42 UTC (rev 2612)
@@ -239,11 +239,11 @@
     ${MOAB_LIB_SRCS}
   )
 
-  add_subdirectory( refiner )
-  include_directories( ${MOAB_SOURCE_DIR}/refiner )
-  target_link_libraries( MOAB
-    MOABrefiner
-  )
+  if ( MOAB_USE_MPI AND MPI_FOUND )
+    add_subdirectory( refiner )
+    include_directories( ${MOAB_SOURCE_DIR}/refiner )
+    target_link_libraries( MOAB MOABrefiner )
+  endif ( MOAB_USE_MPI AND MPI_FOUND )
 
   if ( MOAB_USE_HDF AND HDF5_FOUND )
     target_link_libraries( MOAB
@@ -254,9 +254,7 @@
 
   if ( MOAB_USE_MPI AND MPI_FOUND )
     add_subdirectory( parallel )
-    target_link_libraries( MOAB
-      MOABpar
-    )
+    target_link_libraries( MOAB MOABpar )
   endif ( MOAB_USE_MPI AND MPI_FOUND )
 
   if ( MOAB_USE_NETCDF AND NetCDF_FOUND )
@@ -280,13 +278,14 @@
   endif ( MOAB_BUILD_DAGMC )
 
   # MBCoupler
-  if ( MOAB_BUILD_MBCOUPLER )
+  if ( MOAB_USE_MPI AND MPI_FOUND AND MOAB_BUILD_MBCOUPLER )
     add_subdirectory( tools/mbcoupler )
-  endif ( MOAB_BUILD_MBCOUPLER )
+  endif ( MOAB_USE_MPI AND MPI_FOUND AND MOAB_BUILD_MBCOUPLER )
 
   # iMesh Babel
   if ( MOAB_BUILD_IMESH )
     option( MOAB_IMESH_FORTRAN "Should MOAB include iMesh FORTRAN bindings?" OFF )
+    add_subdirectory( tools/iMesh )
   endif ( MOAB_BUILD_IMESH )
 
   if ( MOAB_IMESH_FORTRAN )
@@ -295,6 +294,7 @@
     # to macros which can be used from C to call FORTRAN.
     #include( ${MOAB_SOURCE_DIR}/cmake/FortranCallingConvention.cmake)
   endif ( MOAB_IMESH_FORTRAN )
+  
 
   include( ${MOAB_SOURCE_DIR}/cmake/AutoconfHeader.cmake )
   # Define some more variables so they will be substituted properly in the autoconf files.

Added: MOAB/trunk/cmake/ITAPSFortranMangling.cmake
===================================================================
--- MOAB/trunk/cmake/ITAPSFortranMangling.cmake	                        (rev 0)
+++ MOAB/trunk/cmake/ITAPSFortranMangling.cmake	2009-01-30 20:37:42 UTC (rev 2612)
@@ -0,0 +1,16 @@
+# Generate GNU autoconf-style Fortran name mangling for ITAPS headers
+
+# MACRO ( itaps_fortran_mangle input_file output_file prefix )
+
+SET( match_expr "^[ \\t]*void[ \\t]+${prefix}_([a-z][_a-zA-Z0-9]*)[ \\t]*\\(.*$" )
+FILE( STRINGS ${input_file} data REGEX ${match_expr} )
+FILE( WRITE ${output_file} "#include \"MBCN_FCDefs.h\"\n#ifdef FC_FUNC_\n\n" )
+FOREACH( line ${data} )
+  STRING(REGEX REPLACE ${match_expr} "${prefix}_\\1" func ${line})
+  STRING(TOUPPER ${func} upper)
+  STRING(TOLOWER ${func} lower)
+  FILE( APPEND ${output_file}  "#define ${func} FC_FUNC_( ${upper}, ${lower} )\n" )
+ENDFOREACH( line )
+FILE( APPEND ${output_file} "\n#endif\n" )
+
+# ENDMACRO( itaps_fortran_mangle )

Added: MOAB/trunk/tools/iMesh/CMakeLists.txt
===================================================================
--- MOAB/trunk/tools/iMesh/CMakeLists.txt	                        (rev 0)
+++ MOAB/trunk/tools/iMesh/CMakeLists.txt	2009-01-30 20:37:42 UTC (rev 2612)
@@ -0,0 +1,60 @@
+
+# Generate Fortran name mangling headers
+ADD_CUSTOM_COMMAND( 
+  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/iMesh_protos.h
+  COMMAND ${CMAKE_COMMAND} 
+          -Dinput_file:STRING=${CMAKE_CURRENT_SOURCE_DIR}/iMesh.h 
+          -Doutput_file:STRING=${CMAKE_CURRENT_BINARY_DIR}/iMesh_protos.h 
+          -Dprefix:STRING=iMesh 
+          -P ${CMAKE_SOURCE_DIR}/cmake/ITAPSFortranMangling.cmake
+  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iMesh.h
+  )
+ADD_CUSTOM_COMMAND( 
+  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/iMesh_extensions_protos.h
+  COMMAND ${CMAKE_COMMAND} 
+          -Dinput_file:STRING=${CMAKE_CURRENT_SOURCE_DIR}/iMesh_extensions.h 
+          -Doutput_file:STRING=${CMAKE_CURRENT_BINARY_DIR}/iMesh_extensions_protos.h 
+          -Dprefix:STRING=iMesh 
+          -P ${CMAKE_SOURCE_DIR}/cmake/ITAPSFortranMangling.cmake
+  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iMesh_extensions.h
+  )
+ADD_CUSTOM_COMMAND( 
+  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h
+  COMMAND ${CMAKE_COMMAND} 
+          -Dinput_file:STRING=${CMAKE_CURRENT_SOURCE_DIR}/iMeshP.h 
+          -Doutput_file:STRING=${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h 
+          -Dprefix:STRING=iMeshP 
+          -P ${CMAKE_SOURCE_DIR}/cmake/ITAPSFortranMangling.cmake
+  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iMeshP.h
+  )
+
+set ( MOAB_IMESH_SRCS 
+      iMesh_MOAB.cpp
+      ${CMAKE_CURRENT_BINARY_DIR}/iMesh_protos.h
+      ${CMAKE_CURRENT_BINARY_DIR}/iMesh_extensions_protos.h
+      ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h )
+
+if ( MOAB_USE_MPI AND MPI_FOUND )
+  LIST ( APPEND MOAB_IMESH_SRCS 
+         iMeshP_MOAB.cpp
+         ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h )
+endif ( MOAB_USE_MPI AND MPI_FOUND )
+         
+
+include_directories( ${CMAKE_SOURCE_DIR}
+                     ${CMAKE_BINARY_DIR}
+                     ${CMAKE_SOURCE_DIR}/parallel
+                     ${CMAKE_BINARY_DIR}/parallel
+                     ${CMAKE_CURRENT_SOURCE_DIR}
+                     ${CMAKE_CURRENT_BINARY_DIR}
+                    )
+                     
+
+set_source_files_properties(
+  ${MOAB_IMESH_SRCS}
+  COMPILE_FLAGS "${MOAB_DEFINES}"
+)
+
+add_library( iMesh
+  ${MOAB_IMESH_SRCS}
+  )



More information about the moab-dev mailing list