Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
e9d403d1
Commit
e9d403d1
authored
Sep 20, 2017
by
Yixing Lao
Committed by
GitHub
Sep 20, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #132 from NervanaSystems/yixing/external-headers
individual install path for external projects
parents
c9f896fc
69d7a755
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
16 deletions
+60
-16
CMakeLists.txt
CMakeLists.txt
+19
-0
external_eigen.cmake
cmake/external_eigen.cmake
+5
-5
external_mkldnn.cmake
cmake/external_mkldnn.cmake
+7
-8
CMakeLists.txt
src/CMakeLists.txt
+29
-3
No files found.
CMakeLists.txt
View file @
e9d403d1
...
...
@@ -44,6 +44,25 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
#-----------------------------------------------------------------------------------------------
# External projects install directory
#-----------------------------------------------------------------------------------------------
# Root for external installs, when using `make`, e.g.
# ${EXTERNAL_INSTALL_DIR}
# ├── eigen <-- ${EIGEN_INSTALL_DIR}
# │ ├── include
# │ │ └── eigen3 <-- ${EIGEN_INCLUDE_DIR}
# │ │ ├── Eigen
# │ ...
# │
# └── mkldnn <-- ${MKLDNN_INSTALL_DIR}
# ├── include <-- ${MKLDNN_INCLUDE_DIR}
# │ ├── mkldnn.h
# │ ...
# ├── lib <-- ${MKLDNN_LIB_DIR}
# │ ├── libiomp5.so
# ...
set
(
EXTERNAL_INSTALL_DIR
${
CMAKE_BINARY_DIR
}
/external
)
# The following 'add_subdirectory' call:
# - defines the 'libgtest' target.
...
...
cmake/external_eigen.cmake
View file @
e9d403d1
...
...
@@ -14,7 +14,7 @@
# Enable ExternalProject CMake module
include
(
ExternalProject
)
set
(
E
XTERNAL_INSTALL_LOCATION
${
CMAKE_BINARY_DIR
}
/external
)
set
(
E
IGEN_INSTALL_DIR
${
EXTERNAL_INSTALL_DIR
}
/eigen
)
#----------------------------------------------------------------------------------------------------------
# Download and install GoogleTest ...
...
...
@@ -27,7 +27,7 @@ if (${CMAKE_VERSION} VERSION_LESS 3.2)
URL http://bitbucket.org/eigen/eigen/get/3.3.3.zip
# PREFIX ${CMAKE_CURRENT_BINARY_DIR}/eigen
UPDATE_COMMAND
""
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=
${
E
XTERNAL_INSTALL_LOCATION
}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=
${
E
IGEN_INSTALL_DIR
}
)
else
()
ExternalProject_Add
(
...
...
@@ -35,8 +35,8 @@ else()
URL http://bitbucket.org/eigen/eigen/get/3.3.3.zip
# PREFIX ${CMAKE_CURRENT_BINARY_DIR}/eigen
UPDATE_COMMAND
""
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=
${
E
XTERNAL_INSTALL_LOCATION
}
BUILD_BYPRODUCTS
"
${
E
XTERNAL_INSTALL_LOCATION
}
/include/eigen3"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=
${
E
IGEN_INSTALL_DIR
}
BUILD_BYPRODUCTS
"
${
E
IGEN_INSTALL_DIR
}
/include/eigen3"
)
endif
()
...
...
@@ -44,4 +44,4 @@ endif()
ExternalProject_Get_Property
(
eigen source_dir binary_dir
)
set
(
EIGEN_INCLUDE_DIR
"
${
E
XTERNAL_INSTALL_LOCATION
}
/include/eigen3"
PARENT_SCOPE
)
set
(
EIGEN_INCLUDE_DIR
"
${
E
IGEN_INSTALL_DIR
}
/include/eigen3"
PARENT_SCOPE
)
cmake/external_mkldnn.cmake
View file @
e9d403d1
...
...
@@ -19,9 +19,8 @@ include(ExternalProject)
if
(
NOT
${
CMAKE_SYSTEM_NAME
}
MATCHES
"Darwin"
)
SET
(
MKLDNN_GIT_REPO_URL https://github.com/01org/mkl-dnn
)
set
(
EXTERNAL_INSTALL_LOCATION
${
CMAKE_BINARY_DIR
}
/external
)
set
(
MKLDNN_GIT_REPO_URL https://github.com/01org/mkl-dnn
)
set
(
MKLDNN_INSTALL_DIR
${
EXTERNAL_INSTALL_DIR
}
/mkldnn
)
# The 'BUILD_BYPRODUCTS' argument was introduced in CMake 3.2.
if
(
${
CMAKE_VERSION
}
VERSION_LESS 3.2
)
...
...
@@ -30,7 +29,7 @@ if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
GIT_REPOSITORY
${
MKLDNN_GIT_REPO_URL
}
UPDATE_COMMAND
""
PATCH_COMMAND patch -p1 <
${
CMAKE_SOURCE_DIR
}
/third-party/patches/mkldnn-cmake-openmp.patch
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=
${
EXTERNAL_INSTALL_LOCATION
}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=
${
MKLDNN_INSTALL_DIR
}
)
else
()
ExternalProject_Add
(
...
...
@@ -38,8 +37,8 @@ if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
GIT_REPOSITORY
${
MKLDNN_GIT_REPO_URL
}
UPDATE_COMMAND
""
PATCH_COMMAND patch -p1 <
${
CMAKE_SOURCE_DIR
}
/third-party/patches/mkldnn-cmake-openmp.patch
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=
${
EXTERNAL_INSTALL_LOCATION
}
BUILD_BYPRODUCTS
"
${
EXTERNAL_INSTALL_LOCATION
}
/include/mkldnn.hpp"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=
${
MKLDNN_INSTALL_DIR
}
BUILD_BYPRODUCTS
"
${
MKLDNN_INSTALL_DIR
}
/include/mkldnn.hpp"
)
endif
()
...
...
@@ -54,7 +53,7 @@ if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
)
set
(
MKLDNN_INCLUDE_DIR
"
${
EXTERNAL_INSTALL_LOCATION
}
/include"
PARENT_SCOPE
)
set
(
MKLDNN_LIB_DIR
"
${
EXTERNAL_INSTALL_LOCATION
}
/lib"
PARENT_SCOPE
)
set
(
MKLDNN_INCLUDE_DIR
"
${
MKLDNN_INSTALL_DIR
}
/include"
PARENT_SCOPE
)
set
(
MKLDNN_LIB_DIR
"
${
MKLDNN_INSTALL_DIR
}
/lib"
PARENT_SCOPE
)
endif
()
src/CMakeLists.txt
View file @
e9d403d1
...
...
@@ -96,11 +96,37 @@ set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/ngraph_dist" CACHE PATH "Install directory"
message
(
STATUS
"Installation directory:
${
CMAKE_INSTALL_PREFIX
}
"
)
message
(
STATUS
"To Override use: cmake -DCMAKE_INSTALL_PREFIX=/foo -P cmake_install.cmake"
)
install
(
TARGETS ngraph DESTINATION
${
CMAKE_INSTALL_PREFIX
}
)
# Destinations
set
(
CMAKE_INSTALL_LIB
"
${
CMAKE_INSTALL_PREFIX
}
/lib"
)
set
(
CMAKE_INSTALL_INCLUDE
"
${
CMAKE_INSTALL_PREFIX
}
/include"
)
# NGraph
install
(
TARGETS ngraph DESTINATION
${
CMAKE_INSTALL_LIB
}
)
# libngraph.so
install
(
DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
/
ngraph
DESTINATION
${
CMAKE_INSTALL_PREFIX
}
${
CMAKE_CURRENT_SOURCE_DIR
}
/
DESTINATION
"
${
CMAKE_INSTALL_INCLUDE
}
"
FILES_MATCHING PATTERN
"*.hpp"
)
# External
# Requirements:
# - In NGraph, there are multiple include paths set for different external projects.
# - However, we want one single include path for external projects from the TF bridge side, while
# making sure that the `#include` files can still be resolved.
# - Therefore, when `make install`, the include directory will be "flattened" for each external
# projects respectively.
install
(
DIRECTORY
${
EIGEN_INCLUDE_DIR
}
/
DESTINATION
"
${
CMAKE_INSTALL_INCLUDE
}
"
)
install
(
DIRECTORY
${
MKLDNN_INCLUDE_DIR
}
/
DESTINATION
"
${
CMAKE_INSTALL_INCLUDE
}
"
)
install
(
DIRECTORY
${
MKLDNN_LIB_DIR
}
/
DESTINATION
"
${
CMAKE_INSTALL_LIB
}
"
)
add_dependencies
(
ngraph eigen
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment