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