Skip to content

Commit

Permalink
Merge pull request #1 from uilianries/simdjson-0.4.7
Browse files Browse the repository at this point in the history
Build simdjson 0.4.7 on Linux
  • Loading branch information
lemire authored Jul 21, 2020
2 parents 53ea7e8 + 8764689 commit c0d040c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
6 changes: 2 additions & 4 deletions recipes/simdjson/0.4.7/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
cmake_minimum_required(VERSION 3.9)

cmake_minimum_required(VERSION 2.8)
project(cmake_wrapper)

include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
include("conanbuildinfo.cmake")
conan_basic_setup()

add_subdirectory(source_subfolder)

34 changes: 21 additions & 13 deletions recipes/simdjson/0.4.7/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,31 @@ class SimdjsonConan(ConanFile):
'fPIC': True,
'threads': True}
_cmake = None

@property
def _source_subfolder(self):
return "source_subfolder"

@property
def _build_subfolder(self):
return "build_subfolder"

@property
def _supported_cppstd(self):
return ["11", "gnu11","14", "gnu14", "17", "gnu17", "20", "gnu20"]
return ["11", "gnu11", "14", "gnu14", "17", "gnu17", "20", "gnu20"]

def _is_supported_compiler(self):
# Try to get by conan. We support more compilers than that.
supported_compilers = [("apple-clang", 10), ("gcc", 8)]
compiler, version = self.settings.compiler, Version(self.settings.compiler.version)
return any(compiler == sc[0] and version >= sc[1] for sc in supported_compilers)

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC

def configure(self):
if self.settings.compiler == "Visual Studio":
if self.options.shared:
del self.options.fPIC
if self.settings.compiler.cppstd and \
not self.settings.compiler.cppstd in self._supported_cppstd:
Expand All @@ -49,21 +58,21 @@ def configure(self):
raise ConanInvalidConfiguration("This library is tested with a family of recent compilers."
" {} {} is not supported."
.format(self.settings.compiler, self.settings.compiler.version))

def source(self):
tools.get(**self.conan_data["sources"][self.version])
extracted_dir = self.name + "-" + self.version
os.rename(extracted_dir, self._source_subfolder)

def _configure_cmake(self):
if(self._cmake):
return self._cmake
if self._cmake:
return self._cmake
self._cmake = CMake(self)
self._cmake.definitions['SIMDJSON_BUILD_STATIC'] = not self.options.shared
self._cmake.definitions['SIMDJSON_ENABLE_THREADS'] = self.options.threads
self._cmake.definitions['SIMDJSON_SANITIZE'] = False
self._cmake.definitions['SIMDJSON_JUST_LIBRARY'] = True
self._cmake.configure(source_folder=self._source_subfolder)
self._cmake.configure(build_folder=self._build_subfolder)
return self._cmake

def build(self):
Expand All @@ -73,16 +82,15 @@ def build(self):
def package(self):
cmake = self._configure_cmake()
cmake.install()
# remove unneeded directories
tools.rmdir(os.path.join(self.package_folder, 'lib', 'cmake'))
tools.rmdir(os.path.join(self.package_folder, 'lib', 'pkgconfig'))

self.copy("license", src=self._source_subfolder, dst="licenses", ignore_case=True, keep_path=False)
self.copy("LICENSE", src=self._source_subfolder, dst="licenses")

def package_info(self):
self.cpp_info.libs = ['simdjson']
if self.settings.os == "Linux":
self.cpp_info.system_libs = ["m"]



if self.options.threads:
self.cpp_info.defines = ["SIMDJSON_THREADS_ENABLED=1"]
if self.settings.os == "Linux":
self.cpp_info.system_libs.append("pthread")
2 changes: 0 additions & 2 deletions recipes/simdjson/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
versions:
"0.2.1":
folder: 0.2.1

versions:
"0.4.7":
folder: 0.4.7

0 comments on commit c0d040c

Please sign in to comment.