Skip to content

Commit

Permalink
Update recipe (#247)
Browse files Browse the repository at this point in the history
* Update recipe
* Remove unused flavours.
  • Loading branch information
szmyd authored Aug 27, 2024
1 parent ccabd78 commit 65b8e86
Show file tree
Hide file tree
Showing 14 changed files with 74 additions and 100 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build_dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ jobs:
conan export 3rd_party/folly folly/2022.01.31.00@
conan export 3rd_party/gperftools
conan export 3rd_party/jemalloc
conan export 3rd_party/prerelease_dummy
conan export 3rd_party/pistache pistache/cci.20201127@
cached_pkgs=$(ls -1d ~/.conan/data/*/*/*/*/export 2>/dev/null | sed 's,.*data/,,' | cut -d'/' -f1,2 | paste -sd',' - -)
echo "::info:: Pre-cached: ${cached_pkgs}"
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/merge_conan_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,14 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: ["ubuntu-22.04", "ubuntu-20.04"]
platform: ["ubuntu-22.04"]
build-type: ["Debug", "Release"]
malloc-impl: ["libc", "tcmalloc"]
prerelease: ["True", "False"]
exclude:
- build-type: Debug
platform: ubuntu-20.04
- malloc-impl: libc
build-type: Release
platform: ubuntu-22.04
- prerelease: "True"
platform: ubuntu-20.04
uses: ./.github/workflows/build_dependencies.yml
with:
platform: ${{ matrix.platform }}
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/pr_conan_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,15 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: ["ubuntu-22.04", "ubuntu-20.04"]
platform: ["ubuntu-22.04"]
build-type: ["Debug", "Release"]
malloc-impl: ["libc", "tcmalloc"]
prerelease: ["True", "False"]
exclude:
- build-type: Debug
platform: ubuntu-20.04
- build-type: Debug
platform: tcmalloc
- malloc-impl: libc
build-type: Release
- prerelease: "True"
platform: ubuntu-20.04
uses: ./.github/workflows/build_dependencies.yml
with:
platform: ${{ matrix.platform }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ cmake-*/**
.vscode/**

# Visual Studio
CMakeUserPresets.json
CMakeSettings.json
.vs/**

Expand Down
23 changes: 0 additions & 23 deletions 3rd_party/prerelease_dummy/conanfile.py

This file was deleted.

23 changes: 4 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,15 @@ if (${MALLOC_IMPL} STREQUAL "tcmalloc")
endif()
find_package(jwt-cpp REQUIRED)
find_package(nlohmann_json REQUIRED)
find_package(prerelease_dummy QUIET)
find_package(prometheus-cpp REQUIRED)
find_package(zmarok-semver REQUIRED)
find_package(spdlog REQUIRED)
find_package(Threads REQUIRED)

# Linux Specific dependencies
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL Linux)
find_package(breakpad REQUIRED)
find_package(folly REQUIRED)
find_package(userspace-rcu REQUIRED)
list (APPEND COMMON_DEPS breakpad::breakpad)
endif()
find_package(breakpad REQUIRED)
find_package(folly REQUIRED)
find_package(userspace-rcu REQUIRED)
list (APPEND COMMON_DEPS breakpad::breakpad)

list (APPEND COMMON_DEPS
Boost::headers
Expand All @@ -86,10 +82,6 @@ if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL Linux)
)
endif()

if (${prerelease_dummy_FOUND})
list (APPEND COMMON_DEPS prerelease_dummy::prerelease_dummy)
endif ()

if (DEFINED MALLOC_IMPL)
if (${MALLOC_IMPL} STREQUAL "tcmalloc")
list(APPEND COMMON_DEPS gperftools::gperftools)
Expand All @@ -112,13 +104,6 @@ endif()

# add conan information
add_flags("-DPACKAGE_NAME=sisl")
if (DEFINED CONAN_PACKAGE_VERSION)
message("Package Version: [${CONAN_PACKAGE_VERSION}]")
add_flags("-DPACKAGE_VERSION=\\\"${CONAN_PACKAGE_VERSION}\\\"")
else ()
message("Unknown Package Version")
add_flags("-DPACKAGE_VERSION=\\\"${CONAN_PACKAGE_VERSION}\\\"")
endif ()

if(UNIX)
# enable proper memstream flags
Expand Down
4 changes: 2 additions & 2 deletions cmake/debug_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU"))
set (REALLY_NO_OPTIMIZATION_FLAGS "${REALLY_NO_OPTIMIZATION_FLAGS} -fthreadsafe-statics" )# Slightly smaller in code that doesn't need to be TS.
endif()

if (DEFINED CONAN_BUILD_COVERAGE)
if (${CONAN_BUILD_COVERAGE})
if (DEFINED BUILD_COVERAGE)
if (${BUILD_COVERAGE})
include (cmake/CodeCoverage.cmake)
APPEND_COVERAGE_COMPILER_FLAGS()
SETUP_TARGET_FOR_COVERAGE_GCOVR_XML(NAME coverage EXECUTABLE ctest DEPENDENCIES )
Expand Down
77 changes: 46 additions & 31 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
from os.path import join
from conan import ConanFile
from conan.tools.files import copy
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd
from conans import CMake
from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout
from conan.tools.files import copy
from os.path import join

required_conan_version = ">=1.52.0"
required_conan_version = ">=1.60.0"

class SISLConan(ConanFile):
name = "sisl"
version = "8.7.0"
version = "8.8.0"
homepage = "https://github.com/eBay/sisl"
description = "Library for fast data structures, utilities"
topics = ("ebay", "components", "core", "efficiency")
Expand All @@ -34,20 +35,14 @@ class SISLConan(ConanFile):
'malloc_impl': 'tcmalloc',
}

generators = "cmake", "cmake_find_package"
exports_sources = ("CMakeLists.txt", "cmake/*", "include/*", "src/*", "LICENSE")

def build_requirements(self):
self.build_requires("benchmark/1.7.0")
self.build_requires("gtest/1.11.0")
if self.settings.compiler in ["gcc"]:
self.build_requires("pistache/0.0.5")
self.test_requires("gtest/1.14.0")
self.test_requires("benchmark/1.8.2")
self.test_requires("pistache/0.0.5")

def requirements(self):
# Custom packages
if self.options.prerelease:
self.requires("prerelease_dummy/1.0.1")

# Generic packages (conan-center)
self.requires("boost/1.79.0")
if self.settings.os in ["Linux"]:
Expand All @@ -57,7 +52,7 @@ def requirements(self):
self.requires("flatbuffers/1.12.0")
if self.settings.os in ["Linux"]:
self.requires("folly/2022.01.31.00")
self.requires("grpc/1.48.0")
self.requires("grpc/1.50.1")
self.requires("jwt-cpp/0.4.0")
self.requires("nlohmann_json/3.11.2")
self.requires("prometheus-cpp/1.0.1")
Expand All @@ -71,6 +66,7 @@ def requirements(self):
self.requires("libcurl/8.4.0", override=True)
self.requires("xz_utils/5.2.5", override=True)
self.requires("zlib/1.2.12", override=True)
self.requires("lz4/1.9.4", override=True)
if self.options.malloc_impl == "jemalloc":
self.requires("jemalloc/5.2.1")
elif self.options.malloc_impl == "tcmalloc":
Expand All @@ -81,6 +77,8 @@ def validate(self):
check_min_cppstd(self, 17)

def configure(self):
if self.settings.compiler in ["gcc"]:
self.options['pistache'].with_ssl: True
if self.options.shared:
del self.options.fPIC
if self.settings.build_type == "Debug":
Expand All @@ -89,26 +87,40 @@ def configure(self):
if self.options.coverage or self.options.sanitize:
self.options.malloc_impl = 'libc'

def build(self):
cmake = CMake(self)

definitions = {'CONAN_BUILD_COVERAGE': 'OFF',
'CMAKE_EXPORT_COMPILE_COMMANDS': 'ON',
'CONAN_CMAKE_SILENT_OUTPUT': 'ON',
'MEMORY_SANITIZER_ON': 'OFF',
'MALLOC_IMPL': self.options.malloc_impl}

def layout(self):
cmake_layout(self)

def generate(self):
# This generates "conan_toolchain.cmake" in self.generators_folder
tc = CMakeToolchain(self)
tc.variables["CONAN_CMAKE_SILENT_OUTPUT"] = "ON"
tc.variables["CTEST_OUTPUT_ON_FAILURE"] = "ON"
tc.variables["MEMORY_SANITIZER_ON"] = "OFF"
tc.variables["BUILD_COVERAGE"] = "OFF"
tc.variables['MALLOC_IMPL'] = self.options.malloc_impl
tc.preprocessor_definitions["PACKAGE_VERSION"] = self.version
tc.preprocessor_definitions["PACKAGE_NAME"] = self.name
if self.options.get_safe("prerelease") or (self.settings.build_type == "Debug"):
tc.preprocessor_definitions["_PRERELEASE"] = "1"
tc.variables["_PRERELEASE"] = "ON"
if self.settings.build_type == "Debug":
if self.options.sanitize:
definitions['MEMORY_SANITIZER_ON'] = 'ON'
elif self.options.coverage:
definitions['CONAN_BUILD_COVERAGE'] = 'ON'
tc.preprocessor_definitions["_PRERELEASE"] = "1"
if self.options.get_safe("coverage"):
tc.variables['BUILD_COVERAGE'] = 'ON'
elif self.options.get_safe("sanitize"):
tc.variables['MEMORY_SANITIZER_ON'] = 'ON'
tc.generate()

definitions['MALLOC_IMPL'] = self.options.malloc_impl
# This generates "boost-config.cmake" and "grpc-config.cmake" etc in self.generators_folder
deps = CMakeDeps(self)
deps.generate()

cmake.configure(defs=definitions)
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
cmake.test(output_on_failure=True)
if not self.conf.get("tools.build:skip_test", default=False):
cmake.test()

def package(self):
lib_dir = join(self.package_folder, "lib")
Expand Down Expand Up @@ -136,6 +148,9 @@ def package_info(self):
if self.settings.compiler == "gcc":
self.cpp_info.cppflags.extend(["-fconcepts"])

if self.options.get_safe("prerelease") or (self.settings.build_type == "Debug"):
self.cpp_info.defines.append("_PRERELEASE=1")

if self.settings.os == "Linux":
self.cpp_info.libs.append("flip")
self.cpp_info.cppflags.append("-D_POSIX_C_SOURCE=200809L")
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL Linux)
$<TARGET_OBJECTS:sisl_settings>
)
list(APPEND SISL_DEPS
Folly::Folly
Folly::folly
breakpad::breakpad
)
endif()
Expand Down
6 changes: 3 additions & 3 deletions src/cache/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ target_sources(test_range_hashmap PRIVATE
tests/test_range_hashmap.cpp
)
target_include_directories(test_range_hashmap BEFORE PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(test_range_hashmap sisl ${COMMON_DEPS} Folly::Folly GTest::gtest)
target_link_libraries(test_range_hashmap sisl ${COMMON_DEPS} Folly::folly GTest::gtest)
#add_test(NAME RangeHashMap COMMAND test_range_hashmap --num_iters 10000)

add_executable(test_range_cache)
target_sources(test_range_cache PRIVATE
tests/test_range_cache.cpp
)
target_include_directories(test_range_cache BEFORE PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(test_range_cache sisl ${COMMON_DEPS} Folly::Folly GTest::gtest)
target_link_libraries(test_range_cache sisl ${COMMON_DEPS} Folly::folly GTest::gtest)
#add_test(NAME RangeCache COMMAND test_range_cache --num_iters 1000)

add_executable(test_simple_cache)
target_sources(test_simple_cache PRIVATE
tests/test_simple_cache.cpp
)
target_include_directories(test_simple_cache BEFORE PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(test_simple_cache sisl ${COMMON_DEPS} Folly::Folly GTest::gtest)
target_link_libraries(test_simple_cache sisl ${COMMON_DEPS} Folly::folly GTest::gtest)
add_test(NAME SimpleCache COMMAND test_simple_cache --num_iters 1000)
2 changes: 1 addition & 1 deletion src/metrics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ target_sources(sisl_metrics PRIVATE
)
target_link_libraries(sisl_metrics
${COMMON_DEPS}
Folly::Folly
Folly::folly
)

add_executable(metrics_farm_test)
Expand Down
16 changes: 9 additions & 7 deletions src/utility/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ target_sources(test_enum PRIVATE
target_link_libraries(test_enum ${COMMON_DEPS} GTest::gtest)
add_test(NAME Enum COMMAND test_enum)

if (${prerelease_dummy_FOUND})
add_executable(test_objlife)
target_sources(test_objlife PRIVATE
tests/test_objlife_counter.cpp
)
target_link_libraries(test_objlife sisl ${COMMON_DEPS} GTest::gtest)
add_test(NAME ObjLife COMMAND test_objlife)
if (DEFINED ${_PRERELEASE})
if (${_PRERELEASE})
add_executable(test_objlife)
target_sources(test_objlife PRIVATE
tests/test_objlife_counter.cpp
)
target_link_libraries(test_objlife sisl ${COMMON_DEPS} GTest::gtest)
add_test(NAME ObjLife COMMAND test_objlife)
endif ()
endif ()
3 changes: 2 additions & 1 deletion src/version/tests/test_version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
#include <sisl/options/options.h>
#include <gtest/gtest.h>
#include <iostream>
#include <boost/preprocessor/stringize.hpp>

using namespace sisl;

SISL_OPTIONS_ENABLE(logging)
SISL_LOGGING_INIT(test_version)

void entry() {
auto ver{version::Semver200_version(PACKAGE_VERSION)};
auto ver{version::Semver200_version(BOOST_PP_STRINGIZE(PACKAGE_VERSION))};
sisl::VersionMgr::addVersion("dummy", ver);
}

Expand Down
4 changes: 3 additions & 1 deletion src/version/version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*
*********************************************************************************/
#include <sisl/version.hpp>

#include <boost/preprocessor/stringize.hpp>
#include <cassert>

namespace sisl {
Expand All @@ -24,7 +26,7 @@ std::once_flag VersionMgr::m_init_flag;

void VersionMgr::createAndInit() {
m_instance = new VersionMgr();
auto ver{version::Semver200_version(PACKAGE_VERSION)};
auto ver{version::Semver200_version(BOOST_PP_STRINGIZE(PACKAGE_VERSION))};
m_instance->m_version_map["sisl"] = ver;
}

Expand Down

0 comments on commit 65b8e86

Please sign in to comment.