Merge pull request #893 from biddisco/develop

Replace CMAKE_SOURCE_DIR/CMAKE_BINARY_DIR with PROJECT_SOURCE_DIR/PRO…
This commit is contained in:
Zhang Xianyi 2016-05-30 14:52:58 +08:00
commit 2daad2bcb5
16 changed files with 41 additions and 41 deletions

View File

@ -45,8 +45,8 @@ 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.")
include("${CMAKE_SOURCE_DIR}/cmake/utils.cmake") include("${PROJECT_SOURCE_DIR}/cmake/utils.cmake")
include("${CMAKE_SOURCE_DIR}/cmake/system.cmake") include("${PROJECT_SOURCE_DIR}/cmake/system.cmake")
set(BLASDIRS interface driver/level2 driver/level3 driver/others) set(BLASDIRS interface driver/level2 driver/level3 driver/others)
@ -123,9 +123,9 @@ 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 AND NOT NO_LAPACK) if (NOT NOFORTRAN AND NOT NO_LAPACK)
include("${CMAKE_SOURCE_DIR}/cmake/lapack.cmake") include("${PROJECT_SOURCE_DIR}/cmake/lapack.cmake")
if (NOT NO_LAPACKE) if (NOT NO_LAPACKE)
include("${CMAKE_SOURCE_DIR}/cmake/lapacke.cmake") include("${PROJECT_SOURCE_DIR}/cmake/lapacke.cmake")
endif () endif ()
endif () endif ()
@ -137,7 +137,7 @@ endif()
# add objects to the openblas lib # add objects to the openblas lib
add_library(${OpenBLAS_LIBNAME} SHARED ${LA_SOURCES} ${LAPACKE_SOURCES} ${TARGET_OBJS} ${OpenBLAS_DEF_FILE}) add_library(${OpenBLAS_LIBNAME} SHARED ${LA_SOURCES} ${LAPACKE_SOURCES} ${TARGET_OBJS} ${OpenBLAS_DEF_FILE})
include("${CMAKE_SOURCE_DIR}/cmake/export.cmake") include("${PROJECT_SOURCE_DIR}/cmake/export.cmake")
# Set output for libopenblas # Set output for libopenblas
set_target_properties( ${OpenBLAS_LIBNAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) set_target_properties( ${OpenBLAS_LIBNAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)

View File

@ -53,7 +53,7 @@ endif()
add_custom_command( add_custom_command(
TARGET ${OpenBLAS_LIBNAME} PRE_LINK TARGET ${OpenBLAS_LIBNAME} PRE_LINK
COMMAND perl COMMAND perl
ARGS "${CMAKE_SOURCE_DIR}/exports/gensymbol" "win2k" "${ARCH_IN}" "dummy" "${EXPRECISION_IN}" "${NO_CBLAS_IN}" "${NO_LAPACK_IN}" "${NO_LAPACKE_IN}" "${NEED2UNDERSCORES_IN}" "${ONLY_CBLAS_IN}" "${SYMBOLPREFIX}" "${SYMBOLSUFFIX}" > "${PROJECT_BINARY_DIR}/openblas.def" ARGS "${PROJECT_SOURCE_DIR}/exports/gensymbol" "win2k" "${ARCH_IN}" "dummy" "${EXPRECISION_IN}" "${NO_CBLAS_IN}" "${NO_LAPACK_IN}" "${NO_LAPACKE_IN}" "${NEED2UNDERSCORES_IN}" "${ONLY_CBLAS_IN}" "${SYMBOLPREFIX}" "${SYMBOLSUFFIX}" > "${PROJECT_BINARY_DIR}/openblas.def"
COMMENT "Create openblas.def file" COMMENT "Create openblas.def file"
VERBATIM) VERBATIM)

View File

@ -50,20 +50,20 @@ else()
set(TARGET_CONF "config.h") set(TARGET_CONF "config.h")
endif () endif ()
include("${CMAKE_SOURCE_DIR}/cmake/c_check.cmake") include("${PROJECT_SOURCE_DIR}/cmake/c_check.cmake")
if (NOT NOFORTRAN) if (NOT NOFORTRAN)
include("${CMAKE_SOURCE_DIR}/cmake/f_check.cmake") include("${PROJECT_SOURCE_DIR}/cmake/f_check.cmake")
endif () endif ()
# compile getarch # compile getarch
set(GETARCH_SRC set(GETARCH_SRC
${CMAKE_SOURCE_DIR}/getarch.c ${PROJECT_SOURCE_DIR}/getarch.c
${CPUIDEMO} ${CPUIDEMO}
) )
if (NOT MSVC) if (NOT MSVC)
list(APPEND GETARCH_SRC ${CMAKE_SOURCE_DIR}/cpuid.S) list(APPEND GETARCH_SRC ${PROJECT_SOURCE_DIR}/cpuid.S)
endif () endif ()
if (MSVC) if (MSVC)
@ -76,7 +76,7 @@ set(GETARCH_BIN "getarch${CMAKE_EXECUTABLE_SUFFIX}")
file(MAKE_DIRECTORY ${GETARCH_DIR}) file(MAKE_DIRECTORY ${GETARCH_DIR})
try_compile(GETARCH_RESULT ${GETARCH_DIR} try_compile(GETARCH_RESULT ${GETARCH_DIR}
SOURCES ${GETARCH_SRC} SOURCES ${GETARCH_SRC}
COMPILE_DEFINITIONS ${EXFLAGS} ${GETARCH_FLAGS} -I${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS ${EXFLAGS} ${GETARCH_FLAGS} -I${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE GETARCH_LOG OUTPUT_VARIABLE GETARCH_LOG
COPY_FILE ${PROJECT_BINARY_DIR}/${GETARCH_BIN} COPY_FILE ${PROJECT_BINARY_DIR}/${GETARCH_BIN}
) )
@ -97,8 +97,8 @@ set(GETARCH2_DIR "${PROJECT_BINARY_DIR}/getarch2_build")
set(GETARCH2_BIN "getarch_2nd${CMAKE_EXECUTABLE_SUFFIX}") set(GETARCH2_BIN "getarch_2nd${CMAKE_EXECUTABLE_SUFFIX}")
file(MAKE_DIRECTORY ${GETARCH2_DIR}) file(MAKE_DIRECTORY ${GETARCH2_DIR})
try_compile(GETARCH2_RESULT ${GETARCH2_DIR} try_compile(GETARCH2_RESULT ${GETARCH2_DIR}
SOURCES ${CMAKE_SOURCE_DIR}/getarch_2nd.c SOURCES ${PROJECT_SOURCE_DIR}/getarch_2nd.c
COMPILE_DEFINITIONS ${EXFLAGS} ${GETARCH_FLAGS} ${GETARCH2_FLAGS} -I${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS ${EXFLAGS} ${GETARCH_FLAGS} ${GETARCH2_FLAGS} -I${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE GETARCH2_LOG OUTPUT_VARIABLE GETARCH2_LOG
COPY_FILE ${PROJECT_BINARY_DIR}/${GETARCH2_BIN} COPY_FILE ${PROJECT_BINARY_DIR}/${GETARCH2_BIN}
) )

View File

@ -3,7 +3,7 @@
## Description: Ported from OpenBLAS/Makefile.system ## Description: Ported from OpenBLAS/Makefile.system
## ##
set(NETLIB_LAPACK_DIR "${CMAKE_SOURCE_DIR}/lapack-netlib") set(NETLIB_LAPACK_DIR "${PROJECT_SOURCE_DIR}/lapack-netlib")
# TODO: Makefile.system detects Darwin (mac) and switches to clang here -hpa # TODO: Makefile.system detects Darwin (mac) and switches to clang here -hpa
# http://stackoverflow.com/questions/714100/os-detecting-makefile # http://stackoverflow.com/questions/714100/os-detecting-makefile
@ -78,7 +78,7 @@ else ()
set(ONLY_CBLAS 0) set(ONLY_CBLAS 0)
endif () endif ()
include("${CMAKE_SOURCE_DIR}/cmake/prebuild.cmake") include("${PROJECT_SOURCE_DIR}/cmake/prebuild.cmake")
if (NOT DEFINED NUM_THREADS) if (NOT DEFINED NUM_THREADS)
set(NUM_THREADS ${NUM_CORES}) set(NUM_THREADS ${NUM_CORES})
@ -124,17 +124,17 @@ set(OBJCOPY "${CROSS_SUFFIX}objcopy")
set(OBJCONV "${CROSS_SUFFIX}objconv") set(OBJCONV "${CROSS_SUFFIX}objconv")
# OS dependent settings # OS dependent settings
include("${CMAKE_SOURCE_DIR}/cmake/os.cmake") include("${PROJECT_SOURCE_DIR}/cmake/os.cmake")
# Architecture dependent settings # Architecture dependent settings
include("${CMAKE_SOURCE_DIR}/cmake/arch.cmake") include("${PROJECT_SOURCE_DIR}/cmake/arch.cmake")
# C Compiler dependent settings # C Compiler dependent settings
include("${CMAKE_SOURCE_DIR}/cmake/cc.cmake") include("${PROJECT_SOURCE_DIR}/cmake/cc.cmake")
if (NOT NOFORTRAN) if (NOT NOFORTRAN)
# Fortran Compiler dependent settings # Fortran Compiler dependent settings
include("${CMAKE_SOURCE_DIR}/cmake/fc.cmake") include("${PROJECT_SOURCE_DIR}/cmake/fc.cmake")
endif () endif ()
if (BINARY64) if (BINARY64)
@ -247,10 +247,10 @@ if (NOT DEFINED SYMBOLSUFFIX)
set(SYMBOLSUFFIX "") set(SYMBOLSUFFIX "")
endif () endif ()
set(KERNELDIR "${CMAKE_SOURCE_DIR}/kernel/${ARCH}") set(KERNELDIR "${PROJECT_SOURCE_DIR}/kernel/${ARCH}")
# TODO: nead to convert these Makefiles # TODO: nead to convert these Makefiles
# include ${CMAKE_SOURCE_DIR}/cmake/${ARCH}.cmake # include ${PROJECT_SOURCE_DIR}/cmake/${ARCH}.cmake
if (${CORE} STREQUAL "PPC440") if (${CORE} STREQUAL "PPC440")
set(CCOMMON_OPT "${CCOMMON_OPT} -DALLOC_QALLOC") set(CCOMMON_OPT "${CCOMMON_OPT} -DALLOC_QALLOC")
@ -410,8 +410,8 @@ set(LIBDEFNAME "${LIBNAME}.${LIBSUFFIX}.def")
set(LIBEXPNAME "${LIBNAME}.${LIBSUFFIX}.exp") set(LIBEXPNAME "${LIBNAME}.${LIBSUFFIX}.exp")
set(LIBZIPNAME "${LIBNAME}.${LIBSUFFIX}.zip") set(LIBZIPNAME "${LIBNAME}.${LIBSUFFIX}.zip")
set(LIBS "${CMAKE_SOURCE_DIR}/${LIBNAME}") set(LIBS "${PROJECT_SOURCE_DIR}/${LIBNAME}")
set(LIBS_P "${CMAKE_SOURCE_DIR}/${LIBNAME_P}") set(LIBS_P "${PROJECT_SOURCE_DIR}/${LIBNAME_P}")
set(LIB_COMPONENTS BLAS) set(LIB_COMPONENTS BLAS)

View File

@ -1,4 +1,4 @@
include_directories(${CMAKE_SOURCE_DIR}) include_directories(${PROJECT_SOURCE_DIR})
enable_language(Fortran) enable_language(Fortran)

View File

@ -1,5 +1,5 @@
include_directories(${CMAKE_SOURCE_DIR}) include_directories(${PROJECT_SOURCE_DIR})
# sources that need to be compiled twice, once with no flags and once with LOWER # sources that need to be compiled twice, once with no flags and once with LOWER
set(UL_SOURCES set(UL_SOURCES

View File

@ -1,4 +1,4 @@
include_directories(${CMAKE_SOURCE_DIR}) include_directories(${PROJECT_SOURCE_DIR})
# N.B. In the original makefile there was a BLOCKS define used in the compilation of these files but I don't see any evidence of it being set anywhere. -hpa # N.B. In the original makefile there was a BLOCKS define used in the compilation of these files but I don't see any evidence of it being set anywhere. -hpa

View File

@ -1,4 +1,4 @@
include_directories(${CMAKE_SOURCE_DIR}) include_directories(${PROJECT_SOURCE_DIR})
if (${CORE} STREQUAL "PPC440") if (${CORE} STREQUAL "PPC440")
set(MEMORY memory_qalloc.c) set(MEMORY memory_qalloc.c)

View File

@ -1,5 +1,5 @@
include_directories(${CMAKE_SOURCE_DIR}) include_directories(${PROJECT_SOURCE_DIR})
set(BLAS1_SOURCES set(BLAS1_SOURCES

View File

@ -1,6 +1,6 @@
include_directories(${CMAKE_SOURCE_DIR}) include_directories(${PROJECT_SOURCE_DIR})
include("${CMAKE_SOURCE_DIR}/cmake/kernel.cmake") include("${PROJECT_SOURCE_DIR}/cmake/kernel.cmake")
# Makefile # Makefile

View File

@ -18,7 +18,7 @@
macro( _CHECK_FORTRAN_TYPE_SIZE _TYPE_NAME _TEST_SIZES ) macro( _CHECK_FORTRAN_TYPE_SIZE _TYPE_NAME _TEST_SIZES )
foreach( __TEST_SIZE ${_TEST_SIZES} ) foreach( __TEST_SIZE ${_TEST_SIZES} )
set( __TEST_FILE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortran${_TYPE_NAME}Size${__TEST_SIZE}.f90 ) set( __TEST_FILE ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortran${_TYPE_NAME}Size${__TEST_SIZE}.f90 )
file( WRITE ${__TEST_FILE} file( WRITE ${__TEST_FILE}
" "
PROGRAM check_size PROGRAM check_size
@ -27,7 +27,7 @@ macro( _CHECK_FORTRAN_TYPE_SIZE _TYPE_NAME _TEST_SIZES )
pa => a pa => a
END PROGRAM END PROGRAM
") ")
try_compile( SIZEOF_${_TYPE_NAME} ${CMAKE_BINARY_DIR} ${__TEST_FILE} ) try_compile( SIZEOF_${_TYPE_NAME} ${PROJECT_BINARY_DIR} ${__TEST_FILE} )
if( SIZEOF_${_TYPE_NAME} ) if( SIZEOF_${_TYPE_NAME} )
message( STATUS "Testing default ${_TYPE_NAME}*${__TEST_SIZE} - found" ) message( STATUS "Testing default ${_TYPE_NAME}*${__TEST_SIZE} - found" )
set( SIZEOF_${_TYPE_NAME} ${__TEST_SIZE} CACHE INTERNAL "Size of the default ${_TYPE_NAME} type" FORCE ) set( SIZEOF_${_TYPE_NAME} ${__TEST_SIZE} CACHE INTERNAL "Size of the default ${_TYPE_NAME} type" FORCE )

View File

@ -16,11 +16,11 @@ macro(CHECK_TIME_FUNCTION FUNCTION VARIABLE)
if(RES) if(RES)
set(${VARIABLE} ${FUNCTION} CACHE INTERNAL "Have Fortran function ${FUNCTION}") set(${VARIABLE} ${FUNCTION} CACHE INTERNAL "Have Fortran function ${FUNCTION}")
message(STATUS "Looking for Fortran ${FUNCTION} - found") message(STATUS "Looking for Fortran ${FUNCTION} - found")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log file(APPEND ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Fortran ${FUNCTION} exists. ${OUTPUT} \n\n") "Fortran ${FUNCTION} exists. ${OUTPUT} \n\n")
else(RES) else(RES)
message(STATUS "Looking for Fortran ${FUNCTION} - not found") message(STATUS "Looking for Fortran ${FUNCTION} - not found")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log file(APPEND ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Fortran ${FUNCTION} does not exist. \n ${OUTPUT} \n") "Fortran ${FUNCTION} does not exist. \n ${OUTPUT} \n")
endif(RES) endif(RES)
endmacro(CHECK_TIME_FUNCTION) endmacro(CHECK_TIME_FUNCTION)

View File

@ -43,7 +43,7 @@ MESSAGE(STATUS "Testing FORTRAN_MANGLING")
MESSAGE(STATUS "Compiling Finface.f...") MESSAGE(STATUS "Compiling Finface.f...")
execute_process ( COMMAND ${CMAKE_Fortran_COMPILER} ${F77_OPTION_COMPILE} ${PROJECT_SOURCE_DIR}/lapacke/mangling/Fintface.f execute_process ( COMMAND ${CMAKE_Fortran_COMPILER} ${F77_OPTION_COMPILE} ${PROJECT_SOURCE_DIR}/lapacke/mangling/Fintface.f
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp WORKING_DIRECTORY ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
OUTPUT_VARIABLE OUTPUT OUTPUT_VARIABLE OUTPUT
RESULT_VARIABLE RESULT RESULT_VARIABLE RESULT
ERROR_VARIABLE ERROR) ERROR_VARIABLE ERROR)
@ -58,7 +58,7 @@ MESSAGE(STATUS "Compiling Finface.f...")
MESSAGE(STATUS "Compiling Cintface.c...") MESSAGE(STATUS "Compiling Cintface.c...")
execute_process ( COMMAND ${CMAKE_C_COMPILER} ${F77_OPTION_COMPILE} ${PROJECT_SOURCE_DIR}/lapacke/mangling/Cintface.c execute_process ( COMMAND ${CMAKE_C_COMPILER} ${F77_OPTION_COMPILE} ${PROJECT_SOURCE_DIR}/lapacke/mangling/Cintface.c
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp WORKING_DIRECTORY ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
OUTPUT_VARIABLE OUTPUT OUTPUT_VARIABLE OUTPUT
RESULT_VARIABLE RESULT RESULT_VARIABLE RESULT
ERROR_VARIABLE ERROR) ERROR_VARIABLE ERROR)
@ -73,7 +73,7 @@ MESSAGE(STATUS "Compiling Cintface.c...")
MESSAGE(STATUS "Linking Finface.f and Cintface.c...") MESSAGE(STATUS "Linking Finface.f and Cintface.c...")
execute_process ( COMMAND ${CMAKE_Fortran_COMPILER} ${F77_OUTPUT_OBJ} xintface.exe Fintface.o Cintface.o execute_process ( COMMAND ${CMAKE_Fortran_COMPILER} ${F77_OUTPUT_OBJ} xintface.exe Fintface.o Cintface.o
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp WORKING_DIRECTORY ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
OUTPUT_VARIABLE OUTPUT OUTPUT_VARIABLE OUTPUT
RESULT_VARIABLE RESULT RESULT_VARIABLE RESULT
ERROR_VARIABLE ERROR) ERROR_VARIABLE ERROR)
@ -88,7 +88,7 @@ MESSAGE(STATUS "Linking Finface.f and Cintface.c...")
MESSAGE(STATUS "Running ./xintface...") MESSAGE(STATUS "Running ./xintface...")
execute_process ( COMMAND ./xintface.exe execute_process ( COMMAND ./xintface.exe
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp WORKING_DIRECTORY ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
RESULT_VARIABLE xintface_RES RESULT_VARIABLE xintface_RES
OUTPUT_VARIABLE xintface_OUT OUTPUT_VARIABLE xintface_OUT
ERROR_VARIABLE xintface_ERR) ERROR_VARIABLE xintface_ERR)

View File

@ -1,5 +1,5 @@
include_directories(${CMAKE_SOURCE_DIR}) include_directories(${PROJECT_SOURCE_DIR})
set(LAPACK_SOURCES set(LAPACK_SOURCES

View File

@ -1,4 +1,4 @@
include_directories(${CMAKE_SOURCE_DIR}) include_directories(${PROJECT_SOURCE_DIR})
enable_language(Fortran) enable_language(Fortran)

View File

@ -1,4 +1,4 @@
include_directories(${CMAKE_SOURCE_DIR}) include_directories(${PROJECT_SOURCE_DIR})
set(OpenBLAS_utest_src set(OpenBLAS_utest_src
utest_main.c utest_main.c