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