Repository: conan-io/conan-center-index

Issue:
[request] boost-ext-simd/4.17.6.0
### Package Details
  * Package Name/Version: **boost-ext-simd/4.17.6.0**
  * Website: **https://github.com/procxx/boost.simd**
  * Source code: **https://github.com/procxx/boost.simd**  (one of latest forks as upstream has been [force-pushed](https://github.com/agenium-scale/boost.simd) and erased in favour of new nsimd which will be proposed in inother issue).


### Description Of The Library / Tool
Boost.SIMD is a portable SIMD programming library which has been proposed as a Boost library.

### Additional notes
Idea taken from another issue #6682.



Discussion:

Resolving patch:
diff --git a/recipes/procxx-boost-ext-simd/all/conanfile.py b/recipes/procxx-boost-ext-simd/all/conanfile.py
new file mode 100644
--- /dev/null
+++ b/recipes/procxx-boost-ext-simd/all/conanfile.py
@@ -0,0 +1,61 @@
+from conans import ConanFile, CMake, tools
+import os
+
+required_conan_version = ">=1.33.0"
+
+
+class ProCxxBoostExSimdConan(ConanFile):
+    name = "procxx-boost-ext-simd"
+    description = ("Portable SIMD computation library - was proposed as a "
+                   "Boost library"
+                   )
+    homepage = "https://github.com/procxx/boost.simd"
+    topics = ("conan", "boost", "simd")
+    license = "BSL-1.0"
+    url = "https://github.com/conan-io/conan-center-index"
+    settings = "os", "arch", "compiler", "build_type"
+    generators = "cmake", "cmake_find_package"
+    no_copy_source = True
+
+    @property
+    def _source_subfolder(self):
+        return "source_subfolder"
+
+    @property
+    def _min_cppstd(self):
+        return "11"
+
+    def requirements(self):
+        self.requires("boost/1.76.0")
+
+    def validate(self):
+        if self.settings.compiler.get_safe("cppstd"):
+            tools.check_min_cppstd(self, self._min_cppstd)
+
+    def package_id(self):
+        self.info.header_only()
+
+    def source(self):
+        tools.get(**self.conan_data["sources"][self.version])
+        extracted_folder = "boost.simd-" + self.version
+        os.rename(extracted_folder, self._source_subfolder)
+
+    def package(self):
+        self.copy(pattern="*", dst="include",
+                  src=os.path.join(self._source_subfolder, "include"))
+        self.copy("LICENSE", dst="licenses", src=self._source_subfolder)
+
+    def package_info(self):
+        # this technique was inspired by conan-center's "boost-ex-ut" recipe,
+        # and has been fixed to use the upstream Capitalized `Boost::`
+        # namespace for components
+        self.cpp_info.names["cmake_find_package"] = "Boost"
+        self.cpp_info.names["cmake_find_package_multi"] = "Boost"
+
+        # The original find_package() name here:
+        self.cpp_info.filenames["cmake_find_package"] = "Boost.SIMD"
+        self.cpp_info.filenames["cmake_find_package_multi"] = "Boost.SIMD"
+        self.cpp_info.components["SIMD"].names["cmake_find_package"] = "SIMD"
+        self.cpp_info.components["SIMD"].names["cmake_find_package_multi"] = \
+            "SIMD"
+        self.cpp_info.components["SIMD"].requires = ["boost::headers"]


Test patch:
diff --git a/recipes/procxx-boost-ext-simd/all/test_package/CMakeLists.txt b/recipes/procxx-boost-ext-simd/all/test_package/CMakeLists.txt
new file mode 100644
--- /dev/null
+++ b/recipes/procxx-boost-ext-simd/all/test_package/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 3.1.0)
+project(test_package)
+
+include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
+conan_basic_setup(TARGETS)
+
+find_package(Boost.SIMD REQUIRED)
+
+# FIXME: components from Boost.SIMD (target Boost::SIMD) don't work.
+# It should be:
+# find_package(BOOST REQUIRED COMPONENTS SIMD)
+# See https://github.com/conan-io/conan-center-index/issues/6682 for details.
+find_package(Boost REQUIRED COMPONENTS date_time) #  COMPONENTS SIMD)
+
+add_executable(${PROJECT_NAME} test_package.cpp)
+target_link_libraries(${PROJECT_NAME} Boost::headers Boost::SIMD)
+# FIXME: recipe should transitively sets proper minimum cxx standard.
+# See https://github.com/conan-io/conan/issues/7772 about revising cxx std model.
+set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
diff --git a/recipes/procxx-boost-ext-simd/all/test_package/conanfile.py b/recipes/procxx-boost-ext-simd/all/test_package/conanfile.py
new file mode 100644
--- /dev/null
+++ b/recipes/procxx-boost-ext-simd/all/test_package/conanfile.py
@@ -0,0 +1,16 @@
+from conans import ConanFile, CMake, tools
+import os
+
+
+class ProCxxBoostExSimdConan(ConanFile):
+    settings = "os", "compiler", "build_type", "arch"
+    generators = "cmake", "cmake_find_package"
+
+    def build(self):
+        cmake = CMake(self)
+        cmake.configure()
+        cmake.build()
+
+    def test(self):
+        if not tools.cross_building(self):
+            self.run(os.path.join("bin", "test_package"), run_environment=True)
diff --git a/recipes/procxx-boost-ext-simd/all/test_package/test_package.cpp b/recipes/procxx-boost-ext-simd/all/test_package/test_package.cpp
new file mode 100644
--- /dev/null
+++ b/recipes/procxx-boost-ext-simd/all/test_package/test_package.cpp
@@ -0,0 +1,19 @@
+// This source file should check the imported headers and do the simple things,
+// like querying library version. It doesn't intended to do some lengthy work
+// or running library tests - just only check that package is properly created.
+// See docs for details:
+// https://docs.conan.io/en/latest/creating_packages/getting_started.html#the-test-package-folder
+#include <boost/simd/pack.hpp>
+#include <boost/date_time.hpp>
+#include <iostream>
+
+namespace bs = boost::simd;
+
+int main()
+{
+    using namespace boost::date_time;
+    bs::pack<float,4> p{1.f,2.f,3.f,4.f};
+    std::cout << "Boost.SIMD test from README.md : " << p + 10*p << "\n";
+    std::cout << "Boost.date_time interop test: " << boost::gregorian::date(2021, Aug, 4) << "\n";
+    return 0;
+}