There are a lot of sources for complex float types that are the same names as the real sources, except with z prepended.tags/v0.2.15^2
| @@ -92,8 +92,6 @@ endforeach () | |||
| # get obj vars into format that add_library likes: $<TARGET_OBJS:objlib> (see http://www.cmake.org/cmake/help/v3.0/command/add_library.html) | |||
| set(TARGET_OBJS "") | |||
| foreach (DBLAS_OBJ ${DBLAS_OBJS}) | |||
| #get_target_property(PREV_DEFS ${DBLAS_OBJ} COMPILE_DEFINITIONS) | |||
| #set_target_properties(${DBLAS_OBJ} PROPERTIES COMPILE_DEFINITIONS "${PREV_DEFS};DOUBLE") | |||
| list(APPEND TARGET_OBJS "$<TARGET_OBJECTS:${DBLAS_OBJ}>") | |||
| endforeach () | |||
| @@ -70,6 +70,11 @@ endfunction () | |||
| # @param replace_last_with replaces the last character in the filename with this string (e.g. symm_k should be symm_TU) | |||
| # @param append_with appends the filename with this string (e.g. trmm_R should be trmm_RTUU or some other combination of characters) | |||
| # @param no_float_type turns off the float type define for this build (e.g. SINGLE/DOUBLE/etc) | |||
| # @param complex_only/real_only some routines have separate source files for complex and non-complex float types. | |||
| # 0 - compiles for all types | |||
| # 1 - compiles the sources for non-complex types only (SINGLE/DOUBLE) | |||
| # 2 - compiles for complex types only (COMPLEX/DOUBLE COMPLEX) | |||
| # 3 - compiles for all types, but changes source names for complex by prepending z (e.g. axpy.c becomes zaxpy.c) | |||
| function(GenerateNamedObjects sources_in) | |||
| if (DEFINED ARGV1) | |||
| @@ -100,10 +105,30 @@ function(GenerateNamedObjects sources_in) | |||
| set(no_float_type false) | |||
| endif () | |||
| set(real_only false) | |||
| set(complex_only false) | |||
| set(mangle_complex_sources false) | |||
| if (DEFINED ARGV7) | |||
| if (${ARGV7} EQUAL 1) | |||
| set(real_only true) | |||
| elseif (${ARGV7} EQUAL 2) | |||
| set(complex_only true) | |||
| elseif (${ARGV7} EQUAL 3) | |||
| set(mangle_complex_sources true) | |||
| endif () | |||
| endif () | |||
| if (no_float_type) | |||
| set(float_list "DUMMY") # still need to loop once | |||
| else () | |||
| set(float_list "${FLOAT_TYPES}") | |||
| if (complex_only) | |||
| list(REMOVE_ITEM float_list "SINGLE") | |||
| list(REMOVE_ITEM float_list "DOUBLE") | |||
| elseif (real_only) | |||
| list(REMOVE_ITEM float_list "COMPLEX") | |||
| list(REMOVE_ITEM float_list "ZCOMPLEX") | |||
| endif () | |||
| endif () | |||
| set(OBJ_LIST_OUT "") | |||
| @@ -148,6 +173,12 @@ function(GenerateNamedObjects sources_in) | |||
| endif () | |||
| if (${float_type} STREQUAL "COMPLEX" OR ${float_type} STREQUAL "ZCOMPLEX") | |||
| list(APPEND obj_defines "COMPLEX") | |||
| if (mangle_complex_sources) | |||
| # add a z to the filename | |||
| get_filename_component(source_name ${source_file} NAME) | |||
| get_filename_component(source_dir ${source_file} DIRECTORY) | |||
| string(REPLACE ${source_name} "z${source_name}" source_file ${source_file}) | |||
| endif () | |||
| endif () | |||
| add_library(${obj_name} OBJECT ${source_file}) | |||
| @@ -2,15 +2,25 @@ | |||
| include_directories(${CMAKE_SOURCE_DIR}) | |||
| set(BLAS1_SOURCES | |||
| copy.c | |||
| asum.c nrm2.c | |||
| ) | |||
| set(BLAS1_REAL_ONLY_SOURCES | |||
| rotm.c rotmg.c # N.B. these do not have complex counterparts | |||
| ) | |||
| # these will have 'z' prepended for the complex version | |||
| set(BLAS1_MANGLED_SOURCES | |||
| axpy.c swap.c | |||
| copy.c scal.c | |||
| scal.c | |||
| dot.c | |||
| asum.c nrm2.c | |||
| rot.c rotg.c rotm.c rotmg.c | |||
| rot.c rotg.c | |||
| axpby.c | |||
| ) | |||
| # TODO: USE_NETLIB_GEMV shoudl switch gemv.c to netlib/*gemv.f | |||
| # these all have 'z' sources for complex versions | |||
| set(BLAS2_SOURCES | |||
| gemv.c ger.c | |||
| trsv.c trmv.c symv.c | |||
| @@ -24,6 +34,9 @@ set(BLAS2_SOURCES | |||
| set(BLAS3_SOURCES | |||
| gemm.c symm.c | |||
| trsm.c syrk.c syr2k.c | |||
| ) | |||
| set(BLAS3_MANGLED_SOURCES | |||
| omatcopy.c imatcopy.c | |||
| ) | |||
| @@ -41,8 +54,11 @@ endif () | |||
| foreach (CBLAS_FLAG ${CBLAS_FLAGS}) | |||
| GenerateNamedObjects("${BLAS1_SOURCES}" "" "" ${CBLAS_FLAG}) | |||
| GenerateNamedObjects("${BLAS2_SOURCES}" "" "" ${CBLAS_FLAG}) | |||
| GenerateNamedObjects("${BLAS1_REAL_ONLY_SOURCES}" "" "" ${CBLAS_FLAG} "" "" 0 1) | |||
| GenerateNamedObjects("${BLAS1_MANGLED_SOURCES}" "" "" ${CBLAS_FLAG} "" "" 0 3) | |||
| GenerateNamedObjects("${BLAS2_SOURCES}" "" "" ${CBLAS_FLAG} "" "" 0 3) | |||
| GenerateNamedObjects("${BLAS3_SOURCES}" "" "" ${CBLAS_FLAG}) | |||
| GenerateNamedObjects("${BLAS3_MANGLED_SOURCES}" "" "" ${CBLAS_FLAG} "" "" 0 3) | |||
| # trmm is trsm with a compiler flag set | |||
| GenerateNamedObjects("trsm.c" "TRMM" "trmm" ${CBLAS_FLAG}) | |||
| @@ -62,11 +78,18 @@ endforeach () | |||
| if (NOT DEFINED NO_LAPACK) | |||
| set(LAPACK_SOURCES | |||
| lapack/gesv.c | |||
| ) | |||
| # prepend z for complex versions | |||
| set(LAPACK_MANGLED_SOURCES | |||
| lapack/getrf.c lapack/getrs.c lapack/potrf.c lapack/getf2.c | |||
| lapack/potf2.c lapack/laswp.c lapack/gesv.c lapack/lauu2.c | |||
| lapack/potf2.c lapack/laswp.c lapack/lauu2.c | |||
| lapack/lauum.c lapack/trti2.c lapack/trtri.c | |||
| ) | |||
| GenerateNamedObjects("${LAPACK_SOURCES}") | |||
| GenerateNamedObjects("${LAPACK_MANGLED_SOURCES}" "" "" 0 "" "" 0 3) | |||
| endif () | |||
| set(DBLAS_OBJS ${DBLAS_OBJS} PARENT_SCOPE) # list append removes the scope from DBLAS_OBJS | |||