Fixed some typos. Updated c_check to set ARCH and BINARY64/32. Added version variables.tags/v0.2.15^2
| @@ -4,6 +4,10 @@ | |||||
| cmake_minimum_required(VERSION 2.8.4) | cmake_minimum_required(VERSION 2.8.4) | ||||
| project(OpenBLAS) | project(OpenBLAS) | ||||
| set(OpenBLAS_MAJOR_VERSION 0) | |||||
| set(OpenBLAS_MINOR_VERSION 2) | |||||
| 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 | # is this necessary? lapack-netlib has its own fortran checks in its CMakeLists.txt | ||||
| #enable_language(Fortran) | #enable_language(Fortran) | ||||
| @@ -12,7 +12,7 @@ if (${ARCH} STREQUAL "x86" OR ${ARCH} STREQUAL "x86_64") | |||||
| endif () | endif () | ||||
| if (NOT NO_EXPRECISION) | if (NOT NO_EXPRECISION) | ||||
| if (${Fortran_COMPILER_NAME} MATCHES "gfortran.*") | |||||
| if (${CMAKE_Fortran_COMPILER} MATCHES "gfortran.*") | |||||
| # N.B. I'm not sure if CMake differentiates between GCC and LSB -hpa | # N.B. I'm not sure if CMake differentiates between GCC and LSB -hpa | ||||
| if (${CMAKE_C_COMPILER} STREQUAL "GNU" OR ${CMAKE_C_COMPILER} STREQUAL "LSB") | if (${CMAKE_C_COMPILER} STREQUAL "GNU" OR ${CMAKE_C_COMPILER} STREQUAL "LSB") | ||||
| set(EXPRECISION 1) | set(EXPRECISION 1) | ||||
| @@ -86,7 +86,7 @@ if (${ARCH} STREQUAL "ia64") | |||||
| set(NO_BINARY_MODE 1) | set(NO_BINARY_MODE 1) | ||||
| set(BINARY_DEFINED 1) | set(BINARY_DEFINED 1) | ||||
| if (${Fortran_COMPILER_NAME} MATCHES "gfortran.*") | |||||
| if (${CMAKE_Fortran_COMPILER} MATCHES "gfortran.*") | |||||
| if (${CMAKE_C_COMPILER} STREQUAL "GNU") | if (${CMAKE_C_COMPILER} STREQUAL "GNU") | ||||
| # EXPRECISION = 1 | # EXPRECISION = 1 | ||||
| # CCOMMON_OPT += -DEXPRECISION | # CCOMMON_OPT += -DEXPRECISION | ||||
| @@ -4,6 +4,26 @@ | |||||
| ## This is triggered by prebuild.cmake and runs before any of the code is built. | ## This is triggered by prebuild.cmake and runs before any of the code is built. | ||||
| ## Creates config.h and Makefile.conf. | ## Creates config.h and Makefile.conf. | ||||
| # CMake vars set by this file: | |||||
| # OSNAME (use CMAKE_SYSTEM_NAME) | |||||
| # ARCH | |||||
| # C_COMPILER (use CMAKE_C_COMPILER) | |||||
| # BINARY32 | |||||
| # BINARY64 | |||||
| # FU | |||||
| # CROSS_SUFFIX | |||||
| # CROSS | |||||
| # CEXTRALIB | |||||
| # Defines set by this file: | |||||
| # OS_ | |||||
| # ARCH_ | |||||
| # C_ | |||||
| # __32BIT__ | |||||
| # __64BIT__ | |||||
| # FUNDERSCORE | |||||
| # PTHREAD_CREATE_FUNC | |||||
| # N.B. c_check (and ctest.c) is not cross-platform, so instead try to use CMake variables. | # 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 | ||||
| @@ -23,17 +43,25 @@ if (NOT DEFINED BINARY) | |||||
| endif () | endif () | ||||
| endif () | endif () | ||||
| if (BINARY EQUAL 64) | |||||
| set(BINARY64 1) | |||||
| else () | |||||
| set(BINARY32 1) | |||||
| endif () | |||||
| # CMake docs define these: | # CMake docs define these: | ||||
| # CMAKE_SYSTEM_PROCESSOR - The name of the CPU CMake is building for. | # CMAKE_SYSTEM_PROCESSOR - The name of the CPU CMake is building for. | ||||
| # CMAKE_HOST_SYSTEM_PROCESSOR - The name of the CPU CMake is running on. | # CMAKE_HOST_SYSTEM_PROCESSOR - The name of the CPU CMake is running on. | ||||
| set(HOST_ARCH ${CMAKE_SYSTEM_PROCESSOR}) | |||||
| if (${HOST_ARCH} STREQUAL "AMD64") | |||||
| set(HOST_ARCH "X86_64") | |||||
| # | |||||
| # TODO: CMAKE_SYSTEM_PROCESSOR doesn't seem to be correct - instead get it from the compiler a la c_check | |||||
| set(ARCH ${CMAKE_SYSTEM_PROCESSOR}) | |||||
| if (${ARCH} STREQUAL "AMD64") | |||||
| set(ARCH "X86_64") | |||||
| endif () | endif () | ||||
| # If you are using a 32-bit compiler on a 64-bit system CMAKE_SYSTEM_PROCESSOR will be wrong | # If you are using a 32-bit compiler on a 64-bit system CMAKE_SYSTEM_PROCESSOR will be wrong | ||||
| if (${HOST_ARCH} STREQUAL "X86_64" AND BINARY EQUAL 32) | |||||
| set(HOST_ARCH X86) | |||||
| if (${ARCH} STREQUAL "X86_64" AND BINARY EQUAL 32) | |||||
| set(ARCH X86) | |||||
| endif () | endif () | ||||
| set(COMPILER_ID ${CMAKE_CXX_COMPILER_ID}) | set(COMPILER_ID ${CMAKE_CXX_COMPILER_ID}) | ||||
| @@ -43,7 +71,7 @@ endif () | |||||
| file(WRITE ${TARGET_CONF} | file(WRITE ${TARGET_CONF} | ||||
| "#define OS_${HOST_OS}\t1\n" | "#define OS_${HOST_OS}\t1\n" | ||||
| "#define ARCH_${HOST_ARCH}\t1\n" | |||||
| "#define ARCH_${ARCH}\t1\n" | |||||
| "#define C_${COMPILER_ID}\t1\n" | "#define C_${COMPILER_ID}\t1\n" | ||||
| "#define __${BINARY}BIT__\t1\n" | "#define __${BINARY}BIT__\t1\n" | ||||
| "#define FUNDERSCORE\t${NEED_FU}\n") | "#define FUNDERSCORE\t${NEED_FU}\n") | ||||
| @@ -6,8 +6,8 @@ | |||||
| if (${CMAKE_C_COMPILER} STREQUAL "GNU" OR ${CMAKE_C_COMPILER} STREQUAL "LSB" OR ${CMAKE_C_COMPILER} STREQUAL "Clang") | if (${CMAKE_C_COMPILER} STREQUAL "GNU" OR ${CMAKE_C_COMPILER} STREQUAL "LSB" OR ${CMAKE_C_COMPILER} STREQUAL "Clang") | ||||
| set(CCOMMON_OPT "${CCOMMON_OPT} -Wall") | set(CCOMMON_OPT "${CCOMMON_OPT} -Wall") | ||||
| COMMON_PROF += -fno-inline | |||||
| NO_UNINITIALIZED_WARN = -Wno-uninitialized | |||||
| set(COMMON_PROF "${COMMON_PROF} -fno-inline") | |||||
| set(NO_UNINITIALIZED_WARN "-Wno-uninitialized") | |||||
| if (QUIET_MAKE) | if (QUIET_MAKE) | ||||
| set(CCOMMON_OPT "${CCOMMON_OPT} ${NO_UNINITIALIZED_WARN} -Wno-unused") | set(CCOMMON_OPT "${CCOMMON_OPT} ${NO_UNINITIALIZED_WARN} -Wno-unused") | ||||
| @@ -89,8 +89,8 @@ if (${CMAKE_C_COMPILER} STREQUAL "OPEN64") | |||||
| else () | else () | ||||
| set(CCOMMON_OPT "${CCOMMON_OPT} -m64") | set(CCOMMON_OPT "${CCOMMON_OPT} -m64") | ||||
| endif () | endif () | ||||
| endif | |||||
| endif | |||||
| endif () | |||||
| endif () | |||||
| if (${CMAKE_C_COMPILER} STREQUAL "SUN") | if (${CMAKE_C_COMPILER} STREQUAL "SUN") | ||||
| set(CCOMMON_OPT "${CCOMMON_OPT} -w") | set(CCOMMON_OPT "${CCOMMON_OPT} -w") | ||||
| @@ -7,8 +7,20 @@ | |||||
| ## This is triggered by prebuild.cmake and runs before any of the code is built. | ## This is triggered by prebuild.cmake and runs before any of the code is built. | ||||
| ## Appends Fortran information to config.h and Makefile.conf. | ## Appends Fortran information to config.h and Makefile.conf. | ||||
| # CMake vars set by this file: | |||||
| # F_COMPILER | |||||
| # FC | |||||
| # BU | |||||
| # NOFORTRAN | |||||
| # NEED2UNDERSCORES | |||||
| # FEXTRALIB | |||||
| if (NOT ${ONLY_CBLAS}) | |||||
| # Defines set by this file: | |||||
| # BUNDERSCORE | |||||
| # NEEDBUNDERSCORE | |||||
| # NEED2UNDERSCORES | |||||
| if (NOT ONLY_CBLAS) | |||||
| # N.B. f_check is not cross-platform, so instead try to use CMake variables | # N.B. f_check is not cross-platform, so instead try to use CMake variables | ||||
| # run f_check (appends to TARGET files) | # run f_check (appends to TARGET files) | ||||
| # message(STATUS "Running f_check...") | # message(STATUS "Running f_check...") | ||||
| @@ -30,6 +42,7 @@ else () | |||||
| #When we only build CBLAS, we set NOFORTRAN=2 | #When we only build CBLAS, we set NOFORTRAN=2 | ||||
| set(NOFORTRAN 2) | set(NOFORTRAN 2) | ||||
| set(NO_FBLAS 1) | set(NO_FBLAS 1) | ||||
| #set(F_COMPILER GFORTRAN) # CMake handles the fortran compiler | |||||
| set(BU "_") | set(BU "_") | ||||
| file(APPEND ${TARGET_CONF} | file(APPEND ${TARGET_CONF} | ||||
| "#define BUNDERSCORE _\n" | "#define BUNDERSCORE _\n" | ||||
| @@ -3,7 +3,7 @@ | |||||
| ## Description: Ported from portion of OpenBLAS/Makefile.system | ## Description: Ported from portion of OpenBLAS/Makefile.system | ||||
| ## Sets Fortran related variables. | ## Sets Fortran related variables. | ||||
| if (${Fortran_COMPILER_NAME} STREQUAL "G77") | |||||
| if (${CMAKE_Fortran_COMPILER} STREQUAL "G77") | |||||
| set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_G77") | set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_G77") | ||||
| set(FCOMMON_OPT "${FCOMMON_OPT} -Wall") | set(FCOMMON_OPT "${FCOMMON_OPT} -Wall") | ||||
| if (NOT NO_BINARY_MODE) | if (NOT NO_BINARY_MODE) | ||||
| @@ -15,7 +15,7 @@ if (${Fortran_COMPILER_NAME} STREQUAL "G77") | |||||
| endif () | endif () | ||||
| endif () | endif () | ||||
| if (${Fortran_COMPILER_NAME} STREQUAL "G95") | |||||
| if (${CMAKE_Fortran_COMPILER} STREQUAL "G95") | |||||
| set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_G95") | set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_G95") | ||||
| set(FCOMMON_OPT "${FCOMMON_OPT} -Wall") | set(FCOMMON_OPT "${FCOMMON_OPT} -Wall") | ||||
| if (NOT NO_BINARY_MODE) | if (NOT NO_BINARY_MODE) | ||||
| @@ -27,7 +27,7 @@ if (${Fortran_COMPILER_NAME} STREQUAL "G95") | |||||
| endif () | endif () | ||||
| endif () | endif () | ||||
| if (${Fortran_COMPILER_NAME} STREQUAL "GFORTRAN") | |||||
| if (${CMAKE_Fortran_COMPILER} STREQUAL "GFORTRAN") | |||||
| set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_GFORT") | set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_GFORT") | ||||
| set(FCOMMON_OPT "${FCOMMON_OPT} -Wall") | set(FCOMMON_OPT "${FCOMMON_OPT} -Wall") | ||||
| #Don't include -lgfortran, when NO_LAPACK=1 or lsbcc | #Don't include -lgfortran, when NO_LAPACK=1 or lsbcc | ||||
| @@ -58,7 +58,7 @@ if (${Fortran_COMPILER_NAME} STREQUAL "GFORTRAN") | |||||
| endif () | endif () | ||||
| endif () | endif () | ||||
| if (${Fortran_COMPILER_NAME} STREQUAL "INTEL") | |||||
| if (${CMAKE_Fortran_COMPILER} STREQUAL "INTEL") | |||||
| set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_INTEL") | set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_INTEL") | ||||
| if (INTERFACE64) | if (INTERFACE64) | ||||
| set(FCOMMON_OPT "${FCOMMON_OPT} -i8") | set(FCOMMON_OPT "${FCOMMON_OPT} -i8") | ||||
| @@ -68,14 +68,14 @@ if (${Fortran_COMPILER_NAME} STREQUAL "INTEL") | |||||
| endif () | endif () | ||||
| endif () | endif () | ||||
| if (${Fortran_COMPILER_NAME} STREQUAL "FUJITSU") | |||||
| if (${CMAKE_Fortran_COMPILER} STREQUAL "FUJITSU") | |||||
| set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_FUJITSU") | set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_FUJITSU") | ||||
| if (USE_OPENMP) | if (USE_OPENMP) | ||||
| set(FCOMMON_OPT "${FCOMMON_OPT} -openmp") | set(FCOMMON_OPT "${FCOMMON_OPT} -openmp") | ||||
| endif () | endif () | ||||
| endif () | endif () | ||||
| if (${Fortran_COMPILER_NAME} STREQUAL "IBM") | |||||
| if (${CMAKE_Fortran_COMPILER} STREQUAL "IBM") | |||||
| set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_IBM") | set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_IBM") | ||||
| # FCOMMON_OPT += -qarch=440 | # FCOMMON_OPT += -qarch=440 | ||||
| if (BINARY64) | if (BINARY64) | ||||
| @@ -91,7 +91,7 @@ if (${Fortran_COMPILER_NAME} STREQUAL "IBM") | |||||
| endif () | endif () | ||||
| endif () | endif () | ||||
| if (${Fortran_COMPILER_NAME} STREQUAL "PGI") | |||||
| if (${CMAKE_Fortran_COMPILER} STREQUAL "PGI") | |||||
| set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_PGI") | set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_PGI") | ||||
| set(COMMON_PROF "${COMMON_PROF} -DPGICOMPILER") | set(COMMON_PROF "${COMMON_PROF} -DPGICOMPILER") | ||||
| if (BINARY64) | if (BINARY64) | ||||
| @@ -107,7 +107,7 @@ if (${Fortran_COMPILER_NAME} STREQUAL "PGI") | |||||
| endif () | endif () | ||||
| endif () | endif () | ||||
| if (${Fortran_COMPILER_NAME} STREQUAL "PATHSCALE") | |||||
| if (${CMAKE_Fortran_COMPILER} STREQUAL "PATHSCALE") | |||||
| set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_PATHSCALE") | set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_PATHSCALE") | ||||
| if (BINARY64) | if (BINARY64) | ||||
| if (INTERFACE64) | if (INTERFACE64) | ||||
| @@ -134,7 +134,7 @@ if (${Fortran_COMPILER_NAME} STREQUAL "PATHSCALE") | |||||
| endif () | endif () | ||||
| endif () | endif () | ||||
| if (${Fortran_COMPILER_NAME} STREQUAL "OPEN64") | |||||
| if (${CMAKE_Fortran_COMPILER} STREQUAL "OPEN64") | |||||
| set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_OPEN64") | set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_OPEN64") | ||||
| if (BINARY64) | if (BINARY64) | ||||
| @@ -172,7 +172,7 @@ if (${Fortran_COMPILER_NAME} STREQUAL "OPEN64") | |||||
| endif () | endif () | ||||
| endif () | endif () | ||||
| if (${Fortran_COMPILER_NAME} "SUN") | |||||
| if (${CMAKE_Fortran_COMPILER} STREQUAL "SUN") | |||||
| set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_SUN") | set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_SUN") | ||||
| if (${ARCH} STREQUAL "x86") | if (${ARCH} STREQUAL "x86") | ||||
| set(FCOMMON_OPT "${FCOMMON_OPT} -m32") | set(FCOMMON_OPT "${FCOMMON_OPT} -m32") | ||||
| @@ -184,7 +184,7 @@ if (${Fortran_COMPILER_NAME} "SUN") | |||||
| endif () | endif () | ||||
| endif () | endif () | ||||
| if (${Fortran_COMPILER_NAME} STREQUAL "COMPAQ") | |||||
| if (${CMAKE_Fortran_COMPILER} STREQUAL "COMPAQ") | |||||
| set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_COMPAQ") | set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_COMPAQ") | ||||
| if (USE_OPENMP) | if (USE_OPENMP) | ||||
| set(FCOMMON_OPT "${FCOMMON_OPT} -openmp") | set(FCOMMON_OPT "${FCOMMON_OPT} -openmp") | ||||
| @@ -6,19 +6,10 @@ | |||||
| ## Next it runs f_check and appends some fortran information to the files. | ## Next it runs f_check and appends some fortran information to the files. | ||||
| ## Finally it runs getarch and getarch_2nd for even more environment information. | ## Finally it runs getarch and getarch_2nd for even more environment information. | ||||
| # List of vars set by this file and included files: | |||||
| # OSNAME | |||||
| # ARCH | |||||
| # C_COMPILER | |||||
| # BINARY32 | |||||
| # BINARY64 | |||||
| # CEXTRALIB | |||||
| # F_COMPILER | |||||
| # FC | |||||
| # BU | |||||
| # CORE <- REQUIRED | |||||
| # CMake vars set by this file: | |||||
| # CORE | |||||
| # LIBCORE | # LIBCORE | ||||
| # NUM_CORES <- REQUIRED | |||||
| # NUM_CORES | |||||
| # HAVE_MMX | # HAVE_MMX | ||||
| # HAVE_SSE | # HAVE_SSE | ||||
| # HAVE_SSE2 | # HAVE_SSE2 | ||||
| @@ -150,7 +150,7 @@ if (NEED_PIC) | |||||
| set(CCOMMON_OPT "${CCOMMON_OPT} -fPIC") | set(CCOMMON_OPT "${CCOMMON_OPT} -fPIC") | ||||
| endif () | endif () | ||||
| if (${Fortran_COMPILER_NAME} STREQUAL "SUN") | |||||
| if (${CMAKE_Fortran_COMPILER} STREQUAL "SUN") | |||||
| set(FCOMMON_OPT "${FCOMMON_OPT} -pic") | set(FCOMMON_OPT "${FCOMMON_OPT} -pic") | ||||
| else () | else () | ||||
| set(FCOMMON_OPT "${FCOMMON_OPT} -fPIC") | set(FCOMMON_OPT "${FCOMMON_OPT} -fPIC") | ||||
| @@ -186,7 +186,7 @@ endif () | |||||
| if (SMP) | if (SMP) | ||||
| set(CCOMMON_OPT "${CCOMMON_OPT} -DSMP_SERVER") | set(CCOMMON_OPT "${CCOMMON_OPT} -DSMP_SERVER") | ||||
| if (${ARCH} STERQUAL "mips64") | |||||
| if (${ARCH} STREQUAL "mips64") | |||||
| if (NOT ${CORE} STREQUAL "LOONGSON3B") | if (NOT ${CORE} STREQUAL "LOONGSON3B") | ||||
| set(USE_SIMPLE_THREADED_LEVEL3 1) | set(USE_SIMPLE_THREADED_LEVEL3 1) | ||||
| endif () | endif () | ||||
| @@ -299,7 +299,7 @@ if (MIXED_MEMORY_ALLOCATION) | |||||
| set(CCOMMON_OPT "${CCOMMON_OPT} -DMIXED_MEMORY_ALLOCATION") | set(CCOMMON_OPT "${CCOMMON_OPT} -DMIXED_MEMORY_ALLOCATION") | ||||
| endif () | endif () | ||||
| if (${OSNAME} STREQUAL "SunOS") | |||||
| if (${CMAKE_SYSTEM_NAME} STREQUAL "SunOS") | |||||
| set(TAR gtar) | set(TAR gtar) | ||||
| set(PATCH gpatch) | set(PATCH gpatch) | ||||
| set(GREP ggrep) | set(GREP ggrep) | ||||
| @@ -315,8 +315,8 @@ endif () | |||||
| set(AWK awk) | set(AWK awk) | ||||
| set(REVISION "-r${VERSION}") | |||||
| string(REGEX MATCH "[0-9]+\\." MAJOR_VERSION "${VERSION}") | |||||
| set(REVISION "-r${OpenBLAS_VERSION}") | |||||
| set(MAJOR_VERSION ${OpenBLAS_MAJOR_VERSION}) | |||||
| if (DEBUG) | if (DEBUG) | ||||
| set(COMMON_OPT "${COMMON_OPT} -g") | set(COMMON_OPT "${COMMON_OPT} -g") | ||||