Unverified Commit 609f9655 authored by Scott Cyphers's avatar Scott Cyphers Committed by GitHub

Merge branch 'master' into aprocter/logical-xor

parents 031e5805 bd0f990d
......@@ -40,8 +40,9 @@ include(var_functions)
NGRAPH_GET_VERSION_LABEL()
string(REGEX MATCH "([0-9?]+)\\.([0-9?]+)\\.([0-9?]+)(-rc\\.[0-9?]+)?" NGRAPH_VERSION_SHORT "${NGRAPH_VERSION_LABEL}")
string(REGEX MATCH "([0-9?]+)\\.([0-9?]+)\\.([0-9?]+)(-(rc|dev)\\.[0-9?]+)?" NGRAPH_VERSION_SHORT "${NGRAPH_VERSION_LABEL}")
string(REGEX REPLACE "-rc." "rc" NGRAPH_WHEEL_VERSION "${NGRAPH_VERSION_SHORT}")
string(REGEX REPLACE "-dev." "dev" NGRAPH_WHEEL_VERSION "${NGRAPH_WHEEL_VERSION}")
string(REGEX MATCH "([0-9?]+)\\.([0-9?]+)" NGRAPH_API_VERSION "${NGRAPH_VERSION_LABEL}")
string(REGEX MATCH "[^v](.*)" NGRAPH_VERSION "${NGRAPH_VERSION_LABEL}")
string(REPLACE "." ";" NGRAPH_VERSION_PARTS "${NGRAPH_VERSION_SHORT}")
......
......@@ -23,6 +23,9 @@ function(NGRAPH_GET_CURRENT_HASH)
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
ERROR_QUIET)
if(NOT HASH)
return()
endif()
string(STRIP ${HASH} HASH)
set(NGRAPH_CURRENT_HASH ${HASH} PARENT_SCOPE)
endfunction()
......@@ -75,7 +78,14 @@ function(NGRAPH_GET_VERSION_LABEL)
if (NOT ${NGRAPH_MOST_RECENT_RELEASE_TAG} STREQUAL "")
set(NGRAPH_VERSION_LABEL "${NGRAPH_MOST_RECENT_RELEASE_TAG}+${HASH}" PARENT_SCOPE)
else()
set(NGRAPH_VERSION_LABEL "?.?.?+${HASH}" PARENT_SCOPE)
if(HASH)
set(NGRAPH_VERSION_LABEL "?.?.?+${HASH}" PARENT_SCOPE)
else()
# Not in a git repo
file(READ ${CMAKE_SOURCE_DIR}/TAG NGRAPH_TAG)
string(STRIP ${NGRAPH_TAG} NGRAPH_TAG)
set(NGRAPH_VERSION_LABEL "${NGRAPH_TAG}" PARENT_SCOPE)
endif()
endif()
endif()
endfunction()
# ******************************************************************************
# Copyright 2017-2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ******************************************************************************
import sys
import os
import subprocess
import tempfile
import tarfile
import zipfile
assert sys.version_info >= (3, 4)
swd = os.path.dirname(os.path.realpath(__file__))
swd = swd + '/..'
swd = os.path.realpath(swd)
get_tag = subprocess.Popen(['git', 'describe', '--tags', '--abbrev=0', '--match', 'v*.*.*'],
cwd=swd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
tag = [line.strip().decode() for line in get_tag.stdout.readlines()]
retval = get_tag.wait()
get_files = subprocess.Popen(['git', 'ls-tree', '-r', 'HEAD', '--name-only'],
cwd=swd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
files = [line.strip().decode() for line in get_files.stdout.readlines()]
retval = get_files.wait()
# create tarball for Linux and macOS
with tarfile.open(swd + '/ngraph-' + tag[0] + '.tar.gz', 'w:gz') as tar:
for f in files:
file_path = swd + '/' + f
tar.add(file_path, arcname='ngraph-' + tag[0][1:] + '/' + f)
with tempfile.NamedTemporaryFile() as tag_file:
tag_line = tag[0] + '\n'
tag_file.write(tag_line.encode())
tag_file.flush()
tar.add(tag_file.name, arcname='ngraph-' + tag[0][1:] + '/TAG')
# create zipfile for Windows
TO = b'\r\n'
FROM = b'\n'
with zipfile.ZipFile(swd + '/ngraph-' + tag[0] + '.zip', 'w', zipfile.ZIP_DEFLATED) as zipf:
for f in files:
with open(file_path, 'rb') as unix_file:
win_content = unix_file.read().replace(FROM, TO)
with tempfile.NamedTemporaryFile() as win_file:
win_file.write(win_content)
zipf.write(win_file.name, arcname='ngraph-' + tag[0][1:] + '/' + f)
with tempfile.NamedTemporaryFile() as tag_file:
tag_line = tag[0] + '\r\n'
tag_file.write(tag_line.encode())
tag_file.flush()
zipf.write(tag_file.name, arcname='ngraph-' + tag[0][1:] + '/TAG')
......@@ -74,6 +74,8 @@ target_include_directories(plaidml_backend SYSTEM PUBLIC ${PLAIDML_INCLUDE_DIRS}
target_link_libraries(plaidml_backend PUBLIC ngraph libplaidml)
install(TARGETS plaidml_backend LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB})
target_compile_definitions(plaidml_backend PRIVATE PLAIDML_BACKEND_DLL_EXPORTS)
set(CMAKE_MACOSX_RPATH 1)
if(APPLE)
set_property(TARGET plaidml_backend PROPERTY INSTALL_RPATH "@loader_path/;@loader_path/../../..")
......
//*****************************************************************************
// Copyright 2017-2019 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//*****************************************************************************
// https://gcc.gnu.org/wiki/Visibility
// Generic helper definitions for shared library support
#if defined _WIN32 || defined __CYGWIN__
#define PLAIDML_BACKEND_HELPER_DLL_IMPORT __declspec(dllimport)
#define PLAIDML_BACKEND_HELPER_DLL_EXPORT __declspec(dllexport)
#define PLAIDML_BACKEND_HELPER_DLL_LOCAL
#else
#if __GNUC__ >= 4
#define PLAIDML_BACKEND_HELPER_DLL_IMPORT __attribute__((visibility("default")))
#define PLAIDML_BACKEND_HELPER_DLL_EXPORT __attribute__((visibility("default")))
#define PLAIDML_BACKEND_HELPER_DLL_LOCAL __attribute__((visibility("hidden")))
#else
#define PLAIDML_BACKEND_HELPER_DLL_IMPORT
#define PLAIDML_BACKEND_HELPER_DLL_EXPORT
#define PLAIDML_BACKEND_HELPER_DLL_LOCAL
#endif
#endif
// Now we use the generic helper definitions above to define PLAIDML_BACKEND_API and PLAIDML_BACKEND_LOCAL.
// PLAIDML_BACKEND_API is used for the public API symbols. It either DLL imports or DLL exports
// (or does nothing for static build)
// PLAIDML_BACKEND_LOCAL is used for non-api symbols.
// #ifdef PLAIDML_BACKEND_DLL // defined if PLAIDML_BACKEND is compiled as a DLL
#ifdef PLAIDML_BACKEND_DLL_EXPORTS // defined if we are building the PLAIDML_BACKEND DLL (instead of using it)
#define PLAIDML_BACKEND_API PLAIDML_BACKEND_HELPER_DLL_EXPORT
#else
#define PLAIDML_BACKEND_API PLAIDML_BACKEND_HELPER_DLL_IMPORT
#endif // PLAIDML_BACKEND_DLL_EXPORTS
#define PLAIDML_BACKEND_LOCAL PLAIDML_BACKEND_HELPER_DLL_LOCAL
// #else // PLAIDML_BACKEND_DLL is not defined: this means PLAIDML_BACKEND is a static lib.
// #define PLAIDML_BACKEND_API
// #define PLAIDML_BACKEND_LOCAL
// #endif // PLAIDML_BACKEND_DLL
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment