Marat Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12 FATAL_ERROR) |
Marat Dukhan | 3645b92 | 2017-10-13 17:03:35 -0400 | [diff] [blame] | 2 | |
| 3 | INCLUDE(GNUInstallDirs) |
| 4 | |
| 5 | # ---[ Project and semantic versioning. |
Marat Dukhan | 63d41a5 | 2017-10-26 00:37:12 +0000 | [diff] [blame] | 6 | PROJECT(cpuinfo C CXX) |
Marat Dukhan | 3645b92 | 2017-10-13 17:03:35 -0400 | [diff] [blame] | 7 | |
| 8 | # ---[ Options. |
Marat Dukhan | daafc28 | 2018-01-31 23:55:05 -0800 | [diff] [blame] | 9 | SET(CPUINFO_LIBRARY_TYPE "default" CACHE STRING "Type of cpuinfo library (shared, static, or default) to build") |
| 10 | SET_PROPERTY(CACHE CPUINFO_LIBRARY_TYPE PROPERTY STRINGS default static shared) |
Marat Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 11 | OPTION(CPUINFO_BUILD_TOOLS "Build command-line tools" ON) |
Marat Dukhan | cc44bf3 | 2017-12-18 17:45:48 -0800 | [diff] [blame] | 12 | OPTION(CPUINFO_BUILD_UNIT_TESTS "Build cpuinfo unit tests" ON) |
| 13 | OPTION(CPUINFO_BUILD_MOCK_TESTS "Build cpuinfo mock tests" ON) |
| 14 | OPTION(CPUINFO_BUILD_BENCHMARKS "Build cpuinfo micro-benchmarks" ON) |
Marat Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 15 | |
| 16 | # ---[ CMake options |
| 17 | IF(CPUINFO_BUILD_UNIT_TESTS OR CPUINFO_BUILD_MOCK_TESTS) |
| 18 | ENABLE_TESTING() |
| 19 | ENDIF() |
Marat Dukhan | 3645b92 | 2017-10-13 17:03:35 -0400 | [diff] [blame] | 20 | |
Marat Dukhan | cddf01b | 2018-02-25 01:37:55 +0100 | [diff] [blame] | 21 | MACRO(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() |
| 31 | ENDMACRO() |
Marat Dukhan | 3645b92 | 2017-10-13 17:03:35 -0400 | [diff] [blame] | 32 | |
Marat Dukhan | cddf01b | 2018-02-25 01:37:55 +0100 | [diff] [blame] | 33 | MACRO(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() |
| 43 | ENDMACRO() |
| 44 | |
| 45 | # ---[ Build flags |
Marat Dukhan | 3645b92 | 2017-10-13 17:03:35 -0400 | [diff] [blame] | 46 | IF(NOT CMAKE_SYSTEM_PROCESSOR) |
Marat Dukhan | e135eff | 2018-02-01 00:39:31 -0800 | [diff] [blame] | 47 | IF(NOT IOS) |
| 48 | MESSAGE(FATAL_ERROR "CMAKE_SYSTEM_PROCESSOR not defined") |
| 49 | ENDIF() |
Marat Dukhan | b2fc4ab | 2018-02-19 22:43:26 -0800 | [diff] [blame] | 50 | ELSEIF(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^(i686|AMD64|x86_64|armv5te|armv7|armv7f|armv7s|armv7k|armv7-a|armv7l|arm64|aarch64)$") |
Marat Dukhan | 3645b92 | 2017-10-13 17:03:35 -0400 | [diff] [blame] | 51 | MESSAGE(FATAL_ERROR "Unrecognized CMAKE_SYSTEM_PROCESSOR = ${CMAKE_SYSTEM_PROCESSOR}") |
| 52 | ENDIF() |
| 53 | |
| 54 | IF(NOT CMAKE_SYSTEM_NAME) |
| 55 | MESSAGE(FATAL_ERROR "CMAKE_SYSTEM_NAME not defined") |
Marat Dukhan | b2fc4ab | 2018-02-19 22:43:26 -0800 | [diff] [blame] | 56 | ELSEIF(NOT CMAKE_SYSTEM_NAME MATCHES "^(Windows|Darwin|Linux|Android)$") |
Marat Dukhan | 3645b92 | 2017-10-13 17:03:35 -0400 | [diff] [blame] | 57 | MESSAGE(FATAL_ERROR "Unrecognized CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}") |
| 58 | ENDIF() |
| 59 | |
Marat Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 60 | # ---[ Download deps |
| 61 | SET(CONFU_DEPENDENCIES_SOURCE_DIR ${CMAKE_SOURCE_DIR}/deps |
| 62 | CACHE PATH "Confu-style dependencies source directory") |
| 63 | SET(CONFU_DEPENDENCIES_BINARY_DIR ${CMAKE_BINARY_DIR}/deps |
| 64 | CACHE PATH "Confu-style dependencies binary directory") |
| 65 | |
Marat Dukhan | d581716 | 2018-01-31 18:39:05 -0800 | [diff] [blame] | 66 | IF(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 Dukhan | d416acf | 2018-02-24 16:36:59 +0100 | [diff] [blame] | 69 | CONFIGURE_FILE(cmake/DownloadGoogleTest.cmake "${CONFU_DEPENDENCIES_BINARY_DIR}/googletest-download/CMakeLists.txt") |
Marat Dukhan | d581716 | 2018-01-31 18:39:05 -0800 | [diff] [blame] | 70 | EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" . |
Marat Dukhan | d416acf | 2018-02-24 16:36:59 +0100 | [diff] [blame] | 71 | WORKING_DIRECTORY "${CONFU_DEPENDENCIES_BINARY_DIR}/googletest-download") |
Marat Dukhan | d581716 | 2018-01-31 18:39:05 -0800 | [diff] [blame] | 72 | EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" --build . |
Marat Dukhan | d416acf | 2018-02-24 16:36:59 +0100 | [diff] [blame] | 73 | WORKING_DIRECTORY "${CONFU_DEPENDENCIES_BINARY_DIR}/googletest-download") |
Marat Dukhan | d581716 | 2018-01-31 18:39:05 -0800 | [diff] [blame] | 74 | SET(GOOGLETEST_SOURCE_DIR "${CONFU_DEPENDENCIES_SOURCE_DIR}/googletest" CACHE STRING "Google Test source directory") |
| 75 | ENDIF() |
Marat Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 76 | ENDIF() |
Marat Dukhan | 3645b92 | 2017-10-13 17:03:35 -0400 | [diff] [blame] | 77 | |
Marat Dukhan | d581716 | 2018-01-31 18:39:05 -0800 | [diff] [blame] | 78 | IF(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 Dukhan | d416acf | 2018-02-24 16:36:59 +0100 | [diff] [blame] | 80 | CONFIGURE_FILE(cmake/DownloadGoogleBenchmark.cmake "${CONFU_DEPENDENCIES_BINARY_DIR}/googlebenchmark-download/CMakeLists.txt") |
Marat Dukhan | cc44bf3 | 2017-12-18 17:45:48 -0800 | [diff] [blame] | 81 | EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" . |
Marat Dukhan | d416acf | 2018-02-24 16:36:59 +0100 | [diff] [blame] | 82 | WORKING_DIRECTORY "${CONFU_DEPENDENCIES_BINARY_DIR}/googlebenchmark-download") |
Marat Dukhan | cc44bf3 | 2017-12-18 17:45:48 -0800 | [diff] [blame] | 83 | EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" --build . |
Marat Dukhan | d416acf | 2018-02-24 16:36:59 +0100 | [diff] [blame] | 84 | WORKING_DIRECTORY "${CONFU_DEPENDENCIES_BINARY_DIR}/googlebenchmark-download") |
Marat Dukhan | d581716 | 2018-01-31 18:39:05 -0800 | [diff] [blame] | 85 | SET(GOOGLEBENCHMARK_SOURCE_DIR "${CONFU_DEPENDENCIES_SOURCE_DIR}/googlebenchmark" CACHE STRING "Google Benchmark source directory") |
Marat Dukhan | cc44bf3 | 2017-12-18 17:45:48 -0800 | [diff] [blame] | 86 | ENDIF() |
| 87 | |
Marat Dukhan | 3645b92 | 2017-10-13 17:03:35 -0400 | [diff] [blame] | 88 | # ---[ cpuinfo library |
| 89 | SET(CPUINFO_SRCS |
| 90 | src/init.c |
| 91 | src/api.c |
| 92 | src/log.c) |
| 93 | |
Marat Dukhan | b2fc4ab | 2018-02-19 22:43:26 -0800 | [diff] [blame] | 94 | IF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i686|x86_64|AMD64)$") |
Marat Dukhan | 3645b92 | 2017-10-13 17:03:35 -0400 | [diff] [blame] | 95 | 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 Dukhan | b2fc4ab | 2018-02-19 22:43:26 -0800 | [diff] [blame] | 112 | ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Windows") |
| 113 | LIST(APPEND CPUINFO_SRCS src/x86/windows/init.c) |
Marat Dukhan | 3645b92 | 2017-10-13 17:03:35 -0400 | [diff] [blame] | 114 | ENDIF() |
Marat Dukhan | e135eff | 2018-02-01 00:39:31 -0800 | [diff] [blame] | 115 | ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv5te|armv7|armv7f|armv7s|armv7k|armv7-a|armv7l|arm64|aarch64)$" OR IOS) |
Marat Dukhan | 3645b92 | 2017-10-13 17:03:35 -0400 | [diff] [blame] | 116 | 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 Dukhan | ed27213 | 2017-10-15 21:55:45 +0000 | [diff] [blame] | 124 | src/arm/linux/chipset.c |
Marat Dukhan | 63a7a6b | 2017-11-29 15:11:56 -0800 | [diff] [blame] | 125 | src/arm/linux/midr.c |
| 126 | src/arm/linux/hwcap.c) |
Marat Dukhan | 3985cf8 | 2017-12-18 18:58:26 -0800 | [diff] [blame] | 127 | IF(CMAKE_SYSTEM_NAME STREQUAL "Android") |
| 128 | LIST(APPEND CPUINFO_SRCS src/arm/android/gpu.c) |
| 129 | ENDIF() |
Marat Dukhan | 7b73888 | 2017-10-18 16:59:28 -0700 | [diff] [blame] | 130 | IF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv5te|armv7l|armv7-a)$") |
Marat Dukhan | deaa898 | 2017-11-28 11:07:11 -0800 | [diff] [blame] | 131 | LIST(APPEND CPUINFO_SRCS src/arm/linux/aarch32-isa.c) |
Marat Dukhan | 7b73888 | 2017-10-18 16:59:28 -0700 | [diff] [blame] | 132 | IF(CMAKE_SYSTEM_NAME STREQUAL "Android" AND ANDROID_ABI STREQUAL "armeabi") |
Marat Dukhan | deaa898 | 2017-11-28 11:07:11 -0800 | [diff] [blame] | 133 | SET_SOURCE_FILES_PROPERTIES(src/arm/linux/aarch32-isa.c PROPERTIES COMPILE_FLAGS -marm) |
Marat Dukhan | 7b73888 | 2017-10-18 16:59:28 -0700 | [diff] [blame] | 134 | ENDIF() |
| 135 | ELSEIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") |
Marat Dukhan | deaa898 | 2017-11-28 11:07:11 -0800 | [diff] [blame] | 136 | LIST(APPEND CPUINFO_SRCS src/arm/linux/aarch64-isa.c) |
Marat Dukhan | 7b73888 | 2017-10-18 16:59:28 -0700 | [diff] [blame] | 137 | ENDIF() |
Marat Dukhan | e135eff | 2018-02-01 00:39:31 -0800 | [diff] [blame] | 138 | ELSEIF(IOS) |
Marat Dukhan | ad1ac95 | 2017-10-23 15:32:25 -0700 | [diff] [blame] | 139 | LIST(APPEND CPUINFO_SRCS |
| 140 | src/arm/mach/init.c |
| 141 | src/gpu/gles-ios.m) |
Marat Dukhan | 0252701 | 2017-10-23 16:03:05 -0700 | [diff] [blame] | 142 | SET_SOURCE_FILES_PROPERTIES(src/gpu/gles-ios.m PROPERTIES COMPILE_FLAGS -fobjc-arc) |
Marat Dukhan | 3645b92 | 2017-10-13 17:03:35 -0400 | [diff] [blame] | 143 | ENDIF() |
| 144 | IF(CMAKE_SYSTEM_NAME STREQUAL "Android") |
| 145 | LIST(APPEND CPUINFO_SRCS |
Marat Dukhan | 4853ef4 | 2018-01-31 23:32:56 -0800 | [diff] [blame] | 146 | src/arm/android/properties.c) |
Marat Dukhan | 3645b92 | 2017-10-13 17:03:35 -0400 | [diff] [blame] | 147 | ENDIF() |
Marat Dukhan | 3645b92 | 2017-10-13 17:03:35 -0400 | [diff] [blame] | 148 | ENDIF() |
| 149 | |
| 150 | IF(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 Dukhan | fd0f3ef | 2017-12-18 17:45:18 -0800 | [diff] [blame] | 158 | LIST(APPEND CPUINFO_SRCS |
| 159 | src/gpu/gles2.c |
| 160 | src/linux/gpu.c) |
Marat Dukhan | 3645b92 | 2017-10-13 17:03:35 -0400 | [diff] [blame] | 161 | ENDIF() |
| 162 | ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Darwin") |
| 163 | LIST(APPEND CPUINFO_SRCS src/mach/topology.c) |
| 164 | ENDIF() |
| 165 | |
Marat Dukhan | bfff348 | 2017-10-15 22:24:32 +0000 | [diff] [blame] | 166 | IF(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) |
| 170 | ENDIF() |
| 171 | |
Marat Dukhan | daafc28 | 2018-01-31 23:55:05 -0800 | [diff] [blame] | 172 | IF(CPUINFO_LIBRARY_TYPE STREQUAL "default") |
| 173 | ADD_LIBRARY(cpuinfo ${CPUINFO_SRCS}) |
| 174 | ELSEIF(CPUINFO_LIBRARY_TYPE STREQUAL "shared") |
| 175 | ADD_LIBRARY(cpuinfo SHARED ${CPUINFO_SRCS}) |
| 176 | ELSEIF(CPUINFO_LIBRARY_TYPE STREQUAL "static") |
| 177 | ADD_LIBRARY(cpuinfo STATIC ${CPUINFO_SRCS}) |
| 178 | ELSE() |
| 179 | MESSAGE(FATAL_ERROR "Unsupported library type ${CPUINFO_LIBRARY_TYPE}") |
| 180 | ENDIF() |
Marat Dukhan | cddf01b | 2018-02-25 01:37:55 +0100 | [diff] [blame] | 181 | CPUINFO_TARGET_ENABLE_C99(cpuinfo) |
Marat Dukhan | 3645b92 | 2017-10-13 17:03:35 -0400 | [diff] [blame] | 182 | SET_TARGET_PROPERTIES(cpuinfo PROPERTIES PUBLIC_HEADER include/cpuinfo.h) |
Marat Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 183 | TARGET_INCLUDE_DIRECTORIES(cpuinfo PUBLIC include) |
Marat Dukhan | 3645b92 | 2017-10-13 17:03:35 -0400 | [diff] [blame] | 184 | TARGET_INCLUDE_DIRECTORIES(cpuinfo PRIVATE src) |
Marat Dukhan | bfff348 | 2017-10-15 22:24:32 +0000 | [diff] [blame] | 185 | IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android") |
| 186 | TARGET_LINK_LIBRARIES(cpuinfo PUBLIC ${CMAKE_THREAD_LIBS_INIT}) |
| 187 | ENDIF() |
Marat Dukhan | e029fd4 | 2017-10-26 00:35:46 +0000 | [diff] [blame] | 188 | IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") |
| 189 | TARGET_COMPILE_DEFINITIONS(cpuinfo PRIVATE -D_GNU_SOURCE) |
| 190 | ENDIF() |
Marat Dukhan | e135eff | 2018-02-01 00:39:31 -0800 | [diff] [blame] | 191 | IF(IOS) |
Marat Dukhan | ad1ac95 | 2017-10-23 15:32:25 -0700 | [diff] [blame] | 192 | TARGET_LINK_LIBRARIES(cpuinfo INTERFACE "-framework OpenGLES") |
| 193 | TARGET_LINK_LIBRARIES(cpuinfo INTERFACE "-framework Foundation") |
| 194 | ENDIF() |
Marat Dukhan | 3645b92 | 2017-10-13 17:03:35 -0400 | [diff] [blame] | 195 | |
| 196 | INSTALL(TARGETS cpuinfo |
| 197 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} |
| 198 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} |
| 199 | PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) |
| 200 | |
Marat Dukhan | cc44bf3 | 2017-12-18 17:45:48 -0800 | [diff] [blame] | 201 | # ---[ cpuinfo micro-benchmarks |
| 202 | IF(CPUINFO_BUILD_BENCHMARKS) |
| 203 | # ---[ Build google benchmark |
| 204 | IF(NOT TARGET benchmark) |
| 205 | SET(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "") |
| 206 | ADD_SUBDIRECTORY( |
Marat Dukhan | d581716 | 2018-01-31 18:39:05 -0800 | [diff] [blame] | 207 | "${GOOGLEBENCHMARK_SOURCE_DIR}" |
Marat Dukhan | cc44bf3 | 2017-12-18 17:45:48 -0800 | [diff] [blame] | 208 | "${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) |
| 218 | ENDIF() |
| 219 | |
Marat Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 220 | IF(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 Dukhan | d581716 | 2018-01-31 18:39:05 -0800 | [diff] [blame] | 225 | "${GOOGLETEST_SOURCE_DIR}" |
Marat Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 226 | "${CONFU_DEPENDENCIES_BINARY_DIR}/googletest") |
| 227 | ENDIF() |
| 228 | ENDIF() |
| 229 | |
| 230 | # ---[ cpuinfo mock library and mock tests |
| 231 | IF(CPUINFO_BUILD_MOCK_TESTS) |
Marat Dukhan | b8a8337 | 2017-10-13 21:07:44 -0400 | [diff] [blame] | 232 | SET(CPUINFO_MOCK_SRCS "${CPUINFO_SRCS}") |
Marat Dukhan | fd0f3ef | 2017-12-18 17:45:18 -0800 | [diff] [blame] | 233 | 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 Dukhan | 1b47462 | 2017-12-18 17:52:40 -0800 | [diff] [blame] | 237 | IF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i686|x86_64)$") |
| 238 | LIST(APPEND CPUINFO_MOCK_SRCS src/x86/mockcpuid.c) |
| 239 | ENDIF() |
Marat Dukhan | b8a8337 | 2017-10-13 21:07:44 -0400 | [diff] [blame] | 240 | 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 Dukhan | daafc28 | 2018-01-31 23:55:05 -0800 | [diff] [blame] | 244 | ADD_LIBRARY(cpuinfo_mock STATIC ${CPUINFO_MOCK_SRCS}) |
Marat Dukhan | cddf01b | 2018-02-25 01:37:55 +0100 | [diff] [blame] | 245 | CPUINFO_TARGET_ENABLE_C99(cpuinfo_mock) |
Marat Dukhan | b8a8337 | 2017-10-13 21:07:44 -0400 | [diff] [blame] | 246 | SET_TARGET_PROPERTIES(cpuinfo_mock PROPERTIES PUBLIC_HEADER include/cpuinfo.h) |
Marat Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 247 | TARGET_INCLUDE_DIRECTORIES(cpuinfo_mock PUBLIC include) |
Marat Dukhan | b8a8337 | 2017-10-13 21:07:44 -0400 | [diff] [blame] | 248 | TARGET_INCLUDE_DIRECTORIES(cpuinfo_mock PRIVATE src) |
Marat Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 249 | TARGET_COMPILE_DEFINITIONS(cpuinfo_mock PUBLIC "-DCPUINFO_MOCK=1") |
Marat Dukhan | bfff348 | 2017-10-15 22:24:32 +0000 | [diff] [blame] | 250 | 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 Dukhan | e029fd4 | 2017-10-26 00:35:46 +0000 | [diff] [blame] | 253 | IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") |
| 254 | TARGET_COMPILE_DEFINITIONS(cpuinfo_mock PRIVATE -D_GNU_SOURCE) |
| 255 | ENDIF() |
Marat Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 256 | |
| 257 | IF(CMAKE_SYSTEM_NAME STREQUAL "Android" AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv5te|armv7-a)$") |
Marat Dukhan | f18db83 | 2017-11-28 11:10:10 -0800 | [diff] [blame] | 258 | 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 Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 263 | 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 Dukhan | 94f763a | 2017-12-04 16:44:33 -0800 | [diff] [blame] | 268 | 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 Dukhan | f9ccfa3 | 2017-11-27 15:50:06 -0800 | [diff] [blame] | 273 | 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 Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 278 | 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 Dukhan | d77e1a2 | 2018-01-04 19:45:06 -0800 | [diff] [blame] | 283 | 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 Dukhan | 126c46d | 2017-12-04 16:24:48 -0800 | [diff] [blame] | 288 | 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 Dukhan | 8443590 | 2017-11-29 15:53:58 -0800 | [diff] [blame] | 293 | 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 Dukhan | 0d2aaa7 | 2017-11-29 15:48:46 -0800 | [diff] [blame] | 298 | 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 Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 308 | 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 Dukhan | dc58d50 | 2018-01-04 20:25:30 -0800 | [diff] [blame] | 363 | 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 Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 368 | 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 Dukhan | 92db81f | 2018-01-05 19:01:52 -0800 | [diff] [blame] | 373 | 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 Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 378 | 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 Dukhan | 2ca13b2 | 2018-01-04 18:52:46 -0800 | [diff] [blame] | 403 | 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 Dukhan | 5957254 | 2017-11-27 17:22:09 -0800 | [diff] [blame] | 408 | 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 Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 413 | 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 Dukhan | ad74184 | 2017-12-03 23:11:46 -0800 | [diff] [blame] | 417 | |
| 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 Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 422 | ENDIF() |
| 423 | |
| 424 | IF(CMAKE_SYSTEM_NAME STREQUAL "Android" AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv5te|armv7-a|aarch64)$") |
Marat Dukhan | c246e32 | 2018-01-26 11:21:48 -0800 | [diff] [blame] | 425 | 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 Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 430 | 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 Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 435 | 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 Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 460 | 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 Dukhan | 7be1140 | 2017-11-27 14:57:02 -0800 | [diff] [blame] | 470 | 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 Dukhan | 705122f | 2018-01-03 18:24:55 -0800 | [diff] [blame] | 475 | 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 Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 490 | 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 Dukhan | 4d4d7e2 | 2018-03-02 10:34:59 -0800 | [diff] [blame^] | 520 | 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 Dukhan | 75dd8a1 | 2017-12-04 15:43:02 -0800 | [diff] [blame] | 525 | 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 Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 530 | 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 Dukhan | 9bfb107 | 2017-11-27 17:02:25 -0800 | [diff] [blame] | 550 | 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 Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 555 | 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 Dukhan | a5fda23 | 2017-12-04 16:08:25 -0800 | [diff] [blame] | 565 | 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 Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 570 | 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 Dukhan | af8a12d | 2017-12-08 16:12:16 -0800 | [diff] [blame] | 577 | 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 Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 582 | 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() |
| 602 | ENDIF() |
| 603 | |
| 604 | # ---[ cpuinfo unit tests |
| 605 | IF(CPUINFO_BUILD_UNIT_TESTS) |
| 606 | ADD_EXECUTABLE(init-test test/init.cc) |
Marat Dukhan | cddf01b | 2018-02-25 01:37:55 +0100 | [diff] [blame] | 607 | CPUINFO_TARGET_ENABLE_CXX11(init-test) |
Marat Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 608 | 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 Dukhan | cddf01b | 2018-02-25 01:37:55 +0100 | [diff] [blame] | 613 | CPUINFO_TARGET_ENABLE_CXX11(get-current-test) |
Marat Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 614 | 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 Dukhan | cddf01b | 2018-02-25 01:37:55 +0100 | [diff] [blame] | 620 | CPUINFO_TARGET_ENABLE_CXX11(brand-string-test) |
Marat Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 621 | 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 Dukhan | cddf01b | 2018-02-25 01:37:55 +0100 | [diff] [blame] | 626 | ADD_LIBRARY(android_properties_interface STATIC test/name/android-properties-interface.c) |
| 627 | CPUINFO_TARGET_ENABLE_C99(android_properties_interface) |
Marat Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 628 | 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 Dukhan | cddf01b | 2018-02-25 01:37:55 +0100 | [diff] [blame] | 638 | CPUINFO_TARGET_ENABLE_CXX11(chipset-test) |
Marat Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 639 | 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 Dukhan | cddf01b | 2018-02-25 01:37:55 +0100 | [diff] [blame] | 643 | CPUINFO_TARGET_ENABLE_CXX11(cache-test) |
| 644 | TARGET_COMPILE_DEFINITIONS(cache-test PRIVATE __STDC_LIMIT_MACROS=1 __STDC_CONSTANT_MACROS=1) |
Marat Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 645 | 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 Dukhan | b8a8337 | 2017-10-13 21:07:44 -0400 | [diff] [blame] | 649 | ENDIF() |
| 650 | |
Marat Dukhan | 3645b92 | 2017-10-13 17:03:35 -0400 | [diff] [blame] | 651 | # ---[ Helper and debug tools |
Marat Dukhan | f1c4a5c | 2017-10-25 17:22:11 -0700 | [diff] [blame] | 652 | IF(CPUINFO_BUILD_TOOLS) |
Marat Dukhan | 3645b92 | 2017-10-13 17:03:35 -0400 | [diff] [blame] | 653 | ADD_EXECUTABLE(isa-info tools/isa-info.c) |
Marat Dukhan | cddf01b | 2018-02-25 01:37:55 +0100 | [diff] [blame] | 654 | CPUINFO_TARGET_ENABLE_C99(isa-info) |
Marat Dukhan | 3645b92 | 2017-10-13 17:03:35 -0400 | [diff] [blame] | 655 | TARGET_LINK_LIBRARIES(isa-info PRIVATE cpuinfo) |
| 656 | |
| 657 | ADD_EXECUTABLE(cpu-info tools/cpu-info.c) |
Marat Dukhan | cddf01b | 2018-02-25 01:37:55 +0100 | [diff] [blame] | 658 | CPUINFO_TARGET_ENABLE_C99(cpu-info) |
Marat Dukhan | 3645b92 | 2017-10-13 17:03:35 -0400 | [diff] [blame] | 659 | TARGET_LINK_LIBRARIES(cpu-info PRIVATE cpuinfo) |
| 660 | |
| 661 | ADD_EXECUTABLE(cache-info tools/cache-info.c) |
Marat Dukhan | cddf01b | 2018-02-25 01:37:55 +0100 | [diff] [blame] | 662 | CPUINFO_TARGET_ENABLE_C99(cache-info) |
Marat Dukhan | 3645b92 | 2017-10-13 17:03:35 -0400 | [diff] [blame] | 663 | TARGET_LINK_LIBRARIES(cache-info PRIVATE cpuinfo) |
| 664 | |
Marat Dukhan | f3a71e6 | 2017-11-29 15:15:36 -0800 | [diff] [blame] | 665 | 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 Dukhan | cddf01b | 2018-02-25 01:37:55 +0100 | [diff] [blame] | 667 | CPUINFO_TARGET_ENABLE_C99(auxv-dump) |
Marat Dukhan | f3a71e6 | 2017-11-29 15:15:36 -0800 | [diff] [blame] | 668 | TARGET_INCLUDE_DIRECTORIES(auxv-dump PRIVATE src) |
| 669 | TARGET_INCLUDE_DIRECTORIES(auxv-dump PRIVATE include) |
| 670 | ENDIF() |
| 671 | |
Marat Dukhan | 3645b92 | 2017-10-13 17:03:35 -0400 | [diff] [blame] | 672 | IF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i686|x86_64)$") |
| 673 | ADD_EXECUTABLE(cpuid-dump tools/cpuid-dump.c) |
Marat Dukhan | cddf01b | 2018-02-25 01:37:55 +0100 | [diff] [blame] | 674 | CPUINFO_TARGET_ENABLE_C99(cpuid-dump) |
Marat Dukhan | 3645b92 | 2017-10-13 17:03:35 -0400 | [diff] [blame] | 675 | TARGET_INCLUDE_DIRECTORIES(cpuid-dump PRIVATE src) |
| 676 | TARGET_INCLUDE_DIRECTORIES(cpuid-dump PRIVATE include) |
| 677 | ENDIF() |
| 678 | ENDIF() |