Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fastpfor: add version 0.2.0, make static-library #25808

Merged
merged 12 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions recipes/fastpfor/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
sources:
"cci.20221225":
url: "https://github.com/lemire/FastPFor/archive/3e7358f8656b4456f4ea1762075553f2984fefcf.tar.gz"
sha256: "cc50b03421db3aa21be2243f5996ea6d027a6563e0863b77cfc46dd08bcfcaf5"
"cci.20220205":
url: "https://github.com/lemire/FastPFor/archive/773283d4a11fa2440a1b3b28fd77f775e86d7898.tar.gz"
sha256: "d4419512420f3bcc65862c5c367021f201b5ba3e8cb0dad895cdf444e0867b30"

"0.2.0":
url: "https://github.com/lemire/FastPFor/archive/refs/tags/v0.2.0.tar.gz"
sha256: "d9f0eacf9c3c61866cda23bae35107ca9c5d35fa7b7a96ca9ccc85803d7e753d"
patches:
"cci.20221225":
- patch_file: "patches/cci.20221225-0001-fix-cmake.patch"
patch_description: "enable shared build, disable unittest/utility"
patch_type: "conan"
"cci.20220205":
- patch_file: "patches/cci.20220205-0001-fix-cmake.patch"
"0.2.0":
- patch_file: "patches/0.2.0-0001-fix-cmake.patch"
patch_description: "enable shared build, disable unittest/utility"
patch_type: "conan"
44 changes: 25 additions & 19 deletions recipes/fastpfor/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,26 @@
from conan.errors import ConanInvalidConfiguration
from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.apple import is_apple_os
from conan.tools.scm import Version
import os

required_conan_version = ">=1.53.0"

class FastPFORConan(ConanFile):
name = "fastpfor"
description = "Fast integer compression"
license = "Apache-2.0"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/lemire/FastPFor"
topics = ("compression", "sorted-lists", "simd", "x86", "x86-64")
package_type = "static-library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
}

Expand All @@ -30,30 +32,37 @@ def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")

def layout(self):
cmake_layout(self, src_folder="src")

def validate(self):
if self.settings.arch != "x86_64":
raise ConanInvalidConfiguration(f"{self.settings.arch} architecture is not supported")
@property
def _has_simde(self):
return "arm" in str(self.settings.arch)

def requirements(self):
if self._has_simde:
self.requires("simde/0.8.0", transitive_headers=True)

if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, "11")
def validate(self):
check_min_cppstd(self, 11)
if self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) < "15.0":
raise ConanInvalidConfiguration("${self.ref} doesn't support ${self.settings.compiler} < 15.0")

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
apply_conandata_patches(self)

def generate(self):
tc = CMakeToolchain(self)
tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True
tc.variables["WITH_TEST"] = False
if self._has_simde:
tc.cache_variables["SUPPORT_NEON"] = True
tc.preprocessor_definitions["SIMDE_ENABLE_NATIVE_ALIASES"] = 1
tc.generate()
tc = CMakeDeps(self)
tc.generate()

def build(self):
apply_conandata_patches(self)
cmake = CMake(self)
cmake.configure()
cmake.build()
Expand All @@ -75,8 +84,5 @@ def package_info(self):
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs.append("m")

# TODO: to remove in conan v2 once cmake_find_package_* generators removed
self.cpp_info.filenames["cmake_find_package"] = "FastPFOR"
self.cpp_info.filenames["cmake_find_package_multi"] = "FastPFOR"
self.cpp_info.names["cmake_find_package"] = "FastPFOR"
self.cpp_info.names["cmake_find_package_multi"] = "FastPFOR"
if self._has_simde:
self.cpp_info.defines = ["SIMDE_ENABLE_NATIVE_ALIASES"]
85 changes: 85 additions & 0 deletions recipes/fastpfor/all/patches/0.2.0-0001-fix-cmake.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f06b25f..1f6bd0f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,7 +4,7 @@
# Copyright (c) 2012 Louis Dionne
#
cmake_minimum_required(VERSION 3.0)
-set (CMAKE_CXX_STANDARD 11) # for constexpr specifier and other goodies
+# set (CMAKE_CXX_STANDARD 11) # for constexpr specifier and other goodies

