Skip to content

Commit

Permalink
* Add build for Mac OS X to presets for nGraph (issue #799)
Browse files Browse the repository at this point in the history
  • Loading branch information
saudet committed Oct 9, 2019
1 parent 07a3f34 commit e187701
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,11 @@ matrix:
env: PROJ=onnx OS=macosx-x86_64
install: true
script: ./ci/install-travis.sh
- os: osx
osx_image: xcode8.3
env: PROJ=ngraph OS=macosx-x86_64
install: true
script: ./ci/install-travis.sh
- os: osx
osx_image: xcode8.3
env: PROJ=liquidfun OS=macosx-x86_64
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Add build for Mac OS X to presets for nGraph ([issue #799](https://github.com/bytedeco/javacpp-presets/issues/799))
* Update presets for Visual Studio 2017
* Bundle the `opencv_annotation`, `opencv_interactive-calibration`, `opencv_version`, `opencv_visualisation`, and `tesseract` programs
* Add `linux-armhf`, `linux-arm64`, `linux-ppc64le`, and `windows-x86` builds for CPython, NumPy, and LLVM ([pull #768](https://github.com/bytedeco/javacpp-presets/pull/768))
Expand Down
2 changes: 1 addition & 1 deletion ci/install-travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ fi
echo "Download dependencies"
if [ "$TRAVIS_OS_NAME" == "osx" ]; then

if [[ "cpython mxnet tensorflow onnx " =~ "$PROJ " ]] || [[ "$PROJ" =~ numpy ]]; then
if [[ "cpython mxnet tensorflow onnx ngraph " =~ "$PROJ " ]] || [[ "$PROJ" =~ numpy ]]; then
curl -L https://www.python.org/ftp/python/3.6.6/python-3.6.6-macosx10.9.pkg -o $HOME/python.pkg
echo "Install python pkg"
sudo installer -store -pkg $HOME/python.pkg -target /
Expand Down
2 changes: 1 addition & 1 deletion ngraph/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ $CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH -DCMAKE_INSTALL_LIBDIR=lib -DNGRAPH_
make -j $MAKEJ
make install/strip

cp onnx/bin/libonnxifi.so ../lib/
cp onnx/bin/libonnxifi.* ../lib/
cp onnx/src/onnx/onnxifi.h ../include/ngraph/frontend/onnxifi/
sedinplace 's/#include <onnxifi.h>/#include "onnxifi.h"/g' ../include/ngraph/frontend/onnxifi/backend_manager.hpp
sedinplace 's/#include <onnx\/onnxifi.h>/#include "onnxifi.h"/g' ../include/ngraph/frontend/onnxifi/backend_manager.hpp
Expand Down
33 changes: 24 additions & 9 deletions ngraph/ngraph.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
diff -ruN ngraph-0.18.0/src/ngraph/frontend/onnx_import/onnx.cpp ngraph-0.18.0-patch/src/ngraph/frontend/onnx_import/onnx.cpp
--- ngraph-0.18.0/src/ngraph/frontend/onnx_import/onnx.cpp 2019-04-11 03:46:07.000000000 +0900
+++ ngraph-0.18.0-patch/src/ngraph/frontend/onnx_import/onnx.cpp 2019-04-12 21:02:25.093051724 +0900
@@ -34,18 +34,10 @@
diff -ruN ngraph-0.25.0/CMakeLists.txt ngraph-0.25.0-patch/CMakeLists.txt
--- ngraph-0.25.0/CMakeLists.txt 2019-08-13 12:33:27.000000000 -0500
+++ ngraph-0.25.0-patch/CMakeLists.txt 2019-10-09 01:39:12.000000000 -0500
@@ -107,7 +107,10 @@
set(XCODE_ISYSROOT ${APPLE_DEV_DIR}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${OSX_SHORT_VERSION}.sdk)
message(STATUS "Trying Xcode sdk at ${XCODE_ISYSROOT}.")
if(NOT EXISTS ${XCODE_ISYSROOT})
- message(FATAL_ERROR "Cannot find macos sdk.")
+ set(XCODE_ISYSROOT ${APPLE_DEV_DIR}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk)
+ if(NOT EXISTS ${XCODE_ISYSROOT})
+ message(FATAL_ERROR "Cannot find macos sdk.")
+ endif()
endif()
endif()
message(STATUS "Setting CMAKE_OSX_SYSROOT for macos ${OSX_SHORT_VERSION} to ${XCODE_ISYSROOT}")
diff -ruN ngraph-0.25.0/src/ngraph/frontend/onnx_import/onnx.cpp ngraph-0.25.0-patch/src/ngraph/frontend/onnx_import/onnx.cpp
--- ngraph-0.25.0/src/ngraph/frontend/onnx_import/onnx.cpp 2019-08-13 12:33:27.000000000 -0500
+++ ngraph-0.25.0-patch/src/ngraph/frontend/onnx_import/onnx.cpp 2019-10-09 01:38:28.000000000 -0500
@@ -33,18 +33,10 @@
{
namespace error
{
Expand All @@ -23,7 +38,7 @@ diff -ruN ngraph-0.18.0/src/ngraph/frontend/onnx_import/onnx.cpp ngraph-0.18.0-p
{
}
};
@@ -53,20 +45,17 @@
@@ -52,20 +44,17 @@
} // namespace error
} // namespace detail

Expand All @@ -48,7 +63,7 @@ diff -ruN ngraph-0.18.0/src/ngraph/frontend/onnx_import/onnx.cpp ngraph-0.18.0-p
}
}

@@ -81,16 +70,6 @@
@@ -80,16 +69,6 @@
return function;
}

Expand All @@ -65,9 +80,9 @@ diff -ruN ngraph-0.18.0/src/ngraph/frontend/onnx_import/onnx.cpp ngraph-0.18.0-p
void register_operator(const std::string& name,
std::int64_t version,
const std::string& domain,
diff -ruN ngraph-0.18.0/src/ngraph/frontend/onnx_import/onnx.hpp ngraph-0.18.0-patch/src/ngraph/frontend/onnx_import/onnx.hpp
--- ngraph-0.18.0/src/ngraph/frontend/onnx_import/onnx.hpp 2019-04-11 03:46:07.000000000 +0900
+++ ngraph-0.18.0-patch/src/ngraph/frontend/onnx_import/onnx.hpp 2019-04-12 20:59:22.724355142 +0900
diff -ruN ngraph-0.25.0/src/ngraph/frontend/onnx_import/onnx.hpp ngraph-0.25.0-patch/src/ngraph/frontend/onnx_import/onnx.hpp
--- ngraph-0.25.0/src/ngraph/frontend/onnx_import/onnx.hpp 2019-08-13 12:33:27.000000000 -0500
+++ ngraph-0.25.0-patch/src/ngraph/frontend/onnx_import/onnx.hpp 2019-10-09 01:38:28.000000000 -0500
@@ -73,19 +73,7 @@
/// and providing through this parameters is invalid (the weights from
/// the model will take precedence).
Expand Down
9 changes: 8 additions & 1 deletion ngraph/platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@
<version>${project.version}</version>
<classifier>${javacpp.platform.linux-x86_64}</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${javacpp.moduleId}</artifactId>
<version>${project.version}</version>
<classifier>${javacpp.platform.macosx-x86_64}</classifier>
</dependency>
</dependencies>

<build>
Expand All @@ -49,7 +55,7 @@
<configuration>
<archive>
<manifestEntries>
<Class-Path>${javacpp.moduleId}.jar ${javacpp.moduleId}-linux-x86_64.jar</Class-Path>
<Class-Path>${javacpp.moduleId}.jar ${javacpp.moduleId}-linux-x86_64.jar ${javacpp.moduleId}-macosx-x86_64.jar</Class-Path>
</manifestEntries>
</archive>
</configuration>
Expand Down Expand Up @@ -95,6 +101,7 @@
<moduleInfoSource>
module org.bytedeco.${javacpp.moduleId}.platform {
requires org.bytedeco.${javacpp.moduleId}.linux.x86_64;
requires org.bytedeco.${javacpp.moduleId}.macosx.x86_64;
}
</moduleInfoSource>
</module>
Expand Down
5 changes: 2 additions & 3 deletions ngraph/src/main/java/org/bytedeco/ngraph/presets/ngraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,8 @@
// "core/tensor.hpp",
"ngraph/frontend/onnx_import/onnx.hpp"
},
preload = {"iomp5", "mklml", "mklml_intel"}, preloadresource = "/org/bytedeco/mkldnn/",
link = {"mkldnn", "ncurses@.6", "onnxifi", "ngraph", "onnxifi-ngraph", "codegen", "tbb@.2", "cpu_backend"}
//@Platform(value = "macosx", link = {"onnx_proto", "onnx"})}) // "onnxifi" not available on Mac
preload = {"iomp5", "mklml", "mklml_intel", "mkldnn", "ncurses@.6", "onnxifi"}, preloadresource = "/org/bytedeco/mkldnn/",
link = {"ngraph", "onnxifi-ngraph", "codegen", "tbb@.2", "cpu_backend"}
)})
public class ngraph implements InfoMapper {
static { Loader.checkVersion("org.bytedeco", "ngraph"); }
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1373,6 +1373,7 @@
<module>tensorflow</module>
<module>ale</module>
<module>onnx</module>
<module>ngraph</module>
<module>liquidfun</module>
<module>qt</module>
<module>skia</module>
Expand Down

0 comments on commit e187701

Please sign in to comment.