external: import cpu_features library
Taken from https://github.com/google/cpu_features at revision 26133d3b620c2c27f31d571efd27371100f891e9
This commit is contained in:
parent
69e75c90e7
commit
931aca28e3
55 changed files with 5724 additions and 0 deletions
3
external/cpu_features/cmake/CpuFeaturesConfig.cmake.in
vendored
Normal file
3
external/cpu_features/cmake/CpuFeaturesConfig.cmake.in
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# CpuFeatures CMake configuration file
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/CpuFeaturesTargets.cmake")
|
||||
28
external/cpu_features/cmake/README.md
vendored
Normal file
28
external/cpu_features/cmake/README.md
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# CMake build instructions
|
||||
|
||||
## Recommended usage : Incorporating cpu_features into a CMake project
|
||||
|
||||
For API / ABI compatibility reasons, it is recommended to build and use
|
||||
cpu_features in a subdirectory of your project or as an embedded dependency.
|
||||
|
||||
This is similar to the recommended usage of the googletest framework
|
||||
( https://github.com/google/googletest/blob/master/googletest/README.md )
|
||||
|
||||
Build and use step-by-step
|
||||
|
||||
|
||||
1- Download cpu_features and copy it in a sub-directory in your project.
|
||||
or add cpu_features as a git-submodule in your project
|
||||
|
||||
2- You can then use the cmake command `add_subdirectory()` to include
|
||||
cpu_features directly and use the `cpu_features` target in your project.
|
||||
|
||||
3- Add the `cpu_features` target to the `target_link_libraries()` section of
|
||||
your executable or of your library.
|
||||
|
||||
## Enabling tests
|
||||
|
||||
CMake default options for cpu_features is Release built type with tests
|
||||
disabled. To enable testing set cmake `BUILD_TESTING` variable to `ON`,
|
||||
[.travis.yml](../.travis.yml) and [appveyor.yml](../appveyor.yml) have up to
|
||||
date examples.
|
||||
15
external/cpu_features/cmake/googletest.CMakeLists.txt.in
vendored
Normal file
15
external/cpu_features/cmake/googletest.CMakeLists.txt.in
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
cmake_minimum_required(VERSION 2.8.2)
|
||||
|
||||
project(googletest-download NONE)
|
||||
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(googletest
|
||||
GIT_REPOSITORY https://github.com/google/googletest.git
|
||||
GIT_TAG master
|
||||
SOURCE_DIR "${CMAKE_BINARY_DIR}/googletest-src"
|
||||
BINARY_DIR "${CMAKE_BINARY_DIR}/googletest-build"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
34
external/cpu_features/cmake/mips32-linux-gcc.cmake
vendored
Normal file
34
external/cpu_features/cmake/mips32-linux-gcc.cmake
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
set(CMAKE_SYSTEM_NAME "Linux")
|
||||
set(CMAKE_SYSTEM_PROCESSOR "mips32")
|
||||
|
||||
if (ENABLE_DSPR2 AND ENABLE_MSA)
|
||||
message(FATAL_ERROR "ENABLE_DSPR2 and ENABLE_MSA cannot be combined.")
|
||||
endif ()
|
||||
|
||||
if (ENABLE_DSPR2)
|
||||
set(HAVE_DSPR2 1 CACHE BOOL "" FORCE)
|
||||
set(MIPS_CFLAGS "-mdspr2")
|
||||
set(MIPS_CXXFLAGS "-mdspr2")
|
||||
elseif (ENABLE_MSA)
|
||||
set(HAVE_MSA 1 CACHE BOOL "" FORCE)
|
||||
set(MIPS_CFLAGS "-mmsa")
|
||||
set(MIPS_CXXFLAGS "-mmsa")
|
||||
endif ()
|
||||
|
||||
if ("${MIPS_CPU}" STREQUAL "")
|
||||
set(MIPS_CFLAGS "${MIPS_CFLAGS} -mips32r2")
|
||||
set(MIPS_CXXFLAGS "${MIPS_CXXFLAGS} -mips32r2")
|
||||
elseif ("${MIPS_CPU}" STREQUAL "p5600")
|
||||
set(P56_FLAGS "-mips32r5 -mload-store-pairs -msched-weight -mhard-float -mfp64")
|
||||
set(MIPS_CFLAGS "${MIPS_CFLAGS} ${P56_FLAGS}")
|
||||
set(MIPS_CXXFLAGS "${MIPS_CXXFLAGS} ${P56_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-mfp64 ${CMAKE_EXE_LINKER_FLAGS}")
|
||||
endif ()
|
||||
|
||||
set(CMAKE_C_COMPILER ${CROSS}gcc)
|
||||
set(CMAKE_CXX_COMPILER ${CROSS}g++)
|
||||
set(AS_EXECUTABLE ${CROSS}as)
|
||||
set(CMAKE_C_COMPILER_ARG1 "-EL ${MIPS_CFLAGS}")
|
||||
set(CMAKE_CXX_COMPILER_ARG1 "-EL ${MIPS_CXXFLAGS}")
|
||||
|
||||
set(THREADS_PTHREAD_ARG "2" CACHE STRING "Forcibly set by CMakeLists.txt." FORCE)
|
||||
Loading…
Add table
Add a link
Reference in a new issue