Skip to content

Commit

Permalink
cmp - fix CMakeLists for SuperLU/ARPACK; add FindAMD.cmake; minor reo…
Browse files Browse the repository at this point in the history
…rganizing
  • Loading branch information
claudioperez committed Jul 6, 2021
1 parent 7e6a22d commit 4213ba9
Show file tree
Hide file tree
Showing 10 changed files with 611 additions and 337 deletions.
84 changes: 51 additions & 33 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.16)
cmake_minimum_required(VERSION 3.18)
#==============================================================================
#
# OpenSees -- Open System For Earthquake Engineering Simulation
Expand Down Expand Up @@ -34,41 +34,66 @@ set(OPS_BUNDLED_DIR ${PROJECT_SOURCE_DIR}/OTHER/)
set(OPS_SRC_DIR ${PROJECT_SOURCE_DIR}/SRC/)
include(OpenSeesFunctions)
include(${PROJECT_SOURCE_DIR}/Conf.cmake)

set_property(CACHE OPS_FINAL_TARGET PROPERTY STRINGS
G3 OpenSeesTcl OpenSeesMP OpenSeesSP OpenSeesPy
)

#==============================================================================
# OS Configuration
#
#==============================================================================
if (UNIX)
include(OpenSeesDependenciesUnix)

if(APPLE)
message(STATUS ">>> MacOS")

