-\r
-include_directories(${CMAKE_SOURCE_DIR})\r
-\r
-# sources that need to be compiled twice, once with no flags and once with LOWER\r
-set(UL_SOURCES\r
- sbmv_k.c\r
- spmv_k.c\r
- spr_k.c\r
- spr2_k.c\r
- syr_k.c\r
- syr2_k.c\r
-)\r
-\r
-# sources that need to be compiled several times, for UNIT, TRANS\r
-set(NU_SOURCES\r
- tbmv_U.c\r
- tbsv_U.c\r
- tpmv_U.c\r
- tpsv_U.c\r
- trmv_U.c\r
- trsv_U.c\r
- tbmv_L.c \r
- tbsv_L.c \r
- tpmv_L.c \r
- tpsv_L.c \r
- trmv_L.c \r
- trsv_L.c \r
-)\r
-\r
-# first compile all the objects that don't need specific preprocessor defines\r
-add_library(DBLAS_NONE OBJECT\r
- gbmv_k.c # gbmv_N\r
- ${UL_SOURCES}\r
- ${NU_SOURCES}\r
-)\r
-\r
-# then do objects with transpose/triangular/etc definitions\r
-\r
-# objects that need TRANS set\r
-add_library(DBLAS_T OBJECT gbmv_k.c ${NU_SOURCES})\r
-set_target_properties(DBLAS_T PROPERTIES COMPILE_DEFINITIONS TRANS)\r
-\r
-# objects that need LOWER set\r
-add_library(DBLAS_L OBJECT ${UL_SOURCES})\r
-set_target_properties(DBLAS_L PROPERTIES COMPILE_DEFINITIONS LOWER)\r
-\r
-# objects that need UNIT set\r
-add_library(DBLAS_U OBJECT ${NU_SOURCES})\r
-set_target_properties(DBLAS_U PROPERTIES COMPILE_DEFINITIONS UNIT)\r
-\r
-# objects that need TRANS and UNIT set\r
-add_library(DBLAS_TU OBJECT ${NU_SOURCES})\r
-set_target_properties(DBLAS_TU PROPERTIES COMPILE_DEFINITIONS UNIT)\r
-set_target_properties(DBLAS_TU PROPERTIES COMPILE_DEFINITIONS TRANS)\r
-\r
-#if (DEFINED SMP)\r
-# add_library(DBLASOBJS_SMP \r
-# dgemv_thread_n.c dgemv_thread_t.c \r
-# dger_thread.c \r
-# dsymv_thread_U.c dsymv_thread_L.c \r
-# dsyr_thread_U.c dsyr_thread_L.c \r
-# dsyr2_thread_U.c dsyr2_thread_L.c \r
-# dspr_thread_U.c dspr_thread_L.c \r
-# dspr2_thread_U.c dspr2_thread_L.c \r
-# dtrmv_thread_NUU.c dtrmv_thread_NUN.c \r
-# dtrmv_thread_NLU.c dtrmv_thread_NLN.c \r
-# dtrmv_thread_TUU.c dtrmv_thread_TUN.c \r
-# dtrmv_thread_TLU.c dtrmv_thread_TLN.c \r
-# dspmv_thread_U.c dspmv_thread_L.c \r
-# dtpmv_thread_NUU.c dtpmv_thread_NUN.c \r
-# dtpmv_thread_NLU.c dtpmv_thread_NLN.c \r
-# dtpmv_thread_TUU.c dtpmv_thread_TUN.c \r
-# dtpmv_thread_TLU.c dtpmv_thread_TLN.c \r
-# dgbmv_thread_n.c dgbmv_thread_t.c \r
-# dsbmv_thread_U.c dsbmv_thread_L.c \r
-# dtbmv_thread_NUU.c dtbmv_thread_NUN.c \r
-# dtbmv_thread_NLU.c dtbmv_thread_NLN.c \r
-# dtbmv_thread_TUU.c dtbmv_thread_TUN.c \r
-# dtbmv_thread_TLU.c dtbmv_thread_TLN.c \r
-# )\r
-#endif ()\r
-\r
-set(DBLAS_TARGETS DBLAS_NONE DBLAS_T DBLAS_L DBLAS_U DBLAS_TU)\r
-\r
-foreach (DBLAS_TARGET ${DBLAS_TARGETS})\r
- set_target_properties(${DBLAS_TARGET} PROPERTIES COMPILE_DEFINITIONS DOUBLE)\r
-endforeach ()\r
-\r
+
+include_directories(${CMAKE_SOURCE_DIR})
+
+# sources that need to be compiled twice, once with no flags and once with LOWER
+set(UL_SOURCES
+ sbmv_k.c
+ spmv_k.c
+ spr_k.c
+ spr2_k.c
+ syr_k.c
+ syr2_k.c
+)
+
+# sources that need to be compiled several times, for UNIT, TRANS
+set(NU_SOURCES
+ tbmv_U.c
+ tbsv_U.c
+ tpmv_U.c
+ tpsv_U.c
+ trmv_U.c
+ trsv_U.c
+ tbmv_L.c
+ tbsv_L.c
+ tpmv_L.c
+ tpsv_L.c
+ trmv_L.c
+ trsv_L.c
+)
+
+# first compile all the objects that don't need specific preprocessor defines
+add_library(DBLAS_NONE OBJECT
+ gbmv_k.c # gbmv_N
+ ${UL_SOURCES}
+ ${NU_SOURCES}
+)
+
+# then do objects with transpose/triangular/etc definitions
+
+# objects that need TRANS set
+add_library(DBLAS_T OBJECT gbmv_k.c ${NU_SOURCES})
+set_target_properties(DBLAS_T PROPERTIES COMPILE_DEFINITIONS "TRANS")
+
+# objects that need LOWER set
+add_library(DBLAS_L OBJECT ${UL_SOURCES})
+set_target_properties(DBLAS_L PROPERTIES COMPILE_DEFINITIONS "LOWER")
+
+# objects that need UNIT set
+add_library(DBLAS_U OBJECT ${NU_SOURCES})
+set_target_properties(DBLAS_U PROPERTIES COMPILE_DEFINITIONS "UNIT")
+
+# objects that need TRANS and UNIT set
+add_library(DBLAS_TU OBJECT ${NU_SOURCES})
+set_target_properties(DBLAS_TU PROPERTIES COMPILE_DEFINITIONS "UNIT;TRANS")
+
+#if (DEFINED SMP)
+# add_library(DBLASOBJS_SMP
+# dgemv_thread_n.c dgemv_thread_t.c
+# dger_thread.c
+# dsymv_thread_U.c dsymv_thread_L.c
+# dsyr_thread_U.c dsyr_thread_L.c
+# dsyr2_thread_U.c dsyr2_thread_L.c
+# dspr_thread_U.c dspr_thread_L.c
+# dspr2_thread_U.c dspr2_thread_L.c
+# dtrmv_thread_NUU.c dtrmv_thread_NUN.c
+# dtrmv_thread_NLU.c dtrmv_thread_NLN.c
+# dtrmv_thread_TUU.c dtrmv_thread_TUN.c
+# dtrmv_thread_TLU.c dtrmv_thread_TLN.c
+# dspmv_thread_U.c dspmv_thread_L.c
+# dtpmv_thread_NUU.c dtpmv_thread_NUN.c
+# dtpmv_thread_NLU.c dtpmv_thread_NLN.c
+# dtpmv_thread_TUU.c dtpmv_thread_TUN.c
+# dtpmv_thread_TLU.c dtpmv_thread_TLN.c
+# dgbmv_thread_n.c dgbmv_thread_t.c
+# dsbmv_thread_U.c dsbmv_thread_L.c
+# dtbmv_thread_NUU.c dtbmv_thread_NUN.c
+# dtbmv_thread_NLU.c dtbmv_thread_NLN.c
+# dtbmv_thread_TUU.c dtbmv_thread_TUN.c
+# dtbmv_thread_TLU.c dtbmv_thread_TLN.c
+# )
+#endif ()
+
+set(DBLAS_TARGETS DBLAS_NONE DBLAS_T DBLAS_L DBLAS_U DBLAS_TU)
+
+foreach (DBLAS_TARGET ${DBLAS_TARGETS})
+ set_target_properties(${DBLAS_TARGET} PROPERTIES COMPILE_DEFINITIONS DOUBLE)
+endforeach ()
+
# these sources are compiled with combinations of TRANS, UPPER, and UNIT, for 32 combinations total
set(TRM_SOURCES trmm_L.c trmm_R.c trsm_L.c trsm_R.c)
-AllCombinations("TRANS UPPER UNIT")
-set(TRM_DEFINE_COMBOS LIST_OUT)
-message(STATUS "alcombos result: ${LIST_OUT}")
-foreach (TRM_SOURCE ${TRM_SOURCES})
- foreach (TRM_DEFINES ${TRM_DEFINE_COMBOS})
- string(REGEX MATCH "[a-z]+_[LR]" TRM_NAME ${TRM_SOURCE})
- string(TOUPPER ${TRM_NAME} TRM_NAME)
- # TODO: TRM_DEFINES is a colon-separated list of defines to set for this object - need to parse it and set them using set_target_properties, and also come up with a unique id for the lib name (e.g. first letter of each define, so TRANS UPPER UNIT is TUU)
- #add_library(${TRM_NAME}_${TRM_DEFINE}_OBJS OBJECT ${TRM_SOURCE})
- #set_target_properties(${TRM_NAME}_${TRM_DEFINE}_OBJS PROPERTIES COMPILE_DEFINITIONS ${TRM_DEFINE})
+AllCombinations("TRANS;UPPER;UNIT")
+set(TRM_DEFINE_COMBOS ${LIST_OUT})
+foreach (trm_source ${TRM_SOURCES})
+ foreach (trm_defines ${TRM_DEFINE_COMBOS})
+
+ # replace colon separated list with semicolons, this turns it into a CMake list that we can use foreach with
+ string(REPLACE ":" ";" trm_defines ${trm_defines})
+
+ # build a unique variable name for this obj file by picking two letters from the defines (can't use one in this case)
+ set(trm_obj_name "")
+ foreach (trm_define ${trm_defines})
+ string(REGEX MATCH "^[A-Z][A-Z]" letter ${trm_define})
+ set(trm_obj_name "${trm_obj_name}${letter}")
+ endforeach ()
+
+ # parse file name
+ string(REGEX MATCH "[a-z]+_[LR]" trm_name ${trm_source})
+ string(TOUPPER ${trm_name} trm_name)
+
+ # prepend the uppercased file name to the obj name
+ set(trm_obj_name "${trm_name}_${trm_obj_name}_OBJS")
+
+ # now add the object and set the defines
+ add_library(${trm_obj_name} OBJECT ${trm_source})
+ set_target_properties(${trm_obj_name} PROPERTIES COMPILE_DEFINITIONS "${trm_defines}")
endforeach ()
endforeach ()
-\r
-include_directories(${CMAKE_SOURCE_DIR})\r
-\r
-# TODO: Need to generate object files for S, D, C, Q and X - start with D for now.\r
-# The sources are the same, but there are additional preprocessor definitions depending on the precision (see Makefile.tail).\r
-\r
-add_library(DBLAS1OBJS OBJECT\r
- axpy.c swap.c \r
- copy.c scal.c \r
- dot.c\r
- asum.c nrm2.c \r
- max.c # amax/min/amin compiled later from same source\r
- rot.c rotg.c rotm.c rotmg.c \r
- axpby.c\r
-)\r
-\r
-# N.B. The original Makefile passed in -UUSE_MIN and -UUSE_ABS (where appropriate), no way to do that at a source-level in cmake. REMOVE_DEFINITIONS removes a definition for the rest of the compilation.\r
-add_library(AMAX_OBJ OBJECT max.c)\r
-set_target_properties(AMAX_OBJ PROPERTIES COMPILE_DEFINITIONS USE_ABS)\r
-add_library(AMIN_OBJ OBJECT max.c)\r
-set_target_properties(AMIN_OBJ PROPERTIES COMPILE_DEFINITIONS USE_ABS)\r
-set_target_properties(AMIN_OBJ PROPERTIES COMPILE_DEFINITIONS USE_MIN)\r
-add_library(MIN_OBJ OBJECT max.c)\r
-set_target_properties(MIN_OBJ PROPERTIES COMPILE_DEFINITIONS USE_MIN)\r
-\r
-# TODO: USE_NETLIB_GEMV shoudl switch gemv.c to netlib/*gemv.f\r
-add_library(DBLAS2OBJS OBJECT\r
- gemv.c ger.c \r
- trsv.c trmv.c symv.c \r
- syr.c syr2.c gbmv.c \r
- sbmv.c spmv.c \r
- spr.c spr2.c \r
- tbsv.c tbmv.c \r
- tpsv.c tpmv.c\r
-)\r
-\r
-add_library(DBLAS3OBJS OBJECT\r
- gemm.c symm.c\r
- trsm.c syrk.c syr2k.c \r
- omatcopy.c imatcopy.c\r
-)\r
-\r
-# trmm is trsm with a compiler flag set\r
-add_library(TRMM_OBJ OBJECT trsm.c)\r
-set_target_properties(TRMM_OBJ PROPERTIES COMPILE_DEFINITIONS TRMM)\r
-\r
+
+include_directories(${CMAKE_SOURCE_DIR})
+
+# TODO: Need to generate object files for S, D, C, Q and X - start with D for now.
+# The sources are the same, but there are additional preprocessor definitions depending on the precision (see Makefile.tail).
+
+add_library(DBLAS1OBJS OBJECT
+ axpy.c swap.c
+ copy.c scal.c
+ dot.c
+ asum.c nrm2.c
+ max.c # amax/min/amin compiled later from same source
+ rot.c rotg.c rotm.c rotmg.c
+ axpby.c
+)
+
+# N.B. The original Makefile passed in -UUSE_MIN and -UUSE_ABS (where appropriate), no way to do that at a source-level in cmake. REMOVE_DEFINITIONS removes a definition for the rest of the compilation.
+add_library(AMAX_OBJ OBJECT max.c)
+set_target_properties(AMAX_OBJ PROPERTIES COMPILE_DEFINITIONS "USE_ABS")
+add_library(AMIN_OBJ OBJECT max.c)
+set_target_properties(AMIN_OBJ PROPERTIES COMPILE_DEFINITIONS "USE_ABS;USE_MIN")
+add_library(MIN_OBJ OBJECT max.c)
+set_target_properties(MIN_OBJ PROPERTIES COMPILE_DEFINITIONS "USE_MIN")
+
+# TODO: USE_NETLIB_GEMV shoudl switch gemv.c to netlib/*gemv.f
+add_library(DBLAS2OBJS OBJECT
+ gemv.c ger.c
+ trsv.c trmv.c symv.c
+ syr.c syr2.c gbmv.c
+ sbmv.c spmv.c
+ spr.c spr2.c
+ tbsv.c tbmv.c
+ tpsv.c tpmv.c
+)
+
+add_library(DBLAS3OBJS OBJECT
+ gemm.c symm.c
+ trsm.c syrk.c syr2k.c
+ omatcopy.c imatcopy.c
+)
+
+# trmm is trsm with a compiler flag set
+add_library(TRMM_OBJ OBJECT trsm.c)
+set_target_properties(TRMM_OBJ PROPERTIES COMPILE_DEFINITIONS TRMM)
+