Updated level3/CMakeLists with correct defines using all combos.

This commit is contained in:
Hank Anderson 2015-01-30 11:21:50 -06:00
parent dbdca7bf0c
commit a6cf8aafc0
3 changed files with 157 additions and 144 deletions

View File

@ -38,20 +38,19 @@ add_library(DBLAS_NONE OBJECT
# objects that need TRANS set # objects that need TRANS set
add_library(DBLAS_T OBJECT gbmv_k.c ${NU_SOURCES}) add_library(DBLAS_T OBJECT gbmv_k.c ${NU_SOURCES})
set_target_properties(DBLAS_T PROPERTIES COMPILE_DEFINITIONS TRANS) set_target_properties(DBLAS_T PROPERTIES COMPILE_DEFINITIONS "TRANS")
# objects that need LOWER set # objects that need LOWER set
add_library(DBLAS_L OBJECT ${UL_SOURCES}) add_library(DBLAS_L OBJECT ${UL_SOURCES})
set_target_properties(DBLAS_L PROPERTIES COMPILE_DEFINITIONS LOWER) set_target_properties(DBLAS_L PROPERTIES COMPILE_DEFINITIONS "LOWER")
# objects that need UNIT set # objects that need UNIT set
add_library(DBLAS_U OBJECT ${NU_SOURCES}) add_library(DBLAS_U OBJECT ${NU_SOURCES})
set_target_properties(DBLAS_U PROPERTIES COMPILE_DEFINITIONS UNIT) set_target_properties(DBLAS_U PROPERTIES COMPILE_DEFINITIONS "UNIT")
# objects that need TRANS and UNIT set # objects that need TRANS and UNIT set
add_library(DBLAS_TU OBJECT ${NU_SOURCES}) add_library(DBLAS_TU OBJECT ${NU_SOURCES})
set_target_properties(DBLAS_TU PROPERTIES COMPILE_DEFINITIONS UNIT) set_target_properties(DBLAS_TU PROPERTIES COMPILE_DEFINITIONS "UNIT;TRANS")
set_target_properties(DBLAS_TU PROPERTIES COMPILE_DEFINITIONS TRANS)
#if (DEFINED SMP) #if (DEFINED SMP)
# add_library(DBLASOBJS_SMP # add_library(DBLASOBJS_SMP

View File

@ -60,16 +60,31 @@ endfunction ()
# these sources are compiled with combinations of TRANS, UPPER, and UNIT, for 32 combinations total # 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) set(TRM_SOURCES trmm_L.c trmm_R.c trsm_L.c trsm_R.c)
AllCombinations("TRANS UPPER UNIT") AllCombinations("TRANS;UPPER;UNIT")
set(TRM_DEFINE_COMBOS LIST_OUT) set(TRM_DEFINE_COMBOS ${LIST_OUT})
message(STATUS "alcombos result: ${LIST_OUT}") foreach (trm_source ${TRM_SOURCES})
foreach (TRM_SOURCE ${TRM_SOURCES}) foreach (trm_defines ${TRM_DEFINE_COMBOS})
foreach (TRM_DEFINES ${TRM_DEFINE_COMBOS})
string(REGEX MATCH "[a-z]+_[LR]" TRM_NAME ${TRM_SOURCE}) # replace colon separated list with semicolons, this turns it into a CMake list that we can use foreach with
string(TOUPPER ${TRM_NAME} TRM_NAME) string(REPLACE ":" ";" trm_defines ${trm_defines})
# 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}) # build a unique variable name for this obj file by picking two letters from the defines (can't use one in this case)
#set_target_properties(${TRM_NAME}_${TRM_DEFINE}_OBJS PROPERTIES COMPILE_DEFINITIONS ${TRM_DEFINE}) 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 ()
endforeach () endforeach ()

View File

@ -16,12 +16,11 @@ add_library(DBLAS1OBJS OBJECT
# 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. # 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) add_library(AMAX_OBJ OBJECT max.c)
set_target_properties(AMAX_OBJ PROPERTIES COMPILE_DEFINITIONS USE_ABS) set_target_properties(AMAX_OBJ PROPERTIES COMPILE_DEFINITIONS "USE_ABS")
add_library(AMIN_OBJ OBJECT max.c) add_library(AMIN_OBJ OBJECT max.c)
set_target_properties(AMIN_OBJ PROPERTIES COMPILE_DEFINITIONS USE_ABS) set_target_properties(AMIN_OBJ PROPERTIES COMPILE_DEFINITIONS "USE_ABS;USE_MIN")
set_target_properties(AMIN_OBJ PROPERTIES COMPILE_DEFINITIONS USE_MIN)
add_library(MIN_OBJ OBJECT max.c) add_library(MIN_OBJ OBJECT max.c)
set_target_properties(MIN_OBJ PROPERTIES COMPILE_DEFINITIONS USE_MIN) set_target_properties(MIN_OBJ PROPERTIES COMPILE_DEFINITIONS "USE_MIN")
# TODO: USE_NETLIB_GEMV shoudl switch gemv.c to netlib/*gemv.f # TODO: USE_NETLIB_GEMV shoudl switch gemv.c to netlib/*gemv.f
add_library(DBLAS2OBJS OBJECT add_library(DBLAS2OBJS OBJECT