Skip to content

Commit

Permalink
cmp - creating CMake lists for bundled libs
Browse files Browse the repository at this point in the history
  • Loading branch information
claudioperez committed Jul 4, 2021
1 parent b48d5c3 commit 200b4d9
Show file tree
Hide file tree
Showing 7 changed files with 199 additions and 13 deletions.
15 changes: 9 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ cmake_minimum_required(VERSION 3.18)
project(
OpenSees
)

set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/ETC/cmake)
set(OPS_EXTERN_SOURCE_DIR ${PROJECT_SOURCE_DIR}/OTHER/)
set(OPS_EXTERNALS_DIR ${PROJECT_SOURCE_DIR}/OTHER/)
Expand Down Expand Up @@ -176,7 +178,7 @@ foreach(filepath ${ops_include_files})
endforeach()
list(REMOVE_DUPLICATES OPS_INCLUDE_DIRS)
include_directories(${OPS_INCLUDE_DIRS})
message(${OPS_INCLUDE_DIRS})
#message(${OPS_INCLUDE_DIRS})


#==============================================================================
Expand All @@ -195,10 +197,11 @@ add_library(G3_Utilities OBJECT)
add_library(G3_Element OBJECT)
add_library(G3_Material OBJECT)
add_library(G3_ModelBuilder OBJECT)
add_library(G3_Numerics OBJECT
add_library(G3_Numerics OBJECT)
target_link_libraries(G3_Numerics
${ARPACK_LIBRARIES}
${SUPERLU_LIBRARIES}
${UMFPACK_LIBRARIES}
#${SUPERLU_LIBRARIES}
#${UMFPACK_LIBRARIES}
${BLAS_LIBRARIES} ${LAPACK_LIBRARIES}
)

Expand Down Expand Up @@ -265,7 +268,7 @@ target_sources(OpenSees
PRIVATE
${OPS_SRC_DIR}/interpreter/OpenSeesCommands.cpp
${OPS_SRC_DIR}/interpreter/OpenSeesUniaxialMaterialCommands.cpp
${OPS_SRC_DIR}/interpreter/OpenSeesElementCommands.cpp
${OPS_SRC_DIR}/interpreter/OpenSeesElementCommands.cpp
)
target_link_libraries(OpenSees
#OPS_Paraview
Expand Down Expand Up @@ -331,7 +334,7 @@ opensees_add_cxx_flag(TARGETS OPS_Tcl
#----------------------------
target_link_libraries(OpenSeesTcl
OPS_Tcl ${OPS_Element_List} OPS_Thermal OpenSees ${CMAKE_DL_LIBS}
${SUPERLU_LIBRARIES}
#${SUPERLU_LIBRARIES}
)

#----------------------------
Expand Down
2 changes: 1 addition & 1 deletion Conf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ opensees_load(LAPACK SEARCH)
#LIBRARY /home/claudio/lib/libLapack.a
#)

opensees_load(SUPERLU SEARCH)
#opensees_load(SUPERLU SEARCH)
#LIBRARY /home/claudio/lib/libSuperLU.a
#INCLUDE ${OPS_BUNDLED_DIR}/SuperLU_5.1.1/
#)
Expand Down
6 changes: 6 additions & 0 deletions ETC/cmake/FindARPACK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ IF(NOT ARPACK_LIBRARIES)
FIND_LIBRARY(ARPACK_LIBRARIES NAMES arpack libarpack ARPACK libARPACK)
ENDIF(NOT ARPACK_LIBRARIES)

IF(NOT ARPACK_LIBRARIES)
message(".......................")
FIND_LIBRARY(ARPACK_LIBRARIES NAMES arpack libarpack ARPACK libARPACK PATHS ${OPS_BUNDLED_DIR}/ARPACK)
ENDIF(NOT ARPACK_LIBRARIES)


IF(ARPACK_LIBRARIES)
# On OS X we probably also need gfortran and BLAS and LAPACK libraries
IF(APPLE)
Expand Down
17 changes: 11 additions & 6 deletions ETC/cmake/OpenSeesFunctions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ function (opensees_load lib_name)
set(${OPS_PKG_FOUND_VAR} FALSE)# PARENT_SCOPE)
if(OPS_LOAD_ARG_BUILD)
message("OPS >>> Using OpenSees bundled library '${lib_name}'")
set(${OPS_PKG_FOUND_VAR} TRUE)#PARENT_SCOPE)
set(${OPS_PKG_FOUND_VAR} TRUE PARENT_SCOPE)
opensees_build(${lib_name})
return()
elseif(OPS_LOAD_ARG_LIBRARY)
message("OPS >>> ${lib_name}")
set("${lib_name}_LIBRARIES" ${OPS_LOAD_ARG_LIBRARY} PARENT_SCOPE)
set("${lib_name}_INCLUDE_DIRS" ${OPS_LOAD_ARG_INCLUDE} PARENT_SCOPE)
message("OPS >>> ${lib_name}")
set("${lib_name}_LIBRARIES" ${OPS_LOAD_ARG_LIBRARY} PARENT_SCOPE)
set("${lib_name}_INCLUDE_DIRS" ${OPS_LOAD_ARG_INCLUDE} PARENT_SCOPE)
elseif(OPS_LOAD_ARG_PATHS)
message("Provided ${lib_name} paths are:")
foreach(src ${OPS_LOAD_ARG_PATHS})
Expand All @@ -57,18 +57,23 @@ function (opensees_load lib_name)
find_package(${lib_name})
message("OPS>>> status: ${OPS_PKG_FOUND_VAR}=${${OPS_PKG_FOUND_VAR}}")
endif()

if(OPS_LOAD_ARG_SEARCH)
if(NOT ${${OPS_PKG_FOUND_VAR}})
message("CMake failed to find ${lib_name}; building OpenSees version")
set(${OPS_PKG_FOUND_VAR} TRUE PARENT_SCOPE)
opensees_build(${lib_name})
set("${lib_name}_LIBRARIES" ${lib_name} PARENT_SCOPE)
endif()
endif()
endfunction()

function (opensees_build lib_name)
add_subdirectory("${OPS_EXTERNALS_DIR}/${lib_name}")
include_directories("${OPS_EXTERNALS_DIR}/${lib_name}")
#message("(OpenSees build not yet implemented)")
include_directories("${OPS_EXTERNALS_DIR}/${lib_name}")
message(${${lib_name}_LIBRARIES})
endfunction()




44 changes: 44 additions & 0 deletions OTHER/ARPACK/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
############################################################################
#
# Program: ARPACK
#
# Module: Makefile
#
# Purpose: Sources Makefile
#
# Creation date: February 22, 1996
#
# Modified: 2021
#
# Send bug reports, comments or suggestions to arpack.caam.rice.edu
#
############################################################################

project(ARPACK Fortran)

add_library(ARPACK)

target_sources(ARPACK PUBLIC
dgetv0.f dlaqrb.f dstqrb.f dsortc.f dsortr.f dstatn.f dstats.f
dnaitr.f dnapps.f dnaup2.f dnaupd.f dnconv.f dneigh.f dngets.f
dsaitr.f dsapps.f dsaup2.f dsaupd.f dsconv.f dseigt.f dsgets.f
dneupd.f dseupd.f dsesrt.f dvout.f dmout.f
icnteq.f icopy.f iset.f iswap.f ivout.f second.f
)

# Required on Unix OS family to be able to be linked into shared libraries.
set_target_properties(${PROJECT_NAME}
PROPERTIES POSITION_INDEPENDENT_CODE ON)

#target_link_libraries(${PROJECT_NAME})

# Expose B's public includes to other subprojects through cache variable.
set(${PROJECT_NAME}_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}
CACHE INTERNAL "${PROJECT_NAME}: Include Directories" FORCE)

export(TARGETS ARPACK
FILE "${CMAKE_CURRENT_BINARY_DIR}/cmake/ARPACK.cmake"
#EXPORT_LINK_INTERFACE_LIBRARIES #NAMESPACE MathFunctions::
)


93 changes: 93 additions & 0 deletions OTHER/CBLAS/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
include ../../Makefile.def

#######################################################################
# This is the makefile to create a library for C-BLAS.
# The files are organized as follows:
#
# SBLAS1 -- Single precision real BLAS routines
# CBLAS1 -- Single precision complex BLAS routines
# DBLAS1 -- Double precision real BLAS routines
# ZBLAS1 -- Double precision complex BLAS routines
#
# CB1AUX -- Real BLAS routines called by complex routines
# ZB1AUX -- D.P. real BLAS routines called by d.p. complex
# routines
#
# ALLBLAS -- Auxiliary routines for Level 2 and 3 BLAS
#
# SBLAS2 -- Single precision real BLAS2 routines
# CBLAS2 -- Single precision complex BLAS2 routines
# DBLAS2 -- Double precision real BLAS2 routines
# ZBLAS2 -- Double precision complex BLAS2 routines
#
# SBLAS3 -- Single precision real BLAS3 routines
# CBLAS3 -- Single precision complex BLAS3 routines
# DBLAS3 -- Double precision real BLAS3 routines
# ZBLAS3 -- Double precision complex BLAS3 routines
#
# The library can be set up to include routines for any combination
# of the four precisions. To create or add to the library, enter make
# followed by one or more of the precisions desired. Some examples:
# make single
# make single complex
# make single double complex complex16
# Alternatively, the command
# make
# without any arguments creates a library of all four precisions.
# The library is called
# blas.a
# and is created at the next higher directory level.
#
# To remove the object files after the library is created, enter
# make clean
#
#######################################################################

MYSBLAS2 = smyblas2.o
MYDBLAS2 = dmyblas2.o
MYCBLAS2 = cmyblas2.o
MYZBLAS2 = zmyblas2.o

SBLAS1 = isamax.o sasum.o saxpy.o scopy.o sdot.o snrm2.o \
srot.o sscal.o
SBLAS2 = sgemv.o ssymv.o strsv.o sger.o ssyr2.o

DBLAS1 = idamax.o dasum.o daxpy.o dcopy.o ddot.o dnrm2.o \
drot.o dscal.o
DBLAS2 = dgemv.o dsymv.o dtrsv.o dger.o dsyr2.o

CBLAS1 = icamax.o scasum.o caxpy.o ccopy.o scnrm2.o \
cscal.o
CBLAS2 = cgemv.o chemv.o ctrsv.o cgerc.o cher2.o

ZBLAS1 = izamax.o dzasum.o zaxpy.o zcopy.o dznrm2.o \
zscal.o dcabs1.o
ZBLAS2 = zgemv.o zhemv.o ztrsv.o zgerc.o zher2.o


all: double

single: $(SBLAS1) $(SBLAS2) $(SBLAS3) $(MYSBLAS2)
$(AR) $(ARFLAGS) $(CBLAS_LIBRARY) $(SBLAS1) $(ALLBLAS) \
$(SBLAS2) $(SBLAS3) $(MYSBLAS2)
$(RANLIB) $(RANLIBFLAGS) $(CBLAS_LIBRARY)

double: $(DBLAS1) $(DBLAS2) $(DBLAS3) $(MYDBLAS2)
$(AR) $(ARFLAGS) $(CBLAS_LIBRARY) $(DBLAS1) $(ALLBLAS) \
$(DBLAS2) $(DBLAS3) $(MYDBLAS2)
$(RANLIB) $(RANLIBFLAGS) $(CBLAS_LIBRARY)

complex: $(CBLAS1) $(CBLAS2) $(CBLAS3) $(MYCBLAS2)
$(AR) $(ARFLAGS) $(CBLAS_LIBRARY) $(CBLAS1) $(ALLBLAS) \
$(CBLAS2) $(CBLAS3) $(MYCBLAS2)
$(RANLIB) $(RANLIBFLAGS) $(CBLAS_LIBRARY)

complex16: $(ZBLAS1) $(ZBLAS2) $(ZBLAS3) $(MYZBLAS2)
$(AR) $(ARFLAGS) $(CBLAS_LIBRARY) $(ZBLAS1) $(ALLBLAS) \
$(ZBLAS2) $(ZBLAS3) $(MYZBLAS2)
$(RANLIB) $(RANLIBFLAGS) $(CBLAS_LIBRARY)

clean:
$(RM) $(RMFLAGS) *.o

wipe: clean
35 changes: 35 additions & 0 deletions OTHER/METIS/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@


#.c.o:
# @$(ECHO) Making $@ from $<
# $(CC) $(CFLAGS) -I. -c $< -o $@
#
#LD = $(CC) -L.

add_library(METIS)

target_sources(METIS PUBLIC
coarsen.c fm.c initpart.c match.c ccgraph.c memory.c
pmetis.c pqueue.c refine.c util.c timing.c debug.c
bucketsort.c graph.c stat.c kmetis.c kwayrefine.c
kwayfm.c balance.c ometis.c srefine.c sfm.c separator.c
mincover.c mmd.c mesh.c meshpart.c frename.c fortran.c
myqsort.c compress.c parmetis.c estmem.c
mpmetis.c mcoarsen.c mmatch.c minitpart.c mbalance.c
mrefine.c mutil.c mfm.c mkmetis.c mkwayrefine.c mkwayfmh.c
mrefine2.c minitpart2.c mbalance2.c mfm2.c
kvmetis.c kwayvolrefine.c kwayvolfm.c subdomains.c
)

#all: $(OBJS)
# @$(RM) $(RMFLAGS) $(METIS_LIBRARY)
# @$(AR) $(ARFLAGS) $(METIS_LIBRARY) $(OBJS)
# @$(RANLIB) $(RANLIBFLAGS) $(METIS_LIBRARY)
#
#clean:
# rm -f *.o
#
#realclean:
# rm -f *.o ; rm -f ../libmetis.a


0 comments on commit 200b4d9

Please sign in to comment.