Debian Codegraph @

debian/external_deps/fetk/punc/src/CMakeLists.txt

raw
1 ##########
2 # CMakeLists.txt for FETK/punc/src
3 ##########
4
5 # Initial setup for build
6 setup_for_build()
7
8 #####
9 # Included dependencies (if externals are missing)
10 #####
11
12 # optional build of vf2c
13 if(BUILD_VF2C)
14 include_directories(vf2c vf2c/punc)
15 add_subdirectory(vf2c)
16 list(APPEND PUNC_INT_LIBS vf2c)
17 endif()
18
19 # optional build of cgcode
20 if(BUILD_CGCODE)
21 include_directories(cgcode)
22 add_subdirectory(cgcode)
23 list(APPEND PUNC_INT_LIBS cgcode)
24 endif()
25
26 # optional build of pmg
27 if(BUILD_PMG)
28 include_directories(pmg)
29 add_subdirectory(pmg)
30 list(APPEND PUNC_INT_LIBS pmg)
31 endif()
32
33 # optional build of blas
34 if(BUILD_BLAS)
35 include_directories(blas)
36 add_subdirectory(blas)
37 list(APPEND PUNC_INT_LIBS blas)
38 else()
39 list(APPEND PUNC_EXT_LIBS ${BLAS_LIBRARIES})
40 endif()
41
42 # optional build of arpack
43 if(BUILD_ARPACK)
44 include_directories(arpack)
45 add_subdirectory(arpack)
46 list(APPEND PUNC_INT_LIBS arpack)
47 else()
48 list(APPEND PUNC_EXT_LIBS ${ARPACK_LIBRARIES})
49 endif()
50
51 # optional build of superlu (actual build takes place below)
52 if(BUILD_SUPERLU)
53 #include_directories(superlu)
54 set(XSDK_ENABLE_Fortran OFF)
55 set(enable_tests OFF)
56 FetchContent_Declare( superlu
57 GIT_REPOSITORY https://github.com/xiaoyeli/superlu.git
58 GIT_TAG e8ed45225963c85a708c129bbcec17ec745d09f5
59 )
60 FetchContent_MakeAvailable( superlu )
61 include_directories(${superlu_SOURCE_DIR}/SRC)
62 list(APPEND PUNC_INT_LIBS superlu)
63 else()
64 include_directories(${SUPERLU_INCLUDES})
65 list(APPEND PUNC_EXT_LIBS ${SUPERLU_LIBRARIES})
66 endif()
67
68
69 #####
70 # Build and install punc
71 #####
72
73 include_directories(${CMAKE_CURRENT_BINARY_DIR})
74 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
75 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/base)
76
77 configure_file(
78 ${CMAKE_CURRENT_SOURCE_DIR}/config/punccf.h.in
79 ${CMAKE_CURRENT_BINARY_DIR}/punccf.h
80 )
81 add_build_items(
82 TYPE INTERNAL_HEADERS
83 ITEMS ${CMAKE_CURRENT_BINARY_DIR}/punccf.h
84 )
85
86 add_subdirectory(base)
87
88 #message(STATUS "PUNC/src")
89 #message(STATUS "With sources: ${SOURCES}")
90 #message(STATUS "With external headers: ${EXTERNAL_HEADERS}")
91 #message(STATUS "With internal headers: ${INTERNAL_HEADERS}")
92 if(${SOURCES})
93 message(FATAL_ERROR "The SOURCES variable should be empty because the PUNC build is currently setup to create an interface library. If there are actual PUNC sources, this library should be made into an actual library")
94 endif()
95
96 add_library(punc ${SOURCES} ${EXTERNAL_HEADERS} ${INTERNAL_HEADERS})
97 set_target_properties(punc PROPERTIES
98 VERSION ${punc_VERSION}
99 SOVERSION ${punc_VERSION_MAJOR}.${punc_VERSION_MINOR})
100 target_link_libraries(punc ${PUNC_EXT_LIBS} ${PUNC_INT_LIBS})
101
102 get_target_property( SOURCE_TREE_INCLUDE_DIRS punc INCLUDE_DIRECTORIES )
103 target_include_directories( punc
104 INTERFACE
105 "$<BUILD_INTERFACE:${SOURCE_TREE_INCLUDE_DIRS}>"
106 "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
107 )
108
109 install(FILES ${EXTERNAL_HEADERS} ${INTERNAL_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
110 install(TARGETS punc DESTINATION ${CMAKE_INSTALL_LIBDIR})