message(FATAL_ERROR "Detecting CPU failed. Please set TARGET explicitly, e.g. make TARGET=your_cpu_target. Please read README for details.")
endif ()
-# Let CMake handle this
-#if (${NOFORTRAN})
-# message(ERROR "OpenBLAS: Detecting fortran compiler failed. Please install fortran compiler, e.g. gfortran, ifort, openf90.")
-#endif ()
-
if (${NO_STATIC} AND ${NO_SHARED})
message(FATAL_ERROR "Neither static nor shared are enabled.")
endif ()
-set(DBLAS_OBJS "")
-foreach (SUBDIR ${SUBDIRS})
- add_subdirectory(${SUBDIR})
-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})
- list(APPEND TARGET_OBJS "$<TARGET_OBJECTS:${DBLAS_OBJ}>")
+foreach (SUBDIR ${SUBDIRS})
+ add_subdirectory(${SUBDIR})
+ string(REPLACE "/" "_" subdir_obj ${SUBDIR})
+ list(APPEND TARGET_OBJS "$<TARGET_OBJECTS:${subdir_obj}>")
endforeach ()
# netlib:
endfunction ()
# Reads a Makefile into CMake vars.
-# TODO: respect IFDEF/IFNDEF?
macro(ParseMakefileVars MAKEFILE_IN)
message(STATUS "Reading vars from ${MAKEFILE_IN}...")
file(STRINGS ${MAKEFILE_IN} makefile_contents)
endif ()
endif ()
- add_library(${obj_name} OBJECT ${source_file})
- set_target_properties(${obj_name} PROPERTIES COMPILE_DEFINITIONS "${obj_defines}")
+ if (VERBOSE_GEN)
+ message(STATUS "${obj_name}:${source_file}")
+ message(STATUS "${obj_defines}")
+ endif ()
+
+ # create a copy of the source to avoid duplicate obj filename problem with ar.exe
+ get_filename_component(source_extension ${source_file} EXT)
+ set(new_source_file "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${obj_name}${source_extension}")
+ if (IS_ABSOLUTE ${source_file})
+ set(old_source_file ${source_file})
+ else ()
+ set(old_source_file "${CMAKE_CURRENT_LIST_DIR}/${source_file}")
+ endif ()
- list(APPEND OBJ_LIST_OUT ${obj_name})
+ string(REPLACE ";" "\n#define " define_source "${obj_defines}")
+ string(REPLACE "=" " " define_source "${define_source}")
+ file(WRITE ${new_source_file} "#define ${define_source}\n#include \"${old_source_file}\"")
+ list(APPEND SRC_LIST_OUT ${new_source_file})
endforeach ()
endforeach ()
- list(APPEND DBLAS_OBJS ${OBJ_LIST_OUT})
- set(DBLAS_OBJS ${DBLAS_OBJS} PARENT_SCOPE)
+ list(APPEND OPENBLAS_SRC ${SRC_LIST_OUT})
+ set(OPENBLAS_SRC ${OPENBLAS_SRC} PARENT_SCOPE)
endfunction ()
# generates object files for each of the sources for each of the combinations of the preprocessor definitions passed in
set(define_combos ${LIST_OUT})
set(define_codes ${CODES_OUT})
- set(COMBO_OBJ_LIST_OUT "")
list(LENGTH define_combos num_combos)
math(EXPR num_combos "${num_combos} - 1")
endif ()
GenerateNamedObjects("${source_file}" "${cur_defines}" "${alternate_name}" false "${replace_code}" "${append_code}" "${no_float_type}" "${complex_filename_scheme}")
- list(APPEND COMBO_OBJ_LIST_OUT "${OBJ_LIST_OUT}")
endforeach ()
endforeach ()
- set(DBLAS_OBJS ${DBLAS_OBJS} PARENT_SCOPE)
+ set(OPENBLAS_SRC ${OPENBLAS_SRC} PARENT_SCOPE)
endfunction ()
#COMMONOBJS += profile.$(SUFFIX)
#endif
-add_library(COMMON_OBJS OBJECT
- ${MEMORY}
- ${SMP_SOURCES}
- ${COMMON_SOURCES}
-)
-
-list(APPEND DBLAS_OBJS "COMMON_OBJS")
-
#LIBOTHERS = libothers.$(LIBSUFFIX)
#ifeq ($(DYNAMIC_ARCH), 1)
#HPLOBJS = memory.$(SUFFIX) xerbla.$(SUFFIX) parameter.$(SUFFIX)
#endif
-set(DBLAS_OBJS ${DBLAS_OBJS} PARENT_SCOPE) # list append removes the scope from DBLAS_OBJS
-
+add_library(driver_others OBJECT ${OPENBLAS_SRC} ${MEMORY} ${SMP_SOURCES} ${COMMON_SOURCES})