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

refine linux cmake and files #8

Open
wants to merge 4 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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file removed 20171121203935599.png
Binary file not shown.
Binary file removed 20171121203946021.png
Binary file not shown.
Binary file removed 20171121204748663.png
Binary file not shown.
138 changes: 138 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
cmake_minimum_required(VERSION 2.8.7)
if(POLICY CMP0046)
cmake_policy(SET CMP0046 NEW)
endif()
if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif()

# ---[ Caffe project
project(Caffe C CXX)

# c++11 required
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)

set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)


# ---[ Caffe version
set(CAFFE_TARGET_VERSION "1.0.0" CACHE STRING "Caffe logical version")
set(CAFFE_TARGET_SOVERSION "1.0.0" CACHE STRING "Caffe soname version")
add_definitions(-DCAFFE_VERSION=${CAFFE_TARGET_VERSION})

# ---[ Using cmake scripts and modules
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules)

include(ExternalProject)
include(GNUInstallDirs)

include(cmake/Utils.cmake)
include(cmake/Targets.cmake)
include(cmake/Misc.cmake)
include(cmake/Summary.cmake)
include(cmake/ConfigGen.cmake)

# ---[ Options
caffe_option(CPU_ONLY "Build Caffe without CUDA support" OFF) # TODO: rename to USE_CUDA
caffe_option(USE_CUDNN "Build Caffe with cuDNN library support" ON IF NOT CPU_ONLY)
caffe_option(USE_NCCL "Build Caffe with NCCL library support" OFF)
caffe_option(BUILD_SHARED_LIBS "Build shared libraries" ON)
caffe_option(BUILD_python "Build Python wrapper" OFF)
set(python_version "2" CACHE STRING "Specify which Python version to use")
caffe_option(BUILD_matlab "Build Matlab wrapper" OFF IF UNIX OR APPLE)
caffe_option(BUILD_docs "Build documentation" OFF IF UNIX OR APPLE)
caffe_option(BUILD_python_layer "Build the Caffe Python layer" OFF)
caffe_option(USE_OPENCV "Build with OpenCV support" ON)
caffe_option(USE_LEVELDB "Build with levelDB" ON)
caffe_option(USE_LMDB "Build with lmdb" ON)
caffe_option(ALLOW_LMDB_NOLOCK "Allow MDB_NOLOCK when reading LMDB files (only if necessary)" ON)
caffe_option(USE_OPENMP "Link with OpenMP (when your BLAS wants OpenMP and you get linker errors)" ON)


# ---[ Dependencies
include(cmake/Dependencies.cmake)

# ---[ Flags
if(UNIX OR APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall")
endif()

caffe_set_caffe_link()

if(USE_libstdcpp)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++")
message("-- Warning: forcing libstdc++ (controlled by USE_libstdcpp option in cmake)")
endif()

# ---[ Warnings
caffe_warnings_disable(CMAKE_CXX_FLAGS -Wno-sign-compare -Wno-uninitialized)

# ---[ Config generation
configure_file(cmake/Templates/caffe_config.h.in "${PROJECT_BINARY_DIR}/caffe_config.h")

# ---[ Includes
set(Caffe_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include)
set(Caffe_SRC_DIR ${PROJECT_SOURCE_DIR}/src)


include_directories(${PROJECT_BINARY_DIR})

# ---[ Includes & defines for CUDA

# cuda_compile() does not have per-call dependencies or include pathes
# (cuda_compile() has per-call flags, but we set them here too for clarity)
#
# list(REMOVE_ITEM ...) invocations remove PRIVATE and PUBLIC keywords from collected definitions and include pathes
if(HAVE_CUDA)
# pass include pathes to cuda_include_directories()
set(Caffe_ALL_INCLUDE_DIRS ${Caffe_INCLUDE_DIRS})
list(REMOVE_ITEM Caffe_ALL_INCLUDE_DIRS PRIVATE PUBLIC)
cuda_include_directories(${Caffe_INCLUDE_DIR} ${Caffe_SRC_DIR} ${Caffe_ALL_INCLUDE_DIRS})

# add definitions to nvcc flags directly
set(Caffe_ALL_DEFINITIONS ${Caffe_DEFINITIONS})
list(REMOVE_ITEM Caffe_ALL_DEFINITIONS PRIVATE PUBLIC)
list(APPEND CUDA_NVCC_FLAGS ${Caffe_ALL_DEFINITIONS})
endif()

# ---[ Subdirectories
add_subdirectory(src/gtest)
add_subdirectory(src/caffe)
add_subdirectory(src/libClassification)
add_subdirectory(src/ocr_test)
#add_subdirectory(tools)
#add_subdirectory(examples)
#add_subdirectory(python)
#add_subdirectory(matlab)
#add_subdirectory(docs)

message(${Caffe_INCLUDE_DIRS})
# ---[ Linter target
add_custom_target(lint COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/lint.cmake)

# ---[ pytest target#
#if(BUILD_python)
# add_custom_target(pytest COMMAND python${python_version} -m unittest discover -s caffe/test WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/python )
# add_dependencies(pytest pycaffe)
#endif()

# ---[ uninstall target
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/Uninstall.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/cmake/Uninstall.cmake
IMMEDIATE @ONLY)

