rsimd

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

commit bd13ee2f4b6535d280906dd4b5f12de7e5a4b2e1
parent 5cf29921154853aa4f057a6d207e2f9eefb5bdf9
Author: vaplv <vaplv@free.fr>
Date:   Mon,  1 Feb 2021 10:55:36 +0100

Upd the RSIMDConfig.cmake file

Recursively linked the Sleef library to the target that links agains
RSIMD.

Diffstat:
Mcmake/CMakeLists.txt | 24++++++++++++++++++------
Acmake/RSIMDConfig.cmake | 96+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Acmake/RSIMDConfigVersion.cmake.in | 54++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mcmake/SleefConfig.cmake | 4++--
Msrc/math.h | 1-
Asrc/rsimd_version.h.in | 23+++++++++++++++++++++++
6 files changed, 193 insertions(+), 9 deletions(-)

diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt @@ -15,7 +15,6 @@ cmake_minimum_required(VERSION 3.1) project(rsimd C) -cmake_policy(SET CMP0011 NEW) enable_testing() option(NO_TEST "Disable the tests" OFF) @@ -24,8 +23,8 @@ set(RSIMD_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../src) ################################################################################ # Check dependencies ################################################################################ -get_filename_component(_current_source_dir ${CMAKE_CURRENT_LIST_FILE} PATH) -set(Sleef_DIR ${_current_source_dir}/) +#get_filename_component(_current_source_dir ${CMAKE_CURRENT_LIST_FILE} PATH) +set(Sleef_DIR ${PROJECT_SOURCE_DIR}/../) find_package(RCMake REQUIRED) find_package(RSys 0.7 REQUIRED) @@ -53,6 +52,12 @@ set(VERSION_MINOR 3) set(VERSION_PATCH 0) set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) +# 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) + set(RSIMD_FILES_INC_LEGACY aosf33.h aosf44.h @@ -83,11 +88,15 @@ set(RSIMD_FILES_SRC aosf44.c aosq.c) set(RSIMD_FILES_DOC COPYING COPYING.LESSER 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} @@ -96,13 +105,10 @@ set(RSIMD_FILES_INC 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 VERSION ${VERSION} SOVERSION ${VERSION_MAJOR}) -rcmake_setup_devel(rsimd RSIMD ${VERSION} rsimd/rsimd_version.h) - ################################################################################ # Add tests ################################################################################ @@ -156,4 +162,10 @@ install(FILES ${RSIMD_FILES_INC_LEGACY} 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 ${PROJECT_SOURCE_DIR}/RSIMDConfig.cmake + DESTINATION lib/cmake/RSIMD) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/RSIMDConfigVersion.cmake + DESTINATION lib/cmake/RSIMD) diff --git a/cmake/RSIMDConfig.cmake b/cmake/RSIMDConfig.cmake @@ -0,0 +1,96 @@ +# Copyright (C) 2013-2017 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) +find_package(Sleef REQUIRED) + +# 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) + +# 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 @@ -0,0 +1,54 @@ +# Copyright (C) 2014-2021 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,4 +1,4 @@ -# Copyright (C) 2014-2019 Vincent Forest (vaplv@free.fr) +# Copyright (C) 2014-2021 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 @@ -19,7 +19,7 @@ cmake_minimum_required(VERSION 3.1) find_path(Sleef_INCLUDE_DIR sleef.h) find_library(Sleef_LIBRARY sleef PATH_SUFFIXES lib64 - DOC "Path the the sleef library") + DOC "Path to the sleef library") # Create the imported library target add_library(Sleef SHARED IMPORTED) diff --git a/src/math.h b/src/math.h @@ -155,5 +155,4 @@ v4f_xyz_to_rthetaphi(const v4f_T v) return v4f_xyab(v4f_xayb(len3, theta), phi); } - #endif /* RSIMD_MATH_H */ diff --git a/src/rsimd_version.h.in b/src/rsimd_version.h.in @@ -0,0 +1,23 @@ +/* Copyright (C) 2014-2021 Vincent Forest (vaplv@free.fr) + * + * The RSIMD library is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser 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 library 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with the RSIMD library. If not, see <http://www.gnu.org/licenses/>. */ + +#ifndef RSIMD_VERSION_H +#define RSIMD_VERSION_H + +#define RSIMD_VERSION_MAJOR @VERSION_MAJOR@ +#define RSIMD_VERSION_MINOR @VERSION_MINOR@ +#define RSIMD_VERSION_PATCH @VERSION_PATCH@ + +#endif /* RSIMD_VERSION_H */