else()
message(STATUS ">>> LINUX")
add_compile_definitions(_LINUX _UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -ffloat-store")
endif()
endif()

if(WIN32)
include(OpenSeesDependenciesBundled)
message(STATUS ">>> WIN32")
endif()

message("OPS >>> BLAS: ${BLAS_LIBRARIES}")
message("OPS >>> CBLAS: ${CBLAS_LIBRARY}")
message("OPS >>> CBLAS: ${CBLAS_LIBRARY}\n")

message("OPS >>> LAPACK: ${LAPACK_LIBRARIES}")

message("OPS >>> ARPACK: ${ARPACK_LIBRARIES}")

message("OPS >>> SUPERLU: ${SUPERLU_LIBRARIES}")

message("OPS >>> TCL: ${TCL_LIBRARY}")
set(TCL_LIBRARIES ${TCL_LIBRARY})

set_property(CACHE OPS_FINAL_TARGET PROPERTY STRINGS
G3 OpenSeesTcl OpenSeesMP OpenSeesSP OpenSeesPy
)
message("OPS >>> AMD: ${AMD_LIBRARIES}")


#==============================================================================
# General Setup
#
#==============================================================================
## Properties
#
# Properties

#define_property(TARGET
# PROPERTY OPS_INTERPRETER_GLOBAL #TODO
# BRIEF_DOCS "Include functionality for using global interpreter"
# FULL_DOCS "..."
#)


#----------------------------------------------------------------
# Compilers
#----------------------------------------------------------------

# Fortran
#--------------------------------------
enable_language(Fortran)


# C++
#--------------------------------------

Expand All @@ -87,30 +112,12 @@ opensees_add_cxx_flag(
)


#----------------------------------------------------------------
# OS Specific Configuration
#----------------------------------------------------------------

if(APPLE)
message(STATUS ">>> MacOS")
endif()

if(UNIX AND NOT APPLE)
message(STATUS ">>> LINUX")
add_compile_definitions(_LINUX _UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -ffloat-store")
endif()

if(WIN32)
message(STATUS ">>> WIN32")
endif()

#----------------------------------------------------------------
# Global Includes
#----------------------------------------------------------------
#
# include paths to main abstract classes
#
# NOTE BeamIntegration and MatrixUtil need to be removed from element/forceBEamColumn

include_directories(
Expand Down Expand Up @@ -209,7 +216,7 @@ target_link_libraries(G3_Numerics INTERFACE
${SUPERLU_LIBRARIES}
${UMFPACK_LIBRARIES}
${LAPACK_LIBRARIES} ${BLAS_LIBRARIES}
-lamd
${AMD_LIBRARIES}
)

# Core OpenSees
Expand All @@ -224,6 +231,8 @@ add_library(OPS_Material OBJECT)
add_library(OPS_Damage OBJECT)
add_library(OPS_Database OBJECT)



# Optional Extensions
add_library(OPS_DRM OBJECT EXCLUDE_FROM_ALL)
add_library(OPS_PFEM OBJECT EXCLUDE_FROM_ALL)
Expand All @@ -232,8 +241,13 @@ add_library(OPS_Paraview OBJECT EXCLUDE_FROM_ALL)
add_library(OPS_Renderer OBJECT EXCLUDE_FROM_ALL)
#add_library(OPS_Reliability OBJECT EXCLUDE_FROM_ALL)


# Packaged libraries
add_library(G3)
add_library(OpenSees EXCLUDE_FROM_ALL )

# Executables
#------------------------------------------------------------------------------
add_executable(OpenSeesTcl EXCLUDE_FROM_ALL
${OPS_SRC_DIR}/tcl/tclAppInit.cpp
${OPS_SRC_DIR}/tcl/tclMain.cpp
Expand All @@ -242,8 +256,11 @@ add_executable(OpenSeesSP EXCLUDE_FROM_ALL ${OPS_SRC_DIR}/tcl/tclAppInit.cpp)
add_executable(OpenSeesMP EXCLUDE_FROM_ALL ${OPS_SRC_DIR}/tcl/tclAppInit.cpp)
add_executable(OpenSeesPy EXCLUDE_FROM_ALL ${OPS_SRC_DIR}/interpreter/pythonMain.cpp)

# Build selected frontend by default

# Set selected frontend to be built by default
set_target_properties(${OPS_FINAL_TARGET} PROPERTIES EXCLUDE_FROM_ALL OFF)


# Add sources to targets
add_subdirectory(${OPS_SRC_DIR})

Expand Down Expand Up @@ -272,6 +289,7 @@ target_link_libraries(G3
OPS_ConvergenceTest
G3_Numerics
)

#----------------------------
# OpenSees
#----------------------------
Expand Down
61 changes: 11 additions & 50 deletions Conf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -62,54 +62,12 @@ option(OPS_MATERIAL_UNIAXIAL_SNAP
# Properties
#
#==============================================================================

define_property(TARGET
PROPERTY OPS_INTERPRETER_GLOBAL #TODO
BRIEF_DOCS "Include functionality for using global interpreter"
FULL_DOCS "..."
)

#==============================================================================
# External Libraries
#
#==============================================================================
# Synopsis
# - opensees_load(<PACKAGE> [BUILD|FIND|SEARCH|PATHS] [<PATHS>])
#
# Options:
# - BUILD: Build OpenSees provided library
# - FIND: Use CMake to find library, fail if not found
# - SEARCH: Try finding library with CMake, build OpenSees
# Version if not found.
# - PATHS: Provide specific paths for library.
#
#----------------------------------------------------------------
opensees_load(TCL FIND
#LIBRARY /home/claudio/miniconda3/lib/libtcl8.6.so
#INCLUDE /home/claudio/miniconda3/include
)

opensees_load(BLAS SEARCH
#LIBRARY /home/claudio/lib/libBlas.a
)

opensees_load(LAPACK SEARCH
#LIBRARY /home/claudio/lib/libLapack.a
)

opensees_load(SUPERLU SEARCH
#LIBRARY /home/claudio/lib/libSuperLU.a
#INCLUDE ${OPS_BUNDLED_DIR}/SuperLU_5.1.1/
)

opensees_load(ARPACK SEARCH)

opensees_load(METIS SEARCH)

opensees_load(HDF5 FIND)

opensees_load(MySQL FIND)


#==============================================================================
# Select Element Libraries
Expand All @@ -118,33 +76,36 @@ opensees_load(MySQL FIND)
#==============================================================================
set(OPS_Element_List

#OPS_Element_PFEMElement
OPS_Element_truss
OPS_Element_beam3d
#OPS_Element_beam2d
OPS_Element_dispBeamColumnInt
OPS_Element_forceBeamColumn
OPS_Element_mixedBeamColumn

#OPS_Element_beamWithHinges
#OPS_Element_feap
OPS_Element_LHMYS
OPS_Element_PML
OPS_Element_RockingBC
OPS_Element_UP_ucsd
OPS_Element_absorbentBoundaries
OPS_Element_adapter
OPS_Element_beam3d
#OPS_Element_beam2d
OPS_Element_catenaryCable
OPS_Element_componentElement
OPS_Element_dispBeamColumnInt
OPS_Element_forceBeamColumn

OPS_Element_elastomericBearing
OPS_Element_frictionBearing

OPS_Element_generic
OPS_Element_gradientInelasticBeamColumn
OPS_Element_joint
OPS_Element_mixedBeamColumn
OPS_Element_mvlem
OPS_Element_pyMacro
OPS_Element_shell
OPS_Element_surfaceLoad
OPS_Element_truss
OPS_Element_updatedLagrangianBeamColumn
#OPS_Element_feap
#OPS_Element_PFEMElement
)


93 changes: 93 additions & 0 deletions ETC/cmake/FindAMD.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# - Find the AMD includes and library
#
# This module defines
# AMD_INCLUDE_DIR, where to find umfpack.h, etc.
# AMD_LIBRARIES, the libraries to link against to use AMD.
# AMD_FOUND, If false, do not try to use AMD.
# also defined, but not for general use are
# AMD_LIBRARY, where to find the AMD library.
# None of the above will be defined unless UFconfig can be found.
# AMD depends on UFConfig

#=============================================================================
# Copyright 2010, Martin Koehler
# http://www-user.tu-chemnitz.de/~komart/
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# Changelog:
# - Apr. 1, 2011 Martin Koehler
# - June 25, 2013 Martin Koehler, add _libdir and _incdir

if (WIN32)
set(_libdir ENV LIB)
set(_liblist $ENV{LIB})
set(_incdir)
foreach ( dir ${_liblist})
set(_incdir ${_incdir} "${dir}/../include")
endforeach()
set(_incdir "${_incdir}" ENV INC ENV INCLUDE ENV CPATH)
elseif (APPLE)
set(_libdir ENV DYLD_LIBRARY_PATH)
string(REPLACE ":" ";" _liblist $ENV{DYLD_LIBRARY_PATH} "")
set(_incdir)
foreach ( dir ${_liblist})
set(_incdir ${_incdir} "${dir}/../include")
endforeach()
set(_incdir "${_incdir}" ENV INC ENV INCLUDE ENV CPATH)
else ()
set(_libdir ENV LD_LIBRARY_PATH)
string(REPLACE ":" ";" _liblist $ENV{LD_LIBRARY_PATH} "")
set(_incdir)
foreach ( dir ${_liblist})
set(_incdir ${_incdir} "${dir}/../include")
endforeach()
set(_incdir "${_incdir}" ENV INC ENV INCLUDE ENV CPATH)
endif ()


find_path(AMD_AMD_INCLUDE_DIR amd.h
HINTS ${SUITESPARSE}/AMD/Include #Local Setup
${SUITESPARSE}/include
${_incdir}
/usr/local/include/suitesparse #FreeBSD
/usr/include/suitesparse #Debian
/opt/local/include/ufsparse #Macports
NO_DEFAULT_PATH
)
find_path(AMD_AMD_INCLUDE_DIR amd.h)


set(AMD_NAMES ${AMD_NAMES} libamd amd)
set(AMD_PATH
${SUITESPARSE}/AMD/Lib
${SUITESPARSE}/lib
/opt/local/lib # Macports
${_libdir}
)
find_library(AMD_LIBRARY NAMES ${AMD_NAMES} PATHS ${AMD_PATH} NO_DEFAULT_PATH )
#MESSAGE(STATUS "AMD_LIB: ${AMD_LIBRARY}")
find_library(AMD_LIBRARY NAMES ${AMD_NAMES} )

#MESSAGE(STATUS "AMD_INC: ${AMD_AMD_INCLUDE_DIR}" )
#MESSAGE(STATUS "AMD_LIB: ${AMD_LIBRARY}")

if (AMD_LIBRARY AND AMD_AMD_INCLUDE_DIR)
SET(AMD_INCLUDE_DIR ${AMD_AMD_INCLUDE_DIR} )
SET(AMD_LIBRARIES ${AMD_LIBRARY} )
endif (AMD_LIBRARY AND AMD_AMD_INCLUDE_DIR)


# handle the QUIETLY and REQUIRED arguments and set AMD_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(AMD DEFAULT_MSG AMD_LIBRARY AMD_AMD_INCLUDE_DIR)

mark_as_advanced(AMD_AMD_INCLUDE_DIR AMD_LIBRARY )


Loading

0 comments on commit 4213ba9

Please sign in to comment.