Added function to set defines for the object names (e.g. -DNAME=dgemm).
This commit is contained in:
+1
-1
@@ -26,7 +26,7 @@
|
||||
|
||||
# N.B. c_check (and ctest.c) is not cross-platform, so instead try to use CMake variables.
|
||||
|
||||
# TODO: detect NEED_FU
|
||||
# TODO: detect NEED_FU/FU
|
||||
set(NEED_FU 1)
|
||||
|
||||
# Convert CMake vars into the format that OpenBLAS expects
|
||||
|
||||
+1
-2
@@ -27,8 +27,7 @@ if (NOT ONLY_CBLAS)
|
||||
# execute_process(COMMAND perl f_check ${TARGET_MAKE} ${TARGET_CONF} ${CMAKE_Fortran_COMPILER}
|
||||
# WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
||||
|
||||
# TODO: is BU makefile macro needed?
|
||||
# TODO: detect whether underscore needed, set #defines appropriately - use try_compile
|
||||
# TODO: detect whether underscore needed, set #defines and BU appropriately - use try_compile
|
||||
# TODO: set FEXTRALIB flags a la f_check?
|
||||
|
||||
set(BU "_")
|
||||
|
||||
+1
-1
@@ -251,7 +251,7 @@ set(KERNELDIR "${CMAKE_SOURCE_DIR}/kernel/${ARCH}")
|
||||
# include ${CMAKE_SOURCE_DIR}/cmake/${ARCH}.cmake
|
||||
|
||||
# TODO: Need to figure out how to get $(*F) in cmake
|
||||
set(CCOMMON_OPT "${CCOMMON_OPT} -DASMNAME=${FU}$(*F) -DASMFNAME=${FU}$(*F)${BU} -DNAME=$(*F)${BU} -DCNAME=$(*F) -DCHAR_NAME=\"$(*F)${BU}\" -DCHAR_CNAME=\"$(*F)\"")
|
||||
#set(CCOMMON_OPT "${CCOMMON_OPT} -DASMNAME=${FU}$(*F) -DASMFNAME=${FU}$(*F)${BU} -DNAME=$(*F)${BU} -DCNAME=$(*F) -DCHAR_NAME=\"$(*F)${BU}\" -DCHAR_CNAME=\"$(*F)\"")
|
||||
|
||||
if (${CORE} STREQUAL "PPC440")
|
||||
set(CCOMMON_OPT "${CCOMMON_OPT} -DALLOC_QALLOC")
|
||||
|
||||
@@ -88,3 +88,35 @@ function(GenerateObjects sources_in defines_in all_defines_in)
|
||||
set(OBJ_LIST_OUT ${OBJ_LIST_OUT} PARENT_SCOPE)
|
||||
endfunction ()
|
||||
|
||||
# generates object files for each of the sources, using the BLAS naming scheme to pass the funciton name as a preprocessor definition
|
||||
# @param sources_in the source files to build from
|
||||
# @param float_type_in the float type to define for this build (e.g. SINGLE/DOUBLE/etc)
|
||||
# @param defines_in (optional) preprocessor definitions that will be applied to all objects
|
||||
function(GenerateNamedObjects sources_in float_type_in defines_in)
|
||||
set(OBJ_LIST_OUT "")
|
||||
foreach (source_file ${sources_in})
|
||||
|
||||
get_filename_component(source_name ${source_file} NAME_WE)
|
||||
|
||||
string(SUBSTRING ${float_type_in} 0 1 float_char)
|
||||
string(TOLOWER ${float_char} float_char)
|
||||
|
||||
# build a unique variable name for this obj file by picking two letters from the defines (can't use one in this case)
|
||||
set(obj_name "${float_char}${source_name}")
|
||||
|
||||
# parse file name
|
||||
string(REGEX MATCH "^[a-zA-Z_0-9]+" source_name ${source_file})
|
||||
string(TOUPPER ${source_name} source_name)
|
||||
|
||||
# now add the object and set the defines
|
||||
add_library(${obj_name} OBJECT ${source_file})
|
||||
set(obj_defines "ASMNAME=${FU}${obj_name};ASMFNAME=${FU}${obj_name}${BU};NAME=${obj_name}${BU};CNAME=${obj_name};CAR_NAME=\"${obj_name}${BU}\";CHAR_CNAME=\"${obj_name}\"")
|
||||
list(APPEND obj_defines ${defines_in})
|
||||
list(APPEND obj_defines ${float_type_in})
|
||||
set_target_properties(${obj_name} PROPERTIES COMPILE_DEFINITIONS "${obj_defines}")
|
||||
|
||||
list(APPEND OBJ_LIST_OUT ${obj_name})
|
||||
|
||||
endforeach ()
|
||||
set(OBJ_LIST_OUT ${OBJ_LIST_OUT} PARENT_SCOPE)
|
||||
endfunction ()
|
||||
|
||||
Reference in New Issue
Block a user