[MOAB-dev] commit/MOAB: vijaysm: Various fixes to the CMake build system.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Fri Jul 12 19:20:54 CDT 2013


1 new commit in MOAB:

https://bitbucket.org/fathomteam/moab/commits/66da1468f39a/
Changeset:   66da1468f39a
Branch:      master
User:        vijaysm
Date:        2013-07-13 02:20:23
Summary:     Various fixes to the CMake build system.
  1) Moving MPI check to root
  2) Adding the CMakeLists file in itaps/imesh
  3) Adding appropriate source, include, link commands for MOAB, MOABPar, iMesh, mhdf libraries
  4) Adding and verifying the compilation/linkage of tools. Currently only MOABRefiner and MBCoupler are configured. Need to add configuration for all other tools.
  5) List of files created in bin after full compilation:
  bsp_tree_test*  homxform_test*  libMOABpar.a           libiMesh.dylib*      libmhdf.dylib*   mbparallelcomm_test*  moab_test*            scdseq_test*   ssn_test*  test_mesh_refiner*
  findpt_test*    libMOAB.dylib*  libMOABrefiner.dylib*  libmbcoupler.dylib*  mbcoupler_test*  mhdf_parallel*        parallel_unit_tests*  seq_man_test*  tag_test*  tqdcfr*

Affected #:  7 files

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3774046..007d501 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -100,7 +100,30 @@ project( MOAB )
   # iMesh
   option ( MOAB_BUILD_IMESH        "Build the iMesh interface?"           ON )
 
+  # check for MPI package
+  if ( MOAB_USE_MPI )
+    find_package( MPI )
+    # CMake FindMPI script is sorely lacking:
+    if ( MPI_LIBRARY AND MPI_INCLUDE_PATH )
+      set( MPI_FOUND 1 )
+    endif ( MPI_LIBRARY AND MPI_INCLUDE_PATH )
+
+    if ( MPI_FOUND )
+      set ( MOAB_DEFINES "${MOAB_DEFINES} -DUSE_MPI" )
+    endif ( MPI_FOUND )
+  endif ( MOAB_USE_MPI )
+
+  if ( MOAB_USE_NETCDF )
+    find_package( NetCDF )
+  endif ( MOAB_USE_NETCDF )
+
+  if ( MOAB_USE_HDF )
+    # HDF5
+    find_package( HDF5 )
+  endif ( MOAB_USE_HDF )
+
   add_subdirectory( src )
+  add_subdirectory( itaps/imesh )
   add_subdirectory( tools )
   add_subdirectory( test )
-  
+

diff --git a/itaps/imesh/CMakeLists.txt b/itaps/imesh/CMakeLists.txt
index a258e9f..5bba3f0 100644
--- a/itaps/imesh/CMakeLists.txt
+++ b/itaps/imesh/CMakeLists.txt
@@ -1,60 +1,61 @@
 
 # Generate Fortran name mangling headers
-ADD_CUSTOM_COMMAND( 
+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
+  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}/config/ITAPSFortranMangling.cmake
   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iMesh.h
   )
-ADD_CUSTOM_COMMAND( 
+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
+  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}/config/ITAPSFortranMangling.cmake
   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iMesh_extensions.h
   )
-ADD_CUSTOM_COMMAND( 
+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
+  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}/config/ITAPSFortranMangling.cmake
   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/iMeshP.h
   )
 
-set ( MOAB_IMESH_SRCS 
+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 )
 
+include_directories(
+    ${MOAB_SOURCE_DIR}/src
+    ${MOAB_SOURCE_DIR}/itaps
+    ${MOAB_SOURCE_DIR}/itaps/imesh
+  )
+
 if ( MOAB_USE_MPI AND MPI_FOUND )
-  LIST ( APPEND MOAB_IMESH_SRCS 
+  LIST ( APPEND MOAB_IMESH_SRCS
          iMeshP_MOAB.cpp
          ${CMAKE_CURRENT_BINARY_DIR}/iMeshP_protos.h )
+
+  include_directories(
+    ${MOAB_SOURCE_DIR}/src/parallel
+  )
 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}
+
+set_source_files_properties( ${MOAB_IMESH_SRCS}
   COMPILE_FLAGS "${MOAB_DEFINES}"
 )
 
 add_library( iMesh
   ${MOAB_IMESH_SRCS}
   )
+
+target_link_libraries( iMesh MOAB )

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 65862a8..c5467e6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,6 +1,6 @@
 
   # MOAB Library
