diff --git a/CMakeLists.txt b/CMakeLists.txt index 76725b0bc..b8c1fa96a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,7 +126,9 @@ set(OPTIONAL_LIBRARIES_STATIC) ######################################################################## # LIBZMQ dependency ######################################################################## -find_package(libzmq REQUIRED) +IF (NOT libzmq_FOUND) + find_package(libzmq REQUIRED) +ENDIF(NOT libzmq_FOUND) IF (libzmq_FOUND) include_directories(${libzmq_INCLUDE_DIRS}) list(APPEND MORE_LIBRARIES ${libzmq_LIBRARIES}) @@ -143,7 +145,9 @@ ENDIF (libzmq_FOUND) ######################################################################## # CZMQ dependency ######################################################################## -find_package(czmq REQUIRED) +IF (NOT czmq_FOUND) + find_package(czmq REQUIRED) +ENDIF(NOT czmq_FOUND) IF (czmq_FOUND) include_directories(${czmq_INCLUDE_DIRS}) list(APPEND MORE_LIBRARIES ${czmq_LIBRARIES}) diff --git a/bindings/jni/build.gradle b/bindings/jni/build.gradle index fd9c88073..072f825ae 100644 --- a/bindings/jni/build.gradle +++ b/bindings/jni/build.gradle @@ -5,15 +5,24 @@ ################################################################################ */ +buildscript { + configurations.configureEach { + resolutionStrategy { + force 'org.codehaus.groovy.modules.http-builder:http-builder:0.7.1' + } + exclude group: 'xerces', module: 'xercesImpl' + } +} + plugins { id 'java' id 'maven-publish' - id 'com.jfrog.artifactory' version '4.21.0' + id 'com.jfrog.artifactory' version '5.2.3' id 'com.jfrog.bintray' version '1.8.5' - id 'com.google.osdetector' version '1.7.0' + id 'com.google.osdetector' version '1.7.3' } -wrapper.gradleVersion = '7.5.1' +wrapper.gradleVersion = '8.9' subprojects { apply plugin: 'java' @@ -47,7 +56,6 @@ artifactory { repoKey = 'oss-snapshot-local' username = System.getenv('ARTIFACTORY_USERNAME') password = System.getenv('ARTIFACTORY_PASSWORD') - maven = true } } } diff --git a/bindings/jni/zyre-jni-all/build.gradle b/bindings/jni/zyre-jni-all/build.gradle index 3c06e8600..9f7f95543 100644 --- a/bindings/jni/zyre-jni-all/build.gradle +++ b/bindings/jni/zyre-jni-all/build.gradle @@ -47,7 +47,6 @@ artifactoryPublish { publications ('mavenJava') } - bintray { user = System.getenv('BINTRAY_USER') key = System.getenv('BINTRAY_KEY') diff --git a/bindings/jni/zyre-jni-native/build.gradle b/bindings/jni/zyre-jni-native/build.gradle index e629a68e8..065ac8343 100644 --- a/bindings/jni/zyre-jni-native/build.gradle +++ b/bindings/jni/zyre-jni-native/build.gradle @@ -13,7 +13,7 @@ dependencies { // ------------------------------------------------------------------ // Build section -task copyLibs(type: Copy) { +tasks.register('copyLibs', Copy) { def libraryPaths = [] if (project.hasProperty('buildPrefix')) { if (osdetector.os == 'windows') { @@ -24,7 +24,7 @@ task copyLibs(type: Copy) { } def javaLibraryPaths = System.getProperty('java.library.path').split(File.pathSeparator).toList() - libraryPaths.addAll (javaLibraryPaths) + libraryPaths.addAll(javaLibraryPaths) libraryPaths.add('/usr/local/lib') if (osdetector.os == 'windows') { @@ -54,7 +54,7 @@ task copyLibs(type: Copy) { duplicatesStrategy = oldStrategy } -jar.baseName = "zyre-jni-${osdetector.classifier}" +jar.archiveBaseName = "zyre-jni-${osdetector.classifier}" jar.dependsOn copyLibs jar { diff --git a/bindings/jni/zyre-jni/build.gradle b/bindings/jni/zyre-jni/build.gradle index 63ef34b6f..c08e796d0 100644 --- a/bindings/jni/zyre-jni/build.gradle +++ b/bindings/jni/zyre-jni/build.gradle @@ -12,15 +12,16 @@ ext.hasNotEmptyProperty = { propertyName -> dependencies { implementation "org.zeromq.czmq:czmq-jni:$jni_dependencies_version" - implementation 'org.scijava:native-lib-loader:2.4.0' - testImplementation 'junit:junit:4.12' - testImplementation 'org.hamcrest:hamcrest-all:1.3' + implementation 'org.scijava:native-lib-loader:2.5.0' + testImplementation 'junit:junit:4.13.2' + testImplementation 'org.hamcrest:hamcrest:2.2' } // ------------------------------------------------------------------ // Build section -task generateJniHeaders(type: Exec, dependsOn: 'classes') { +tasks.register('generateJniHeaders', Exec) { + dependsOn 'classes' def classpath = sourceSets.main.output.classesDirs def appclasspath = configurations.runtimeClasspath.files*.getAbsolutePath().join(File.pathSeparator) def nativeIncludes = 'src/native/include' @@ -34,14 +35,14 @@ task generateJniHeaders(type: Exec, dependsOn: 'classes') { commandLine("javac", "-h", "$nativeIncludes", "-classpath", "$classpath${File.pathSeparator}$appclasspath", *jniClasses, *utilityClasses) } -tasks.withType(Test) { +tasks.withType(Test).configureEach { def defaultJavaLibraryPath = System.getProperty("java.library.path") if (osdetector.os == 'windows') { - def extraJavaLibraryPath = hasNotEmptyProperty('buildPrefix') ? "$project.buildPrefix\\bin;$project.buildPrefix\\lib" : '' - extraJavaLibraryPath = extraJavaLibraryPath.replace("/", "\\") - systemProperty "java.library.path", "${projectDir}\\build\\Release${File.pathSeparator}" + - "${extraJavaLibraryPath}${File.pathSeparator}" + - "${defaultJavaLibraryPath}" + def extraJavaLibraryPath = hasNotEmptyProperty('buildPrefix') ? "$project.buildPrefix\\bin;$project.buildPrefix\\lib" : '' + extraJavaLibraryPath = extraJavaLibraryPath.replace("/", "\\") + systemProperty "java.library.path", "${projectDir}\\build\\Release${File.pathSeparator}" + + "${extraJavaLibraryPath}${File.pathSeparator}" + + "${defaultJavaLibraryPath}" } else { def extraJavaLibraryPath = hasNotEmptyProperty('buildPrefix') ? "$project.buildPrefix/lib" : '' systemProperty "java.library.path", "${projectDir}/build${File.pathSeparator}" + @@ -52,22 +53,24 @@ tasks.withType(Test) { } } -task initCMake(type: Exec, dependsOn: 'generateJniHeaders') { - workingDir 'build' +tasks.register('initCMake', Exec) { + dependsOn 'generateJniHeaders' + workingDir 'build' def prefixPath = hasNotEmptyProperty('buildPrefix') ? "-DCMAKE_PREFIX_PATH=$project.buildPrefix" : '' commandLine 'cmake', "$prefixPath", '..' } -task buildNative(type: Exec, dependsOn: 'initCMake') { +tasks.register('buildNative', Exec) { + dependsOn 'initCMake' if (osdetector.os == 'windows') { commandLine 'cmake', - '--build', 'build', + '--build', 'build', '--config', 'Release', '--target', 'zyrejni', - '--', '-verbosity:Minimal', '-maxcpucount' + '--', '-verbosity:Minimal', '-maxcpucount' } else { commandLine 'cmake', - '--build', 'build' + '--build', 'build' } } @@ -77,13 +80,15 @@ test.dependsOn buildNative // ------------------------------------------------------------------ // Install and Publish section -task sourcesJar(type: Jar, dependsOn: 'classes') { - classifier = 'sources' +tasks.register('sourcesJar', Jar) { + dependsOn 'classes' + archiveClassifier = 'sources' from sourceSets.main.allSource } -task javadocJar(type: Jar, dependsOn: 'javadoc') { - classifier = 'javadoc' +tasks.register('javadocJar', Jar) { + dependsOn 'javadoc' + archiveClassifier = 'javadoc' from javadoc.destinationDir } @@ -119,7 +124,6 @@ artifactoryPublish { publications ('mavenJava') } - bintray { user = System.getenv('BINTRAY_USER') key = System.getenv('BINTRAY_KEY') diff --git a/bindings/python_cffi/zyre_cffi/cdefs.py b/bindings/python_cffi/zyre_cffi/cdefs.py index 6c916c0ed..f9fe4d9c3 100644 --- a/bindings/python_cffi/zyre_cffi/cdefs.py +++ b/bindings/python_cffi/zyre_cffi/cdefs.py @@ -891,6 +891,11 @@ zlist_t * zdir_list (zdir_t *self); +// Returns a sorted list of char*; Each entry in the list is a path of a file +// or directory contained in self. +zlist_t * + zdir_list_paths (zdir_t *self); + // Remove directory, optionally including all files that it contains, at // all levels. If force is false, will only remove the directory if empty. // If force is true, will remove all files and all subdirectories. @@ -1635,6 +1640,10 @@ const char * ziflist_netmask (ziflist_t *self); +// Return the current interface MAC address as a printable string +const char * + ziflist_mac (ziflist_t *self); + // Return the list of interfaces. void ziflist_print (ziflist_t *self); @@ -1694,13 +1703,13 @@ zlist_item (zlist_t *self); // Append an item to the end of the list, return 0 if OK or -1 if this -// failed for some reason (out of memory). Note that if a duplicator has +// failed for some reason (invalid input). Note that if a duplicator has // been set, this method will also duplicate the item. int zlist_append (zlist_t *self, void *item); // Push an item to the start of the list, return 0 if OK or -1 if this -// failed for some reason (out of memory). Note that if a duplicator has +// failed for some reason (invalid input). Note that if a duplicator has // been set, this method will also duplicate the item. int zlist_push (zlist_t *self, void *item); @@ -1791,13 +1800,13 @@ // Add an item to the head of the list. Calls the item duplicator, if any, // on the item. Resets cursor to list head. Returns an item handle on -// success, NULL if memory was exhausted. +// success. void * zlistx_add_start (zlistx_t *self, void *item); // Add an item to the tail of the list. Calls the item duplicator, if any, // on the item. Resets cursor to list head. Returns an item handle on -// success, NULL if memory was exhausted. +// success. void * zlistx_add_end (zlistx_t *self, void *item); @@ -1902,8 +1911,7 @@ // duplicator, if any, on the item. If low_value is true, starts searching // from the start of the list, otherwise searches from the end. Use the item // comparator, if any, to find where to place the new node. Returns a handle -// to the new node, or NULL if memory was exhausted. Resets the cursor to the -// list head. +// to the new node. Resets the cursor to the list head. void * zlistx_insert (zlistx_t *self, void *item, bool low_value); @@ -2360,19 +2368,19 @@ // Connects process stdin with a readable ('>', connect) zeromq socket. If // socket argument is NULL, zproc creates own managed pair of inproc -// sockets. The writable one is then accessbile via zproc_stdin method. +// sockets. The writable one is then accessible via zproc_stdin method. void zproc_set_stdin (zproc_t *self, void *socket); // Connects process stdout with a writable ('@', bind) zeromq socket. If // socket argument is NULL, zproc creates own managed pair of inproc -// sockets. The readable one is then accessbile via zproc_stdout method. +// sockets. The readable one is then accessible via zproc_stdout method. void zproc_set_stdout (zproc_t *self, void *socket); // Connects process stderr with a writable ('@', bind) zeromq socket. If // socket argument is NULL, zproc creates own managed pair of inproc -// sockets. The readable one is then accessbile via zproc_stderr method. +// sockets. The readable one is then accessible via zproc_stderr method. void zproc_set_stderr (zproc_t *self, void *socket); @@ -4649,6 +4657,11 @@ zosc_t * zosc_frommem (char *data, size_t size); +// Create a new zosc message from a string. This the same syntax as +// zosc_create but written as a single line string. +zosc_t * + zosc_fromstring (const char *oscstring); + // Create a new zosc message from the given format and arguments. // The format type tags are as follows: // i - 32bit integer @@ -4752,6 +4765,10 @@ zosc_t * zosc_unpack (zframe_t *frame); +// Return a string describing the the OSC message. The returned string must be freed by the caller. +char * + zosc_dump (zosc_t *self); + // Dump OSC message to stdout, for debugging and tracing. void zosc_print (zosc_t *self); diff --git a/bindings/qt/src/qzlist.cpp b/bindings/qt/src/qzlist.cpp index 9715dec60..a278f5217 100644 --- a/bindings/qt/src/qzlist.cpp +++ b/bindings/qt/src/qzlist.cpp @@ -83,7 +83,7 @@ void * QZlist::item () /// // Append an item to the end of the list, return 0 if OK or -1 if this -// failed for some reason (out of memory). Note that if a duplicator has +// failed for some reason (invalid input). Note that if a duplicator has // been set, this method will also duplicate the item. int QZlist::append (void *item) { @@ -93,7 +93,7 @@ int QZlist::append (void *item) /// // Push an item to the start of the list, return 0 if OK or -1 if this -// failed for some reason (out of memory). Note that if a duplicator has +// failed for some reason (invalid input). Note that if a duplicator has // been set, this method will also duplicate the item. int QZlist::push (void *item) { diff --git a/bindings/qt/src/qzlist.h b/bindings/qt/src/qzlist.h index 3e65506b0..adc225d99 100644 --- a/bindings/qt/src/qzlist.h +++ b/bindings/qt/src/qzlist.h @@ -46,12 +46,12 @@ class QT_ZYRE_EXPORT QZlist : public QObject void * item (); // Append an item to the end of the list, return 0 if OK or -1 if this - // failed for some reason (out of memory). Note that if a duplicator has + // failed for some reason (invalid input). Note that if a duplicator has // been set, this method will also duplicate the item. int append (void *item); // Push an item to the start of the list, return 0 if OK or -1 if this - // failed for some reason (out of memory). Note that if a duplicator has + // failed for some reason (invalid input). Note that if a duplicator has // been set, this method will also duplicate the item. int push (void *item); diff --git a/bindings/ruby/lib/zyre/ffi/event.rb b/bindings/ruby/lib/zyre/ffi/event.rb index 7a256bdb2..c66930e67 100644 --- a/bindings/ruby/lib/zyre/ffi/event.rb +++ b/bindings/ruby/lib/zyre/ffi/event.rb @@ -33,8 +33,9 @@ def initialize(ptr, finalize = true) # @param ptr [::FFI::Pointer] # @return [Proc] def self.create_finalizer_for(ptr) + ptr_ptr = ::FFI::MemoryPointer.new :pointer + Proc.new do - ptr_ptr = ::FFI::MemoryPointer.new :pointer ptr_ptr.write_pointer ptr ::Zyre::FFI.zyre_event_destroy ptr_ptr end diff --git a/bindings/ruby/lib/zyre/ffi/zyre.rb b/bindings/ruby/lib/zyre/ffi/zyre.rb index 5402ea644..e4178a2cf 100644 --- a/bindings/ruby/lib/zyre/ffi/zyre.rb +++ b/bindings/ruby/lib/zyre/ffi/zyre.rb @@ -33,8 +33,9 @@ def initialize(ptr, finalize = true) # @param ptr [::FFI::Pointer] # @return [Proc] def self.create_finalizer_for(ptr) + ptr_ptr = ::FFI::MemoryPointer.new :pointer + Proc.new do - ptr_ptr = ::FFI::MemoryPointer.new :pointer ptr_ptr.write_pointer ptr ::Zyre::FFI.zyre_destroy ptr_ptr end diff --git a/builds/ios/README.md b/builds/ios/README.md new file mode 100644 index 000000000..f0e81acd0 --- /dev/null +++ b/builds/ios/README.md @@ -0,0 +1,24 @@ +# iOS Build + +## Prerequisites + +The build script require to be run on MacOs with XCode and the developer SDK installed. + +This project is tested against SDK 15.5. + +If you want to specify another version you need to set the environment variable below: + + export SDK_VERSION=15.5 + +You can list all the versions of the SDK installed on your Mac using the command below: + + xcodebuild -showsdks + +## Build + +In the ios directory, run: + ./build.sh [ iPhoneOS armv7 | iPhoneOS armv7s | iPhoneOS arm64 | iPhoneSimulator i386 | iPhoneSimulator x86_64 ] + +Note that certain target architectures may or may not be available depending on your target SDK Version. For example, iOS 10 is the maximum deployment target for 32-bit targets. + +[This website](https://docs.elementscompiler.com/Platforms/Cocoa/CpuArchitectures/) can help you choose which architecture you need to target depending on your SDK version. diff --git a/builds/ios/build.sh b/builds/ios/build.sh new file mode 100755 index 000000000..d3cabb10c --- /dev/null +++ b/builds/ios/build.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash +################################################################################ +# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # +# Read the zproject/README.md for information about making permanent changes. # +################################################################################ + +set -e + +function usage { + echo "Usage ./build.sh [ iPhoneOS armv7 | iPhoneOS armv7s | iPhoneOS arm64 | iPhoneSimulator i386 | iPhoneSimulator x86_64 ]" +} + +PLATFORM=$1 +if [ -z PLATFORM ]; then + usage + exit 1 +fi + +if [[ $PLATFORM == "iPhoneOS" ]]; then + SDK="iphoneos" +elif [[ $PLATFORM == "iPhoneSimulator" ]]; then + SDK="iphonesimulator" +else + echo "Unknown platform '$PLATFORM'" + usage + exit 1 +fi + +TARGET=$2 +if [ -z $TARGET ]; then + usage + exit 1 +fi + +if [[ $TARGET == "x86_64" ]]; then + HOST="i386" +elif [[ $TARGET == "arm64" ]]; then + HOST="arm" +else + HOST=$TARGET +fi + +export SDK_VERSION=${SDK_VERSION:-"15.5"} + +PLATFORM_PATH="/Applications/Xcode.app/Contents/Developer/Platforms" +TOOLCHAIN_PATH="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin" +SYSROOT=$PLATFORM_PATH/$PLATFORM.platform/Developer/SDKs/$PLATFORM$SDK_VERSION.sdk +OUTPUT_DIR=output/$PLATFORM/$TARGET +PWD="$(pwd)" + +export CC="$(xcrun -sdk $SDK -find clang)" +export CPP="$CC -E" +export AR="$(xcrun -sdk $SDK -find ar)" +export RANLIB="$(xcrun -sdk $SDK -find ranlib)" +export CFLAGS="-arch $TARGET -isysroot $SYSROOT -miphoneos-version-min=$SDK_VERSION -fembed-bitcode" +export CPPFLAGS="-arch $TARGET -isysroot $SYSROOT -miphoneos-version-min=$SDK_VERSION -fembed-bitcode" +export LDFLAGS="-arch $TARGET -isysroot $SYSROOT" + +cd ../../ +mkdir -p $OUTPUT_DIR +./autogen.sh +./configure --prefix="$PWD/$OUTPUT_DIR" --host=$HOST-apple-darwin +make +make install + +echo "$PLATFORM $TARGET build successful" +################################################################################ +# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # +# Read the zproject/README.md for information about making permanent changes. # +################################################################################ diff --git a/builds/ios/ci_build.sh b/builds/ios/ci_build.sh new file mode 100755 index 000000000..cbe0d6e88 --- /dev/null +++ b/builds/ios/ci_build.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +################################################################################ +# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # +# Read the zproject/README.md for information about making permanent changes. # +################################################################################ + +#./build.sh "iPhoneOS" "armv7" # Only available with SDK_VERSION <= 10 +#./build.sh "iPhoneOS" "armv7s" # Only available with SDK_VERSION <= 10 +./build.sh "iPhoneOS" "arm64" +#./build.sh "iPhoneSimulator" "i386" # Only available with SDK_VERSION <= 10 +./build.sh "iPhoneSimulator" "x86_64" + +################################################################################ +# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # +# Read the zproject/README.md for information about making permanent changes. # +################################################################################ diff --git a/doc/Makefile.am b/doc/Makefile.am index 0d26f3c4e..ca5de70e1 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -11,7 +11,7 @@ MAN1 = zpinger.1 MAN3 = zyre.3 zyre_event.3 # Project overview, written by a human after initial skeleton: # NOTE: stub doc/zyre.adoc is generated by GSL from project.xml -# and then comitted to SCM and maintained manually to describe the +# and then committed to SCM and maintained manually to describe the # project (section 7 = Overview, conventions, and miscellaneous). MAN7 = zyre.7 MAN_DOC = $(MAN1) $(MAN3) $(MAN7) diff --git a/include/zyre_library.h b/include/zyre_library.h index 0b8ca6e8c..6830203b0 100644 --- a/include/zyre_library.h +++ b/include/zyre_library.h @@ -71,9 +71,15 @@ typedef struct _zyre_event_t zyre_event_t; #define ZYRE_EVENT_T_DEFINED // Public constants -#define ZRE_DISCOVERY_PORT 5670 // IANA-assigned UDP port for ZRE + +// IANA-assigned UDP port for ZRE +#define ZRE_DISCOVERY_PORT 5670 + #ifdef ZYRE_BUILD_DRAFT_API -#define ZAP_DOMAIN_DEFAULT "global" // Default ZAP domain (auth) + +// Default ZAP domain (auth) +#define ZAP_DOMAIN_DEFAULT "global" + #endif // ZYRE_BUILD_DRAFT_API // Public classes, each with its own header file diff --git a/src/zyre_classes.h b/src/zyre_classes.h index e142625c3..16f666891 100644 --- a/src/zyre_classes.h +++ b/src/zyre_classes.h @@ -73,7 +73,9 @@ typedef struct _zyre_node_t zyre_node_t; #ifndef ZYRE_BUILD_DRAFT_API // *** Draft global constants, defined for internal use only *** -#define ZAP_DOMAIN_DEFAULT "global" // Default ZAP domain (auth) +// Default ZAP domain (auth) +#define ZAP_DOMAIN_DEFAULT "global" + // *** Draft method, defined for internal use only *** // Set the TCP port bound by the ROUTER peer-to-peer socket (beacon mode). @@ -131,5 +133,8 @@ ZYRE_PRIVATE void #endif // ZYRE_BUILD_DRAFT_API // Private constants -#define REAP_INTERVAL 1000 // Once per second + +// Once per second +#define REAP_INTERVAL 1000 + #endif