-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add efsw #25448
Add efsw #25448
Changes from all commits
1960c4b
820eb98
ebdc43a
f931088
eb33e92
e06c076
26dd855
c86e4f4
5d257f0
f4bfe1c
4c4576c
0554f86
033e800
8b95405
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
sources: | ||
# Newer versions at the top | ||
"1.4.0": | ||
url: "https://github.com/SpartanJ/efsw/archive/refs/tags/1.4.0.tar.gz" | ||
sha256: "9eed5fc8471767faa44134f5379d4de02825e3756007dafa482fd1656e42bc4a" |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,79 @@ | ||||||||||||||||||||
from conan import ConanFile | ||||||||||||||||||||
from conan.tools.build import check_min_cppstd | ||||||||||||||||||||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout | ||||||||||||||||||||
from conan.tools.files import copy, get, rm, rmdir | ||||||||||||||||||||
from conan.tools.microsoft import is_msvc, is_msvc_static_runtime | ||||||||||||||||||||
import os | ||||||||||||||||||||
|
||||||||||||||||||||
|
||||||||||||||||||||
required_conan_version = ">=1.53.0" | ||||||||||||||||||||
|
||||||||||||||||||||
|
||||||||||||||||||||
class EfswConan(ConanFile): | ||||||||||||||||||||
name = "efsw" | ||||||||||||||||||||
description = "efsw is a C++ cross-platform file system watcher and notifier." | ||||||||||||||||||||
license = "MIT" | ||||||||||||||||||||
url = "https://github.com/conan-io/conan-center-index" | ||||||||||||||||||||
homepage = "https://github.com/SpartanJ/efsw" | ||||||||||||||||||||
topics = ("file system", "watch", "cross-platform") | ||||||||||||||||||||
package_type = "library" | ||||||||||||||||||||
settings = "os", "arch", "compiler", "build_type" | ||||||||||||||||||||
options = { | ||||||||||||||||||||
"shared": [True, False], | ||||||||||||||||||||
"fPIC": [True, False], | ||||||||||||||||||||
} | ||||||||||||||||||||
default_options = { | ||||||||||||||||||||
"shared": False, | ||||||||||||||||||||
"fPIC": True, | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
def config_options(self): | ||||||||||||||||||||
if self.settings.os == "Windows": | ||||||||||||||||||||
del self.options.fPIC | ||||||||||||||||||||
|
||||||||||||||||||||
def configure(self): | ||||||||||||||||||||
if self.options.shared: | ||||||||||||||||||||
self.options.rm_safe("fPIC") | ||||||||||||||||||||
Comment on lines
+29
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Simplify using implements: https://docs.conan.io/2/reference/conanfile/attributes.html#implements |
||||||||||||||||||||
|
||||||||||||||||||||
def validate(self): | ||||||||||||||||||||
if self.settings.get_safe("compiler.cppstd"): | ||||||||||||||||||||
check_min_cppstd(self, 11) | ||||||||||||||||||||
Comment on lines
+39
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
For Conan 2.x, it's expected cppstd always. |
||||||||||||||||||||
|
||||||||||||||||||||
Julianiolo marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||
def layout(self): | ||||||||||||||||||||
cmake_layout(self, src_folder="src") | ||||||||||||||||||||
|
||||||||||||||||||||
def source(self): | ||||||||||||||||||||
get(self, **self.conan_data["sources"][self.version], strip_root=True) | ||||||||||||||||||||
|
||||||||||||||||||||
def generate(self): | ||||||||||||||||||||
tc = CMakeToolchain(self) | ||||||||||||||||||||
if is_msvc(self): | ||||||||||||||||||||
tc.variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(self) | ||||||||||||||||||||
tc.variables["BUILD_TEST_APP"] = False | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Avoid building repeated static library "efsw-static.a" |
||||||||||||||||||||
tc.generate() | ||||||||||||||||||||
|
||||||||||||||||||||
def build(self): | ||||||||||||||||||||
cmake = CMake(self) | ||||||||||||||||||||
cmake.configure() | ||||||||||||||||||||
cmake.build() | ||||||||||||||||||||
|
||||||||||||||||||||
def package(self): | ||||||||||||||||||||
copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) | ||||||||||||||||||||
cmake = CMake(self) | ||||||||||||||||||||
cmake.install() | ||||||||||||||||||||
|
||||||||||||||||||||
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) | ||||||||||||||||||||
rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) | ||||||||||||||||||||
rmdir(self, os.path.join(self.package_folder, "share")) | ||||||||||||||||||||
rm(self, "*.la", os.path.join(self.package_folder, "lib")) | ||||||||||||||||||||
rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) | ||||||||||||||||||||
rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) | ||||||||||||||||||||
|
||||||||||||||||||||
def package_info(self): | ||||||||||||||||||||
self.cpp_info.libs = ["efsw"] | ||||||||||||||||||||
|
||||||||||||||||||||
if self.settings.os in ["Linux", "FreeBSD"]: | ||||||||||||||||||||
self.cpp_info.system_libs = ["m", "pthread"] | ||||||||||||||||||||
|
||||||||||||||||||||
if self.settings.os == "Macos": | ||||||||||||||||||||
self.cpp_info.frameworks = ["Cocoa", "CoreFoundation", "CoreServices"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
|
||
project(test_package LANGUAGES CXX) # if the project uses c++ | ||
|
||
find_package(efsw REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE efsw::efsw) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout, CMake | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindir, "test_package") | ||
self.run(bin_path, env="conanrun") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include <iostream> | ||
#include <cstdlib> // EXIT_SUCCESS | ||
#include "efsw/efsw.hpp" | ||
|
||
int main() { | ||
efsw::FileWatcher* fileWatcher = new efsw::FileWatcher(); | ||
|
||
std::cout << "Follows symlinks?: " << fileWatcher->followSymlinks() << std::endl; | ||
|
||
delete fileWatcher; | ||
|
||
return EXIT_SUCCESS; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"1.4.0": | ||
folder: all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implements is available since 2.0.9