Added function to set defines for the object names (e.g. -DNAME=dgemm).
This commit is contained in:
parent
84b3d760c4
commit
a0aeda6187
|
@ -10,7 +10,7 @@ set(OpenBLAS_PATCH_VERSION 13)
|
|||
set(OpenBLAS_VERSION "${OpenBLAS_MAJOR_VERSION}.${OpenBLAS_MINOR_VERSION}.${OpenBLAS_PATCH_VERSION}")
|
||||
|
||||
# is this necessary? lapack-netlib has its own fortran checks in its CMakeLists.txt
|
||||
#enable_language(Fortran)
|
||||
enable_language(Fortran)
|
||||
|
||||
message(WARNING "CMake support is experimental. This will not produce the same Makefiles that OpenBLAS ships with.")
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 "_")
|
||||
|
|
|
@ -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 ()
|
||||
|
|
|
@ -39,15 +39,16 @@ if (NOT DEFINED NO_FBLAS)
|
|||
set_target_properties(MIN_OBJ PROPERTIES COMPILE_DEFINITIONS "USE_MIN")
|
||||
add_library(MAX_OBJ OBJECT max.c)
|
||||
|
||||
add_library(DBLAS1OBJS OBJECT ${BLAS1_SOURCES})
|
||||
add_library(DBLAS2OBJS OBJECT ${BLAS2_SOURCES})
|
||||
add_library(DBLAS3OBJS OBJECT ${BLAS3_SOURCES})
|
||||
GenerateNamedObjects("${BLAS1_SOURCES}" "DOUBLE" "")
|
||||
GenerateNamedObjects("${BLAS2_SOURCES}" "DOUBLE" "")
|
||||
GenerateNamedObjects("${BLAS3_SOURCES}" "DOUBLE" "")
|
||||
list(APPEND DBLAS_OBJS ${OBJ_LIST_OUT})
|
||||
|
||||
# trmm is trsm with a compiler flag set
|
||||
add_library(TRMM_OBJ OBJECT trsm.c)
|
||||
set_target_properties(TRMM_OBJ PROPERTIES COMPILE_DEFINITIONS "TRMM")
|
||||
|
||||
list(APPEND DBLAS_OBJS "DBLAS1OBJS;DBLAS2OBJS;DBLAS3OBJS;AMAX_OBJ;AMIN_OBJ;MIN_OBJ;MAX_OBJ;TRMM_OBJ")
|
||||
list(APPEND DBLAS_OBJS "AMAX_OBJ;AMIN_OBJ;MIN_OBJ;MAX_OBJ;TRMM_OBJ")
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED NO_CBLAS)
|
||||
|
|
Loading…
Reference in New Issue