if (NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to Release")
@@ -62,7 +62,7 @@ if( SUPPORT_SSE42 )
MESSAGE( STATUS "SSE 4.2 support detected" )
else()
if (SUPPORT_NEON)
- include("${CMAKE_MODULE_PATH}/simde.cmake")
+ find_package(simde REQUIRED CONFIG)
MESSAGE(STATUS "USING SIMDE FOR SIMD OPERATIONS")
else ()
MESSAGE(STATUS "SIMDE and SSE 4.2 support not detected")
@@ -103,6 +103,10 @@ elseif(WIN32)
if(NOT MSVC12)
message(STATUS "On Windows, only MSVC version 12 is supported!")
endif()
+ set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /arch:AVX")
+ set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:AVX")
+ set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /arch:AVX")
+ set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:AVX")
else ()
message(FATAL_ERROR "Please, use GCC, Clang, or the Intel compiler!")
endif()
@@ -129,19 +133,19 @@ add_library(FastPFOR STATIC
src/streamvbyte.c)
set_target_properties(FastPFOR PROPERTIES POSITION_INDEPENDENT_CODE TRUE)

-
+if(0)
# other executables
add_executable(gapstats src/gapstats.cpp)
add_executable(partitionbylength src/partitionbylength.cpp)
add_executable(csv2maropu src/csv2maropu.cpp)
-
+endif()
if (SUPPORT_NEON)
- target_link_libraries(FastPFOR PUBLIC simde)
- target_link_libraries(gapstats PUBLIC simde)
- target_link_libraries(partitionbylength PUBLIC simde)
- target_link_libraries(csv2maropu PUBLIC simde)
+ target_link_libraries(FastPFOR PUBLIC simde::simde)
+ # target_link_libraries(gapstats PUBLIC simde::simde)
+ # target_link_libraries(partitionbylength PUBLIC simde::simde)
+ # target_link_libraries(csv2maropu PUBLIC simde::simde)
endif()
-
+if(0)
add_executable(entropy src/entropy.cpp)
target_link_libraries(entropy FastPFOR)

@@ -149,7 +153,7 @@ if( SUPPORT_SSE42 )
add_executable(benchbitpacking src/benchbitpacking.cpp)
target_link_libraries(benchbitpacking FastPFOR)
endif()
-
+endif()
find_package(snappy)
if(NOT ${snappy_FOUND})
message(STATUS "Snappy was not found. codecssnappy and "
@@ -158,6 +162,7 @@ else()
message(STATUS "Snappy was found. Building additional targets "
"codecssnappy and inmemorybenchmarksnappy.")
include_directories(${snappy_INCLUDE_DIRS})
+ if(0)
add_executable(codecssnappy src/codecs.cpp)
set_target_properties(codecssnappy PROPERTIES DEFINE_SYMBOL USESNAPPY)
target_link_libraries(codecssnappy FastPFOR ${snappy_LIBRARIES})
@@ -165,6 +170,7 @@ else()
add_executable(inmemorybenchmarksnappy src/inmemorybenchmark.cpp)
set_target_properties(inmemorybenchmarksnappy PROPERTIES DEFINE_SYMBOL USESNAPPY)
target_link_libraries(inmemorybenchmarksnappy FastPFOR ${snappy_LIBRARIES})
+ endif()
endif()

option(WITH_TEST "Build with Google Test" ON)
72 changes: 0 additions & 72 deletions recipes/fastpfor/all/patches/cci.20220205-0001-fix-cmake.patch

This file was deleted.

71 changes: 0 additions & 71 deletions recipes/fastpfor/all/patches/cci.20221225-0001-fix-cmake.patch

This file was deleted.

8 changes: 0 additions & 8 deletions recipes/fastpfor/all/test_v1_package/CMakeLists.txt

This file was deleted.

17 changes: 0 additions & 17 deletions recipes/fastpfor/all/test_v1_package/conanfile.py

This file was deleted.

4 changes: 1 addition & 3 deletions recipes/fastpfor/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
versions:
"cci.20221225":
folder: all
"cci.20220205":
"0.2.0":
folder: all