Skip to content

Commit

Permalink
drop support apple-clang < 15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
toge committed Nov 19, 2024
1 parent 944d6de commit 4b617fc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 39 deletions.
18 changes: 8 additions & 10 deletions recipes/fastpfor/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from conan import ConanFile
from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, replace_in_file
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, 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"
Expand Down Expand Up @@ -34,25 +36,22 @@ def layout(self):
cmake_layout(self, src_folder="src")

def requirements(self):
if str(self.settings.arch).startswith("armv8"):
if "arm" in str(self.settings.arch):
self.requires("simde/0.8.0", transitive_headers=True)

def validate(self):
check_min_cppstd(self, 11)

def _patch_sources(self):
# Let Conan set the C++ standard
replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"),
"set (CMAKE_CXX_STANDARD 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)
self._patch_sources()
apply_conandata_patches(self)

def generate(self):
tc = CMakeToolchain(self)
tc.variables["WITH_TEST"] = False
if str(self.settings.arch).startswith("armv8"):
if "arm" in str(self.settings.arch):
tc.cache_variables["SUPPORT_NEON"] = True
tc.preprocessor_definitions["SIMDE_ENABLE_NATIVE_ALIASES"] = 1
if is_apple_os(self):
Expand All @@ -64,7 +63,6 @@ def generate(self):
tc.generate()

def build(self):
apply_conandata_patches(self)
cmake = CMake(self)
cmake.configure()
cmake.build()
Expand Down
44 changes: 15 additions & 29 deletions recipes/fastpfor/all/patches/0.2.0-0001-fix-cmake.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 38590f3..cbe7357 100644
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()
Expand All @@ -11,30 +20,7 @@ index 38590f3..cbe7357 100644
MESSAGE(STATUS "USING SIMDE FOR SIMD OPERATIONS")
else ()
MESSAGE(STATUS "SIMDE and SSE 4.2 support not detected")
@@ -90,7 +90,7 @@ elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
set (CMAKE_CXX_FLAGS_DEBUG "-Wall -ggdb -std=c++11 -DHAVE_CXX0X -march=native")
set (CMAKE_C_FLAGS_RELEASE "-Wall -Ofast -DNDEBUG -std=c99 -march=native")
set (CMAKE_C_FLAGS_DEBUG "-Wall -ggdb -std=c99 -march=native")
-elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang")
+elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
if (CXX_COMPILER_VERSION VERSION_LESS 4.2.1)
message(STATUS "Clang version must be at least 4.2.1!" )
endif()
@@ -98,11 +98,24 @@ elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STR
set (CMAKE_CXX_FLAGS_DEBUG "-Wall -Wcast-align -ggdb -std=c++11 -DHAVE_CXX0X -march=native")
set (CMAKE_C_FLAGS_RELEASE "-Wall -Wcast-align -O3 -DNDEBUG -std=c99 -march=native")
set (CMAKE_C_FLAGS_DEBUG "-Wall -Wcast-align -ggdb -std=c99 -march=native")
+elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang")
+ set(TUNE_FLAG "-mtune=core-avx2")
+ if(CMAKE_OSX_ARCHITECTURES MATCHES "arm64.*")
+ set(TUNE_FLAG "-mtune=apple-m1")
+ endif()
+ set (CMAKE_CXX_FLAGS_RELEASE "-Wall -Wcast-align -O3 -DNDEBUG -std=c++11 -DHAVE_CXX0X ${TUNE_FLAG}")
+ set (CMAKE_CXX_FLAGS_DEBUG "-Wall -Wcast-align -ggdb -std=c++11 -DHAVE_CXX0X ${TUNE_FLAG}")
+ set (CMAKE_C_FLAGS_RELEASE "-Wall -Wcast-align -O3 -DNDEBUG -std=c99 ${TUNE_FLAG}")
+ set (CMAKE_C_FLAGS_DEBUG "-Wall -Wcast-align -ggdb -std=c99 ${TUNE_FLAG}")
elseif(WIN32)
# TODO add support for later versions?
@@ -103,6 +103,10 @@ elseif(WIN32)
if(NOT MSVC12)
message(STATUS "On Windows, only MSVC version 12 is supported!")
endif()
Expand All @@ -45,7 +31,7 @@ index 38590f3..cbe7357 100644
else ()
message(FATAL_ERROR "Please, use GCC, Clang, or the Intel compiler!")
endif()
@@ -129,19 +142,19 @@ add_library(FastPFOR STATIC
@@ -129,19 +133,19 @@ add_library(FastPFOR STATIC
src/streamvbyte.c)
set_target_properties(FastPFOR PROPERTIES POSITION_INDEPENDENT_CODE TRUE)

Expand All @@ -72,7 +58,7 @@ index 38590f3..cbe7357 100644
add_executable(entropy src/entropy.cpp)
target_link_libraries(entropy FastPFOR)

@@ -149,7 +162,7 @@ if( SUPPORT_SSE42 )
@@ -149,7 +153,7 @@ if( SUPPORT_SSE42 )
add_executable(benchbitpacking src/benchbitpacking.cpp)
target_link_libraries(benchbitpacking FastPFOR)
endif()
Expand All @@ -81,15 +67,15 @@ index 38590f3..cbe7357 100644
find_package(snappy)
if(NOT ${snappy_FOUND})
message(STATUS "Snappy was not found. codecssnappy and "
@@ -158,6 +171,7 @@ else()
@@ -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 +179,7 @@ else()
@@ -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})
Expand Down

0 comments on commit 4b617fc

Please sign in to comment.