You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

lapack_build.cmake 7.6 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. cmake_minimum_required(VERSION 2.8.7)
  2. ###################################################################
  3. # The values in this section must always be provided
  4. ###################################################################
  5. if(UNIX)
  6. if(NOT compiler)
  7. set(compiler gcc)
  8. endif(NOT compiler)
  9. if(NOT c_compiler)
  10. set(c_compiler gcc)
  11. endif(NOT c_compiler)
  12. if(NOT full_compiler)
  13. set(full_compiler g++)
  14. endif(NOT full_compiler)
  15. endif(UNIX)
  16. if(EXISTS "/proc/cpuinfo")
  17. set(parallel 1)
  18. file(STRINGS "/proc/cpuinfo" CPUINFO)
  19. foreach(line ${CPUINFO})
  20. if("${line}" MATCHES processor)
  21. math(EXPR parallel "${parallel} + 1")
  22. endif()
  23. endforeach(line)
  24. endif()
  25. if(WIN32)
  26. set(VSLOCATIONS
  27. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\6.0\\Setup;VsCommonDir]/MSDev98/Bin"
  28. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.0\\Setup\\VS;EnvironmentDirectory]"
  29. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VS;EnvironmentDirectory]"
  30. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0;InstallDir]"
  31. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup;Dbghelp_path]"
  32. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VS;EnvironmentDirectory]"
  33. )
  34. set(GENERATORS
  35. "Visual Studio 6"
  36. "Visual Studio 7"
  37. "Visual Studio 7 .NET 2003"
  38. "Visual Studio 8 2005"
  39. "Visual Studio 8 2005"
  40. "Visual Studio 9 2008"
  41. )
  42. set(vstype 0)
  43. foreach(p ${VSLOCATIONS})
  44. get_filename_component(VSPATH ${p} PATH)
  45. if(NOT "${VSPATH}" STREQUAL "/" AND EXISTS "${VSPATH}")
  46. message(" found VS install = ${VSPATH}")
  47. set(genIndex ${vstype})
  48. endif()
  49. math(EXPR vstype "${vstype} +1")
  50. endforeach()
  51. if(NOT DEFINED genIndex)
  52. message(FATAL_ERROR "Could not find installed visual stuido")
  53. endif()
  54. list(GET GENERATORS ${genIndex} GENERATOR)
  55. set(CTEST_CMAKE_GENERATOR "${GENERATOR}")
  56. message("${CTEST_CMAKE_GENERATOR} - found")
  57. set(compiler cl)
  58. endif(WIN32)
  59. find_program(HOSTNAME NAMES hostname)
  60. find_program(UNAME NAMES uname)
  61. # Get the build name and hostname
  62. exec_program(${HOSTNAME} ARGS OUTPUT_VARIABLE hostname)
  63. string(REGEX REPLACE "[/\\\\+<> #]" "-" hostname "${hostname}")
  64. message("HOSTNAME: ${hostname}")
  65. # default to parallel 1
  66. if(NOT DEFINED parallel)
  67. set(parallel 1)
  68. endif(NOT DEFINED parallel)
  69. # find CVS
  70. find_program(SVN svn PATHS $ENV{HOME}/bin /vol/local/bin)
  71. if(NOT SVN)
  72. message(FATAL_ERROR "SVN not found")
  73. endif()
  74. set(CTEST_UPDATE_COMMAND ${SVN})
  75. macro(getuname name flag)
  76. exec_program("${UNAME}" ARGS "${flag}" OUTPUT_VARIABLE "${name}")
  77. string(REGEX REPLACE "[/\\\\+<> #]" "-" "${name}" "${${name}}")
  78. string(REGEX REPLACE "^(......|.....|....|...|..|.).*" "\\1" "${name}" "${${name}}")
  79. endmacro(getuname)
  80. getuname(osname -s)
  81. getuname(osver -v)
  82. getuname(osrel -r)
  83. getuname(cpu -m)
  84. if("${osname}" MATCHES Darwin)
  85. find_program(SW_VER sw_vers)
  86. execute_process(COMMAND "${SW_VER}" -productVersion OUTPUT_VARIABLE osver)
  87. string(REPLACE "\n" "" osver "${osver}")
  88. set(osname "MacOSX")
  89. set(osrel "")
  90. if("${cpu}" MATCHES "Power")
  91. set(cpu "ppc")
  92. endif("${cpu}" MATCHES "Power")
  93. endif("${osname}" MATCHES Darwin)
  94. if(NOT compiler)
  95. message(FATAL_ERROR "compiler must be set")
  96. endif(NOT compiler)
  97. set(BUILDNAME "${osname}${osver}${osrel}${cpu}-${compiler}")
  98. message("BUILDNAME: ${BUILDNAME}")
  99. # this is the cvs module name that should be checked out
  100. set (CTEST_MODULE_NAME lapack)
  101. set (CTEST_DIR_NAME "${CTEST_MODULE_NAME}SVN")
  102. # Settings:
  103. message("NOSPACES = ${NOSPACES}")
  104. if(NOSPACES)
  105. set(CTEST_DASHBOARD_ROOT "$ENV{HOME}/Dashboards/MyTests-${BUILDNAME}")
  106. else(NOSPACES)
  107. set(CTEST_DASHBOARD_ROOT "$ENV{HOME}/Dashboards/My Tests-${BUILDNAME}")
  108. endif(NOSPACES)
  109. set(CTEST_SITE "${hostname}")
  110. set(CTEST_BUILD_NAME "${BUILDNAME}")
  111. set(CTEST_TEST_TIMEOUT "36000")
  112. # CVS command and the checkout command
  113. if(NOT EXISTS "${CTEST_DASHBOARD_ROOT}/${CTEST_DIR_NAME}")
  114. set(CTEST_CHECKOUT_COMMAND
  115. "\"${CTEST_UPDATE_COMMAND}\" co https://icl.cs.utk.edu/svn/lapack-dev/lapack/trunk ${CTEST_DIR_NAME}")
  116. endif(NOT EXISTS "${CTEST_DASHBOARD_ROOT}/${CTEST_DIR_NAME}")
  117. # Set the generator and build configuration
  118. if(NOT DEFINED CTEST_CMAKE_GENERATOR)
  119. set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
  120. endif(NOT DEFINED CTEST_CMAKE_GENERATOR)
  121. set(CTEST_PROJECT_NAME "LAPACK")
  122. set(CTEST_BUILD_CONFIGURATION "Release")
  123. # Extra special variables
  124. set(ENV{DISPLAY} "")
  125. if(CTEST_CMAKE_GENERATOR MATCHES Makefiles)
  126. set(ENV{CC} "${c_compiler}")
  127. set(ENV{FC} "${f_compiler}")
  128. set(ENV{CXX} "${full_compiler}")
  129. endif(CTEST_CMAKE_GENERATOR MATCHES Makefiles)
  130. #----------------------------------------------------------------------------------
  131. # Should not need to edit under this line
  132. #----------------------------------------------------------------------------------
  133. # if you do not want to use the default location for a
  134. # dashboard then set this variable to the directory
  135. # the dashboard should be in
  136. make_directory("${CTEST_DASHBOARD_ROOT}")
  137. # these are the the name of the source and binary directory on disk.
  138. # They will be appended to DASHBOARD_ROOT
  139. set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_DIR_NAME}")
  140. set(CTEST_BINARY_DIRECTORY "${CTEST_SOURCE_DIRECTORY}-${CTEST_BUILD_NAME}")
  141. set(CTEST_NOTES_FILES "${CTEST_NOTES_FILES}"
  142. "${CMAKE_CURRENT_LIST_FILE}"
  143. )
  144. # check for parallel
  145. if(parallel GREATER 10)
  146. if(NOT CTEST_BUILD_COMMAND)
  147. set(CTEST_BUILD_COMMAND "make -j${parallel} -i")
  148. endif(NOT CTEST_BUILD_COMMAND)
  149. message("Use parallel build")
  150. message("CTEST_BUILD_COMMAND: ${CTEST_BUILD_COMMAND}")
  151. message("CTEST_CONFIGURE_COMMAND: ${CTEST_CONFIGURE_COMMAND}")
  152. endif(parallel GREATER 10)
  153. ###################################################################
  154. # Values for the cmake build
  155. ###################################################################
  156. set( CACHE_CONTENTS "
  157. SITE:STRING=${hostname}
  158. BUILDNAME:STRING=${BUILDNAME}
  159. DART_ROOT:PATH=
  160. SVNCOMMAND:FILEPATH=${CTEST_UPDATE_COMMAND}
  161. DROP_METHOD:STRING=https
  162. DART_TESTING_TIMEOUT:STRING=${CTEST_TEST_TIMEOUT}
  163. # Enable LAPACKE
  164. LAPACKE:OPTION=ON
  165. # Use Reference BLAS by default
  166. USE_OPTIMIZED_BLAS:OPTION=OFF
  167. " )
  168. ##########################################################################
  169. # wipe the binary dir
  170. message("Remove binary directory...")
  171. ctest_empty_binary_directory("${CTEST_BINARY_DIRECTORY}")
  172. message("CTest Directory: ${CTEST_DASHBOARD_ROOT}")
  173. message("Initial checkout: ${CTEST_CVS_CHECKOUT}")
  174. message("Initial cmake: ${CTEST_CMAKE_COMMAND}")
  175. message("CTest command: ${CTEST_COMMAND}")
  176. # this is the initial cache to use for the binary tree, be careful to escape
  177. # any quotes inside of this string if you use it
  178. file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" "${CACHE_CONTENTS}")
  179. message("Start dashboard...")
  180. ctest_start(Nightly)
  181. #ctest_start(Experimental)
  182. message(" Update")
  183. ctest_update(SOURCE "${CTEST_SOURCE_DIRECTORY}" RETURN_VALUE res)
  184. message(" Configure")
  185. ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
  186. message("read custom files after configure")
  187. ctest_read_custom_files("${CTEST_BINARY_DIRECTORY}")
  188. message(" Build")
  189. ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
  190. message(" Test")
  191. ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
  192. #ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" INCLUDE "Summary")
  193. message(" Submit")
  194. ctest_submit(RETURN_VALUE res)
  195. message(" All done")