Fixed cmake building bugs on Linux. Disable LAPACK by default.
This commit is contained in:
parent
a55377e9a4
commit
7ac7e147d4
|
@ -6,10 +6,29 @@ cmake_minimum_required(VERSION 2.8.4)
|
||||||
project(OpenBLAS)
|
project(OpenBLAS)
|
||||||
set(OpenBLAS_MAJOR_VERSION 0)
|
set(OpenBLAS_MAJOR_VERSION 0)
|
||||||
set(OpenBLAS_MINOR_VERSION 2)
|
set(OpenBLAS_MINOR_VERSION 2)
|
||||||
set(OpenBLAS_PATCH_VERSION 13)
|
set(OpenBLAS_PATCH_VERSION 14)
|
||||||
set(OpenBLAS_VERSION "${OpenBLAS_MAJOR_VERSION}.${OpenBLAS_MINOR_VERSION}.${OpenBLAS_PATCH_VERSION}")
|
set(OpenBLAS_VERSION "${OpenBLAS_MAJOR_VERSION}.${OpenBLAS_MINOR_VERSION}.${OpenBLAS_PATCH_VERSION}")
|
||||||
|
|
||||||
enable_language(ASM)
|
enable_language(ASM)
|
||||||
|
enable_language(C)
|
||||||
|
|
||||||
|
set(OpenBLAS_LIBNAME openblas)
|
||||||
|
|
||||||
|
#######
|
||||||
|
option(BUILD_WITHOUT_LAPACK "Without LAPACK and LAPACKE (Only BLAS and CBLAS)" ON)
|
||||||
|
option(BUILD_DEBUG "Build Debug Version" OFF)
|
||||||
|
#######
|
||||||
|
if(BUILD_WITHOUT_LAPACK)
|
||||||
|
set(NO_LAPACK 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(BUILD_DEBUG)
|
||||||
|
set(CMAKE_BUILD_TYPE Debug)
|
||||||
|
else()
|
||||||
|
set(CMAKE_BUILD_TYPE Release)
|
||||||
|
endif()
|
||||||
|
#######
|
||||||
|
|
||||||
|
|
||||||
message(WARNING "CMake support is experimental. This will not produce the same Makefiles that OpenBLAS ships with. Only x86 support is currently available.")
|
message(WARNING "CMake support is experimental. This will not produce the same Makefiles that OpenBLAS ships with. Only x86 support is currently available.")
|
||||||
|
|
||||||
|
@ -32,6 +51,7 @@ endif ()
|
||||||
|
|
||||||
set(SUBDIRS ${BLASDIRS})
|
set(SUBDIRS ${BLASDIRS})
|
||||||
if (NOT NO_LAPACK)
|
if (NOT NO_LAPACK)
|
||||||
|
message ("error 1")
|
||||||
list(APPEND SUBDIRS lapack)
|
list(APPEND SUBDIRS lapack)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
@ -90,15 +110,29 @@ endforeach ()
|
||||||
|
|
||||||
# Can't just use lapack-netlib's CMake files, since they are set up to search for BLAS, build and install a binary. We just want to build a couple of lib files out of lapack and lapacke.
|
# Can't just use lapack-netlib's CMake files, since they are set up to search for BLAS, build and install a binary. We just want to build a couple of lib files out of lapack and lapacke.
|
||||||
# Not using add_subdirectory here because lapack-netlib already has its own CMakeLists.txt. Instead include a cmake script with the sources we want.
|
# Not using add_subdirectory here because lapack-netlib already has its own CMakeLists.txt. Instead include a cmake script with the sources we want.
|
||||||
if (NOT NOFORTRAN)
|
if (NOT NOFORTRAN AND NOT NO_LAPACK)
|
||||||
|
message ("error 2")
|
||||||
include("${CMAKE_SOURCE_DIR}/cmake/lapack.cmake")
|
include("${CMAKE_SOURCE_DIR}/cmake/lapack.cmake")
|
||||||
endif ()
|
|
||||||
if (NOT NO_LAPACKE)
|
if (NOT NO_LAPACKE)
|
||||||
include("${CMAKE_SOURCE_DIR}/cmake/lapacke.cmake")
|
include("${CMAKE_SOURCE_DIR}/cmake/lapacke.cmake")
|
||||||
endif ()
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
# add objects to the openblas lib
|
# add objects to the openblas lib
|
||||||
add_library(openblas ${LA_SOURCES} ${LAPACKE_SOURCES} ${TARGET_OBJS})
|
add_library(${OpenBLAS_LIBNAME} SHARED ${LA_SOURCES} ${LAPACKE_SOURCES} ${TARGET_OBJS})
|
||||||
|
|
||||||
|
#only build shared library for MSVC
|
||||||
|
if(NOT MSVC)
|
||||||
|
add_library(${OpenBLAS_LIBNAME}_static STATIC ${LA_SOURCES} ${LAPACKE_SOURCES} ${TARGET_OBJS})
|
||||||
|
set_target_properties(${OpenBLAS_LIBNAME}_static PROPERTIES OUTPUT_NAME ${OpenBLAS_LIBNAME})
|
||||||
|
set_target_properties(${OpenBLAS_LIBNAME}_static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set_target_properties(${OpenBLAS_LIBNAME} PROPERTIES
|
||||||
|
VERSION ${OpenBLAS_MAJOR_VERSION}.${OpenBLAS_MINOR_VERSION}
|
||||||
|
SOVERSION ${OpenBLAS_MAJOR_VERSION}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# TODO: Why is the config saved here? Is this necessary with CMake?
|
# TODO: Why is the config saved here? Is this necessary with CMake?
|
||||||
#Save the config files for installation
|
#Save the config files for installation
|
||||||
|
|
|
@ -79,10 +79,10 @@ try_compile(GETARCH_RESULT ${GETARCH_DIR}
|
||||||
message(STATUS "Running getarch")
|
message(STATUS "Running getarch")
|
||||||
|
|
||||||
# use the cmake binary w/ the -E param to run a shell command in a cross-platform way
|
# use the cmake binary w/ the -E param to run a shell command in a cross-platform way
|
||||||
execute_process(COMMAND ${GETARCH_BIN} 0 OUTPUT_VARIABLE GETARCH_MAKE_OUT)
|
execute_process(COMMAND ${PROJECT_BINARY_DIR}/${GETARCH_BIN} 0 OUTPUT_VARIABLE GETARCH_MAKE_OUT)
|
||||||
execute_process(COMMAND ${GETARCH_BIN} 1 OUTPUT_VARIABLE GETARCH_CONF_OUT)
|
execute_process(COMMAND ${PROJECT_BINARY_DIR}/${GETARCH_BIN} 1 OUTPUT_VARIABLE GETARCH_CONF_OUT)
|
||||||
|
|
||||||
#message(STATUS "GETARCH results:\n${GETARCH_MAKE_OUT}")
|
message(STATUS "GETARCH results:\n${GETARCH_MAKE_OUT}")
|
||||||
|
|
||||||
# append config data from getarch to the TARGET file and read in CMake vars
|
# append config data from getarch to the TARGET file and read in CMake vars
|
||||||
file(APPEND ${TARGET_CONF} ${GETARCH_CONF_OUT})
|
file(APPEND ${TARGET_CONF} ${GETARCH_CONF_OUT})
|
||||||
|
@ -99,8 +99,8 @@ try_compile(GETARCH2_RESULT ${GETARCH2_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
# use the cmake binary w/ the -E param to run a shell command in a cross-platform way
|
# use the cmake binary w/ the -E param to run a shell command in a cross-platform way
|
||||||
execute_process(COMMAND ${GETARCH2_BIN} 0 OUTPUT_VARIABLE GETARCH2_MAKE_OUT)
|
execute_process(COMMAND ${PROJECT_BINARY_DIR}/${GETARCH2_BIN} 0 OUTPUT_VARIABLE GETARCH2_MAKE_OUT)
|
||||||
execute_process(COMMAND ${GETARCH2_BIN} 1 OUTPUT_VARIABLE GETARCH2_CONF_OUT)
|
execute_process(COMMAND ${PROJECT_BINARY_DIR}/${GETARCH2_BIN} 1 OUTPUT_VARIABLE GETARCH2_CONF_OUT)
|
||||||
|
|
||||||
# append config data from getarch_2nd to the TARGET file and read in CMake vars
|
# append config data from getarch_2nd to the TARGET file and read in CMake vars
|
||||||
file(APPEND ${TARGET_CONF} ${GETARCH2_CONF_OUT})
|
file(APPEND ${TARGET_CONF} ${GETARCH2_CONF_OUT})
|
||||||
|
|
|
@ -16,8 +16,9 @@ else ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
SetDefaultL1()
|
SetDefaultL1()
|
||||||
ParseMakefileVars("${KERNELDIR}/KERNEL.${TARGET_CORE}")
|
SetDefaultL2()
|
||||||
ParseMakefileVars("${KERNELDIR}/KERNEL")
|
ParseMakefileVars("${KERNELDIR}/KERNEL")
|
||||||
|
ParseMakefileVars("${KERNELDIR}/KERNEL.${TARGET_CORE}")
|
||||||
|
|
||||||
if (${ARCH} STREQUAL "x86")
|
if (${ARCH} STREQUAL "x86")
|
||||||
GenerateNamedObjects("${KERNELDIR}/cpuid.S" "" "" false "" "" true)
|
GenerateNamedObjects("${KERNELDIR}/cpuid.S" "" "" false "" "" true)
|
||||||
|
@ -67,7 +68,6 @@ foreach (float_type ${FLOAT_TYPES})
|
||||||
endforeach ()
|
endforeach ()
|
||||||
|
|
||||||
# Makefile.L2
|
# Makefile.L2
|
||||||
SetDefaultL2()
|
|
||||||
GenerateCombinationObjects("generic/symv_k.c" "LOWER" "U" "" 1 "" "" 3)
|
GenerateCombinationObjects("generic/symv_k.c" "LOWER" "U" "" 1 "" "" 3)
|
||||||
GenerateNamedObjects("generic/ger.c" "" "ger_k" false "" "" "" 3)
|
GenerateNamedObjects("generic/ger.c" "" "ger_k" false "" "" "" 3)
|
||||||
foreach (float_type ${FLOAT_TYPES})
|
foreach (float_type ${FLOAT_TYPES})
|
||||||
|
|
Loading…
Reference in New Issue