Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Build ngraph-tf not only on Centos #396

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ cmake_minimum_required(VERSION 3.1)

project (ngraph_tensorflow_bridge CXX)

if (UNIX AND NOT APPLE)
set(LINUX TRUE)
endif()

# set directory where the custom finders live
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")

Expand Down Expand Up @@ -267,7 +271,7 @@ endif()
set(NGRAPH_INSTALL_DIR ${NGRAPH_ARTIFACTS_DIR})


if(OS_VERSION STREQUAL "\"centos\"")
if(EXISTS ${NGRAPH_INSTALL_DIR}/lib64)
set(NGRAPH_IMPORTED_LOCATION ${NGRAPH_INSTALL_DIR}/lib64/${LIBNGRAPH_SO})
else()
set(NGRAPH_IMPORTED_LOCATION ${NGRAPH_INSTALL_DIR}/lib/${LIBNGRAPH_SO})
Expand Down
4 changes: 2 additions & 2 deletions python/CreatePipWhl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ if (PYTHON)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/python/ngraph_bridge)

# Get the list of libraries we need for the Python pip package
# If we are building on CentOS then it's lib64 - else lib
# If we are building on a 64-bits OS that uses lib64 then it's lib64 - else lib
set(LIB_SUFFIX lib)
if(NOT APPLE)
if(OS_VERSION STREQUAL "centos")
if(EXISTS ${NGTF_INSTALL_DIR}/lib64)
set(LIB_SUFFIX lib64)
endif()
endif()
Expand Down
16 changes: 8 additions & 8 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,27 +72,27 @@ target_include_directories(${LIB_NAME} PUBLIC "${NGRAPH_DEVICE_INCLUDE_PATH}")
#------------------------------------------------------------------------------
#installation
#------------------------------------------------------------------------------
if (DEFINED NGRAPH_TF_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX ${NGRAPH_TF_INSTALL_PREFIX})
if (LINUX)
include(GNUInstallDirs)
else()
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/../install/")
set(CMAKE_INSTALL_LIBDIR "lib")
endif()

if(OS_VERSION STREQUAL "\"centos\"")
set(NGTF_INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/lib64)
if (DEFINED NGRAPH_TF_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX ${NGRAPH_TF_INSTALL_PREFIX})
else()
set(NGTF_INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/lib)
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/../install/")
endif()

message(STATUS "NGTF_INSTALL_LIB_DIR: ${NGTF_INSTALL_LIB_DIR}")
set(NGTF_INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})

# First install the libngraph_bridge.so and headers
install(TARGETS ${LIB_NAME} DESTINATION "${NGTF_INSTALL_LIB_DIR}")
install(FILES ngraph_backend_manager.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include)


# Next install all the other prerequisites
if(OS_VERSION STREQUAL "\"centos\"")
if(EXISTS ${NGRAPH_INSTALL_DIR}/lib64)
install(DIRECTORY ${NGRAPH_INSTALL_DIR}/lib64/ DESTINATION "${NGTF_INSTALL_LIB_DIR}" )
else()
install(DIRECTORY ${NGRAPH_INSTALL_DIR}/lib/ DESTINATION "${NGTF_INSTALL_LIB_DIR}" )
Expand Down