add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P
${CMAKE_CURRENT_BINARY_DIR}/cmake/Uninstall.cmake)

# ---[ Configuration summary
caffe_print_configuration_summary()

# ---[ Export configs generation
caffe_generate_export_configs()

Binary file removed bin/WM_ocr_test.exe
Binary file not shown.
Binary file removed bin/WM_ocr_test.lib
Binary file not shown.
Binary file removed bin/caffe.lib
Binary file not shown.
Binary file removed bin/dynlib1.dll
Binary file not shown.
Binary file removed bin/dynlib3.dll
Binary file not shown.
Binary file removed bin/gflags.dll
Binary file not shown.
Binary file removed bin/hdf5.dll
Binary file not shown.
Binary file removed bin/hdf5_cpp.dll
Binary file not shown.
Binary file removed bin/hdf5_hl.dll
Binary file not shown.
Binary file removed bin/hdf5_hl_cpp.dll
Binary file not shown.
Binary file removed bin/hdf5_test.dll
Binary file not shown.
Binary file removed bin/hdf5_tools.dll
Binary file not shown.
Binary file removed bin/libClassification.dll
Binary file not shown.
Binary file removed bin/libClassification.exe
Binary file not shown.
Binary file removed bin/libClassification.lib
Binary file not shown.
Binary file removed bin/libgcc_s_seh-1.dll
Binary file not shown.
Binary file removed bin/libgfortran-3.dll
Binary file not shown.
Binary file removed bin/libglog.dll
Binary file not shown.
Binary file removed bin/libquadmath-0.dll
Binary file not shown.
Binary file removed bin/ocr_test.exe
Binary file not shown.
Binary file removed bin/ocr_test.lib
Binary file not shown.
Binary file removed bin/opencv_core340.dll
Binary file not shown.
Binary file removed bin/opencv_highgui340.dll
Binary file not shown.
Binary file removed bin/opencv_imgcodecs340.dll
Binary file not shown.
Binary file removed bin/opencv_ml340.dll
Binary file not shown.
Binary file removed bin/opencv_objdetect340.dll
Binary file not shown.
Binary file removed bin/opencv_videoio340.dll
Binary file not shown.
Binary file removed bin/szip.dll
Binary file not shown.
Binary file removed bin/szip_D.dll
Binary file not shown.
Binary file removed bin/zlib.dll
Binary file not shown.
Binary file removed caffe-vsproj/.vs/caffe/v14/.suo
Binary file not shown.
Binary file removed caffe-vsproj/caffe.VC.db
Binary file not shown.
78 changes: 0 additions & 78 deletions caffe-vsproj/caffe.sln

This file was deleted.

Binary file removed caffe-vsproj/caffe.v12.suo
Binary file not shown.
8 changes: 0 additions & 8 deletions caffe-vsproj/caffe/Debug/caffe.log

This file was deleted.

Loading