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

Feature/nsync #6085

Merged
merged 32 commits into from
Sep 25, 2021
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5f1419d
[boost] Add 'algorithm' lib #3961
CAMOBAP Dec 21, 2020
99b049c
Merge remote-tracking branch 'upstream/master'
CAMOBAP Apr 3, 2021
89c0a21
Revert "[boost] Add 'algorithm' lib #3961"
CAMOBAP Apr 5, 2021
5b138bc
Merge remote-tracking branch 'upstream/master'
CAMOBAP Apr 10, 2021
87ed6a8
Merge remote-tracking branch 'upstream/master'
CAMOBAP May 29, 2021
49efd36
Merge branch 'conan-io:master' into master
CAMOBAP Jun 20, 2021
25f9752
Merge branch 'conan-io:master' into master
CAMOBAP Jun 21, 2021
0b171a8
Merge branch 'conan-io:master' into master
CAMOBAP Jun 29, 2021
90345d4
#4806 add nsync because required by onnxruntime
CAMOBAP Jun 29, 2021
d5d3786
#4806 nsync add LICENSE file package
CAMOBAP Jun 29, 2021
0e85191
Add homepage, update source dowload, using components to seaprate nsy…
CAMOBAP Jun 29, 2021
ae8c9b3
#4806 nsync: add pthread as system_lib for Linux
CAMOBAP Jun 30, 2021
8a7107c
#4806 nsync: simplify tests
CAMOBAP Aug 19, 2021
8410cac
#4806 nsync: fix missing nsync_mu_init in tests
CAMOBAP Sep 10, 2021
93121cd
#4806 nsync: add missing CMakeLists.txt wrapper with conan_basic_setup
CAMOBAP Sep 10, 2021
d87aa70
#4806 nsync remove with_tests option
CAMOBAP Sep 10, 2021
0c6f4a7
#4806 nsync remove with_tests option
CAMOBAP Sep 10, 2021
2c88b10
#4806 nsync: remove chdir from test receipt
CAMOBAP Sep 10, 2021
5f45f40
#4806 nsync: improve test CMakeLists.txt
CAMOBAP Sep 10, 2021
3ef05d4
#4806 nsync: add build_folder to cmake.configure
CAMOBAP Sep 10, 2021
8e913da
#4806 nsync: remove redundant pthread flags
CAMOBAP Sep 10, 2021
db3df8c
#4806 nsync: replace cmake_find_package generator with cmake_find_pac…
CAMOBAP Sep 10, 2021
b536769
#4806 nsync: fix include(conanbuildinfo.cmake)
CAMOBAP Sep 10, 2021
a3db04d
#4806 nsync: fix test c library
CAMOBAP Sep 10, 2021
411b55a
#4806 nsync: add shared and fPIC options
CAMOBAP Sep 10, 2021
d088f49
#4806 nsync: fix redundant semaphore_mutex.c compilation during nsync…
CAMOBAP Sep 11, 2021
aa8f759
#4806 nsync: fix copy dlls to lib
CAMOBAP Sep 11, 2021
26c62b8
#4806 nsync: remove code duplication in nsync_c and nsync_cpp components
CAMOBAP Sep 15, 2021
17bd7b2
#4806 nsync: add CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS
CAMOBAP Sep 15, 2021
4180c78
#4806 nsync: remove unnecessary code
CAMOBAP Sep 17, 2021
0f213ec
Apply suggestions from code review
CAMOBAP Sep 20, 2021
b48c151
Update recipes/nsync/all/conanfile.py
CAMOBAP Sep 21, 2021
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
4 changes: 4 additions & 0 deletions recipes/nsync/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"1.23.0":
sha256: "b7e75b17957c62bd02dd73890bde22da3a564903fcaad651b395453d41d3325b"
url: "https://github.com/google/nsync/archive/refs/tags/1.23.0.tar.gz"
52 changes: 52 additions & 0 deletions recipes/nsync/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import os
from conans import ConanFile, CMake, tools


class NsyncConan(ConanFile):
name = "nsync"
description = "Library that exports various synchronization primitive"
license = "Apache-2.0"
url = "https://github.com/conan-io/conan-center-index"
topics = ("c", "thread", "multithreading", "google")
settings = "os", "compiler", "build_type", "arch"

options = {"with_tests": [True, False]}
default_options = {"with_tests": False}

generators = "cmake", "cmake_find_package"
_cmake = None

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

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

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

def _configure_cmake(self):
if self._cmake:
return self._cmake
self._cmake = CMake(self)
self._cmake.definitions["NSYNC_ENABLE_TESTS"] = self.options.with_tests
self._cmake.configure(
build_folder=self._build_subfolder,
source_folder=self._source_subfolder)
return self._cmake

def build(self):
cmake = self._configure_cmake()
cmake.build()

def package(self):
self.copy("LICENSE", dst='licenses', src=self._source_subfolder)
cmake = self._configure_cmake()
cmake.install()

def package_info(self):
self.cpp_info.nsync_cpp.libs = ["nsync_cpp"]
self.cpp_info.nsync.libs = ["nsync"]
17 changes: 17 additions & 0 deletions recipes/nsync/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.1)
project(PackageTest)

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

add_executable(example_c example_c.c)
target_link_libraries(example_c ${CONAN_LIBS_NSYNC})

add_executable(example_cpp example_cpp.cpp)
target_link_libraries(example_cpp ${CONAN_LIBS_NSYNC_CPP})

# CTest is a testing tool that can be used to test your project.
# enable_testing()
# add_test(NAME example
# WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
# COMMAND example)
24 changes: 24 additions & 0 deletions recipes/nsync/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import os

from conans import ConanFile, CMake, tools


class NsyncTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"

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

def imports(self):
self.copy("*.dll", dst="bin", src="bin")
self.copy("*.dylib*", dst="bin", src="lib")
self.copy('*.so*', dst='bin', src='lib')

def test(self):
if not tools.cross_building(self):
os.chdir("bin")
self.run(".%sexample_c" % os.sep)
self.run(".%sexample_cpp" % os.sep)
15 changes: 15 additions & 0 deletions recipes/nsync/all/test_package/example_c.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <nsync.h>

static int int_is_zero (const void *v) {
return (*(const int *)v == 0);
}

int main() {
nsync_mu testing_mu; /* protects fields below */
int child_count; /* count of testing_s structs whose base is this testing_base_s */

nsync_mu_lock (&testing_mu);
nsync_mu_wait (&testing_mu, &int_is_zero, &child_count, NULL);
nsync_mu_unlock (&testing_mu);
return 0;
}
15 changes: 15 additions & 0 deletions recipes/nsync/all/test_package/example_cpp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <nsync.h>

static int int_is_zero (const void *v) {
return (*(const int *)v == 0);
}

int main() {
nsync::nsync_mu testing_mu; /* protects fields below */
int child_count; /* count of testing_s structs whose base is this testing_base_s */

nsync::nsync_mu_lock (&testing_mu);
nsync::nsync_mu_wait (&testing_mu, &int_is_zero, &child_count, NULL);
nsync::nsync_mu_unlock (&testing_mu);
return 0;
}
3 changes: 3 additions & 0 deletions recipes/nsync/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"1.23.0":
folder: "all"