Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SINGA-270 Installation error: include/singa/proto/ is not in /usr/local/include #282

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ OPTION(USE_CUDA "Use Cuda libs" OFF)
OPTION(USE_CUDNN "Use Cudnn libs" ON)
OPTION(USE_OPENCV "Use opencv" OFF)
OPTION(USE_LMDB "Use LMDB libs" OFF)
OPTION(USE_GLOG "Use glog libs" ON)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this one?
I think we agreed to remove it and use it if cmake can detect it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If cmake detects glog, then we link glog statically into libsinga.so.
In this way, we would not have the linking error when compiling user code.

OPTION(USE_PYTHON "Generate py wrappers" ON)
OPTION(USE_JAVA "Generate java wrappers" OFF)
OPTION(USE_OPENCL "Use OpenCL" OFF)
Expand All @@ -74,6 +75,14 @@ CONFIGURE_FILE (

SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
#SET(DEPENDENT_LIB_PREFIX ${CMAKE_INSTALL_PREFIX})

IF(CMAKE_INSTALL_PREFIX STREQUAL "")
SET(DEPENDENT_LIB_PREFIX ${CMAKE_BINARY_DIR})
ELSE()
SET(DEPENDENT_LIB_PREFIX ${CMAKE_INSTALL_PREFIX})
ENDIF()


IF (USE_CUDA)
include(ExternalProject)
Expand All @@ -83,7 +92,7 @@ IF (USE_CUDA)
SOURCE_DIR "cnmem/"
CONFIGURE_COMMAND "${CMAKE_COMMAND}"
"-H${CMAKE_BINARY_DIR}/cnmem" "-B."
"-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}"
"-DCMAKE_INSTALL_PREFIX=${DEPENDENT_LIB_PREFIX}"
)
#ADD_SUBDIRECTORY(lib/cnmem)
#LIST(APPEND SINGA_LINKER_LIBS cnmem)
Expand Down Expand Up @@ -120,7 +129,7 @@ IF (USE_MODULES)
SOURCE_DIR "protobuf-2.6.1/"
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND "./configure" "--disable-shared"
"--prefix=${CMAKE_BINARY_DIR}/" "CXXFLAGS=-fPIC"
"--prefix=${DEPENDENT_LIB_PREFIX}/" "CXXFLAGS=-fPIC"
INSTALL_COMMAND "make" "install"
)
ExternalProject_Add(openblas
Expand All @@ -131,7 +140,7 @@ IF (USE_MODULES)
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND "make" "ONLY_CBLAS=1"
INSTALL_COMMAND "make" "PREFIX=${CMAKE_BINARY_DIR}/" "install"
INSTALL_COMMAND "make" "PREFIX=${DEPENDENT_LIB_PREFIX}/" "install"
)
ENDIF()

Expand All @@ -150,8 +159,10 @@ IF (USE_JAVA)
ENDIF()

INSTALL(DIRECTORY include/singa DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
INSTALL(FILES ${CMAKE_BINARY_DIR}/include/singa/singa_config.h DESTINATION
${CMAKE_INSTALL_PREFIX}/include/singa)
#INSTALL(FILES ${CMAKE_BINARY_DIR}/include/singa/singa_config.h DESTINATION
# ${CMAKE_INSTALL_PREFIX}/include/singa)
INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/include/singa DESTINATION
${CMAKE_INSTALL_PREFIX}/include)
INSTALL (DIRECTORY ${CMAKE_BINARY_DIR}/lib DESTINATION
${CMAKE_INSTALL_PREFIX}
PATTERN "*libgtest.a" EXCLUDE )
6 changes: 3 additions & 3 deletions cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ ENDIF()
#INCLUDE("cmake/ProtoBuf.cmake")
#INCLUDE("cmake/Protobuf.cmake")

FIND_PACKAGE(Glog)
IF(GLOG_FOUND)
#MESSAGE(STATUS "GLOG FOUND at ${GLOG_INCLUDE_DIR}")
IF(USE_GLOG)
FIND_PACKAGE(Glog REQUIRED)
MESSAGE(STATUS "GLOG FOUND at ${GLOG_INCLUDE_DIR}")
ADD_DEFINITIONS("-DUSE_GLOG")
LIST(APPEND SINGA_LINKER_LIBS ${GLOG_LIBRARIES})
INCLUDE_DIRECTORIES(${GLOG_INCLUDE_DIR})
Expand Down