blob: 8235b44b6fd7c9d1236050e53442c26a7eda5e0f [file] [log] [blame]
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -07001CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12 FATAL_ERROR)
Marat Dukhan3645b922017-10-13 17:03:35 -04002
3INCLUDE(GNUInstallDirs)
4
5# ---[ Project and semantic versioning.
Marat Dukhan63d41a52017-10-26 00:37:12 +00006PROJECT(cpuinfo C CXX)
Marat Dukhan3645b922017-10-13 17:03:35 -04007
8# ---[ Options.
Marat Dukhandaafc282018-01-31 23:55:05 -08009SET(CPUINFO_LIBRARY_TYPE "default" CACHE STRING "Type of cpuinfo library (shared, static, or default) to build")
10SET_PROPERTY(CACHE CPUINFO_LIBRARY_TYPE PROPERTY STRINGS default static shared)
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -070011OPTION(CPUINFO_BUILD_TOOLS "Build command-line tools" ON)
Marat Dukhancc44bf32017-12-18 17:45:48 -080012OPTION(CPUINFO_BUILD_UNIT_TESTS "Build cpuinfo unit tests" ON)
13OPTION(CPUINFO_BUILD_MOCK_TESTS "Build cpuinfo mock tests" ON)
14OPTION(CPUINFO_BUILD_BENCHMARKS "Build cpuinfo micro-benchmarks" ON)
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -070015
16# ---[ CMake options
17IF(CPUINFO_BUILD_UNIT_TESTS OR CPUINFO_BUILD_MOCK_TESTS)
18 ENABLE_TESTING()
19ENDIF()
Marat Dukhan3645b922017-10-13 17:03:35 -040020
Marat Dukhancddf01b2018-02-25 01:37:55 +010021MACRO(CPUINFO_TARGET_ENABLE_C99 target)
22 IF(${CMAKE_VERSION} VERSION_LESS "3.1")
23 IF(NOT MSVC)
24 TARGET_COMPILE_OPTIONS(${target} PRIVATE -std=c99)
25 ENDIF()
26 ELSE()
27 SET_TARGET_PROPERTIES(${target} PROPERTIES
28 C_STANDARD 99
29 C_EXTENSIONS NO)
30 ENDIF()
31ENDMACRO()
Marat Dukhan3645b922017-10-13 17:03:35 -040032
Marat Dukhancddf01b2018-02-25 01:37:55 +010033MACRO(CPUINFO_TARGET_ENABLE_CXX11 target)
34 IF(${CMAKE_VERSION} VERSION_LESS "3.1")
35 IF(NOT MSVC)
36 TARGET_COMPILE_OPTIONS(${target} PRIVATE -std=c++11)
37 ENDIF()
38 ELSE()
39 SET_TARGET_PROPERTIES(${target} PROPERTIES
40 CXX_STANDARD 11
41 CXX_EXTENSIONS NO)
42 ENDIF()
43ENDMACRO()
44
45# ---[ Build flags
Marat Dukhan3645b922017-10-13 17:03:35 -040046IF(NOT CMAKE_SYSTEM_PROCESSOR)
Marat Dukhane135eff2018-02-01 00:39:31 -080047 IF(NOT IOS)
48 MESSAGE(FATAL_ERROR "CMAKE_SYSTEM_PROCESSOR not defined")
49 ENDIF()
Marat Dukhanb2fc4ab2018-02-19 22:43:26 -080050ELSEIF(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^(i686|AMD64|x86_64|armv5te|armv7|armv7f|armv7s|armv7k|armv7-a|armv7l|arm64|aarch64)$")
Marat Dukhan3645b922017-10-13 17:03:35 -040051 MESSAGE(FATAL_ERROR "Unrecognized CMAKE_SYSTEM_PROCESSOR = ${CMAKE_SYSTEM_PROCESSOR}")
52ENDIF()
53
54IF(NOT CMAKE_SYSTEM_NAME)
55 MESSAGE(FATAL_ERROR "CMAKE_SYSTEM_NAME not defined")
Marat Dukhanb2fc4ab2018-02-19 22:43:26 -080056ELSEIF(NOT CMAKE_SYSTEM_NAME MATCHES "^(Windows|Darwin|Linux|Android)$")
Marat Dukhan3645b922017-10-13 17:03:35 -040057 MESSAGE(FATAL_ERROR "Unrecognized CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}")
58ENDIF()
59
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -070060# ---[ Download deps
61SET(CONFU_DEPENDENCIES_SOURCE_DIR ${CMAKE_SOURCE_DIR}/deps
62 CACHE PATH "Confu-style dependencies source directory")
63SET(CONFU_DEPENDENCIES_BINARY_DIR ${CMAKE_BINARY_DIR}/deps
64 CACHE PATH "Confu-style dependencies binary directory")
65
Marat Dukhand5817162018-01-31 18:39:05 -080066IF(CPUINFO_BUILD_MOCK_TESTS OR CPUINFO_BUILD_UNIT_TESTS)
67 IF(NOT DEFINED GOOGLETEST_SOURCE_DIR)
68 MESSAGE(STATUS "Downloading Google Test to ${CONFU_DEPENDENCIES_SOURCE_DIR}/googletest (define GOOGLETEST_SOURCE_DIR to avoid it)")
Marat Dukhand416acf2018-02-24 16:36:59 +010069 CONFIGURE_FILE(cmake/DownloadGoogleTest.cmake "${CONFU_DEPENDENCIES_BINARY_DIR}/googletest-download/CMakeLists.txt")
Marat Dukhand5817162018-01-31 18:39:05 -080070 EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
Marat Dukhand416acf2018-02-24 16:36:59 +010071 WORKING_DIRECTORY "${CONFU_DEPENDENCIES_BINARY_DIR}/googletest-download")
Marat Dukhand5817162018-01-31 18:39:05 -080072 EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" --build .
Marat Dukhand416acf2018-02-24 16:36:59 +010073 WORKING_DIRECTORY "${CONFU_DEPENDENCIES_BINARY_DIR}/googletest-download")
Marat Dukhand5817162018-01-31 18:39:05 -080074 SET(GOOGLETEST_SOURCE_DIR "${CONFU_DEPENDENCIES_SOURCE_DIR}/googletest" CACHE STRING "Google Test source directory")
75 ENDIF()
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -070076ENDIF()
Marat Dukhan3645b922017-10-13 17:03:35 -040077
Marat Dukhand5817162018-01-31 18:39:05 -080078IF(CPUINFO_BUILD_BENCHMARKS AND NOT DEFINED GOOGLEBENCHMARK_SOURCE_DIR)
79 MESSAGE(STATUS "Downloading Google Benchmark to ${CONFU_DEPENDENCIES_SOURCE_DIR}/googlebenchmark (define GOOGLEBENCHMARK_SOURCE_DIR to avoid it)")
Marat Dukhand416acf2018-02-24 16:36:59 +010080 CONFIGURE_FILE(cmake/DownloadGoogleBenchmark.cmake "${CONFU_DEPENDENCIES_BINARY_DIR}/googlebenchmark-download/CMakeLists.txt")
Marat Dukhancc44bf32017-12-18 17:45:48 -080081 EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
Marat Dukhand416acf2018-02-24 16:36:59 +010082 WORKING_DIRECTORY "${CONFU_DEPENDENCIES_BINARY_DIR}/googlebenchmark-download")
Marat Dukhancc44bf32017-12-18 17:45:48 -080083 EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" --build .
Marat Dukhand416acf2018-02-24 16:36:59 +010084 WORKING_DIRECTORY "${CONFU_DEPENDENCIES_BINARY_DIR}/googlebenchmark-download")
Marat Dukhand5817162018-01-31 18:39:05 -080085 SET(GOOGLEBENCHMARK_SOURCE_DIR "${CONFU_DEPENDENCIES_SOURCE_DIR}/googlebenchmark" CACHE STRING "Google Benchmark source directory")
Marat Dukhancc44bf32017-12-18 17:45:48 -080086ENDIF()
87
Marat Dukhan3645b922017-10-13 17:03:35 -040088# ---[ cpuinfo library
89SET(CPUINFO_SRCS
90 src/init.c
91 src/api.c
92 src/log.c)
93
Marat Dukhanb2fc4ab2018-02-19 22:43:26 -080094IF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i686|x86_64|AMD64)$")
Marat Dukhan3645b922017-10-13 17:03:35 -040095 LIST(APPEND CPUINFO_SRCS
96 src/x86/init.c
97 src/x86/info.c
98 src/x86/vendor.c
99 src/x86/uarch.c
100 src/x86/name.c
101 src/x86/topology.c
102 src/x86/isa.c
103 src/x86/cache/init.c
104 src/x86/cache/descriptor.c
105 src/x86/cache/deterministic.c)
106 IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
107 LIST(APPEND CPUINFO_SRCS
108 src/x86/linux/init.c
109 src/x86/linux/cpuinfo.c)
110 ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
111 LIST(APPEND CPUINFO_SRCS src/x86/mach/init.c)
Marat Dukhanb2fc4ab2018-02-19 22:43:26 -0800112 ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
113 LIST(APPEND CPUINFO_SRCS src/x86/windows/init.c)
Marat Dukhan3645b922017-10-13 17:03:35 -0400114 ENDIF()
Marat Dukhane135eff2018-02-01 00:39:31 -0800115ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv5te|armv7|armv7f|armv7s|armv7k|armv7-a|armv7l|arm64|aarch64)$" OR IOS)
Marat Dukhan3645b922017-10-13 17:03:35 -0400116 LIST(APPEND CPUINFO_SRCS
117 src/arm/uarch.c
118 src/arm/cache.c)
119 IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
120 LIST(APPEND CPUINFO_SRCS
121 src/arm/linux/init.c
122 src/arm/linux/cpuinfo.c
123 src/arm/linux/clusters.c
Marat Dukhaned272132017-10-15 21:55:45 +0000124 src/arm/linux/chipset.c
Marat Dukhan63a7a6b2017-11-29 15:11:56 -0800125 src/arm/linux/midr.c
126 src/arm/linux/hwcap.c)
Marat Dukhan3985cf82017-12-18 18:58:26 -0800127 IF(CMAKE_SYSTEM_NAME STREQUAL "Android")
128 LIST(APPEND CPUINFO_SRCS src/arm/android/gpu.c)
129 ENDIF()
Marat Dukhan7b738882017-10-18 16:59:28 -0700130 IF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv5te|armv7l|armv7-a)$")
Marat Dukhandeaa8982017-11-28 11:07:11 -0800131 LIST(APPEND CPUINFO_SRCS src/arm/linux/aarch32-isa.c)
Marat Dukhan7b738882017-10-18 16:59:28 -0700132 IF(CMAKE_SYSTEM_NAME STREQUAL "Android" AND ANDROID_ABI STREQUAL "armeabi")
Marat Dukhandeaa8982017-11-28 11:07:11 -0800133 SET_SOURCE_FILES_PROPERTIES(src/arm/linux/aarch32-isa.c PROPERTIES COMPILE_FLAGS -marm)
Marat Dukhan7b738882017-10-18 16:59:28 -0700134 ENDIF()
135 ELSEIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
Marat Dukhandeaa8982017-11-28 11:07:11 -0800136 LIST(APPEND CPUINFO_SRCS src/arm/linux/aarch64-isa.c)
Marat Dukhan7b738882017-10-18 16:59:28 -0700137 ENDIF()
Marat Dukhane135eff2018-02-01 00:39:31 -0800138 ELSEIF(IOS)
Marat Dukhanad1ac952017-10-23 15:32:25 -0700139 LIST(APPEND CPUINFO_SRCS
140 src/arm/mach/init.c
141 src/gpu/gles-ios.m)
Marat Dukhan02527012017-10-23 16:03:05 -0700142 SET_SOURCE_FILES_PROPERTIES(src/gpu/gles-ios.m PROPERTIES COMPILE_FLAGS -fobjc-arc)
Marat Dukhan3645b922017-10-13 17:03:35 -0400143 ENDIF()
144 IF(CMAKE_SYSTEM_NAME STREQUAL "Android")
145 LIST(APPEND CPUINFO_SRCS
Marat Dukhan4853ef42018-01-31 23:32:56 -0800146 src/arm/android/properties.c)
Marat Dukhan3645b922017-10-13 17:03:35 -0400147 ENDIF()
Marat Dukhan3645b922017-10-13 17:03:35 -0400148ENDIF()
149
150IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
151 LIST(APPEND CPUINFO_SRCS
152 src/linux/smallfile.c
153 src/linux/multiline.c
154 src/linux/current.c
155 src/linux/cpulist.c
156 src/linux/processors.c)
157 IF(CMAKE_SYSTEM_NAME STREQUAL "Android")
Marat Dukhanfd0f3ef2017-12-18 17:45:18 -0800158 LIST(APPEND CPUINFO_SRCS
159 src/gpu/gles2.c
160 src/linux/gpu.c)
Marat Dukhan3645b922017-10-13 17:03:35 -0400161 ENDIF()
162ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
163 LIST(APPEND CPUINFO_SRCS src/mach/topology.c)
164ENDIF()
165
Marat Dukhanbfff3482017-10-15 22:24:32 +0000166IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
167 SET(CMAKE_THREAD_PREFER_PTHREAD TRUE)
168 SET(THREADS_PREFER_PTHREAD_FLAG TRUE)
169 FIND_PACKAGE(Threads REQUIRED)
170ENDIF()
171
Marat Dukhandaafc282018-01-31 23:55:05 -0800172IF(CPUINFO_LIBRARY_TYPE STREQUAL "default")
173 ADD_LIBRARY(cpuinfo ${CPUINFO_SRCS})
174ELSEIF(CPUINFO_LIBRARY_TYPE STREQUAL "shared")
175 ADD_LIBRARY(cpuinfo SHARED ${CPUINFO_SRCS})
176ELSEIF(CPUINFO_LIBRARY_TYPE STREQUAL "static")
177 ADD_LIBRARY(cpuinfo STATIC ${CPUINFO_SRCS})
178ELSE()
179 MESSAGE(FATAL_ERROR "Unsupported library type ${CPUINFO_LIBRARY_TYPE}")
180ENDIF()
Marat Dukhancddf01b2018-02-25 01:37:55 +0100181CPUINFO_TARGET_ENABLE_C99(cpuinfo)
Marat Dukhan3645b922017-10-13 17:03:35 -0400182SET_TARGET_PROPERTIES(cpuinfo PROPERTIES PUBLIC_HEADER include/cpuinfo.h)
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700183TARGET_INCLUDE_DIRECTORIES(cpuinfo PUBLIC include)
Marat Dukhan3645b922017-10-13 17:03:35 -0400184TARGET_INCLUDE_DIRECTORIES(cpuinfo PRIVATE src)
Marat Dukhanbfff3482017-10-15 22:24:32 +0000185IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
186 TARGET_LINK_LIBRARIES(cpuinfo PUBLIC ${CMAKE_THREAD_LIBS_INIT})
187ENDIF()
Marat Dukhane029fd42017-10-26 00:35:46 +0000188IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
189 TARGET_COMPILE_DEFINITIONS(cpuinfo PRIVATE -D_GNU_SOURCE)
190ENDIF()
Marat Dukhane135eff2018-02-01 00:39:31 -0800191IF(IOS)
Marat Dukhanad1ac952017-10-23 15:32:25 -0700192 TARGET_LINK_LIBRARIES(cpuinfo INTERFACE "-framework OpenGLES")
193 TARGET_LINK_LIBRARIES(cpuinfo INTERFACE "-framework Foundation")
194ENDIF()
Marat Dukhan3645b922017-10-13 17:03:35 -0400195
196INSTALL(TARGETS cpuinfo
197 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
198 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
199 PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
200
Marat Dukhancc44bf32017-12-18 17:45:48 -0800201# ---[ cpuinfo micro-benchmarks
202IF(CPUINFO_BUILD_BENCHMARKS)
203 # ---[ Build google benchmark
204 IF(NOT TARGET benchmark)
205 SET(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "")
206 ADD_SUBDIRECTORY(
Marat Dukhand5817162018-01-31 18:39:05 -0800207 "${GOOGLEBENCHMARK_SOURCE_DIR}"
Marat Dukhancc44bf32017-12-18 17:45:48 -0800208 "${CONFU_DEPENDENCIES_BINARY_DIR}/googlebenchmark")
209 ENDIF()
210
211 IF(CMAKE_SYSTEM_NAME MATCHES "^(Linux|Android)$")
212 ADD_EXECUTABLE(get-current-bench bench/get-current.cc)
213 TARGET_LINK_LIBRARIES(get-current-bench cpuinfo benchmark)
214 ENDIF()
215
216 ADD_EXECUTABLE(init-bench bench/init.cc)
217 TARGET_LINK_LIBRARIES(init-bench cpuinfo benchmark)
218ENDIF()
219
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700220IF(CPUINFO_BUILD_MOCK_TESTS OR CPUINFO_BUILD_UNIT_TESTS)
221 # ---[ Build google test
222 IF(NOT TARGET gtest)
223 SET(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
224 ADD_SUBDIRECTORY(
Marat Dukhand5817162018-01-31 18:39:05 -0800225 "${GOOGLETEST_SOURCE_DIR}"
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700226 "${CONFU_DEPENDENCIES_BINARY_DIR}/googletest")
227 ENDIF()
228ENDIF()
229
230# ---[ cpuinfo mock library and mock tests
231IF(CPUINFO_BUILD_MOCK_TESTS)
Marat Dukhanb8a83372017-10-13 21:07:44 -0400232 SET(CPUINFO_MOCK_SRCS "${CPUINFO_SRCS}")
Marat Dukhanfd0f3ef2017-12-18 17:45:18 -0800233 IF(CMAKE_SYSTEM_NAME STREQUAL "Android")
234 LIST(REMOVE_ITEM CPUINFO_MOCK_SRCS src/gpu/gles2.c)
235 LIST(APPEND CPUINFO_MOCK_SRCS src/gpu/gles2-mock.c)
236 ENDIF()
Marat Dukhan1b474622017-12-18 17:52:40 -0800237 IF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i686|x86_64)$")
238 LIST(APPEND CPUINFO_MOCK_SRCS src/x86/mockcpuid.c)
239 ENDIF()
Marat Dukhanb8a83372017-10-13 21:07:44 -0400240 IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
241 LIST(APPEND CPUINFO_MOCK_SRCS src/linux/mockfile.c)
242 ENDIF()
243
Marat Dukhandaafc282018-01-31 23:55:05 -0800244 ADD_LIBRARY(cpuinfo_mock STATIC ${CPUINFO_MOCK_SRCS})
Marat Dukhancddf01b2018-02-25 01:37:55 +0100245 CPUINFO_TARGET_ENABLE_C99(cpuinfo_mock)
Marat Dukhanb8a83372017-10-13 21:07:44 -0400246 SET_TARGET_PROPERTIES(cpuinfo_mock PROPERTIES PUBLIC_HEADER include/cpuinfo.h)
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700247 TARGET_INCLUDE_DIRECTORIES(cpuinfo_mock PUBLIC include)
Marat Dukhanb8a83372017-10-13 21:07:44 -0400248 TARGET_INCLUDE_DIRECTORIES(cpuinfo_mock PRIVATE src)
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700249 TARGET_COMPILE_DEFINITIONS(cpuinfo_mock PUBLIC "-DCPUINFO_MOCK=1")
Marat Dukhanbfff3482017-10-15 22:24:32 +0000250 IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
251 TARGET_LINK_LIBRARIES(cpuinfo_mock PUBLIC ${CMAKE_THREAD_LIBS_INIT})
252 ENDIF()
Marat Dukhane029fd42017-10-26 00:35:46 +0000253 IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
254 TARGET_COMPILE_DEFINITIONS(cpuinfo_mock PRIVATE -D_GNU_SOURCE)
255 ENDIF()
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700256
257 IF(CMAKE_SYSTEM_NAME STREQUAL "Android" AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv5te|armv7-a)$")
Marat Dukhanf18db832017-11-28 11:10:10 -0800258 ADD_EXECUTABLE(atm7029b-tablet-test test/mock/atm7029b-tablet.cc)
259 TARGET_INCLUDE_DIRECTORIES(atm7029b-tablet-test PRIVATE test/mock)
260 TARGET_LINK_LIBRARIES(atm7029b-tablet-test PRIVATE cpuinfo_mock gtest)
261 ADD_TEST(atm7029b-tablet-test atm7029b-tablet-test)
262
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700263 ADD_EXECUTABLE(blu-r1-hd-test test/mock/blu-r1-hd.cc)
264 TARGET_INCLUDE_DIRECTORIES(blu-r1-hd-test PRIVATE test/mock)
265 TARGET_LINK_LIBRARIES(blu-r1-hd-test PRIVATE cpuinfo_mock gtest)
266 ADD_TEST(blu-r1-hd-test blu-r1-hd-test)
267
Marat Dukhan94f763a2017-12-04 16:44:33 -0800268 ADD_EXECUTABLE(galaxy-a3-2016-eu-test test/mock/galaxy-a3-2016-eu.cc)
269 TARGET_INCLUDE_DIRECTORIES(galaxy-a3-2016-eu-test PRIVATE test/mock)
270 TARGET_LINK_LIBRARIES(galaxy-a3-2016-eu-test PRIVATE cpuinfo_mock gtest)
271 ADD_TEST(galaxy-a3-2016-eu-test galaxy-a3-2016-eu-test)
272
Marat Dukhanf9ccfa32017-11-27 15:50:06 -0800273 ADD_EXECUTABLE(galaxy-a8-2016-duos-test test/mock/galaxy-a8-2016-duos.cc)
274 TARGET_INCLUDE_DIRECTORIES(galaxy-a8-2016-duos-test PRIVATE test/mock)
275 TARGET_LINK_LIBRARIES(galaxy-a8-2016-duos-test PRIVATE cpuinfo_mock gtest)
276 ADD_TEST(galaxy-a8-2016-duos-test galaxy-a8-2016-duos-test)
277
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700278 ADD_EXECUTABLE(galaxy-grand-prime-value-edition-test test/mock/galaxy-grand-prime-value-edition.cc)
279 TARGET_INCLUDE_DIRECTORIES(galaxy-grand-prime-value-edition-test PRIVATE test/mock)
280 TARGET_LINK_LIBRARIES(galaxy-grand-prime-value-edition-test PRIVATE cpuinfo_mock gtest)
281 ADD_TEST(galaxy-grand-prime-value-edition-test galaxy-grand-prime-value-edition-test)
282
Marat Dukhand77e1a22018-01-04 19:45:06 -0800283 ADD_EXECUTABLE(galaxy-j1-2016-test test/mock/galaxy-j1-2016.cc)
284 TARGET_INCLUDE_DIRECTORIES(galaxy-j1-2016-test PRIVATE test/mock)
285 TARGET_LINK_LIBRARIES(galaxy-j1-2016-test PRIVATE cpuinfo_mock gtest)
286 ADD_TEST(galaxy-j1-2016-test galaxy-j1-2016-test)
287
Marat Dukhan126c46d2017-12-04 16:24:48 -0800288 ADD_EXECUTABLE(galaxy-j5-test test/mock/galaxy-j5.cc)
289 TARGET_INCLUDE_DIRECTORIES(galaxy-j5-test PRIVATE test/mock)
290 TARGET_LINK_LIBRARIES(galaxy-j5-test PRIVATE cpuinfo_mock gtest)
291 ADD_TEST(galaxy-j5-test galaxy-j5-test)
292
Marat Dukhan84435902017-11-29 15:53:58 -0800293 ADD_EXECUTABLE(galaxy-j7-prime-test test/mock/galaxy-j7-prime.cc)
294 TARGET_INCLUDE_DIRECTORIES(galaxy-j7-prime-test PRIVATE test/mock)
295 TARGET_LINK_LIBRARIES(galaxy-j7-prime-test PRIVATE cpuinfo_mock gtest)
296 ADD_TEST(galaxy-j7-prime-test galaxy-j7-prime-test)
297
Marat Dukhan0d2aaa72017-11-29 15:48:46 -0800298 ADD_EXECUTABLE(galaxy-j7-tmobile-test test/mock/galaxy-j7-tmobile.cc)
299 TARGET_INCLUDE_DIRECTORIES(galaxy-j7-tmobile-test PRIVATE test/mock)
300 TARGET_LINK_LIBRARIES(galaxy-j7-tmobile-test PRIVATE cpuinfo_mock gtest)
301 ADD_TEST(galaxy-j7-tmobile-test galaxy-j7-tmobile-test)
302
303 ADD_EXECUTABLE(galaxy-j7-uae-test test/mock/galaxy-j7-uae.cc)
304 TARGET_INCLUDE_DIRECTORIES(galaxy-j7-uae-test PRIVATE test/mock)
305 TARGET_LINK_LIBRARIES(galaxy-j7-uae-test PRIVATE cpuinfo_mock gtest)
306 ADD_TEST(galaxy-j7-uae-test galaxy-j7-uae-test)
307
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700308 ADD_EXECUTABLE(galaxy-s3-us-test test/mock/galaxy-s3-us.cc)
309 TARGET_INCLUDE_DIRECTORIES(galaxy-s3-us-test PRIVATE test/mock)
310 TARGET_LINK_LIBRARIES(galaxy-s3-us-test PRIVATE cpuinfo_mock gtest)
311 ADD_TEST(galaxy-s3-us-test galaxy-s3-us-test)
312
313 ADD_EXECUTABLE(galaxy-s4-us-test test/mock/galaxy-s4-us.cc)
314 TARGET_INCLUDE_DIRECTORIES(galaxy-s4-us-test PRIVATE test/mock)
315 TARGET_LINK_LIBRARIES(galaxy-s4-us-test PRIVATE cpuinfo_mock gtest)
316 ADD_TEST(galaxy-s4-us-test galaxy-s4-us-test)
317
318 ADD_EXECUTABLE(galaxy-s5-global-test test/mock/galaxy-s5-global.cc)
319 TARGET_INCLUDE_DIRECTORIES(galaxy-s5-global-test PRIVATE test/mock)
320 TARGET_LINK_LIBRARIES(galaxy-s5-global-test PRIVATE cpuinfo_mock gtest)
321 ADD_TEST(galaxy-s5-global-test galaxy-s5-global-test)
322
323 ADD_EXECUTABLE(galaxy-s5-us-test test/mock/galaxy-s5-us.cc)
324 TARGET_INCLUDE_DIRECTORIES(galaxy-s5-us-test PRIVATE test/mock)
325 TARGET_LINK_LIBRARIES(galaxy-s5-us-test PRIVATE cpuinfo_mock gtest)
326 ADD_TEST(galaxy-s5-us-test galaxy-s5-us-test)
327
328 ADD_EXECUTABLE(galaxy-tab-3-7.0-test test/mock/galaxy-tab-3-7.0.cc)
329 TARGET_INCLUDE_DIRECTORIES(galaxy-tab-3-7.0-test PRIVATE test/mock)
330 TARGET_LINK_LIBRARIES(galaxy-tab-3-7.0-test PRIVATE cpuinfo_mock gtest)
331 ADD_TEST(galaxy-tab-3-7.0-test galaxy-tab-3-7.0-test)
332
333 ADD_EXECUTABLE(galaxy-tab-3-lite-test test/mock/galaxy-tab-3-lite.cc)
334 TARGET_INCLUDE_DIRECTORIES(galaxy-tab-3-lite-test PRIVATE test/mock)
335 TARGET_LINK_LIBRARIES(galaxy-tab-3-lite-test PRIVATE cpuinfo_mock gtest)
336 ADD_TEST(galaxy-tab-3-lite-test galaxy-tab-3-lite-test)
337
338 ADD_EXECUTABLE(galaxy-win-duos-test test/mock/galaxy-win-duos.cc)
339 TARGET_INCLUDE_DIRECTORIES(galaxy-win-duos-test PRIVATE test/mock)
340 TARGET_LINK_LIBRARIES(galaxy-win-duos-test PRIVATE cpuinfo_mock gtest)
341 ADD_TEST(galaxy-win-duos-test galaxy-win-duos-test)
342
343 ADD_EXECUTABLE(huawei-ascend-p7-test test/mock/huawei-ascend-p7.cc)
344 TARGET_INCLUDE_DIRECTORIES(huawei-ascend-p7-test PRIVATE test/mock)
345 TARGET_LINK_LIBRARIES(huawei-ascend-p7-test PRIVATE cpuinfo_mock gtest)
346 ADD_TEST(huawei-ascend-p7-test huawei-ascend-p7-test)
347
348 ADD_EXECUTABLE(lenovo-a6600-plus-test test/mock/lenovo-a6600-plus.cc)
349 TARGET_INCLUDE_DIRECTORIES(lenovo-a6600-plus-test PRIVATE test/mock)
350 TARGET_LINK_LIBRARIES(lenovo-a6600-plus-test PRIVATE cpuinfo_mock gtest)
351 ADD_TEST(lenovo-a6600-plus-test lenovo-a6600-plus-test)
352
353 ADD_EXECUTABLE(lenovo-vibe-x2-test test/mock/lenovo-vibe-x2.cc)
354 TARGET_INCLUDE_DIRECTORIES(lenovo-vibe-x2-test PRIVATE test/mock)
355 TARGET_LINK_LIBRARIES(lenovo-vibe-x2-test PRIVATE cpuinfo_mock gtest)
356 ADD_TEST(lenovo-vibe-x2-test lenovo-vibe-x2-test)
357
358 ADD_EXECUTABLE(lg-k10-eu-test test/mock/lg-k10-eu.cc)
359 TARGET_INCLUDE_DIRECTORIES(lg-k10-eu-test PRIVATE test/mock)
360 TARGET_LINK_LIBRARIES(lg-k10-eu-test PRIVATE cpuinfo_mock gtest)
361 ADD_TEST(lg-k10-eu-test lg-k10-eu-test)
362
Marat Dukhandc58d502018-01-04 20:25:30 -0800363 ADD_EXECUTABLE(lg-optimus-g-pro-test test/mock/lg-optimus-g-pro.cc)
364 TARGET_INCLUDE_DIRECTORIES(lg-optimus-g-pro-test PRIVATE test/mock)
365 TARGET_LINK_LIBRARIES(lg-optimus-g-pro-test PRIVATE cpuinfo_mock gtest)
366 ADD_TEST(lg-optimus-g-pro-test lg-optimus-g-pro-test)
367
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700368 ADD_EXECUTABLE(moto-e-gen1-test test/mock/moto-e-gen1.cc)
369 TARGET_INCLUDE_DIRECTORIES(moto-e-gen1-test PRIVATE test/mock)
370 TARGET_LINK_LIBRARIES(moto-e-gen1-test PRIVATE cpuinfo_mock gtest)
371 ADD_TEST(moto-e-gen1-test moto-e-gen1-test)
372
Marat Dukhan92db81f2018-01-05 19:01:52 -0800373 ADD_EXECUTABLE(moto-g-gen1-test test/mock/moto-g-gen1.cc)
374 TARGET_INCLUDE_DIRECTORIES(moto-g-gen1-test PRIVATE test/mock)
375 TARGET_LINK_LIBRARIES(moto-g-gen1-test PRIVATE cpuinfo_mock gtest)
376 ADD_TEST(moto-g-gen1-test moto-g-gen1-test)
377
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700378 ADD_EXECUTABLE(moto-g-gen2-test test/mock/moto-g-gen2.cc)
379 TARGET_INCLUDE_DIRECTORIES(moto-g-gen2-test PRIVATE test/mock)
380 TARGET_LINK_LIBRARIES(moto-g-gen2-test PRIVATE cpuinfo_mock gtest)
381 ADD_TEST(moto-g-gen2-test moto-g-gen2-test)
382
383 ADD_EXECUTABLE(moto-g-gen3-test test/mock/moto-g-gen3.cc)
384 TARGET_INCLUDE_DIRECTORIES(moto-g-gen3-test PRIVATE test/mock)
385 TARGET_LINK_LIBRARIES(moto-g-gen3-test PRIVATE cpuinfo_mock gtest)
386 ADD_TEST(moto-g-gen3-test moto-g-gen3-test)
387
388 ADD_EXECUTABLE(nexus-s-test test/mock/nexus-s.cc)
389 TARGET_INCLUDE_DIRECTORIES(nexus-s-test PRIVATE test/mock)
390 TARGET_LINK_LIBRARIES(nexus-s-test PRIVATE cpuinfo_mock gtest)
391 ADD_TEST(nexus-s-test nexus-s-test)
392
393 ADD_EXECUTABLE(nexus4-test test/mock/nexus4.cc)
394 TARGET_INCLUDE_DIRECTORIES(nexus4-test PRIVATE test/mock)
395 TARGET_LINK_LIBRARIES(nexus4-test PRIVATE cpuinfo_mock gtest)
396 ADD_TEST(nexus4-test nexus4-test)
397
398 ADD_EXECUTABLE(nexus6-test test/mock/nexus6.cc)
399 TARGET_INCLUDE_DIRECTORIES(nexus6-test PRIVATE test/mock)
400 TARGET_LINK_LIBRARIES(nexus6-test PRIVATE cpuinfo_mock gtest)
401 ADD_TEST(nexus6-test nexus6-test)
402
Marat Dukhan2ca13b22018-01-04 18:52:46 -0800403 ADD_EXECUTABLE(nexus10-test test/mock/nexus10.cc)
404 TARGET_INCLUDE_DIRECTORIES(nexus10-test PRIVATE test/mock)
405 TARGET_LINK_LIBRARIES(nexus10-test PRIVATE cpuinfo_mock gtest)
406 ADD_TEST(nexus10-test nexus10-test)
407
Marat Dukhan59572542017-11-27 17:22:09 -0800408 ADD_EXECUTABLE(padcod-10.1-test test/mock/padcod-10.1.cc)
409 TARGET_INCLUDE_DIRECTORIES(padcod-10.1-test PRIVATE test/mock)
410 TARGET_LINK_LIBRARIES(padcod-10.1-test PRIVATE cpuinfo_mock gtest)
411 ADD_TEST(padcod-10.1-test padcod-10.1-test)
412
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700413 ADD_EXECUTABLE(xiaomi-redmi-2a-test test/mock/xiaomi-redmi-2a.cc)
414 TARGET_INCLUDE_DIRECTORIES(xiaomi-redmi-2a-test PRIVATE test/mock)
415 TARGET_LINK_LIBRARIES(xiaomi-redmi-2a-test PRIVATE cpuinfo_mock gtest)
416 ADD_TEST(xiaomi-redmi-2a-test xiaomi-redmi-2a-test)
Marat Dukhanad741842017-12-03 23:11:46 -0800417
418 ADD_EXECUTABLE(xperia-sl-test test/mock/xperia-sl.cc)
419 TARGET_INCLUDE_DIRECTORIES(xperia-sl-test PRIVATE test/mock)
420 TARGET_LINK_LIBRARIES(xperia-sl-test PRIVATE cpuinfo_mock gtest)
421 ADD_TEST(xperia-sl-test xperia-sl-test)
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700422 ENDIF()
423
424 IF(CMAKE_SYSTEM_NAME STREQUAL "Android" AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv5te|armv7-a|aarch64)$")
Marat Dukhanc246e322018-01-26 11:21:48 -0800425 ADD_EXECUTABLE(alcatel-revvl-test test/mock/alcatel-revvl.cc)
426 TARGET_INCLUDE_DIRECTORIES(alcatel-revvl-test PRIVATE test/mock)
427 TARGET_LINK_LIBRARIES(alcatel-revvl-test PRIVATE cpuinfo_mock gtest)
428 ADD_TEST(alcatel-revvl-test alcatel-revvl-test)
429
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700430 ADD_EXECUTABLE(galaxy-c9-pro-test test/mock/galaxy-c9-pro.cc)
431 TARGET_INCLUDE_DIRECTORIES(galaxy-c9-pro-test PRIVATE test/mock)
432 TARGET_LINK_LIBRARIES(galaxy-c9-pro-test PRIVATE cpuinfo_mock gtest)
433 ADD_TEST(galaxy-c9-pro-test galaxy-c9-pro-test)
434
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700435 ADD_EXECUTABLE(galaxy-s6-test test/mock/galaxy-s6.cc)
436 TARGET_INCLUDE_DIRECTORIES(galaxy-s6-test PRIVATE test/mock)
437 TARGET_LINK_LIBRARIES(galaxy-s6-test PRIVATE cpuinfo_mock gtest)
438 ADD_TEST(galaxy-s6-test galaxy-s6-test)
439
440 ADD_EXECUTABLE(galaxy-s7-us-test test/mock/galaxy-s7-us.cc)
441 TARGET_INCLUDE_DIRECTORIES(galaxy-s7-us-test PRIVATE test/mock)
442 TARGET_LINK_LIBRARIES(galaxy-s7-us-test PRIVATE cpuinfo_mock gtest)
443 ADD_TEST(galaxy-s7-us-test galaxy-s7-us-test)
444
445 ADD_EXECUTABLE(galaxy-s7-global-test test/mock/galaxy-s7-global.cc)
446 TARGET_INCLUDE_DIRECTORIES(galaxy-s7-global-test PRIVATE test/mock)
447 TARGET_LINK_LIBRARIES(galaxy-s7-global-test PRIVATE cpuinfo_mock gtest)
448 ADD_TEST(galaxy-s7-global-test galaxy-s7-global-test)
449
450 ADD_EXECUTABLE(galaxy-s8-us-test test/mock/galaxy-s8-us.cc)
451 TARGET_INCLUDE_DIRECTORIES(galaxy-s8-us-test PRIVATE test/mock)
452 TARGET_LINK_LIBRARIES(galaxy-s8-us-test PRIVATE cpuinfo_mock gtest)
453 ADD_TEST(galaxy-s8-us-test galaxy-s8-us-test)
454
455 ADD_EXECUTABLE(galaxy-s8-global-test test/mock/galaxy-s8-global.cc)
456 TARGET_INCLUDE_DIRECTORIES(galaxy-s8-global-test PRIVATE test/mock)
457 TARGET_LINK_LIBRARIES(galaxy-s8-global-test PRIVATE cpuinfo_mock gtest)
458 ADD_TEST(galaxy-s8-global-test galaxy-s8-global-test)
459
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700460 ADD_EXECUTABLE(huawei-mate-8-test test/mock/huawei-mate-8.cc)
461 TARGET_INCLUDE_DIRECTORIES(huawei-mate-8-test PRIVATE test/mock)
462 TARGET_LINK_LIBRARIES(huawei-mate-8-test PRIVATE cpuinfo_mock gtest)
463 ADD_TEST(huawei-mate-8-test huawei-mate-8-test)
464
465 ADD_EXECUTABLE(huawei-mate-9-test test/mock/huawei-mate-9.cc)
466 TARGET_INCLUDE_DIRECTORIES(huawei-mate-9-test PRIVATE test/mock)
467 TARGET_LINK_LIBRARIES(huawei-mate-9-test PRIVATE cpuinfo_mock gtest)
468 ADD_TEST(huawei-mate-9-test huawei-mate-9-test)
469
Marat Dukhan7be11402017-11-27 14:57:02 -0800470 ADD_EXECUTABLE(huawei-mate-10-test test/mock/huawei-mate-10.cc)
471 TARGET_INCLUDE_DIRECTORIES(huawei-mate-10-test PRIVATE test/mock)
472 TARGET_LINK_LIBRARIES(huawei-mate-10-test PRIVATE cpuinfo_mock gtest)
473 ADD_TEST(huawei-mate-10-test huawei-mate-10-test)
474
Marat Dukhan705122f2018-01-03 18:24:55 -0800475 ADD_EXECUTABLE(huawei-p8-lite-test test/mock/huawei-p8-lite.cc)
476 TARGET_INCLUDE_DIRECTORIES(huawei-p8-lite-test PRIVATE test/mock)
477 TARGET_LINK_LIBRARIES(huawei-p8-lite-test PRIVATE cpuinfo_mock gtest)
478 ADD_TEST(huawei-p8-lite-test huawei-p8-lite-test)
479
480 ADD_EXECUTABLE(huawei-p9-lite-test test/mock/huawei-p9-lite.cc)
481 TARGET_INCLUDE_DIRECTORIES(huawei-p9-lite-test PRIVATE test/mock)
482 TARGET_LINK_LIBRARIES(huawei-p9-lite-test PRIVATE cpuinfo_mock gtest)
483 ADD_TEST(huawei-p9-lite-test huawei-p9-lite-test)
484
485 ADD_EXECUTABLE(iconia-one-10-test test/mock/iconia-one-10.cc)
486 TARGET_INCLUDE_DIRECTORIES(iconia-one-10-test PRIVATE test/mock)
487 TARGET_LINK_LIBRARIES(iconia-one-10-test PRIVATE cpuinfo_mock gtest)
488 ADD_TEST(iconia-one-10-test iconia-one-10-test)
489
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700490 ADD_EXECUTABLE(meizu-pro-6-test test/mock/meizu-pro-6.cc)
491 TARGET_INCLUDE_DIRECTORIES(meizu-pro-6-test PRIVATE test/mock)
492 TARGET_LINK_LIBRARIES(meizu-pro-6-test PRIVATE cpuinfo_mock gtest)
493 ADD_TEST(meizu-pro-6-test meizu-pro-6-test)
494
495 ADD_EXECUTABLE(meizu-pro-6s-test test/mock/meizu-pro-6s.cc)
496 TARGET_INCLUDE_DIRECTORIES(meizu-pro-6s-test PRIVATE test/mock)
497 TARGET_LINK_LIBRARIES(meizu-pro-6s-test PRIVATE cpuinfo_mock gtest)
498 ADD_TEST(meizu-pro-6s-test meizu-pro-6s-test)
499
500 ADD_EXECUTABLE(meizu-pro-7-plus-test test/mock/meizu-pro-7-plus.cc)
501 TARGET_INCLUDE_DIRECTORIES(meizu-pro-7-plus-test PRIVATE test/mock)
502 TARGET_LINK_LIBRARIES(meizu-pro-7-plus-test PRIVATE cpuinfo_mock gtest)
503 ADD_TEST(meizu-pro-7-plus-test meizu-pro-7-plus-test)
504
505 ADD_EXECUTABLE(nexus5x-test test/mock/nexus5x.cc)
506 TARGET_INCLUDE_DIRECTORIES(nexus5x-test PRIVATE test/mock)
507 TARGET_LINK_LIBRARIES(nexus5x-test PRIVATE cpuinfo_mock gtest)
508 ADD_TEST(nexus5x-test nexus5x-test)
509
510 ADD_EXECUTABLE(nexus6p-test test/mock/nexus6p.cc)
511 TARGET_INCLUDE_DIRECTORIES(nexus6p-test PRIVATE test/mock)
512 TARGET_LINK_LIBRARIES(nexus6p-test PRIVATE cpuinfo_mock gtest)
513 ADD_TEST(nexus6p-test nexus6p-test)
514
515 ADD_EXECUTABLE(nexus9-test test/mock/nexus9.cc)
516 TARGET_INCLUDE_DIRECTORIES(nexus9-test PRIVATE test/mock)
517 TARGET_LINK_LIBRARIES(nexus9-test PRIVATE cpuinfo_mock gtest)
518 ADD_TEST(nexus9-test nexus9-test)
519
Marat Dukhan4d4d7e22018-03-02 10:34:59 -0800520 ADD_EXECUTABLE(oneplus-3t-test test/mock/oneplus-3t.cc)
521 TARGET_INCLUDE_DIRECTORIES(oneplus-3t-test PRIVATE test/mock)
522 TARGET_LINK_LIBRARIES(oneplus-3t-test PRIVATE cpuinfo_mock gtest)
523 ADD_TEST(oneplus-3t-test oneplus-3t-test)
524
Marat Dukhan75dd8a12017-12-04 15:43:02 -0800525 ADD_EXECUTABLE(oppo-a37-test test/mock/oppo-a37.cc)
526 TARGET_INCLUDE_DIRECTORIES(oppo-a37-test PRIVATE test/mock)
527 TARGET_LINK_LIBRARIES(oppo-a37-test PRIVATE cpuinfo_mock gtest)
528 ADD_TEST(oppo-a37-test oppo-a37-test)
529
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700530 ADD_EXECUTABLE(oppo-r9-test test/mock/oppo-r9.cc)
531 TARGET_INCLUDE_DIRECTORIES(oppo-r9-test PRIVATE test/mock)
532 TARGET_LINK_LIBRARIES(oppo-r9-test PRIVATE cpuinfo_mock gtest)
533 ADD_TEST(oppo-r9-test oppo-r9-test)
534
535 ADD_EXECUTABLE(pixel-test test/mock/pixel.cc)
536 TARGET_INCLUDE_DIRECTORIES(pixel-test PRIVATE test/mock)
537 TARGET_LINK_LIBRARIES(pixel-test PRIVATE cpuinfo_mock gtest)
538 ADD_TEST(pixel-test pixel-test)
539
540 ADD_EXECUTABLE(pixel-c-test test/mock/pixel-c.cc)
541 TARGET_INCLUDE_DIRECTORIES(pixel-c-test PRIVATE test/mock)
542 TARGET_LINK_LIBRARIES(pixel-c-test PRIVATE cpuinfo_mock gtest)
543 ADD_TEST(pixel-c-test pixel-c-test)
544
545 ADD_EXECUTABLE(pixel-xl-test test/mock/pixel-xl.cc)
546 TARGET_INCLUDE_DIRECTORIES(pixel-xl-test PRIVATE test/mock)
547 TARGET_LINK_LIBRARIES(pixel-xl-test PRIVATE cpuinfo_mock gtest)
548 ADD_TEST(pixel-xl-test pixel-xl-test)
549
Marat Dukhan9bfb1072017-11-27 17:02:25 -0800550 ADD_EXECUTABLE(pixel-2-xl-test test/mock/pixel-2-xl.cc)
551 TARGET_INCLUDE_DIRECTORIES(pixel-2-xl-test PRIVATE test/mock)
552 TARGET_LINK_LIBRARIES(pixel-2-xl-test PRIVATE cpuinfo_mock gtest)
553 ADD_TEST(pixel-2-xl-test pixel-2-xl-test)
554
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700555 ADD_EXECUTABLE(xiaomi-mi-5c-test test/mock/xiaomi-mi-5c.cc)
556 TARGET_INCLUDE_DIRECTORIES(xiaomi-mi-5c-test PRIVATE test/mock)
557 TARGET_LINK_LIBRARIES(xiaomi-mi-5c-test PRIVATE cpuinfo_mock gtest)
558 ADD_TEST(xiaomi-mi-5c-test xiaomi-mi-5c-test)
559
560 ADD_EXECUTABLE(xiaomi-redmi-note-3-test test/mock/xiaomi-redmi-note-3.cc)
561 TARGET_INCLUDE_DIRECTORIES(xiaomi-redmi-note-3-test PRIVATE test/mock)
562 TARGET_LINK_LIBRARIES(xiaomi-redmi-note-3-test PRIVATE cpuinfo_mock gtest)
563 ADD_TEST(xiaomi-redmi-note-3-test xiaomi-redmi-note-3-test)
564
Marat Dukhana5fda232017-12-04 16:08:25 -0800565 ADD_EXECUTABLE(xiaomi-redmi-note-4-test test/mock/xiaomi-redmi-note-4.cc)
566 TARGET_INCLUDE_DIRECTORIES(xiaomi-redmi-note-4-test PRIVATE test/mock)
567 TARGET_LINK_LIBRARIES(xiaomi-redmi-note-4-test PRIVATE cpuinfo_mock gtest)
568 ADD_TEST(xiaomi-redmi-note-4-test xiaomi-redmi-note-4-test)
569
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700570 ADD_EXECUTABLE(xperia-c4-dual-test test/mock/xperia-c4-dual.cc)
571 TARGET_INCLUDE_DIRECTORIES(xperia-c4-dual-test PRIVATE test/mock)
572 TARGET_LINK_LIBRARIES(xperia-c4-dual-test PRIVATE cpuinfo_mock gtest)
573 ADD_TEST(xperia-c4-dual-test xperia-c4-dual-test)
574 ENDIF()
575
576 IF(CMAKE_SYSTEM_NAME STREQUAL "Android" AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(i686|x86_64)$")
Marat Dukhanaf8a12d2017-12-08 16:12:16 -0800577 ADD_EXECUTABLE(alldocube-iwork8-test test/mock/alldocube-iwork8.cc)
578 TARGET_INCLUDE_DIRECTORIES(alldocube-iwork8-test PRIVATE test/mock)
579 TARGET_LINK_LIBRARIES(alldocube-iwork8-test PRIVATE cpuinfo_mock gtest)
580 ADD_TEST(alldocube-iwork8-test alldocube-iwork8-test)
581
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700582 ADD_EXECUTABLE(memo-pad-7-test test/mock/memo-pad-7.cc)
583 TARGET_INCLUDE_DIRECTORIES(memo-pad-7-test PRIVATE test/mock)
584 TARGET_LINK_LIBRARIES(memo-pad-7-test PRIVATE cpuinfo_mock gtest)
585 ADD_TEST(memo-pad-7-test memo-pad-7-test)
586
587 ADD_EXECUTABLE(zenfone-c-test test/mock/zenfone-c.cc)
588 TARGET_INCLUDE_DIRECTORIES(zenfone-c-test PRIVATE test/mock)
589 TARGET_LINK_LIBRARIES(zenfone-c-test PRIVATE cpuinfo_mock gtest)
590 ADD_TEST(zenfone-c-test zenfone-c-test)
591
592 ADD_EXECUTABLE(zenfone-2-test test/mock/zenfone-2.cc)
593 TARGET_INCLUDE_DIRECTORIES(zenfone-2-test PRIVATE test/mock)
594 TARGET_LINK_LIBRARIES(zenfone-2-test PRIVATE cpuinfo_mock gtest)
595 ADD_TEST(zenfone-2-test zenfone-2-test)
596
597 ADD_EXECUTABLE(zenfone-2e-test test/mock/zenfone-2e.cc)
598 TARGET_INCLUDE_DIRECTORIES(zenfone-2e-test PRIVATE test/mock)
599 TARGET_LINK_LIBRARIES(zenfone-2e-test PRIVATE cpuinfo_mock gtest)
600 ADD_TEST(zenfone-2e-test zenfone-2e-test)
601 ENDIF()
602ENDIF()
603
604# ---[ cpuinfo unit tests
605IF(CPUINFO_BUILD_UNIT_TESTS)
606 ADD_EXECUTABLE(init-test test/init.cc)
Marat Dukhancddf01b2018-02-25 01:37:55 +0100607 CPUINFO_TARGET_ENABLE_CXX11(init-test)
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700608 TARGET_LINK_LIBRARIES(init-test PRIVATE cpuinfo gtest)
609 ADD_TEST(init-test init-test)
610
611 IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
612 ADD_EXECUTABLE(get-current-test test/get-current.cc)
Marat Dukhancddf01b2018-02-25 01:37:55 +0100613 CPUINFO_TARGET_ENABLE_CXX11(get-current-test)
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700614 TARGET_LINK_LIBRARIES(get-current-test PRIVATE cpuinfo gtest)
615 ADD_TEST(get-current-test get-current-test)
616 ENDIF()
617
618 IF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i686|x86_64)$")
619 ADD_EXECUTABLE(brand-string-test test/name/brand-string.cc)
Marat Dukhancddf01b2018-02-25 01:37:55 +0100620 CPUINFO_TARGET_ENABLE_CXX11(brand-string-test)
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700621 TARGET_LINK_LIBRARIES(brand-string-test PRIVATE cpuinfo gtest gtest_main)
622 ADD_TEST(brand-string-test brand-string-test)
623 ENDIF()
624
625 IF(CMAKE_SYSTEM_NAME STREQUAL "Android" AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv5te|armv7-a|aarch64)$")
Marat Dukhancddf01b2018-02-25 01:37:55 +0100626 ADD_LIBRARY(android_properties_interface STATIC test/name/android-properties-interface.c)
627 CPUINFO_TARGET_ENABLE_C99(android_properties_interface)
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700628 TARGET_INCLUDE_DIRECTORIES(android_properties_interface PRIVATE src)
629 TARGET_LINK_LIBRARIES(android_properties_interface PRIVATE cpuinfo)
630
631 ADD_EXECUTABLE(chipset-test
632 test/name/proc-cpuinfo-hardware.cc
633 test/name/ro-product-board.cc
634 test/name/ro-board-platform.cc
635 test/name/ro-mediatek-platform.cc
636 test/name/ro-chipname.cc
637 test/name/android-properties.cc)
Marat Dukhancddf01b2018-02-25 01:37:55 +0100638 CPUINFO_TARGET_ENABLE_CXX11(chipset-test)
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700639 TARGET_LINK_LIBRARIES(chipset-test PRIVATE android_properties_interface gtest gtest_main)
640 ADD_TEST(chipset-test chipset-test)
641
642 ADD_EXECUTABLE(cache-test test/arm-cache.cc)
Marat Dukhancddf01b2018-02-25 01:37:55 +0100643 CPUINFO_TARGET_ENABLE_CXX11(cache-test)
644 TARGET_COMPILE_DEFINITIONS(cache-test PRIVATE __STDC_LIMIT_MACROS=1 __STDC_CONSTANT_MACROS=1)
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700645 TARGET_INCLUDE_DIRECTORIES(cache-test PRIVATE src)
646 TARGET_LINK_LIBRARIES(cache-test PRIVATE cpuinfo gtest gtest_main)
647 ADD_TEST(cache-test, cache-test)
648 ENDIF()
Marat Dukhanb8a83372017-10-13 21:07:44 -0400649ENDIF()
650
Marat Dukhan3645b922017-10-13 17:03:35 -0400651# ---[ Helper and debug tools
Marat Dukhanf1c4a5c2017-10-25 17:22:11 -0700652IF(CPUINFO_BUILD_TOOLS)
Marat Dukhan3645b922017-10-13 17:03:35 -0400653 ADD_EXECUTABLE(isa-info tools/isa-info.c)
Marat Dukhancddf01b2018-02-25 01:37:55 +0100654 CPUINFO_TARGET_ENABLE_C99(isa-info)
Marat Dukhan3645b922017-10-13 17:03:35 -0400655 TARGET_LINK_LIBRARIES(isa-info PRIVATE cpuinfo)
656
657 ADD_EXECUTABLE(cpu-info tools/cpu-info.c)
Marat Dukhancddf01b2018-02-25 01:37:55 +0100658 CPUINFO_TARGET_ENABLE_C99(cpu-info)
Marat Dukhan3645b922017-10-13 17:03:35 -0400659 TARGET_LINK_LIBRARIES(cpu-info PRIVATE cpuinfo)
660
661 ADD_EXECUTABLE(cache-info tools/cache-info.c)
Marat Dukhancddf01b2018-02-25 01:37:55 +0100662 CPUINFO_TARGET_ENABLE_C99(cache-info)
Marat Dukhan3645b922017-10-13 17:03:35 -0400663 TARGET_LINK_LIBRARIES(cache-info PRIVATE cpuinfo)
664
Marat Dukhanf3a71e62017-11-29 15:15:36 -0800665 IF(CMAKE_SYSTEM_NAME MATCHES "^(Android|Linux)$" AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv5te|armv7|armv7-a|armv7l|arm64|aarch64)$")
666 ADD_EXECUTABLE(auxv-dump tools/auxv-dump.c)
Marat Dukhancddf01b2018-02-25 01:37:55 +0100667 CPUINFO_TARGET_ENABLE_C99(auxv-dump)
Marat Dukhanf3a71e62017-11-29 15:15:36 -0800668 TARGET_INCLUDE_DIRECTORIES(auxv-dump PRIVATE src)
669 TARGET_INCLUDE_DIRECTORIES(auxv-dump PRIVATE include)
670 ENDIF()
671
Marat Dukhan3645b922017-10-13 17:03:35 -0400672 IF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i686|x86_64)$")
673 ADD_EXECUTABLE(cpuid-dump tools/cpuid-dump.c)
Marat Dukhancddf01b2018-02-25 01:37:55 +0100674 CPUINFO_TARGET_ENABLE_C99(cpuid-dump)
Marat Dukhan3645b922017-10-13 17:03:35 -0400675 TARGET_INCLUDE_DIRECTORIES(cpuid-dump PRIVATE src)
676 TARGET_INCLUDE_DIRECTORIES(cpuid-dump PRIVATE include)
677 ENDIF()
678ENDIF()