-  set ( MOAB_LIB_SRCS
+  set ( MOABCORE_LIB_SRCS
     AdaptiveKDTree.cpp
     AEntityFactory.cpp
     AffineXform.cpp
@@ -31,7 +31,6 @@
     PolyElementSeq.cpp
     Range.cpp
     RangeSeqIntersectIter.cpp
-    ReaderWriterSet.cpp
     ReadUtil.cpp
     ScdElementData.cpp
     ScdInterface.cpp
@@ -57,6 +56,13 @@
     WriteUtil.cpp
   )
 
+  set ( MOABPTLOC_LIB_SRCS
+    lotte/findpt.c
+    lotte/errmem.c
+    lotte/poly.c
+    lotte/tensor.c
+  )
+
   set ( MOABIO_LIB_SRCS
     io/IODebugTrack.cpp
     io/ExoIIUtil.cpp
@@ -64,6 +70,7 @@
     io/GmshUtil.cpp
     io/ReadABAQUS.cpp
     io/ReadGmsh.cpp
+    io/ReadGCRM.cpp
     io/ReadIDEAS.cpp
     io/ReadMCNP5.cpp
     io/ReadNASTRAN.cpp
@@ -84,87 +91,61 @@
     io/WriteSmf.cpp
     io/WriteTemplate.cpp
     io/WriteVtk.cpp
+    ReaderWriterSet.cpp
   )
   include_directories(
     ${MOAB_SOURCE_DIR}/src
     ${MOAB_SOURCE_DIR}/src/io
     ${MOAB_SOURCE_DIR}/src/parallel
+    ${MOAB_SOURCE_DIR}/src/moab/point_locater/lotte
   )
 
-  if ( MOAB_USE_MPI )
-    find_package( MPI )
-    # CMake FindMPI script is sorely lacking:
-    if ( MPI_LIBRARY AND MPI_INCLUDE_PATH )
-      set( MPI_FOUND 1 )
-    endif ( MPI_LIBRARY AND MPI_INCLUDE_PATH )
-
-    if ( MPI_FOUND )
-      set ( MOAB_DEFINES "${MOAB_DEFINES} -DUSE_MPI" )
-      include_directories(
-        ${MPI_INCLUDE_PATH}
-        ${MOAB_SOURCE_DIR}/parallel
-      )
-    endif ( MPI_FOUND )
-  endif ( MOAB_USE_MPI )
+  if ( NetCDF_FOUND )
+    set ( MOAB_DEFINES "${MOAB_DEFINES} -DNETCDF_FILE" )
+    set ( MOABIO_LIB_SRCS
+      ${MOABIO_LIB_SRCS}
+      io/ReadNC.cpp
+      io/ReadNCDF.cpp
+      io/WriteNCDF.cpp
+      io/WriteSLAC.cpp
+      io/NCHelper.cpp
+      io/NCHelperEuler.cpp
+      io/NCHelperFV.cpp
+      io/NCHelperHOMME.cpp
+      SpectralMeshTool.cpp
+    )
+    include_directories(
+      ${NetCDF_INCLUDE_DIRECTORIES}
+    )
+  endif ( NetCDF_FOUND )
+
+  if ( HDF5_FOUND )
+    set ( MOAB_DEFINES "${MOAB_DEFINES} -DHDF5_FILE" )
+    check_function_exists( H5Pset_fapl_mpio MOAB_HDF_HAVE_PARALLEL )
+    set ( MOABIO_LIB_SRCS
+      ${MOABIO_LIB_SRCS}
+      io/HDF5Common.cpp
+      io/ReadHDF5.cpp
+      io/ReadHDF5Dataset.cpp
+      io/ReadHDF5VarLen.cpp
+      io/WriteHDF5.cpp
+    )
+
+    include_directories(
+      ${HDF5_INCLUDE_DIRECTORIES}
+      io/mhdf/include
+    )
+    add_subdirectory( io/mhdf )
+  endif ( HDF5_FOUND )
+
+
+  SET(MOAB_LIB_SRCS ${MOABCORE_LIB_SRCS} ${MOABPTLOC_LIB_SRCS} ${MOABIO_LIB_SRCS})
 
   set_source_files_properties( ${MOAB_LIB_SRCS}
     COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES}"
   )
