Add static/dynamic library, package support and rearrange source files
[platform/upstream/lapack.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.6)
2 project(LAPACK Fortran)
3 if (UNIX)
4    if ( "${CMAKE_Fortran_COMPILER}" MATCHES "ifort" )
5   set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fltconsistency -fp_port" )
6    endif ()
7 endif ()
8
9 # --------------------------------------------------
10 # Testing
11
12 enable_testing()
13 include(CTest)
14 enable_testing()
15 # --------------------------------------------------
16
17 set(CMAKE_MODULE_PATH ${LAPACK_SOURCE_DIR} ${CMAKE_MODULE_PATH})
18
19 # --------------------------------------------------
20 # Check second function
21
22 include(CheckTimeFunction)
23 set(TIME_FUNC NONE ${TIME_FUNC})
24 CHECK_TIME_FUNCTION(NONE TIME_FUNC)
25 CHECK_TIME_FUNCTION(INT_CPU_TIME TIME_FUNC)
26 CHECK_TIME_FUNCTION(EXT_ETIME TIME_FUNC)
27 CHECK_TIME_FUNCTION(EXT_ETIME_ TIME_FUNC)
28 CHECK_TIME_FUNCTION(INT_ETIME TIME_FUNC)
29 message(STATUS "--> Will use second_${TIME_FUNC}.f and dsecnd_${TIME_FUNC}.f as timing function.")
30
31 set(SECOND_SRC  ${LAPACK_SOURCE_DIR}/INSTALL/second_${TIME_FUNC}.f)
32 set(DSECOND_SRC  ${LAPACK_SOURCE_DIR}/INSTALL/dsecnd_${TIME_FUNC}.f)
33
34 # --------------------------------------------------
35 # Subdirectories that need to be processed
36
37 add_subdirectory(BLAS)
38 add_subdirectory(SRC)
39 add_subdirectory(TESTING)
40
41 # --------------------------------------------------
42 # CPACK Packaging 
43
44 SET(CPACK_PACKAGE_NAME "LAPACK")
45 SET(CPACK_PACKAGE_VENDOR "University of Tennessee, Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd")
46 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "LAPACK- Linear Algebra Package")
47 set(LAPACK_VERSION 3.2.2)
48 set(CPACK_PACKAGE_VERSION_MAJOR 3)
49 set(CPACK_PACKAGE_VERSION_MINOR 2)
50 set(CPACK_PACKAGE_VERSION_PATCH 2)
51 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
52 SET(CPACK_PACKAGE_INSTALL_DIRECTORY "LAPACK")
53 IF(WIN32 AND NOT UNIX)
54   # There is a bug in NSI that does not handle full unix paths properly. Make
55   # sure there is at least one set of four (4) backlasshes.
56   SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\http://icl.cs.utk.edu/lapack-forum")
57   SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.netlib.org/lapack")
58   SET(CPACK_NSIS_CONTACT "lapack@eecs.utk.edu")
59   SET(CPACK_NSIS_MODIFY_PATH ON)
60   SET(CPACK_NSIS_DISPLAY_NAME "LAPACK-${LAPACK_VERSION}")
61   set(CPACK_PACKAGE_RELOCATABLE "true")
62 ELSE(WIN32 AND NOT UNIX)
63   SET(CPACK_GENERATOR "TGZ")
64   SET(CPACK_SOURCE_GENERATOR TGZ)
65   SET(CPACK_SOURCE_PACKAGE_FILE_NAME "lapack-${LAPACK_VERSION}" )
66   SET(CPACK_SOURCE_IGNORE_FILES ~$ .svn ${CPACK_SOURCE_IGNORE_FILES} )
67 ENDIF(WIN32 AND NOT UNIX)
68 INCLUDE(CPack)
69
70
71 # --------------------------------------------------
72 # By default static library
73 OPTION(BUILD_SHARED_LIBS "Build shared libraries" OFF )
74 #OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON )
75
76 export(TARGETS blas lapack FILE lapack-targets.cmake)
77 configure_file(${LAPACK_SOURCE_DIR}/lapack-config-version.cmake.in
78   ${LAPACK_BINARY_DIR}/lapack-config-version.cmake @ONLY)
79 configure_file(${LAPACK_SOURCE_DIR}/lapack-config.cmake.in
80   ${LAPACK_BINARY_DIR}/lapack-config.cmake @ONLY)