-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
134 lines (115 loc) · 4.09 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
cmake_minimum_required(VERSION 3.0.2)
project(LADEL VERSION 0.1.0)
############################################################
################## Configure directories ###################
############################################################
get_directory_property(hasParent PARENT_DIRECTORY)
if(hasParent)
# Assume the relevant directories have been set
else()
SET(LIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/../lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIB_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
endif()
############################################################
################### Compilation options ####################
############################################################
option (UNITTESTS "Perform unit testing" ON)
option (SIMPLE_COL_COUNTS "Simplify symbolic analysis (worse asymptotic time complexity)" OFF)
if (SIMPLE_COL_COUNTS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSIMPLE_COL_COUNTS")
endif (SIMPLE_COL_COUNTS)
option (LONG "Use long integers for indexing" ON)
if (LONG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDLONG")
endif (LONG)
option (FLOAT "Use single precision instead of double" OFF)
if (FLOAT)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDFLOAT")
endif (FLOAT)
if (UNIX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-conversion -Wno-sign-conversion")
endif (UNIX)
option (AMD "Use approximate minimum degree ordering" ON)
if (AMD)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDAMD")
endif (AMD)
option (PYTHON "Compile for python" OFF)
############################################################
#################### Build the library #####################
############################################################
SET(SRC
src/ladel_global.c
src/ladel_scale.c
src/ladel_matvec.c
src/ladel_matmat.c
src/ladel_upper_diag.c
src/ladel_etree.c
src/ladel_postorder.c
src/ladel_transpose.c
src/ladel_col_counts.c
src/ladel_ldl_symbolic.c
src/ladel_permutation.c
src/ladel_copy.c
src/ladel_ldl_numeric.c
src/ladel_pattern.c
src/ladel.c
src/ladel_rank1_mod.c
src/ladel_row_mod.c
src/ladel_debug_print.c
src/ladel_add.c
src/ladel_submatrix.c)
if (AMD)
SET(AMD_SRC
amd/Source/amd_1.c
amd/Source/amd_control.c
amd/Source/amd_global.c
amd/Source/amd_postorder.c
amd/Source/amd_valid.c
amd/Source/amd_2.c
amd/Source/amd_defaults.c
amd/Source/amd_info.c
amd/Source/amd_post_tree.c
amd/Source/amd_aat.c
amd/Source/amd_dump.c
amd/Source/amd_order.c
amd/Source/amd_preprocess.c
amd/Source/SuiteSparse_config.c)
SET(SRC ${SRC} ${AMD_SRC})
endif (AMD)
add_library(ladel ${SRC})
if ("${CMAKE_INSTALL_LIBDIR}" STREQUAL "")
SET(CMAKE_INSTALL_LIBDIR ${LIB_DIR})
endif()
install(TARGETS ladel
EXPORT ${PROJECT_NAME}
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
if (LONG)
target_compile_options(ladel PUBLIC "-DDLONG")
endif (LONG)
if (AMD)
target_include_directories(ladel
PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include
${CMAKE_CURRENT_LIST_DIR}/amd/Include)
else ()
target_include_directories(ladel
PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
endif (AMD)
if (PYTHON)
find_package(PythonInterp REQUIRED)
# We don't really need the libs, but the headers.
find_package(PythonLibs 3 REQUIRED)
target_include_directories(ladel PUBLIC ${PYTHON_INCLUDE_DIRS})
target_link_libraries(ladel ${PYTHON_LIBRARIES})
endif()
############################################################
#################### Build executables #####################
############################################################
if (UNITTESTS)
add_subdirectory(test)
include(CTest)
enable_testing()
add_test(NAME ladel_tester COMMAND $<TARGET_FILE:ladel_run_all_tests>)
endif()