-
-#  target_link_libraries( MOAB moabio )
-  if ( MOAB_USE_NETCDF )
-    find_package( NetCDF )
-    if ( NetCDF_FOUND )
-      set ( MOAB_DEFINES "${MOAB_DEFINES} -DNETCDF_FILE" )
-      set ( MOABIO_LIB_SRCS
-        ${MOABIO_LIB_SRCS}
-        io/ReadNCDF.cpp
-        io/WriteNCDF.cpp
-        io/WriteSLAC.cpp
-      )
-      include_directories(
-        ${NetCDF_INCLUDE_DIRECTORIES}
-      )
-    endif ( NetCDF_FOUND )
-  endif ( MOAB_USE_NETCDF )
-
-  if ( MOAB_USE_HDF )
-    # HDF5
-    find_package( HDF5 )
-    if ( HDF5_FOUND )
-      set ( MOAB_DEFINES "${MOAB_DEFINES} -DHDF5_FILE" )
-      check_function_exists( H5Pset_fapl_mpio MOAB_HDF_HAVE_PARALLEL )
-      set ( MOABIO_LIB_SRCS
-        ${MOABIO_LIB_SRCS}
-        io/HDF5Common.cpp
-        io/ReadHDF5.cpp
-        io/ReadHDF5Dataset.cpp
-        io/ReadHDF5VarLen.cpp
-        io/WriteHDF5.cpp
-      )
-
-#      if ( MOAB_USE_MPI AND MPI_FOUND )
-#        set ( MOABIO_LIB_SRCS
-#          ${MOABIO_LIB_SRCS}
-#          src/parallel/WriteHDF5Parallel.cpp
-#        )
-#      endif (MOAB_USE_MPI AND MPI_FOUND)
-
-      include_directories(
-        ${HDF5_INCLUDE_DIRECTORIES}
-        io/mhdf/include
-      )
-      add_subdirectory( io/mhdf )
-    endif ( HDF5_FOUND )
-  endif ( MOAB_USE_HDF )
-
-  set_source_files_properties( ${MOABIO_LIB_SRCS}
-    COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES}"
-  )
-
   add_library( MOAB
     ${MOAB_LIB_SRCS}
-    ${MOABIO_LIB_SRCS}
   )
 
   if ( MOAB_USE_NETCDF AND NetCDF_FOUND )

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 3b1d28d..e6c2d94 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -43,9 +43,9 @@
 
 if ( MOAB_USE_MPI AND MPI_FOUND )
 
-  add_executable ( mbparallelcomm_test mbparallelcomm_test.cpp )
+  add_executable ( mbparallelcomm_test parallel/mbparallelcomm_test.cpp )
   target_link_libraries( mbparallelcomm_test MOAB )
