CMakeLists.txt 1.6 KB
Newer Older
朔-望's avatar
朔-望 已提交
1 2 3 4 5 6 7
cmake_minimum_required(VERSION 3.0)
project(paddle-mobile)
add_definitions(-std=c++11)
add_definitions(-DPADDLE_MOBILE_DEBUG="true")


set(CMAKE_BUILD_TYPE RelWithDebInfo)
朔-望's avatar
朔-望 已提交
8 9
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
朔-望's avatar
朔-望 已提交
10 11 12 13 14 15 16 17 18 19
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY build)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY build)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY build)

file(GLOB_RECURSE PADDLE_MOBILE_CC src/*.cc src/*.cpp)
file(GLOB_RECURSE PADDLE_MOBILE_H src/*.h)

# include headers
include_directories(src/)

Z
zhaojiaying01 已提交
20 21 22 23 24 25 26 27 28 29 30
#include(ExternalProject)
#ExternalProject_Add(openblas_proj
#        GIT_REPOSITORY "https://github.com/xianyi/OpenBLAS.git"
#        GIT_TAG "v0.2.20"
#        SOURCE_DIR "openblas/"
#        BUILD_IN_SOURCE 1
#        CONFIGURE_COMMAND ""
#        BUILD_COMMAND "make" "ONLY_CBLAS=1"
#        INSTALL_COMMAND "make" "PREFIX=${CMAKE_BINARY_DIR}/" "install"
#        )
#set_target_properties(openblas_proj PROPERTIES EXCLUDE_FROM_ALL 1)
朔-望's avatar
朔-望 已提交
31 32
# link protobuf
include_directories(third-party/protobuf/include)
W
wangliu 已提交
33 34 35 36 37 38 39 40
if (ANDROID)
    link_directories(third-party/protobuf/armeabi-v7a)
else()
    # link openblas
    include_directories(third-party/openblas/include)
    link_directories(third-party/openblas/lib)
    link_directories(third-party/protobuf/lib)
endif ()
朔-望's avatar
朔-望 已提交
41

Z
zhaojiaying01 已提交
42
#add_dependencies(paddle-mobile openblas_proj)
朔-望's avatar
朔-望 已提交
43 44

# gen static
W
wangliu 已提交
45 46 47 48 49 50 51
ADD_LIBRARY(paddle-mobile STATIC ${PADDLE_MOBILE_CC} ${PADDLE_MOBILE_H})
if (ANDROID)
    # openblas.a need log lib
    target_link_libraries(paddle-mobile protobuf-lite)
else()
    target_link_libraries(paddle-mobile protobuf-lite openblas)
endif ()
Z
zhaojiaying01 已提交
52
#add_dependencies(paddle-mobile openblas_proj)
朔-望's avatar
朔-望 已提交
53

L
liuruilong 已提交
54
add_subdirectory(test)