format cmake files

This commit is contained in:
Max Bachmann 2022-10-02 10:17:09 +02:00
parent 6f8fac72a3
commit 66cb57358f
7 changed files with 222 additions and 143 deletions

View File

@ -10,34 +10,42 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
project(rapidfuzz LANGUAGES C CXX)
if (MSVC)
add_compile_options(/W4 /bigobj)
if(MSVC)
add_compile_options(/W4 /bigobj)
else()
add_compile_options(-Wall -Wextra -pedantic -Wno-psabi)
add_compile_options(-Wall -Wextra -pedantic -Wno-psabi)
endif()
if(CMAKE_VERSION VERSION_LESS 3.18)
find_package(Python COMPONENTS Interpreter Development REQUIRED)
find_package(
Python
COMPONENTS Interpreter Development
REQUIRED)
else()
set(Python_ARTIFACTS_INTERACTIVE TRUE)
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
set(Python_ARTIFACTS_INTERACTIVE TRUE)
find_package(
Python
COMPONENTS Interpreter Development.Module
REQUIRED)
endif()
if(CMAKE_VERSION VERSION_LESS 3.17)
execute_process(
COMMAND "${Python_EXECUTABLE}" -c
"import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX').split('.')[1])"
OUTPUT_VARIABLE Python_SOABI
OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ECHO STDOUT)
message(STATUS "Corrected SOABI: ${Python_SOABI}")
execute_process(
COMMAND
"${Python_EXECUTABLE}" -c
"import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX').split('.')[1])"
OUTPUT_VARIABLE Python_SOABI
OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ECHO STDOUT)
message(STATUS "Corrected SOABI: ${Python_SOABI}")
elseif("${Python_INTERPRETER_ID}" STREQUAL "PyPy")
message(STATUS "PyPy SOABI: ${Python_SOABI}")
execute_process(
COMMAND "${Python_EXECUTABLE}" -c
"import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX').split('.')[1])"
OUTPUT_VARIABLE Python_SOABI
OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ECHO STDOUT)
message(STATUS "Corrected SOABI: ${Python_SOABI}")
message(STATUS "PyPy SOABI: ${Python_SOABI}")
execute_process(
COMMAND
"${Python_EXECUTABLE}" -c
"import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX').split('.')[1])"
OUTPUT_VARIABLE Python_SOABI
OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ECHO STDOUT)
message(STATUS "Corrected SOABI: ${Python_SOABI}")
endif()
include(FetchContent)
@ -48,23 +56,29 @@ check_cpu_arch_x64(RAPIDFUZZ_ARCH_X64)
set(RF_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
find_package(Taskflow 3.0.0 QUIET)
if (Taskflow_FOUND)
message(STATUS "Using system supplied version of Taskflow")
if(Taskflow_FOUND)
message(STATUS "Using system supplied version of Taskflow")
else()
message(STATUS "Using packaged version of Taskflow")
set(TF_BUILD_CUDA OFF CACHE BOOL "Enables build of CUDA code")
set(TF_BUILD_TESTS OFF CACHE BOOL "Enables build of tests")
set(TF_BUILD_EXAMPLES OFF CACHE BOOL "Enables build of examples")
add_subdirectory(extern/taskflow EXCLUDE_FROM_ALL)
add_library(Taskflow::Taskflow ALIAS Taskflow)
message(STATUS "Using packaged version of Taskflow")
set(TF_BUILD_CUDA
OFF
CACHE BOOL "Enables build of CUDA code")
set(TF_BUILD_TESTS
OFF
CACHE BOOL "Enables build of tests")
set(TF_BUILD_EXAMPLES
OFF
CACHE BOOL "Enables build of examples")
add_subdirectory(extern/taskflow EXCLUDE_FROM_ALL)
add_library(Taskflow::Taskflow ALIAS Taskflow)
endif()
find_package(rapidfuzz 1.7.0 QUIET)
if (rapidfuzz_FOUND)
message(STATUS "Using system supplied version of rapidfuzz-cpp")
if(rapidfuzz_FOUND)
message(STATUS "Using system supplied version of rapidfuzz-cpp")
else()
message(STATUS "Using packaged version of rapidfuzz-cpp")
add_subdirectory(extern/rapidfuzz-cpp)
message(STATUS "Using packaged version of rapidfuzz-cpp")
add_subdirectory(extern/rapidfuzz-cpp)
endif()
add_subdirectory(src/rapidfuzz)

View File

@ -58,7 +58,7 @@ def _cmake_required():
if tag.platform in cmake_wheels:
return True
print("No Cmake wheel available on platform")
print("No cmake wheel available on platform")
return False
def _ninja_required():

View File

@ -1,31 +1,45 @@
macro(_CHECK_CPU_ARCH ARCH ARCH_DEFINES VARIABLE)
if(NOT DEFINED HAVE_${VARIABLE})
message(STATUS "Check CPU architecture is ${ARCH}")
set(CHECK_CPU_ARCH_DEFINES ${ARCH_DEFINES})
configure_file(${PROJECT_SOURCE_DIR}/cmake/CheckCPUArch.c.in ${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckCPUArch.c @ONLY)
try_compile(HAVE_${VARIABLE} "${PROJECT_BINARY_DIR}"
"${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckCPUArch.c")
if(HAVE_${VARIABLE})
message(STATUS "Check CPU architecture is ${ARCH} - yes")
set(${VARIABLE} 1 CACHE INTERNAL "Result of CHECK_CPU_ARCH" FORCE)
else ()
message(STATUS "Check CPU architecture is ${ARCH} - no")
endif()
endif ()
if(NOT DEFINED HAVE_${VARIABLE})
message(STATUS "Check CPU architecture is ${ARCH}")
set(CHECK_CPU_ARCH_DEFINES ${ARCH_DEFINES})
configure_file(
${PROJECT_SOURCE_DIR}/cmake/CheckCPUArch.c.in
${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckCPUArch.c @ONLY)
try_compile(HAVE_${VARIABLE} "${PROJECT_BINARY_DIR}"
"${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckCPUArch.c")
if(HAVE_${VARIABLE})
message(STATUS "Check CPU architecture is ${ARCH} - yes")
set(${VARIABLE}
1
CACHE INTERNAL "Result of CHECK_CPU_ARCH" FORCE)
else()
message(STATUS "Check CPU architecture is ${ARCH} - no")
endif()
endif()
endmacro(_CHECK_CPU_ARCH)
macro(CHECK_CPU_ARCH_X64 VARIABLE)
_CHECK_CPU_ARCH(x64 "defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)" ${VARIABLE})
_check_cpu_arch(
x64
"defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)"
${VARIABLE})
endmacro(CHECK_CPU_ARCH_X64)
macro(CHECK_CPU_ARCH_X86 VARIABLE)
_CHECK_CPU_ARCH(x86 "defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) ||defined( __i386) || defined(_M_IX86)" ${VARIABLE})
_check_cpu_arch(
x86
"defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) ||defined( __i386) || defined(_M_IX86)"
${VARIABLE})
endmacro(CHECK_CPU_ARCH_X86)
macro(CHECK_CPU_ARCH_PPC64 VARIABLE)
_CHECK_CPU_ARCH(ppc64 "defined(__powerpc64__) || defined(__ppc64__) || defined(__PPC64__) ||defined(_ARCH_PPC64)" ${VARIABLE})
_check_cpu_arch(
ppc64
"defined(__powerpc64__) || defined(__ppc64__) || defined(__PPC64__) ||defined(_ARCH_PPC64)"
${VARIABLE})
endmacro(CHECK_CPU_ARCH_PPC64)
macro(CHECK_CPU_ARCH_ARM64 VARIABLE)
_CHECK_CPU_ARCH(arm64 "defined(__aarch64__) || defined(__arm64__)" ${VARIABLE})
_check_cpu_arch(arm64 "defined(__aarch64__) || defined(__arm64__)"
${VARIABLE})
endmacro(CHECK_CPU_ARCH_ARM64)

View File

@ -28,7 +28,7 @@
issn = {0004-5411},
url = {https://doi.org/10.1145/321796.321811},
doi = {10.1145/321796.321811},
abstract = {The string-to-string correction problem is to determine the distance between two strings as measured by the minimum cost sequence of “edit operations” needed to change the one string into the other. The edit operations investigated allow changing one symbol of a string into another single symbol, deleting one symbol from a string, or inserting a single symbol into a string. An algorithm is presented which solves this problem in time proportional to the product of the lengths of the two strings. Possible applications are to the problems of automatic spelling correction and determining the longest subsequence of characters common to two strings.},
abstract = {The string-to-string correction problem is to determine the distance between two strings as measured by the minimum cost sequence of "edit operations" needed to change the one string into the other. The edit operations investigated allow changing one symbol of a string into another single symbol, deleting one symbol from a string, or inserting a single symbol into a string. An algorithm is presented which solves this problem in time proportional to the product of the lengths of the two strings. Possible applications are to the problems of automatic spelling correction and determining the longest subsequence of characters common to two strings.},
journal = {J. ACM},
month = {jan},
pages = {168173},

View File

@ -1,80 +1,103 @@
function(create_cython_target _name)
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/${_name}.cxx)
set(${_name} ${CMAKE_CURRENT_LIST_DIR}/${_name}.cxx PARENT_SCOPE)
else()
find_package(Cython REQUIRED)
# should use target_include_directories once this is supported by scikit-build
include_directories(${RF_BASE_DIR}/rapidfuzz)
add_cython_target(${_name} CXX)
set(${_name} ${_name} PARENT_SCOPE)
endif()
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/${_name}.cxx)
set(${_name}
${CMAKE_CURRENT_LIST_DIR}/${_name}.cxx
PARENT_SCOPE)
else()
find_package(Cython REQUIRED)
# should use target_include_directories once this is supported by
# scikit-build
include_directories(${RF_BASE_DIR}/rapidfuzz)
add_cython_target(${_name} CXX)
set(${_name}
${_name}
PARENT_SCOPE)
endif()
endfunction(create_cython_target)
function(rf_add_library name)
if(CMAKE_VERSION VERSION_LESS 3.17)
Python_add_library(${name} MODULE ${ARGV})
get_property(suffix TARGET ${name} PROPERTY SUFFIX)
if (NOT suffix)
set (suffix "${CMAKE_SHARED_MODULE_SUFFIX}")
endif()
set_property (TARGET ${name} PROPERTY SUFFIX ".${Python_SOABI}${suffix}")
else()
Python_add_library(${name} MODULE WITH_SOABI ${ARGV})
if(CMAKE_VERSION VERSION_LESS 3.17)
python_add_library(${name} MODULE ${ARGV})
get_property(
suffix
TARGET ${name}
PROPERTY SUFFIX)
if(NOT suffix)
set(suffix "${CMAKE_SHARED_MODULE_SUFFIX}")
endif()
set_property(TARGET ${name} PROPERTY SUFFIX ".${Python_SOABI}${suffix}")
else()
python_add_library(${name} MODULE WITH_SOABI ${ARGV})
endif()
endfunction(rf_add_library)
if (RAPIDFUZZ_ARCH_X64)
add_library(CpuInfo STATIC ${RF_BASE_DIR}/rapidfuzz/FeatureDetector/CpuInfo.cpp)
target_compile_features(CpuInfo PUBLIC cxx_std_17)
if(RAPIDFUZZ_ARCH_X64)
add_library(CpuInfo STATIC
${RF_BASE_DIR}/rapidfuzz/FeatureDetector/CpuInfo.cpp)
target_compile_features(CpuInfo PUBLIC cxx_std_17)
add_library(edit_based_avx2 STATIC ${RF_BASE_DIR}/rapidfuzz/simd/avx2/edit_based_avx2.cpp)
target_compile_features(edit_based_avx2 PUBLIC cxx_std_17)
target_include_directories(edit_based_avx2 PRIVATE ${Python_INCLUDE_DIRS} ${RF_CAPI_PATH} ${RF_BASE_DIR}/rapidfuzz ${RF_BASE_DIR}/rapidfuzz/distance)
target_link_libraries(edit_based_avx2 PRIVATE rapidfuzz::rapidfuzz)
if (MSVC)
set_target_properties(edit_based_avx2 PROPERTIES COMPILE_FLAGS "/arch:AVX2")
else()
set_target_properties(edit_based_avx2 PROPERTIES COMPILE_FLAGS "-mavx2")
endif()
add_library(edit_based_avx2 STATIC
${RF_BASE_DIR}/rapidfuzz/simd/avx2/edit_based_avx2.cpp)
target_compile_features(edit_based_avx2 PUBLIC cxx_std_17)
target_include_directories(
edit_based_avx2
PRIVATE ${Python_INCLUDE_DIRS} ${RF_CAPI_PATH} ${RF_BASE_DIR}/rapidfuzz
${RF_BASE_DIR}/rapidfuzz/distance)
target_link_libraries(edit_based_avx2 PRIVATE rapidfuzz::rapidfuzz)
if(MSVC)
set_target_properties(edit_based_avx2 PROPERTIES COMPILE_FLAGS "/arch:AVX2")
else()
set_target_properties(edit_based_avx2 PROPERTIES COMPILE_FLAGS "-mavx2")
endif()
add_library(edit_based_sse2 STATIC ${RF_BASE_DIR}/rapidfuzz/simd/sse2/edit_based_sse2.cpp)
target_compile_features(edit_based_sse2 PUBLIC cxx_std_17)
target_include_directories(edit_based_sse2 PRIVATE ${Python_INCLUDE_DIRS} ${RF_CAPI_PATH} ${RF_BASE_DIR}/rapidfuzz ${RF_BASE_DIR}/rapidfuzz/distance)
target_link_libraries(edit_based_sse2 PRIVATE rapidfuzz::rapidfuzz)
if (NOT MSVC)
set_target_properties(edit_based_sse2 PROPERTIES COMPILE_FLAGS "-msse2")
endif()
add_library(edit_based_sse2 STATIC
${RF_BASE_DIR}/rapidfuzz/simd/sse2/edit_based_sse2.cpp)
target_compile_features(edit_based_sse2 PUBLIC cxx_std_17)
target_include_directories(
edit_based_sse2
PRIVATE ${Python_INCLUDE_DIRS} ${RF_CAPI_PATH} ${RF_BASE_DIR}/rapidfuzz
${RF_BASE_DIR}/rapidfuzz/distance)
target_link_libraries(edit_based_sse2 PRIVATE rapidfuzz::rapidfuzz)
if(NOT MSVC)
set_target_properties(edit_based_sse2 PROPERTIES COMPILE_FLAGS "-msse2")
endif()
endif()
create_cython_target(utils_cpp)
rf_add_library(utils_cpp ${utils_cpp} ${CMAKE_CURRENT_LIST_DIR}/utils.cpp)
target_compile_features(utils_cpp PUBLIC cxx_std_17)
target_include_directories(utils_cpp PRIVATE ${RF_CAPI_PATH} ${RF_BASE_DIR}/rapidfuzz)
target_include_directories(utils_cpp PRIVATE ${RF_CAPI_PATH}
${RF_BASE_DIR}/rapidfuzz)
target_link_libraries(utils_cpp PRIVATE rapidfuzz::rapidfuzz)
install(TARGETS utils_cpp LIBRARY DESTINATION src/rapidfuzz)
create_cython_target(fuzz_cpp)
rf_add_library(fuzz_cpp ${fuzz_cpp})
target_compile_features(fuzz_cpp PUBLIC cxx_std_17)
target_include_directories(fuzz_cpp PRIVATE ${RF_CAPI_PATH} ${RF_BASE_DIR}/rapidfuzz)
target_include_directories(fuzz_cpp PRIVATE ${RF_CAPI_PATH}
${RF_BASE_DIR}/rapidfuzz)
target_link_libraries(fuzz_cpp PRIVATE rapidfuzz::rapidfuzz)
if (RAPIDFUZZ_ARCH_X64)
target_link_libraries(fuzz_cpp PRIVATE edit_based_avx2 edit_based_sse2 CpuInfo)
if(RAPIDFUZZ_ARCH_X64)
target_link_libraries(fuzz_cpp PRIVATE edit_based_avx2 edit_based_sse2
CpuInfo)
endif()
install(TARGETS fuzz_cpp LIBRARY DESTINATION src/rapidfuzz)
create_cython_target(process_cpp_impl)
rf_add_library(process_cpp_impl ${process_cpp_impl})
target_compile_features(process_cpp_impl PUBLIC cxx_std_17)
target_include_directories(process_cpp_impl PRIVATE ${RF_CAPI_PATH} ${RF_BASE_DIR}/rapidfuzz)
target_link_libraries(process_cpp_impl PRIVATE Taskflow::Taskflow rapidfuzz::rapidfuzz)
target_include_directories(process_cpp_impl PRIVATE ${RF_CAPI_PATH}
${RF_BASE_DIR}/rapidfuzz)
target_link_libraries(process_cpp_impl PRIVATE Taskflow::Taskflow
rapidfuzz::rapidfuzz)
# check if we need to link with libatomic (not needed on Windows)
if (NOT Windows)
# TODO: migrate to CheckSourceCompiles in CMake >= 3.19
include(CheckCXXSourceCompiles)
if(NOT Windows)
# TODO: migrate to CheckSourceCompiles in CMake >= 3.19
include(CheckCXXSourceCompiles)
set(ATOMICS_TEST_SOURCE [=[
set(ATOMICS_TEST_SOURCE
[=[
#include <atomic>
#include <cstdint>
std::atomic<int> x{0};
@ -83,31 +106,45 @@ if (NOT Windows)
return 0;
}
]=])
string(REPLACE "std::atomic<int>" "std::atomic<std::int8_t>" ATOMICS8_TEST_SOURCE "${ATOMICS_TEST_SOURCE}")
string(REPLACE "std::atomic<int>" "std::atomic<std::int64_t>" ATOMICS64_TEST_SOURCE "${ATOMICS_TEST_SOURCE}")
string(REPLACE "std::atomic<int>" "std::atomic<std::int8_t>"
ATOMICS8_TEST_SOURCE "${ATOMICS_TEST_SOURCE}")
string(REPLACE "std::atomic<int>" "std::atomic<std::int64_t>"
ATOMICS64_TEST_SOURCE "${ATOMICS_TEST_SOURCE}")
if(APPLE)
set(CMAKE_REQUIRED_FLAGS "-std=c++11")
endif()
check_cxx_source_compiles("${ATOMICS_TEST_SOURCE}" HAVE_CXX_ATOMICS_WITHOUT_LIB)
check_cxx_source_compiles("${ATOMICS8_TEST_SOURCE}" HAVE_CXX_ATOMICS8_WITHOUT_LIB)
check_cxx_source_compiles("${ATOMICS64_TEST_SOURCE}" HAVE_CXX_ATOMICS64_WITHOUT_LIB)
if((NOT HAVE_CXX_ATOMICS_WITHOUT_LIB) OR (NOT HAVE_CXX_ATOMICS8_WITHOUT_LIB) OR (NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB))
set(CMAKE_REQUIRED_LIBRARIES "atomic")
check_cxx_source_compiles("${ATOMICS_TEST_SOURCE}" HAVE_CXX_ATOMICS_WITH_LIB)
check_cxx_source_compiles("${ATOMICS8_TEST_SOURCE}" HAVE_CXX_ATOMICS8_WITH_LIB)
check_cxx_source_compiles("${ATOMICS64_TEST_SOURCE}" HAVE_CXX_ATOMICS64_WITH_LIB)
if ((NOT HAVE_CXX_ATOMICS_WITH_LIB) OR (NOT HAVE_CXX_ATOMICS8_WITH_LIB) OR (NOT HAVE_CXX_ATOMICS64_WITH_LIB))
message(FATAL_ERROR "No native support for std::atomic, or libatomic not found!")
else()
message(STATUS "Linking with libatomic for atomics support")
unset(CMAKE_REQUIRED_LIBRARIES)
target_link_libraries(process_cpp_impl PUBLIC atomic)
endif()
endif()
if(APPLE)
unset(CMAKE_REQUIRED_FLAGS)
if(APPLE)
set(CMAKE_REQUIRED_FLAGS "-std=c++11")
endif()
check_cxx_source_compiles("${ATOMICS_TEST_SOURCE}"
HAVE_CXX_ATOMICS_WITHOUT_LIB)
check_cxx_source_compiles("${ATOMICS8_TEST_SOURCE}"
HAVE_CXX_ATOMICS8_WITHOUT_LIB)
check_cxx_source_compiles("${ATOMICS64_TEST_SOURCE}"
HAVE_CXX_ATOMICS64_WITHOUT_LIB)
if((NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
OR (NOT HAVE_CXX_ATOMICS8_WITHOUT_LIB)
OR (NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB))
set(CMAKE_REQUIRED_LIBRARIES "atomic")
check_cxx_source_compiles("${ATOMICS_TEST_SOURCE}"
HAVE_CXX_ATOMICS_WITH_LIB)
check_cxx_source_compiles("${ATOMICS8_TEST_SOURCE}"
HAVE_CXX_ATOMICS8_WITH_LIB)
check_cxx_source_compiles("${ATOMICS64_TEST_SOURCE}"
HAVE_CXX_ATOMICS64_WITH_LIB)
if((NOT HAVE_CXX_ATOMICS_WITH_LIB)
OR (NOT HAVE_CXX_ATOMICS8_WITH_LIB)
OR (NOT HAVE_CXX_ATOMICS64_WITH_LIB))
message(
FATAL_ERROR "No native support for std::atomic, or libatomic not found!"
)
else()
message(STATUS "Linking with libatomic for atomics support")
unset(CMAKE_REQUIRED_LIBRARIES)
target_link_libraries(process_cpp_impl PUBLIC atomic)
endif()
endif()
if(APPLE)
unset(CMAKE_REQUIRED_FLAGS)
endif()
endif()
install(TARGETS process_cpp_impl LIBRARY DESTINATION src/rapidfuzz)

View File

@ -1,41 +1,55 @@
function(create_cython_target _name)
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/${_name}.cxx)
set(${_name} ${CMAKE_CURRENT_LIST_DIR}/${_name}.cxx PARENT_SCOPE)
else()
find_package(Cython REQUIRED)
# should use target_include_directories once this is supported by scikit-build
include_directories(${RF_BASE_DIR}/rapidfuzz ${RF_BASE_DIR}/rapidfuzz/distance)
add_cython_target(${_name} CXX)
set(${_name} ${_name} PARENT_SCOPE)
endif()
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/${_name}.cxx)
set(${_name}
${CMAKE_CURRENT_LIST_DIR}/${_name}.cxx
PARENT_SCOPE)
else()
find_package(Cython REQUIRED)
# should use target_include_directories once this is supported by
# scikit-build
include_directories(${RF_BASE_DIR}/rapidfuzz
${RF_BASE_DIR}/rapidfuzz/distance)
add_cython_target(${_name} CXX)
set(${_name}
${_name}
PARENT_SCOPE)
endif()
endfunction(create_cython_target)
function(rf_add_library name)
if(CMAKE_VERSION VERSION_LESS 3.17)
Python_add_library(${name} MODULE ${ARGV})
get_property(suffix TARGET ${name} PROPERTY SUFFIX)
if (NOT suffix)
set (suffix "${CMAKE_SHARED_MODULE_SUFFIX}")
endif()
set_property (TARGET ${name} PROPERTY SUFFIX ".${Python_SOABI}${suffix}")
else()
Python_add_library(${name} MODULE WITH_SOABI ${ARGV})
if(CMAKE_VERSION VERSION_LESS 3.17)
python_add_library(${name} MODULE ${ARGV})
get_property(
suffix
TARGET ${name}
PROPERTY SUFFIX)
if(NOT suffix)
set(suffix "${CMAKE_SHARED_MODULE_SUFFIX}")
endif()
set_property(TARGET ${name} PROPERTY SUFFIX ".${Python_SOABI}${suffix}")
else()
python_add_library(${name} MODULE WITH_SOABI ${ARGV})
endif()
endfunction(rf_add_library)
create_cython_target(_initialize_cpp)
rf_add_library(_initialize_cpp ${_initialize_cpp})
target_compile_features(_initialize_cpp PUBLIC cxx_std_17)
target_include_directories(_initialize_cpp PRIVATE ${RF_CAPI_PATH} ${RF_BASE_DIR}/rapidfuzz ${RF_BASE_DIR}/rapidfuzz/distance)
target_include_directories(
_initialize_cpp PRIVATE ${RF_CAPI_PATH} ${RF_BASE_DIR}/rapidfuzz
${RF_BASE_DIR}/rapidfuzz/distance)
target_link_libraries(_initialize_cpp PRIVATE rapidfuzz::rapidfuzz)
install(TARGETS _initialize_cpp LIBRARY DESTINATION src/rapidfuzz/distance)
create_cython_target(metrics_cpp)
rf_add_library(metrics_cpp ${metrics_cpp})
target_compile_features(metrics_cpp PUBLIC cxx_std_17)
target_include_directories(metrics_cpp PRIVATE ${RF_CAPI_PATH} ${RF_BASE_DIR}/rapidfuzz ${RF_BASE_DIR}/rapidfuzz/distance)
target_include_directories(
metrics_cpp PRIVATE ${RF_CAPI_PATH} ${RF_BASE_DIR}/rapidfuzz
${RF_BASE_DIR}/rapidfuzz/distance)
target_link_libraries(metrics_cpp PRIVATE rapidfuzz::rapidfuzz)
if (RAPIDFUZZ_ARCH_X64)
target_link_libraries(metrics_cpp PRIVATE edit_based_avx2 edit_based_sse2 CpuInfo)
if(RAPIDFUZZ_ARCH_X64)
target_link_libraries(metrics_cpp PRIVATE edit_based_avx2 edit_based_sse2
CpuInfo)
endif()
install(TARGETS metrics_cpp LIBRARY DESTINATION src/rapidfuzz/distance)

View File

@ -1,5 +1,5 @@
#!/bin/bash
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 || exit ; pwd -P )"
ulimit -c unlimited
"$@"