-  set_source_files_properties( mbparallelcomm_test.cpp
+  set_source_files_properties( parallel/mbparallelcomm_test.cpp
     COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES}" )
   add_test( TestParallelComm-BcastDelete
     ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 2 ${MPIEXEC_PREFLAGS}
@@ -61,19 +61,22 @@ if ( MOAB_USE_MPI AND MPI_FOUND )
     ${EXECUTABLE_OUTPUT_PATH}/mbparallelcomm_test ${MPIEXEC_POSTFLAGS} -3 ${MOAB_SOURCE_DIR}/parallel/ptest.cub )
 
   if ( MOAB_USE_HDF )
-    add_executable( mhdf_parallel mhdf_parallel.c )
+    add_executable( mhdf_parallel parallel/mhdf_parallel.c )
+    include_directories(
+      ${MOAB_SOURCE_DIR}/src/io/mhdf/include
+    )
     target_link_libraries( mhdf_parallel MOAB MOABpar mhdf )
     add_test( TestMHDFParallel ${EXECUTABLE_OUTPUT_PATH}/mhdf_parallel )
-    set_source_files_properties( mhdf_parallel.c
+    set_source_files_properties( parallel/mhdf_parallel.c
       COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES}" )
   endif ( MOAB_USE_HDF )
 
-  add_executable ( parallel_unit_tests parallel_unit_tests.cpp )
+  add_executable ( parallel_unit_tests parallel/parallel_unit_tests.cpp )
   target_link_libraries( parallel_unit_tests MOAB )
   add_test( TestParallel
     ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 2 ${MPIEXEC_PREFLAGS}
     ${EXECUTABLE_OUTPUT_PATH}/parallel_unit_tests ${MPIEXEC_POSTFLAGS} ${MOAB_SOURCE_DIR}/parallel/ptest.cub )
-  set_source_files_properties( parallel_unit_tests.cpp
+  set_source_files_properties( parallel/parallel_unit_tests.cpp
     COMPILE_FLAGS "-DIS_BUILDING_MB ${MOAB_DEFINES}" )
 
 endif ( MOAB_USE_MPI AND MPI_FOUND )

diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 1f30dcf..56e115c 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -1,4 +1,4 @@
-  
+
   # Documentation
   # Optional tools
   option ( MOAB_BUILD_MBCONVERT    "Build the MOAB mesh converter tool?"  ON )
@@ -17,8 +17,8 @@
 
   if ( MOAB_USE_MPI AND MPI_FOUND )
     add_subdirectory( refiner )
-    include_directories( ${MOAB_SOURCE_DIR}/refiner )
-    target_link_libraries( MOAB MOABrefiner )
+#    include_directories( ${MOAB_SOURCE_DIR}/refiner )
+#    target_link_libraries( MOAB MOABrefiner )
   endif ( MOAB_USE_MPI AND MPI_FOUND )
 
 
@@ -37,5 +37,6 @@
 
   # MBCoupler
   if ( MOAB_USE_MPI AND MPI_FOUND AND MOAB_BUILD_MBCOUPLER )
+#  if ( MOAB_BUILD_MBCOUPLER )
     add_subdirectory( mbcoupler )
   endif ( MOAB_USE_MPI AND MPI_FOUND AND MOAB_BUILD_MBCOUPLER )

diff --git a/tools/mbcoupler/CMakeLists.txt b/tools/mbcoupler/CMakeLists.txt
index 93e97d1..9c4279d 100644
--- a/tools/mbcoupler/CMakeLists.txt
+++ b/tools/mbcoupler/CMakeLists.txt
@@ -1,26 +1,29 @@
 include_directories(
-  ${CMAKE_CURRENT_SOURCE_DIRECTORY}
+    ${MOAB_SOURCE_DIR}/src
+    ${MOAB_SOURCE_DIR}/src/parallel
+    ${MOAB_SOURCE_DIR}/src/moab/point_locater/lotte
+    ${MOAB_SOURCE_DIR}/itaps
+    ${MOAB_SOURCE_DIR}/itaps/imesh
+    ${MOAB_SOURCE_DIR}/tools/mbcoupler
 )
 
 set( MBCOUPLER_SRCS
   Coupler.cpp
   ElemUtil.cpp
-  errmem.cpp
-  findpt.c
-  poly.c
-  tensor.c
+)
+
+set_source_files_properties( ${MBCOUPLER_SRCS}
+  COMPILE_FLAGS "${MOAB_DEFINES}"
 )
 
 add_library( mbcoupler
   ${MBCOUPLER_SRCS}
 )
-target_link_libraries( mbcoupler MOAB )
+
+target_link_libraries( mbcoupler MOAB iMesh )
 if ( MOAB_USE_MPI )
   target_link_libraries( mbcoupler MOABpar )
 endif ( MOAB_USE_MPI )
-set_source_files_properties( ${MBCOUPLER_SRCS}
-  COMPILE_FLAGS "${MOAB_DEFINES}"
-)
 
 enable_testing()
 
@@ -39,4 +42,10 @@ if ( MOAB_USE_MPI )
     COMPILE_FLAGS "${MOAB_DEFINES}" )
   target_link_libraries( mbcoupler_test mbcoupler MOAB MOABpar )
   add_test( TestMBCoupler ${EXECUTABLE_OUTPUT_PATH}/mbcoupler_test )
+
+  add_executable( ssn_test ssn_test.cpp )
+  set_source_files_properties( ssn_test.cpp
+    COMPILE_FLAGS "${MOAB_DEFINES}" )
+  target_link_libraries( ssn_test mbcoupler MOAB MOABpar )
+  add_test( TestMBCoupler ${EXECUTABLE_OUTPUT_PATH}/ssn_test )
 endif ( MOAB_USE_MPI )

diff --git a/tools/refiner/CMakeLists.txt b/tools/refiner/CMakeLists.txt
index 5c41c27..230b34c 100644
--- a/tools/refiner/CMakeLists.txt
+++ b/tools/refiner/CMakeLists.txt
@@ -1,4 +1,4 @@
-set ( MOAB_REFINER_SRCS 
+set ( MOAB_REFINER_SRCS
   EdgeSizeEvaluator.cpp
   EdgeSizeSimpleImplicit.cpp
   EntityRefiner.cpp
@@ -11,6 +11,11 @@ set ( MOAB_REFINER_SRCS
   SplitVertices.cpp
   )
 
+include_directories(
+    ${MOAB_SOURCE_DIR}/src
+    ${MOAB_SOURCE_DIR}/src/parallel
+)
+
 set_source_files_properties(
   ${MOAB_REFINER_SRCS}
   COMPILE_FLAGS "${MOAB_DEFINES}"
@@ -19,6 +24,10 @@ set_source_files_properties(
 add_library( MOABrefiner
   ${MOAB_REFINER_SRCS}
   )
+target_link_libraries( MOABrefiner MOAB )
+if ( MOAB_USE_MPI )
+  target_link_libraries( MOABrefiner MOABpar )
+endif ( MOAB_USE_MPI )
 
 enable_testing()
 
@@ -26,6 +35,7 @@ add_executable( test_mesh_refiner test_mesh_refiner.cpp )
 set_source_files_properties( test_mesh_refiner.cpp
   COMPILE_FLAGS "-DTEST ${MOAB_DEFINES}" )
 target_link_libraries( test_mesh_refiner MOAB MOABrefiner )
+
 add_test( TestMeshRefiner
   ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 4 ${MPIEXEC_PREFLAGS}
   ${EXECUTABLE_OUTPUT_PATH}/test_mesh_refiner ${MPIEXEC_POSTFLAGS}

Repository URL: https://bitbucket.org/fathomteam/moab/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.


More information about the moab-dev mailing list