rsimd

Make SIMD instruction sets easier to use
git clone git://git.meso-star.fr/rsimd.git
Log | Files | Refs | README | LICENSE

commit c31f1b36d63138fe9e67742fab9a0bd9e0713462
parent e364e2a4dc6cd8ede5c192fcd6640e16bd9534ed
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed, 18 Oct 2023 15:26:09 +0200

Remove CMake support

POSIX make is now the only supported build system

Diffstat:
Dcmake/CMakeLists.txt | 239-------------------------------------------------------------------------------
Dcmake/RSIMDConfig.cmake.in | 133-------------------------------------------------------------------------------
Dcmake/RSIMDConfigVersion.cmake.in | 54------------------------------------------------------
Dcmake/SleefConfig.cmake | 35-----------------------------------
4 files changed, 0 insertions(+), 461 deletions(-)

diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt @@ -1,239 +0,0 @@ -# Copyright (C) 2014-2019, 2021, 2023 Vincent Forest (vaplv@free.fr) -# -# The RSIMD CMake is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# The RSIMD CMake is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with the RSIMD CMake. If not, see <http://www.gnu.org/licenses/>. - -cmake_minimum_required(VERSION 3.1) -project(rsimd C) -enable_testing() - -option(NO_TEST "Disable the tests" OFF) -set(RSIMD_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../src) - -################################################################################ -# Check dependencies -################################################################################ -set(Sleef_DIR ${PROJECT_SOURCE_DIR}) - -find_package(RCMake REQUIRED) -find_package(RSys 0.12 REQUIRED) -find_package(PkgConfig REQUIRED) -find_package(Sleef REQUIRED) - -include_directories(${RSys_INCLUDE_DIR} ${Sleef_INCLUDE_DIR}) -include(CheckCCompilerFlag) -set(CMAKE_MODULE_PATH ${RCMAKE_SOURCE_DIR}) -include(rcmake) - -################################################################################ -# Check compiler features -################################################################################ -if(NOT CMAKE_SYSTEM_NAME MATCHES "Linux" -OR NOT CMAKE_COMPILER_IS_GNUCC) - message(STATUS ${CMAKE_SYSTEM_NAME}) - message(FATAL_ERROR "Unsupported platform") -endif() - -execute_process(COMMAND cat "/proc/cpuinfo" - OUTPUT_VARIABLE CPUINFO_OUT - ERROR_VARIABLE CPUINFO_ERR - RESULT_VARIABLE CPUINFO_RES) -if(NOT CPUINFO_RES EQUAL 0) - message(FATAL_ERROR "${CPUINFO_ERR}") -endif() - -string(REGEX MATCH "[ \t\r\n]+sse2[ \t\r\n]+" SSE2 ${CPUINFO_OUT}) -string(REGEX MATCH "[ \t\r\n]+sse4_1[ \t\r\n]+" SSE4_1 ${CPUINFO_OUT}) -string(REGEX MATCH "[ \t\r\n]+avx[ \t\r\n]+" AVX ${CPUINFO_OUT}) -string(REGEX MATCH "[ \t\r\n]+fma[ \t\r\n]+" FMA ${CPUINFO_OUT}) - -set(CFLAGS "-std=c99") # Required by the sleef library's c99 style comments - -if(SSE2) - unset(SSE2) - CHECK_C_COMPILER_FLAG("-msse2" SSE2) - message(STATUS "Use the SSE2 instruction set ") - set(CFLAGS "${CFLAGS} -msse2") -else() - message(FATAL_ERROR "The SSE2 instruction set must be supported.") -endif() -if(SSE4_1) - unset(SSE4_1) - CHECK_C_COMPILER_FLAG("-msse4.1" SSE4_1) - message(STATUS "Use the SSE4.1 instruction set") - set(CFLAGS "${CFLAGS} -msse4.1") -endif() -if(AVX) - unset(AVX) - CHECK_C_COMPILER_FLAG("-mavx" AVX) - message(STATUS "Use the AVX instruction set") - set(CFLAGS "${CFLAGS} -mavx") -endif() -if(FMA) - unset(FMA) - CHECK_C_COMPILER_FLAG("-mfma" FMA) - message(STATUS "Use the FMA instruction set") - set(CFLAGS "${CFLAGS} -mfma") -endif() - -################################################################################ -# Configure and define targets -################################################################################ -set(VERSION_MAJOR 0) -set(VERSION_MINOR 3) -set(VERSION_PATCH 0) -set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) - -set(RSIMD_SSE2 ${SSE2}) -set(RSIMD_SSE4_1 ${SSE4_1}) -set(RSIMD_AVX ${AVX}) -set(RSIMD_FMA ${FMA}) - -# Configure the files generic to the RSIMD version -configure_file(${RSIMD_SOURCE_DIR}/rsimd_version.h.in - ${CMAKE_CURRENT_BINARY_DIR}/rsimd_version.h @ONLY) -configure_file(${PROJECT_SOURCE_DIR}/RSIMDConfigVersion.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/RSIMDConfigVersion.cmake @ONLY) -configure_file(${PROJECT_SOURCE_DIR}/RSIMDConfig.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/RSIMDConfig.cmake @ONLY) - -set(RSIMD_FILES_INC_LEGACY - aosf33.h - aosf44.h - aosq.h - math.h - mathX.h - math4.h - math8.h - rsimd.h - soaXfY.h - soaXfY_begin.h - soaXfY_end.h - soaXf2.h - soaXf3.h - soa4f2.h - soa4f3.h - soa4f4.h - soa8f2.h - soa8f3.h - soa8f4.h - vXf_begin.h - vXf_end.h) -set(RSIMD_FILES_INC_SSE - sse/sse.h - sse/ssef.h - sse/ssei.h - sse/sse_swz.h) -set(RSIMD_FILES_INC_AVX - avx/avx.h - avx/avxf.h - avx/avxi.h) -set(RSIMD_FILES_SRC - math4.c - aosf44.c - aosq.c) -if(AVX) - set(RSIMD_FILES_SRC ${RSIMD_FILES_SRC} math8.c) -endif() -set(RSIMD_FILES_DOC COPYING README.md) -set(RSIMD_FILES_CMAKE - RSIMDConfig.cmake - RSIMDConfigVersion.cmake) -rcmake_prepend_path(RSIMD_FILES_INC_LEGACY ${RSIMD_SOURCE_DIR}) -rcmake_prepend_path(RSIMD_FILES_INC_SSE ${RSIMD_SOURCE_DIR}) -rcmake_prepend_path(RSIMD_FILES_INC_AVX ${RSIMD_SOURCE_DIR}) -rcmake_prepend_path(RSIMD_FILES_SRC ${RSIMD_SOURCE_DIR}) -rcmake_prepend_path(RSIMD_FILES_DOC ${PROJECT_SOURCE_DIR}/../) -rcmake_prepend_path(RSIMD_FILES_CMAKE ${PROJECT_SOURCE_DIR}/) -set(RSIMD_FILES_INC - ${RSIMD_FILES_INC_LEGACY} - ${RSIMD_FILES_INC_SSE} - ${RSIMD_FILES_INC_AVX}) - -add_library(rsimd SHARED ${RSIMD_FILES_INC} ${RSIMD_FILES_SRC}) -target_link_libraries(rsimd Sleef) -set_target_properties(rsimd PROPERTIES DEFINE_SYMBOL RSIMD_SHARED_BUILD) -set_target_properties(rsimd PROPERTIES COMPILE_FLAGS "${CFLAGS}") -set_target_properties(rsimd PROPERTIES - VERSION ${VERSION} - SOVERSION ${VERSION_MAJOR}) - -################################################################################ -# Add tests -################################################################################ -if(NOT NO_TEST) - function(new_test_named _name _src) - add_executable(${_name} ${RSIMD_SOURCE_DIR}/${_src}.c) - target_link_libraries(${_name} rsimd m) - add_test(${_name} ${_name}) - if(NOT "${ARGN}" STREQUAL "") - set_target_properties(${_name} PROPERTIES COMPILE_FLAGS ${ARGN}) - endif() - endfunction() - - function(new_test _name) - new_test_named(${_name} ${_name} ${ARGN}) - endfunction() - - new_test(test_v4f) - new_test(test_v4i) - new_test(test_aosf33) - new_test(test_aosf44) - new_test(test_aosq) - new_test(test_math4) - new_test(test_soa4f2) - new_test(test_soa4f3) - new_test(test_soa4f4) - - if(SSE4_1 AND CMAKE_COMPILER_IS_GNUCC) - new_test_named(test_v4f_sse4_1 test_v4f "-msse4.1") - new_test_named(test_v4i_sse4_1 test_v4i "-msse4.1") - endif() - - if(FMA AND CMAKE_COMPILER_IS_GNUCC) - new_test_named(test_v4f_fma test_v4f "-mfma") - new_test_named(test_soa8f2_fma test_soa8f2 "-mfma") - new_test_named(test_soa8f3_fma test_soa8f3 "-mfma") - new_test_named(test_soa8f4_fma test_soa8f4 "-mfma") - endif() - - if(AVX AND CMAKE_COMPILER_IS_GNUCC) - new_test(test_math8 "-mavx") - new_test(test_v8f "-mavx") - new_test(test_v8i "-mavx") - new_test(test_soa8f2 "-mavx") - new_test(test_soa8f3 "-mavx") - new_test(test_soa8f4 "-mavx") - endif(AVX AND CMAKE_COMPILER_IS_GNUCC) - -endif(NOT NO_TEST) - -################################################################################ -# Install directives -################################################################################ -install(TARGETS rsimd - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin) -install(FILES ${RSIMD_FILES_INC_LEGACY} DESTINATION include/rsimd) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/rsimd_version.h DESTINATION include/rsimd) -install(FILES ${RSIMD_FILES_INC_SSE} DESTINATION include/rsimd/sse) -install(FILES ${RSIMD_FILES_INC_AVX} DESTINATION include/rsimd/avx) -install(FILES ${RSIMD_FILES_DOC} DESTINATION share/doc/rsimd) -install(FILES ${Sleef_DIR}/SleefConfig.cmake DESTINATION lib/cmake/Sleef/) - -install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/RSIMDConfig.cmake - ${CMAKE_CURRENT_BINARY_DIR}/RSIMDConfigVersion.cmake - DESTINATION lib/cmake/RSIMD) - diff --git a/cmake/RSIMDConfig.cmake.in b/cmake/RSIMDConfig.cmake.in @@ -1,133 +0,0 @@ -# Copyright (C) 2014-2019, 2021, 2023 Vincent Forest (vaplv@free.fr) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -cmake_minimum_required(VERSION 3.1) - -# Check dependenc -find_package(Sleef REQUIRED) - -set(RSIMD_SSE2 @RSIMD_SSE2@) -set(RSIMD_SSE4_1 @RSIMD_SSE4_1@) -set(RSIMD_AVX @RSIMD_AVX@) -set(RSIMD_FMA @RSIMD_FMA@) - -# Check compiler features -if(CMAKE_COMPILER_IS_GNUCC) - include(CheckCCompilerFlag) - if(RSIMD_SSE2) - CHECK_C_COMPILER_FLAG("-msse2" SSE2) - if(SSE2) - list(APPEND _compile_flags -msse2) - endif() - endif() - if(RSIMD_SSE4_1) - CHECK_C_COMPILER_FLAG("-msse4.1" SSE4_1) - if(SSE4_1) - list(APPEND _compile_flags -msse4.1) - endif() - endif() - if(RSIMD_AVX) - CHECK_C_COMPILER_FLAG("-mavx" AVX) - if(AVX) - list(APPEND _compile_flags -mavx) - endif() - endif() - if(RSIMD_FMA) - CHECK_C_COMPILER_FLAG("-mfma" FMA) - if(FMA) - list(APPEND _compile_flags -mfma) - endif() - endif() -endif() - -# Try to find the RSIMD devel. Once done this will define: -# - RSIMD_FOUND: system has RSIMD -# - RSIMD_INCLUDE_DIR: the include directory -# - RSIMD Target: Link this to use rsimd - -# Look for library header -find_path(RSIMD_INCLUDE_DIR rsimd/rsimd_version.h) - -# Look for Release, Debug, RelWithDebInfo and MinSizeRel libraries -unset(RSIMD_LIBRARY CACHE) -unset(RSIMD_LIBRARY_RELEASE CACHE) -unset(RSIMD_LIBRARY_DEBUG CACHE) -unset(RSIMD_LIBRARY_RELWITHDEBINFO CACHE) -unset(RSIMD_LIBRARY_MINSIZEREL CACHE) - -# Find per configuration type libraries -find_library(RSIMD_LIBRARY_RELEASE - rsimd - PATH_SUFFIXES bin Bin BIN - DOC "Path to the library rsimd used during release builds.") -find_library(RSIMD_LIBRARY_DEBUG - rsimd-dbg - PATH_SUFFIXES bin Bin BIN - DOC "Path to the library rsimd used during debug builds.") -find_library(RSIMD_LIBRARY_RELWITHDEBINFO - rsimd-rdbg - PATH_SUFFIXES bin Bin BIN - DOC "Path to the library rsimd used during release with debug info builds.") -find_library(RSIMD_LIBRARY_MINSIZEREL - rsimd-mszr - PATH_SUFFIXES bin Bin BIN - DOC "Path to the library rsimd used during minsize builds.") - -# Define the generic rsimd library -if(RSIMD_LIBRARY_RELEASE) - set(RSIMD_LIBRARY ${RSIMD_LIBRARY_RELEASE}) -elseif(RSIMD_LIBRARY_RELWITHDEBINFO) - set(RSIMD_LIBRARY ${RSIMD_LIBRARY_RELWITHDEBINFO}) -elseif(RSIMD_LIBRARY_MINSIZEREL) - set(RSIMD_LIBRARY ${RSIMD_LIBRARY_MINSIZEREL}) -elseif(RSIMD_LIBRARY_DEBUG) - set(RSIMD_LIBRARY ${RSIMD_LIBRARY_DEBUG}) -endif() - -# Define the per configuration library fallback when not found -set(_configs RELEASE DEBUG RELWITHDEBINFO MINSIZEREL) -foreach(_cfg ${_configs}) - if(NOT RSIMD_LIBRARY_${_cfg}) - get_property(_doc CACHE RSIMD_LIBRARY_${_cfg} PROPERTY HELPSTRING) - set(RSIMD_LIBRARY_${_cfg} - ${RSIMD_LIBRARY} CACHE PATH ${_doc} FORCE) - endif() -endforeach() - -# Create the imported library target -add_library(RSIMD SHARED IMPORTED) - -# Setup the properties of the imported target -if(CMAKE_HOST_WIN32) - set(_import_prop IMPORTED_IMPLIB) -else() - set(_import_prop IMPORTED_LOCATION) -endif() -set_target_properties(RSIMD PROPERTIES - ${_import_prop} ${RSIMD_LIBRARY} - ${_import_prop}_RELEASE ${RSIMD_LIBRARY_RELEASE} - ${_import_prop}_DEBUG ${RSIMD_LIBRARY_DEBUG} - ${_import_prop}_RELWITHDEBINFO ${RSIMD_LIBRARY_RELWITHDEBINFO} - ${_import_prop}_MINSIZEREL ${RSIMD_LIBRARY_MINSIZEREL} - INTERFACE_INCLUDE_DIRECTORIES ${RSIMD_INCLUDE_DIR} - INTERFACE_LINK_LIBRARIES Sleef - INTERFACE_COMPILE_OPTIONS "${_compile_flags}") - -# Check the package -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(RSIMD DEFAULT_MSG - RSIMD_INCLUDE_DIR - RSIMD_LIBRARY) - diff --git a/cmake/RSIMDConfigVersion.cmake.in b/cmake/RSIMDConfigVersion.cmake.in @@ -1,54 +0,0 @@ -# Copyright (C) 2014-2019, 2021, 2023 Vincent Forest (vaplv@free.fr) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -set(VERSION_MAJOR @VERSION_MAJOR@) -set(VERSION_MINOR @VERSION_MINOR@) -set(VERSION_PATCH @VERSION_PATCH@) -set(PACKAGE_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") - -if(NOT PACKAGE_FIND_VERSION - OR PACKAGE_VERSION VERSION_EQUAL PACKAGE_FIND_VERSION) - set(PACKAGE_VERSION_COMPATIBLE TRUE) - set(PACKAGE_VERSION_EXACT TRUE) - set(PACKAGE_VERSION_UNSUITABLE FALSE) - return() -endif() - -if(NOT VERSION_MAJOR VERSION_EQUAL PACKAGE_FIND_VERSION_MAJOR) - set(PACKAGE_VERSION_COMPATIBLE FALSE) - set(PACKAGE_VERSION_EXACT FALSE) - set(PACKAGE_VERSION_UNSUITABLE TRUE) - return() -endif() - -if(VERSION_MINOR VERSION_LESS PACKAGE_FIND_VERSION_MINOR) - set(PACKAGE_VERSION_COMPATIBLE FALSE) - set(PACKAGE_VERSION_EXACT FALSE) - set(PACKAGE_VERSION_UNSUITABLE TRUE) - return() -endif() - -if(VERSION_MINOR VERSION_EQUAL PACKAGE_FIND_VERSION_MINOR) - if(VERSION_PATCH VERSION_LESS PACKAGE_FIND_VERSION_PATCH) - set(PACKAGE_VERSION_COMPATIBLE FALSE) - set(PACKAGE_VERSION_EXACT FALSE) - set(PACKAGE_VERSION_UNSUITABLE TRUE) - return() - endif() -endif() - -set(PACKAGE_VERSION_COMPATIBLE TRUE) -set(PACKAGE_VERSION_EXACT FALSE) -set(PACKAGE_VERSION_UNSUITABLE FALSE) diff --git a/cmake/SleefConfig.cmake b/cmake/SleefConfig.cmake @@ -1,35 +0,0 @@ -# Copyright (C) 2014-2019, 2021, 2023 Vincent Forest (vaplv@free.fr) -# -# The RSIMD CMake is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# The RSIMD CMake is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with the RSIMD CMake. If not, see <http://www.gnu.org/licenses/>. - -cmake_minimum_required(VERSION 3.1) - -# Look for library header -find_path(Sleef_INCLUDE_DIR sleef.h) - -find_library(Sleef_LIBRARY sleef PATH_SUFFIXES lib64 - DOC "Path to the sleef library") - -# Create the imported library target -add_library(Sleef SHARED IMPORTED) -set_target_properties(Sleef PROPERTIES - IMPORTED_LOCATION ${Sleef_LIBRARY} - INTERFACE_INCLUDE_DIRECTORIES ${Sleef_INCLUDE_DIR}) - -# Check the package -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Sleef DEFAULT_MSG - Sleef_INCLUDE_DIR - Sleef_LIBRARY) -