CMakeLists.txt 1.9 KB
Newer Older
S
superjom 已提交
1
cmake_minimum_required(VERSION 3.5)
S
superjom 已提交
2 3
project(VisualDL)

Q
Qiao Longfei 已提交
4
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
S
superjom 已提交
5
set(CMAKE_CXX_STANDARD 11)
S
superjom 已提交
6
set(CMAKE_CXX_FLAGS "-fPIC")
S
superjom 已提交
7 8


Q
Qiao Longfei 已提交
9 10 11 12 13
set(THIRD_PARTY_PATH "${CMAKE_BINARY_DIR}/third_party" CACHE STRING
        "A path setting third party libraries download & build directories.")

################################ Configurations #######################################
option(WITH_TESTING     "Compile VisualDL with unit testing"        ON)
S
superjom 已提交
14

S
superjom 已提交
15

Q
Qiao Longfei 已提交
16 17 18 19 20 21 22 23 24 25 26
include(external/zlib)      # download, build, install zlib
include(external/gflags)    # download, build, install gflags
include(external/glog)      # download, build, install glog
include(external/gtest)     # download, build, install gtest
include(external/pybind11)  # download pybind11
include(external/protobuf)  # download, build, install protobuf
include(external/python)    # find python and set path

include_directories(${PROJECT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/local/include)
S
superjom 已提交
27 28

pybind11_add_module(core
S
superjom 已提交
29 30 31 32
        ${PROJECT_SOURCE_DIR}/visualdl/backend/logic/pybind.cc
        ${PROJECT_SOURCE_DIR}/visualdl/backend/utils/filesystem.h
        ${PROJECT_SOURCE_DIR}/visualdl/backend/utils/concurrency.h
        )
S
superjom 已提交
33 34
target_link_libraries(core PRIVATE pybind11::module im storage sdk protobuf glog)
set_target_properties(core PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
Q
Qiao Longfei 已提交
35 36
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/visualdl/backend/storage)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/visualdl/backend/logic)
S
superjom 已提交
37 38

add_executable(vl_test
S
superjom 已提交
39
        ${PROJECT_SOURCE_DIR}/visualdl/backend/test.cc
S
superjom 已提交
40
        ${PROJECT_SOURCE_DIR}/visualdl/backend/storage/storage_test.cc
S
superjom 已提交
41
        ${PROJECT_SOURCE_DIR}/visualdl/backend/utils/test_concurrency.cc
S
superjom 已提交
42
        ${PROJECT_SOURCE_DIR}/visualdl/backend/logic/im_test.cc)
S
superjom 已提交
43
target_link_libraries(vl_test storage im gtest glog protobuf gflags pthread)