forked from Xyce/Xyce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
129 lines (118 loc) · 3.96 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
# SuiteSparse web page: http://suitesparse.com/
#
# The only part of SuiteSparse used by Xyce is AMD.
# When pointed to a SuiteSparse repository, this file is designed to build and
# install *only* the AMD library into a specified location.
#
# The recommended usage is to first obtain SuiteSparse. Either download a
# release tarball or make a shallow clone of the repository from GitHub:
# git clone --depth 1 https://github.com/DrTimothyAldenDavis/SuiteSparse.git
#
# Next, use the following invocation from a build directory, making the install
# directory the *same* as the Trilinos installation target:
# cmake \
# -D SuiteSparsePath=path/to/SuiteSparse \
# -D CMAKE_INSTALL_PREFIX=/trilinos/install/path \
# path/to/Xyce/cmake/trilinos/AMD
#
# Build/install AMD in the usual way; e.g., from the AMD build directory, run:
# cmake --build . -t install
#
# Then be sure to use the following flags with the Trilnos CMake invocation:
# -D CMAKE_INSTALL_PREFIX=/trilinos/install/path \
# -D AMD_LIBRARY_DIRS=/trilinos/install/path/lib \
# -D AMD_INCLUDE_DIRS=/trilinos/install/path/include \
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
project(AMD LANGUAGES C)
if(NOT DEFINED SuiteSparsePath)
message(FATAL_ERROR "Must supply the path to SuiteSparse using:
-D SuiteSparsePath=path/to/SuiteSparse")
endif()
set(SuiteSparsePath "" CACHE FILEPATH "Path to the SuiteSparse repository")
set(CMAKE_BUILD_TYPE Release)
add_library(amd
STATIC
${SuiteSparsePath}/AMD/Source/amd_aat.c
${SuiteSparsePath}/AMD/Source/amd_1.c
${SuiteSparsePath}/AMD/Source/amd_2.c
${SuiteSparsePath}/AMD/Source/amd_dump.c
${SuiteSparsePath}/AMD/Source/amd_postorder.c
${SuiteSparsePath}/AMD/Source/amd_defaults.c
${SuiteSparsePath}/AMD/Source/amd_post_tree.c
${SuiteSparsePath}/AMD/Source/amd_order.c
${SuiteSparsePath}/AMD/Source/amd_control.c
${SuiteSparsePath}/AMD/Source/amd_info.c
${SuiteSparsePath}/AMD/Source/amd_valid.c
${SuiteSparsePath}/AMD/Source/amd_preprocess.c
${SuiteSparsePath}/SuiteSparse_config/SuiteSparse_config.c
)
target_include_directories(amd
PUBLIC
${SuiteSparsePath}/AMD/Include/
${SuiteSparsePath}/SuiteSparse_config/
)
set_property(TARGET amd PROPERTY POSITION_INDEPENDENT_CODE ON)
install(TARGETS amd DESTINATION lib)
install(FILES
${SuiteSparsePath}/AMD/Include/amd.h
${SuiteSparsePath}/SuiteSparse_config/SuiteSparse_config.h
DESTINATION include
)
# NOTE 1:
#
# This could probably be combined with the Xyce/cmake/Patch_suitesparse.cmake
# file at some point, maybe as part of a modified superbuild?
#
#
# NOTE 2:
#
# This file does not build amd_global.c, which just contains a comment block
# stating the functions it provided are now in
# SuiteSparse_config/SuiteSparse_config.c.
#
#
# NOTE 3:
#
# The following fragments would more faithfully reproduce what the Makefiles
# do. However, the AMD package has no ifdef's with DINT or DLONG, so it
# doesn't seem to make sense to do all the extra compiling with those flags.
# (SuiteSparse_config doesn't have them either.) However, if AMD is ever
# changed to preferentially use ints vs longs, then something like the
# following will need to be done.
#
# add_library(amd_integer
# STATIC
# amd_aat.c
# amd_1.c
# amd_2.c
# amd_dump.c
# amd_postorder.c
# amd_defaults.c
# amd_post_tree.c
# amd_order.c
# amd_control.c
# amd_info.c
# amd_valid.c
# amd_preprocess.c
# )
# target_compile_definitions(amd_integer PUBLIC DINT)
#
#
# add_library(amd_long
# STATIC
# amd_aat.c
# amd_1.c
# amd_2.c
# amd_dump.c
# amd_postorder.c
# amd_defaults.c
# amd_post_tree.c
# amd_order.c
# amd_control.c
# amd_info.c
# amd_valid.c
# amd_preprocess.c
# )
# target_compile_definitions(amd_long PUBLIC DLONG)
#
# target_link_libraries(amd suitesparseconfig amd_integer amd_long)