forked from OpenSees/OpenSees
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
863 lines (717 loc) · 24.6 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
#==============================================================================
#
# OpenSees -- Open System For Earthquake Engineering Simulation
# Pacific Earthquake Engineering Research Center
#
# (c) Copyright 1999-2021 The Regents of the University of California
# All Rights Reserved
# (Copyright and Disclaimer @ http://www.berkeley.edu/OpenSees/copyright.html)
#
#------------------------------------------------------------------------------
#
# Major sections:
# - General Setup
# - External Libreries (Conan or User supplied paths)
# - Libraries
# - Executables
# - Option Application
#
#==============================================================================
cmake_minimum_required(VERSION 3.16)
project(OpenSeesFramework LANGUAGES C CXX Fortran)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
set(OPS_EXTERN_SOURCE_DIR "${PROJECT_SOURCE_DIR}/OTHER/")
set(OPS_EXTERNALS_DIR "${PROJECT_SOURCE_DIR}/OTHER/")
set(OPS_BUNDLED_DIR "${PROJECT_SOURCE_DIR}/OTHER/")
set(OPS_SRC_DIR "${PROJECT_SOURCE_DIR}/SRC/")
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake/cmake")
include(OpenSeesFunctions)
# include user config
include(${PROJECT_SOURCE_DIR}/Conf.cmake)
#
# for ubuntu this has to be before the Compiler SPECIFIC stuff below .. go figure!
#
find_package(MPI)
#cmake -DCMAKE_RULE_MESSAGES:BOOL=OFF -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON .
#
# Compiler SPECIFIC
#
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
MESSAGE("COMPILER: Clang")
# set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(BUILD_SHARED_LIBS OFF)
# set(CMAKE_EXE_LINKER_FLAGS "-static")
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_EXE_LINKER_FLAGS "-static")
add_compile_options(-fPIC)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
MESSAGE("COMPILER: GNU")
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel")
MESSAGE("COMPILER: Intel")
add_compile_options(-fPIC)
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
MESSAGE("COMPILER: MSVC")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")
else()
MESSAGE("COMPILER: UKNOWN COMPILER ${CMAKE_CXX_COMPILER_ID}")
endif()
#
# external packages
#
add_library(OPS_External_packages INTERFACE)
add_library(OPS_OS_Specific_libs INTERFACE)
#
# Conan (manages external dependencies for a typical build)
#
MESSAGE("${CMAKE_BINARY_DIR}")
if(EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
MESSAGE("USING CONAN")
include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
conan_basic_setup()
set (Eigen3_FOUND TRUE)
set (HDF5_FOUND TRUE)
set (HDF5_LIBRARIES ${CONAN_LIBS_HDF5} ${CONAN_LIBS_ZLIB})
set (HDF5_VERSION "1.12.0")
set(USING_CONAN TRUE)
set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR} ${CMAKE_MODULE_PATH})
set(CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR} ${CMAKE_PREFIX_PATH})
set(TCL_LIBRARIES ${TCL_LIBRARY})
include_directories(${TCL_INCLUDE_PATH})
else()
MESSAGE("NOT USING CONAN")
include(OpenSeesFunctions)
set(NOT_USING_CONAN TRUE)
set (CONAN_LIBS )
find_package(HDF5 REQUIRED)
find_package(TCL REQUIRED)
find_package(Eigen3 REQUIRED)
include_directories(${TCL_INCLUDE_DIR})
set(TCL_INCLUDE_PATH ${TCL_INCLUDE_DIR})
set(TCL_LIBRARY ${TCL_LIBRARIES})
endif()
# define user-selectable options for end target
set_property(CACHE OPS_FINAL_TARGET PROPERTY STRINGS
G3 OpenSees OpenSeesMP OpenSeesSP OpenSeesPy)
#
# OS Configuration:
# defines: compile flags & user supplied paths and includes if not using conan
#
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
add_compile_definitions(_LINUX _UNIX _TCL85)
if (NOT_USING_CONAN)
include(OpenSeesDependenciesUnix)
endif()
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(OPS_Use_Graphics_Option None)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
add_compile_definitions(_LINUX _UNIX _TCL85)
if (NOT_USING_CONAN)
include(OpenSeesDependenciesUnix)
endif()
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_link_libraries(OPS_OS_Specific_libs INTERFACE wsock32 ws2_32)
add_compile_definitions(_WIN32 _TCL85)
if (NOT_USING_CONAN)
include(OpenSeesDependenciesWin)
endif()
endif()
#==============================================================================
# General Setup
#
#==============================================================================
#----------------------------------------------------------------
# Compilers
#----------------------------------------------------------------
# Fortran
#--------------------------------------
enable_language(Fortran)
# C++
#--------------------------------------
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_STANDARD 11)
set(CMAKE_FORTRAN_STANDARD 08)
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> cqls <TARGET> <LINK_FLAGS> <OBJECTS>")
#add_compile_options(-g)
# Warnings
#opensees_add_cxx_flag(
# GNU -Wall
# MSVC /W0
#)
# Floating-point
#opensees_add_cxx_flag(
# GNU -ffloat-store
# MSVC /fp:precise
#)
#----------------------------------------------------------------
# Global Includes
#----------------------------------------------------------------
# include paths to main abstract classes
# NOTE BeamIntegration and MatrixUtil need to be removed from element/forceBEamColumn
include_directories(
${OPS_SRC_DIR}
${OPS_SRC_DIR}/matrix
${OPS_SRC_DIR}/handler
${OPS_SRC_DIR}/database
${OPS_SRC_DIR}/element
${OPS_SRC_DIR}/element/forceBeamColumn
${OPS_SRC_DIR}/element/nonlinearBeamColumn/matrixutil
${OPS_SRC_DIR}/coordTransformation
${OPS_SRC_DIR}/damping
${OPS_SRC_DIR}/tagged
${OPS_SRC_DIR}/tagged/storage
${OPS_SRC_DIR}/recorder
${OPS_SRC_DIR}/renderer
${OPS_SRC_DIR}/damage
${OPS_SRC_DIR}/recorder/response
${OPS_SRC_DIR}/material
${OPS_SRC_DIR}/material/section
${OPS_SRC_DIR}/material/uniaxial
${OPS_SRC_DIR}/material/nD
${OPS_SRC_DIR}/graph/graph
${OPS_SRC_DIR}/graph/numberer
${OPS_SRC_DIR}/graph/partitioner
${OPS_SRC_DIR}/domain/component
${OPS_SRC_DIR}/domain/domain
${OPS_SRC_DIR}/domain/subdomain
${OPS_SRC_DIR}/domain/load
${OPS_SRC_DIR}/domain/loadBalancer
${OPS_SRC_DIR}/domain/pattern
${OPS_SRC_DIR}/domain/groundMotion
${OPS_SRC_DIR}/domain/node
${OPS_SRC_DIR}/domain/constraints
${OPS_SRC_DIR}/domain/region
${OPS_SRC_DIR}/analysis/algorithm
${OPS_SRC_DIR}/analysis/dof_grp
${OPS_SRC_DIR}/analysis/fe_ele
${OPS_SRC_DIR}/analysis/algorithm/equiSolnAlgo
${OPS_SRC_DIR}/analysis/algorithm/eigenAlgo
${OPS_SRC_DIR}/analysis/algorithm/domainDecompAlgo
${OPS_SRC_DIR}/analysis/analysis
${OPS_SRC_DIR}/analysis/integrator
${OPS_SRC_DIR}/analysis/handler
${OPS_SRC_DIR}/analysis/numberer
${OPS_SRC_DIR}/analysis/model
${OPS_SRC_DIR}/convergenceTest
${OPS_SRC_DIR}/modelbuilder
${OPS_SRC_DIR}/system_of_eqn
${OPS_SRC_DIR}/system_of_eqn/linearSOE
${OPS_SRC_DIR}/system_of_eqn/eigenSOE
${OPS_SRC_DIR}/actor/actor
${OPS_SRC_DIR}/actor/channel
${OPS_SRC_DIR}/actor/objectBroker
${OPS_SRC_DIR}/actor/message
${OPS_BUNDLED_DIR}/eigenAPI
)
# TODO: Temporary fix; include all directories with .h files through glob
file(GLOB_RECURSE ops_include_files CONFIGURE_DEPENDS
${OPS_SRC_DIR}/*.h
${OPS_BUNDLED_DIR}/*.h
)
set(OPS_INCLUDE_DIRS "")
foreach(filepath ${ops_include_files})
get_filename_component(dir_path ${filepath} PATH)
set(OPS_INCLUDE_DIRS ${OPS_INCLUDE_DIRS} ${dir_path})
endforeach()
list(REMOVE_DUPLICATES OPS_INCLUDE_DIRS)
include_directories(${OPS_INCLUDE_DIRS})
# end TODO
# ##############################################################
#
# NUMERICAL and OpenSees LIBRARIES
#
# ##############################################################
#
# NUMERICAL LIBRARIES
#
add_subdirectory("${PROJECT_SOURCE_DIR}/OTHER/SuperLU_5.1.1")
set (SUPERLU_LIBRARIES SUPERLU)
add_subdirectory("${PROJECT_SOURCE_DIR}/OTHER/UMFPACK")
set (UMFPACK_LIBRARIES UMFPACK)
add_subdirectory("${PROJECT_SOURCE_DIR}/OTHER/AMD")
set (AMD_LIBRARIES AMD)
add_subdirectory("${PROJECT_SOURCE_DIR}/OTHER/ARPACK")
set (ARPACK_LIBRARIES ARPACK)
add_subdirectory("${PROJECT_SOURCE_DIR}/OTHER/CSPARSE")
set (CSPARSE_LIBRARIES CSPARSE)
add_subdirectory("${PROJECT_SOURCE_DIR}/OTHER/tetgen1.4.3")
set (TETGEN_LIBRARIES tet)
add_subdirectory("${PROJECT_SOURCE_DIR}/OTHER/Triangle")
set (TRIANGLE_LIBRARIES triangle)
# add_subdirectory("${PROJECT_SOURCE_DIR}/OTHER/eigenAPI")
# set (EIGENAPI_LIBRARIES EIGENAPI)
if (NOT DEFINED LAPACK_LIBRARIES)
find_package(LAPACK)
else()
set (LAPACK_FOUND TRUE CACHE BOOL "providing own lapack lib")
endif()
if (NOT DEFINED Python_LIBRARIES)
find_package(Python COMPONENTS Interpreter Development)
else()
set (PYTHON_FOUND TRUE CACHE BOOL "providing own python lib")
endif()
find_package(MPI)
find_package(MKL)
#set (LAPACK_FOUND FALSE)
#set (BLAS_FOUND FALSE)
if(LAPACK_FOUND)
message(STATUS "LAPACK was found.")
message(STATUS "LAPACK_LINKER_FLAGS = ${LAPACK_LINKER_FLAGS}")
message(STATUS "LAPACK_LIBRARIES = ${LAPACK_LIBRARIES}" )
else()
add_subdirectory("${PROJECT_SOURCE_DIR}/OTHER/BLAS")
add_subdirectory("${PROJECT_SOURCE_DIR}/OTHER/LAPACK")
set(LAPACK_LIBRARIES LAPACK)
endif()
if(PYTHON_FOUND)
message("Python_FOUND:${Python_FOUND}")
#message("Python_VERSION:${Python_VERSION}")
#message("Python_Development_FOUND:${Python_Development_FOUND}")
message("Python_LIBRARIES:${Python_LIBRARIES}")
message("Python_INCLUDES:${Python_INCLUDE_DIRS}")
else()
message(STATUS "PYTHON NOT FOUND")
endif()
if(MPI_FOUND)
message(STATUS "MPI was found.")
message(STATUS "MPI was found .. path added ${MPI_C_INCLUDE_DIRS} ${MPI_FOUND}")
include_directories(SYSTEM ${MPI_C_INCLUDE_DIRS})
#add_subdirectory("${PROJECT_SOURCE_DIR}/OTHER/MUMPS_5.4.1")
#if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
if (NOT DEFINED MUMPS_DIR)
# include(ExternalProject)
# ExternalProject_Add(mumps
# GIT_REPOSITORY https://github.com/scivision/mumps.git
# GIT_TAG v5.5.1.5
# SOURCE_DIR "${CMAKE_BINARY_DIR}/mumps-src"
# BINARY_DIR "${CMAKE_BINARY_DIR}"
# INSTALL_COMMAND ""
# )
#
# set (MUMPS_LIBRARIES "${CMAKE_BINARY_DIR}/libdmumps.lib;${CMAKE_BINARY_DIR}/libmumps_common.lib;${CMAKE_BINARY_DIR}/libpord.lib")
set (MUMPS_FLAG -D_NOMUMPS)
set (MUMPS_LIBRARIES "")
else()
set (MUMPS_FLAG -D_MUMPS)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set (MUMPS_LIBRARIES "${MUMPS_DIR}/dmumps;${MUMPS_DIR}/mumps_common;${MUMPS_DIR}/pord")
else()
set (MUMPS_LIBRARIES "${MUMPS_DIR}/libdmumps.a;${MUMPS_DIR}/libmumps_common.a;${MUMPS_DIR}/libpord.a")
endif()
endif()
add_subdirectory("${PROJECT_SOURCE_DIR}/OTHER/SuperLU_DIST_4.3/SRC")
add_subdirectory("${PROJECT_SOURCE_DIR}/OTHER/METIS")
else()
message(STATUS "MPI was NOT found.")
endif()
if(MKL_FOUND)
message(STATUS "MKL was found.")
if (NOT DEFINED SCALAPACK_LIBRARIES)
set (SCALAPACK_LIBRARIES ${MKL_LIBRARIES})
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set (MKL_LPATH ${MKL_ROOT}/lib/intel64)
set (SCALAPACK_LIBRARIES "${MKL_LPATH}/mkl_scalapack_ilp64.lib;${MKL_LPATH}/mkl_intel_ilp64.lib;${MKL_LPATH}/mkl_sequential.lib;${MKL_LPATH}/mkl_core.lib;${MKL_LPATH}/mkl_blacs_intelmpi_ilp64.lib")
endif()
else()
message(STATUS "MKL NOT found .. user to provide -DSCALAPACK_LIBRARIES=")
endif()
message(STATUS "SCALAPACK_LIBRARIES=${SCALAPACK_LIBRARIES}")
#get_cmake_property(_variableNames VARIABLES)
#list (SORT _variableNames)
#foreach (_variableName ${_variableNames})
# message(STATUS "${_variableName}=${${_variableName}}")
#endforeach()
add_library(OPS_Numerics INTERFACE)
target_link_libraries(OPS_Numerics INTERFACE
${ARPACK_LIBRARIES}
${CSPARSE_LIBRARIES}
${SUPERLU_LIBRARIES}
${UMFPACK_LIBRARIES}
${TETGEN_LIBRARIES}
${TRIANGLE_LIBRARIES}
${AMD_LIBRARIES}
${AMD_LIBRARIES}
${LAPACK_LIBRARIES}
${EIGENAPI_LIBRARIES}
)
set(TCL_LIBRARIES ${TCL_LIBRARY})
#
# OpenSees OBJECT LIBRARIES
#
add_library(OPS_Matrix OBJECT)
add_library(OPS_Actor OBJECT)
add_library(OPS_ObjectBroker OBJECT)
add_library(OPS_Handler OBJECT)
add_library(OPS_Recorder OBJECT)
add_library(OPS_Reliability OBJECT)
add_library(OPS_Tagged OBJECT)
add_library(OPS_Utilities OBJECT)
add_library(OPS_ModelBuilder OBJECT)
add_library(OPS_Domain OBJECT)
add_library(OPS_SysOfEqn OBJECT)
#add_library(OPS_SysOfEqnSP OBJECT)
add_library(OPS_Analysis OBJECT)
add_library(OPS_ConvergenceTest OBJECT)
add_library(OPS_Thermal OBJECT)
add_library(OPS_Element OBJECT)
add_library(OPS_ElementFortran OBJECT)
#add_library(OPS_ElementSP OBJECT)
add_library(OPS_Material OBJECT)
add_library(OPS_MaterialFortran OBJECT)
add_library(OPS_Damage OBJECT)
add_library(OPS_Database OBJECT)
add_library(OPS_INTERPRETER OBJECT)
#
# Optional Extensions
#
add_library(OPS_Paraview OBJECT EXCLUDE_FROM_ALL)
add_library(OPS_Renderer OBJECT EXCLUDE_FROM_ALL)
add_library(OPS_Graphics OBJECT EXCLUDE_FROM_ALL)
add_library(OPS_Graphics_Default OBJECT EXCLUDE_FROM_ALL)
add_library(OPS_Graphics_GL OBJECT EXCLUDE_FROM_ALL)
add_library(OPS_PFEM OBJECT EXCLUDE_FROM_ALL)
#
# Tcl Interpreter Library & special include and link directives
#
add_library(OPS_InterpTcl STATIC)
target_compile_definitions(OPS_InterpTcl PUBLIC _TCL85)
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
target_include_directories(OPS_InterpTcl PUBLIC ${TCL_INCLUDE_PATH})
target_link_libraries(OPS_InterpTcl PRIVATE ${TCL_LIBRARIES})
endif()
#
# OpenSees G3 Library - a slimmed down OpenSees
#
add_library(G3)
target_link_libraries(G3
coordTransformation
damping
OPS_Matrix
OPS_Analysis
OPS_ModelBuilder
OPS_Domain
OPS_ConvergenceTest
OPS_Element
OPS_Material
OPS_Recorder
OPS_Handler
OPS_SysOfEqn
OPS_Tagged
OPS_Utilities
graph
OPS_Actor
OPS_ObjectBroker
OPS_Numerics
OPS_INTERPRETER
)
#
# OpenSees Libray
#
add_library(OpenSeesLIB EXCLUDE_FROM_ALL)
target_link_libraries(OpenSeesLIB
${OPS_Extension_List}
OPS_Actor
OPS_Analysis
OPS_ConvergenceTest
OPS_Damage
OPS_Database
OPS_Domain
graph
OPS_Element
OPS_ElementFortran
OPS_Handler
OPS_INTERPRETER
OPS_Material
OPS_MaterialFortran
OPS_Material_YieldSurface
OPS_Matrix
OPS_ModelBuilder
OPS_ObjectBroker
OPS_PFEM
OPS_Recorder
coordTransformation
damping
OPS_Renderer
OPS_Section_Repres
OPS_Section_YieldSurface
OPS_SysOfEqn
OPS_Thermal
OPS_OS_Specific_libs
OPS_Tagged
OPS_Utilities
)
# ########################################################################
#
# EXECUTABLES
#
# ########################################################################
# Adding EXCLUDE_FROM_ALL prevents these from being made by default.
#
# OpenSees Tcl Interpreter
#
add_executable(OpenSees EXCLUDE_FROM_ALL
${OPS_SRC_DIR}/tcl/tclAppInit.cpp
${OPS_SRC_DIR}/tcl/tclMain.cpp
${OPS_SRC_DIR}/tcl/commands.cpp
${OPS_SRC_DIR}/actor/objectBroker/FEM_ObjectBrokerAllClasses.cpp
)
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
target_include_directories(OpenSees PUBLIC ${TCL_INCLUDE_PATH})
FILE(COPY ${CONAN_LIB_DIRS_TCL}/tcl8.6
DESTINATION ${PROJECT_BINARY_DIR}/lib/tcl8.6
FILES_MATCHING PATTERN .tcl)
else ()
FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib/tcl8.6)
add_custom_command(
TARGET OpenSees POST_BUILD
COMMENT("Copying init.tcl to ${CMAKE_CURRENT_BINARY_DIR}")
COMMAND ${CMAKE_COMMAND} -E copy
${CONAN_LIB_DIRS_TCL}/tcl8.6/init.tcl
${CMAKE_CURRENT_BINARY_DIR}/lib/tcl8.6
)
endif()
target_link_libraries(OpenSees
OPS_InterpTcl
coordTransformation
OpenSeesLIB
OPS_Reliability
OPS_ReliabilityTcl
OPS_Numerics
OPS_Recorder
${CMAKE_DL_LIBS}
${HDF5_LIBRARIES}
${CONAN_LIBS}
)
#
# OpenSeesSP Tcl Parallel Interpreter
#
if(MPI_FOUND)
add_executable(OpenSeesSP EXCLUDE_FROM_ALL
${OPS_SRC_DIR}/tcl/mpiMain.cpp
${OPS_SRC_DIR}/tcl/tclMain.cpp
${OPS_SRC_DIR}/tcl/commands.cpp
${OPS_SRC_DIR}/domain/domain/partitioned/PartitionedDomain.cpp
${OPS_SRC_DIR}/domain/domain/partitioned/PartitionedDomainEleIter.cpp
${OPS_SRC_DIR}/domain/domain/partitioned/PartitionedDomainSubIter.cpp
${OPS_SRC_DIR}/actor/objectBroker/FEM_ObjectBrokerAllClasses.cpp
${OPS_SRC_DIR}/actor/machineBroker/MPI_MachineBroker.cpp
${OPS_SRC_DIR}/system_of_eqn/linearSOE/diagonal/MPIDiagonalSOE.cpp
${OPS_SRC_DIR}/system_of_eqn/linearSOE/diagonal/MPIDiagonalSolver.cpp
${OPS_SRC_DIR}/system_of_eqn/linearSOE/mumps/MumpsSOE.cpp
${OPS_SRC_DIR}/system_of_eqn/linearSOE/mumps/MumpsSolver.cpp
${OPS_SRC_DIR}/system_of_eqn/linearSOE/mumps/MumpsParallelSOE.cpp
${OPS_SRC_DIR}/system_of_eqn/linearSOE/mumps/MumpsParallelSolver.cpp
${OPS_SRC_DIR}/system_of_eqn/linearSOE/sparseGEN/DistributedSuperLU.cpp
${OPS_SRC_DIR}/system_of_eqn/linearSOE/sparseGEN/DistributedSparseGenColLinSOE.cpp
${OPS_SRC_DIR}/system_of_eqn/linearSOE/sparseGEN/DistributedSparseGenRowLinSOE.cpp
${OPS_SRC_DIR}/domain/subdomain/ActorSubdomain.cpp
${OPS_SRC_DIR}/domain/subdomain/ShadowSubdomain.cpp
)
target_include_directories(OpenSeesSP PRIVATE ${MUMPS_DIR}/_deps/mumps-src/include ${MPI_CXX_INCLUDE_DIRS})
target_compile_options(OpenSeesSP PRIVATE ${MPI_CXX_COMPILE_FLAGS})
if (DEFINED OPENMPI)
target_compile_definitions(OpenSeesSP
PUBLIC _PARALLEL_PROCESSING ${MUMPS_FLAG} _OPENMPI)
else()
target_compile_definitions(OpenSeesSP
PUBLIC _PARALLEL_PROCESSING ${MUMPS_FLAG})
endif()
target_link_libraries(OpenSeesSP
OPS_InterpTcl
OpenSeesLIB
OPS_Reliability
OPS_ReliabilityTcl
OPS_Recorder
METIS
SUPERLU_DIST
OPS_Numerics
${MUMPS_LIBRARIES}
${CMAKE_DL_LIBS}
${HDF5_LIBRARIES}
${CONAN_LIBS}
${MPI_CXX_LIBRARIES}
${SCALAPACK_LIBRARIES}
${MPI_Fortran_LIBRARIES}
${MPI_CXX_LINK_FLAGS}
)
endif()
#
# OpenSeesMP Tcl MPI Interpreter
#
if(MPI_FOUND)
add_executable(OpenSeesMP EXCLUDE_FROM_ALL
${OPS_SRC_DIR}/tcl/mpiParameterMain.cpp
${OPS_SRC_DIR}/tcl/tclMain.cpp
${OPS_SRC_DIR}/tcl/commands.cpp
${OPS_SRC_DIR}/domain/domain/partitioned/PartitionedDomain.cpp
${OPS_SRC_DIR}/domain/domain/partitioned/PartitionedDomainEleIter.cpp
${OPS_SRC_DIR}/domain/domain/partitioned/PartitionedDomainSubIter.cpp
${OPS_SRC_DIR}/actor/machineBroker/MPI_MachineBroker.cpp
${OPS_SRC_DIR}/actor/objectBroker/FEM_ObjectBrokerAllClasses.cpp
${OPS_SRC_DIR}/system_of_eqn/linearSOE/diagonal/MPIDiagonalSOE.cpp
${OPS_SRC_DIR}/system_of_eqn/linearSOE/diagonal/MPIDiagonalSolver.cpp
${OPS_SRC_DIR}/system_of_eqn/linearSOE/mumps/MumpsSOE.cpp
${OPS_SRC_DIR}/system_of_eqn/linearSOE/mumps/MumpsSolver.cpp
${OPS_SRC_DIR}/system_of_eqn/linearSOE/mumps/MumpsParallelSOE.cpp
${OPS_SRC_DIR}/system_of_eqn/linearSOE/mumps/MumpsParallelSolver.cpp
${OPS_SRC_DIR}/domain/subdomain/ActorSubdomain.cpp
${OPS_SRC_DIR}/domain/subdomain/ShadowSubdomain.cpp
)
target_include_directories(OpenSeesMP PRIVATE ${MUMPS_DIR}/_deps/mumps-src/include ${MPI_CXX_INCLUDE_DIRS})
target_compile_options(OpenSeesMP PRIVATE ${MPI_CXX_COMPILE_FLAGS})
if (NOT DEFINED MUMPS_DIR)
add_dependencies(OpenSeesMP mumps)
endif()
if (DEFINED OPENMPI)
target_compile_definitions(OpenSeesMP
PUBLIC _PARALLEL_INTERPRETERS ${MUMPS_FLAG} _OPENMPI)
else()
target_compile_definitions(OpenSeesMP
PUBLIC _PARALLEL_INTERPRETERS ${MUMPS_FLAG})
endif()
target_link_libraries(OpenSeesMP
OPS_InterpTcl
OpenSeesLIB
OPS_Reliability
OPS_ReliabilityTcl
OPS_Recorder
METIS
SUPERLU_DIST
OPS_Numerics
${MUMPS_LIBRARIES}
${CMAKE_DL_LIBS}
${HDF5_LIBRARIES}
${CONAN_LIBS}
${MPI_CXX_LIBRARIES}
${SCALAPACK_LIBRARIES}
${MPI_Fortran_LIBRARIES}
${MPI_CXX_LINK_FLAGS}
)
endif()
#
# OpenSeesPy Module
#
add_library(OpenSeesPy SHARED EXCLUDE_FROM_ALL
${OPS_SRC_DIR}/interpreter/PythonModule.cpp
${OPS_SRC_DIR}/actor/objectBroker/FEM_ObjectBrokerAllClasses.cpp
)
set_target_properties(OpenSeesPy PROPERTIES PREFIX "")
target_include_directories(OpenSeesPy PUBLIC ${Python_INCLUDE_DIRS})
target_link_libraries(OpenSeesPy
OpenSeesLIB
OPS_Reliability
OPS_Recorder
OPS_Numerics
${HDF5_LIBRARIES}
${CONAN_LIBS}
${Python_LIBRARIES}
)
#
# INSTALL
#
install (TARGETS OpenSees DESTINATION bin)
set (TCL_INIT_FILE "${TCL_INCLUDE_PATH}/../lib/tcl8.6/init.tcl")
install(FILES ${TCL_INIT_FILE} DESTINATION lib/tcl8.6)
# Set selected executable 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})
#==============================================================================
# Configure targets
#
#==============================================================================
#target_link_libraries(OPS_Numerics INTERFACE ${OPS_Numlib_List})
#message("Numlibs: ${OPS_Numlib_List}")
#target_link_libraries(OPS_Element PRIVATE ${OPS_Element_List})
#target_link_libraries(OPS_ObjectBroker PRIVATE ${OPS_Element_List})
#target_link_libraries(OPS_InterpTcl PRIVATE ${OPS_Element_List})
#==============================================================================
# Apply Options
#
#==============================================================================
#----------------------------
# FMK
#----------------------------
if(FMK)
add_compile_definitions(
_HAVE_Damage2p
_HAVE_PSUMAT
_HAVE_PML
_FILIP_LHNMYS
)
endif()
#----------------------------
# Extensions
#----------------------------
message("OPS >>> Configuring OpenSees extensions")
foreach(extension IN LISTS OPS_SysOfEqn_List OPS_Element_List OPS_Extension_List)
string(TOUPPER "${extension}" ext_flag)
string(REGEX REPLACE "^OPS_" "OPSDEF_" ext_flag "${ext_flag}")
add_compile_definitions(${ext_flag})
endforeach()
foreach(extension IN LISTS OPS_Exclude_List)
string(TOUPPER "${extension}" ext_flag)
string(REGEX REPLACE "^OPS_" "OPS_EXCLUDE_" ext_flag "${ext_flag}")
message(" Adding macro definition '${ext_flag}'")
add_compile_definitions(${ext_flag})
endforeach()
# Renderer
#----------------------------
if (${OPS_Use_Graphics_Option} STREQUAL "Base")
target_link_libraries(${OPS_FINAL_TARGET} OPS_Graphics_Default OPS_Graphics)
elseif (${OPS_Use_Graphics_Option} STREQUAL "OpenGL")
message("OPS >>> Including OpenGL graphics option")
set_source_files_properties(
"${OPS_SRC_DIR}/recorder/AlgorithmIncrements.cpp"
"${OPS_SRC_DIR}/recorder/FilePlotter.cpp"
"${OPS_SRC_DIR}/renderer/main.cpp"
"${OPS_SRC_DIR}/renderer/OpenGlDevice.cpp"
"${OPS_SRC_DIR}/renderer/OpenGlRenderer.cpp"
"${OPS_SRC_DIR}/tcl/TclFeViewer.cpp"
"${OPS_SRC_DIR}/tcl/TclVideoPlayer.cpp"
PROPERTIES COMPILE_DEFINITIONS _AGL
)
target_link_libraries(${OPS_FINAL_TARGET} OPS_Graphics_GL OPS_Graphics)
else()
add_compile_definitions(_NOGRAPHICS)
endif()
# Reliability
#----------------------------
#if ("OPS_Reliability" IN_LIST OPS_Extension_List)
add_compile_definitions(_RELIABILITY)
#target_link_libraries(${OPS_FINAL_TARGET} OPS_Reliability)
#endif()
#----------------------------
# HDF5
#----------------------------
if(HDF5_FOUND)
include_directories(${HDF5_INCLUDE_DIR})
set(_hdf5_libs hdf5 hdf5_cpp)
if (HDF5_VERSION VERSION_GREATER_EQUAL 1.12.0)
add_compile_definitions(_H5DRM)
add_compile_definitions(_HDF5)
message(STATUS "OPS >>> Have HDF5 and VERSION >= 1.12.0")
endif()
else()
message(STATUS "OPS >>> Could not find HDF5")
endif()
#----------------------------
# Eigen3
#----------------------------
if(Eigen3_FOUND)
include_directories(${Eigen3_INCLUDE_DIR})
add_compile_definitions(_EIGEN3)
else()
message(STATUS "OPS >>> Could not find Eigen3")
endif()
if (OPS_Use_Dev_Directories)
add_subdirectory("${PROJECT_SOURCE_DIR}/DEVELOPER/")
endif()