cmake fixes
[platform/upstream/openblas.git] / lapack / CMakeLists.txt
1
2 include_directories(${PROJECT_SOURCE_DIR})
3 include_directories(${PROJECT_BINARY_DIR})
4
5 list (REMOVE_ITEM FLOAT_TYPES "HALF")
6
7 set(LAPACK_SOURCES
8   potrf/potrf_U_single.c
9   potrf/potrf_L_single.c
10   lauum/lauum_U_single.c
11   lauum/lauum_L_single.c
12 )
13
14 # add a 'z' to filename for complex version
15 set(LAPACK_MANGLED_SOURCES
16   getf2/getf2_k.c
17   lauu2/lauu2_U.c
18   lauu2/lauu2_L.c
19   potf2/potf2_U.c
20   potf2/potf2_L.c
21 )
22
23 # sources that need TRANS set
24 # this has a 'z' version
25 set(TRANS_SOURCES
26   getrs/getrs_single.c
27 )
28
29 # sources that need UNIT set
30 # these do NOT have a z version
31 set(UNIT_SOURCES
32   trtri/trtri_U_single.c
33   trtri/trtri_L_single.c
34 )
35
36 # these have a 'z' version
37 set(UNIT_SOURCES2
38   trti2/trti2_U.c
39   trti2/trti2_L.c
40 )
41
42 GenerateNamedObjects("${LAPACK_SOURCES}")
43 GenerateNamedObjects("${LAPACK_MANGLED_SOURCES}" "" "" false "" "" false 3)
44
45 GenerateNamedObjects("laswp/generic/laswp_k_4.c" "" "laswp_plus" false "" ""  false 3)
46 GenerateNamedObjects("laswp/generic/laswp_k_4.c" "MINUS" "laswp_minus" false "" ""  false 3)
47
48 foreach (float_type ${FLOAT_TYPES})
49 if (${float_type} STREQUAL "HALF")
50  continue()
51 endif()
52 GenerateNamedObjects("getrf/getrf_single.c" "UNIT" "getrf_single" false "" "" false ${float_type})
53 endforeach ()
54
55 # dynamic_arch laswp needs arch specific code ?
56 #foreach(TARGET_CORE ${DYNAMIC_CORE})
57 #      set(TSUFFIX "_${TARGET_CORE}")
58 #
59 #GenerateNamedObjects("laswp/generic/laswp_k_4.c" "" "laswp_plus" false "" ${TSUFFIX}  false 3)
60 #GenerateNamedObjects("laswp/generic/laswp_k_4.c" "MINUS" "laswp_minus" false "" ${TSUFFIX}  false 3)
61 #endforeach ()
62
63 if (USE_THREAD)
64
65   if (USE_OPENMP)
66     set(GETRF_SRC getrf/getrf_parallel_omp.c)
67   else ()
68     set(GETRF_SRC getrf/getrf_parallel.c)
69   endif ()
70
71   # these do not have 'z' versions
72   set(PARALLEL_SOURCES
73     lauum/lauum_U_parallel.c
74     lauum/lauum_L_parallel.c
75     potrf/potrf_U_parallel.c
76     potrf/potrf_L_parallel.c
77   )
78
79   # this has a z version
80   list(APPEND TRANS_SOURCES
81     getrs/getrs_parallel.c
82   )
83
84   # these do NOT have a z version
85   list(APPEND UNIT_SOURCES
86     trtri/trtri_U_parallel.c
87     trtri/trtri_L_parallel.c
88   )
89
90   foreach (float_type ${FLOAT_TYPES})
91     GenerateNamedObjects("${GETRF_SRC}" "UNIT" "getrf_parallel" false "" "" false ${float_type})
92   endforeach()
93
94   GenerateNamedObjects("${PARALLEL_SOURCES}")
95 endif ()
96
97 foreach (float_type ${FLOAT_TYPES})
98   if (${float_type} STREQUAL "COMPLEX" OR ${float_type} STREQUAL "ZCOMPLEX")
99     foreach (trans_src ${TRANS_SOURCES})
100       string(REGEX MATCH "[a-z]/([a-z]+_)([a-z]+)" op_name ${trans_src})
101       string(REPLACE "/" "/z" ztrans_src ${trans_src})
102       GenerateNamedObjects("${ztrans_src}" "TRANS=1" "${CMAKE_MATCH_1}N_${CMAKE_MATCH_2}" false "" "" false ${float_type})
103       GenerateNamedObjects("${ztrans_src}" "TRANS=2" "${CMAKE_MATCH_1}T_${CMAKE_MATCH_2}" false "" "" false ${float_type})
104       GenerateNamedObjects("${ztrans_src}" "TRANS=3" "${CMAKE_MATCH_1}R_${CMAKE_MATCH_2}" false "" "" false ${float_type})
105       GenerateNamedObjects("${ztrans_src}" "TRANS=4" "${CMAKE_MATCH_1}C_${CMAKE_MATCH_2}" false "" "" false ${float_type})
106     endforeach ()
107   else ()
108     GenerateCombinationObjects("${TRANS_SOURCES}" "TRANS" "N" "" 4 "" false ${float_type})
109   endif ()
110 endforeach ()
111
112 GenerateCombinationObjects("${UNIT_SOURCES}" "UNIT" "N" "" 4)
113 GenerateCombinationObjects("${UNIT_SOURCES2}" "UNIT" "N" "" 0 "" "" 3)
114
115 add_library(lapack OBJECT ${OPENBLAS_SRC})
116