-
Notifications
You must be signed in to change notification settings - Fork 14
/
CMakeLists.txt
executable file
·112 lines (93 loc) · 4.72 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
cmake_minimum_required(VERSION 3.5)
include(cmake/CMakeUtils.cmake)
project(Alchemy VERSION 0.0.1 LANGUAGES C CXX)
# 使用项目分组,Visual studio
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
include(cmake/AlchemyCompiler.cmake)
# 设置bin和lib目录
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
# ========================== Options ==========================
alchemy_option(USE_CUDA "Build Alchemy with CUDA library support" ON)
alchemy_option(USE_CUDNN "Build Alchemy with CUDNN library support" ON)
alchemy_option(USE_OPENCV "Build Alchemy with OpenCV library support" ON)
alchemy_option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
# ========================== 3rdparty ==========================
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/;${CMAKE_MODULE_PATH}")
if(WIN32)
add_custom_target(COPY_DLL_FILES ALL)
endif()
include(cmake/AlchemyDependencies.cmake)
# ========================== Debug ==========================
set(CMAKE_DEBUG_POSTFIX "d")
# ========================== Modules ==========================
include_directories(${PROJECT_SOURCE_DIR}/modules)
add_subdirectory(modules/util)
add_subdirectory(modules/math)
add_subdirectory(modules/core)
add_subdirectory(modules/imgproc)
add_subdirectory(modules/gui)
add_subdirectory(modules/nn)
list(APPEND ALCHEMY_LIBS alchemy_math alchemy_nn alchemy_gui alchemy_imgproc alchemy_util alchemy_core)
# simples
add_subdirectory(simples)
#enable_testing()
add_subdirectory(test)
# ========================== Build platform ==========================
alchemy_status("")
alchemy_status("~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Build ~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
alchemy_status("")
alchemy_status(" Name :" ${PROJECT_NAME})
alchemy_status(" Version :" ${PROJECT_VERSION})
alchemy_status(" Host :" ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_VERSION} ${CMAKE_HOST_SYSTEM_PROCESSOR})
alchemy_status(" CMake :" ${CMAKE_VERSION})
alchemy_status(" CMake generator :" ${CMAKE_GENERATOR})
alchemy_status(" CMake build tool :" ${CMAKE_BUILD_TOOL})
if(MSVC)
alchemy_status(" MSVC :" ${MSVC_VERSION})
endif()
if(CMAKE_GENERATOR MATCHES Xcode)
alchemy_status(" Xcode :" ${XCODE_VERSION})
endif()
if(NOT CMAKE_GENERATOR MATCHES "Xcode|Visual Studio")
alchemy_status(" Configuration :" ${CMAKE_BUILD_TYPE})
endif()
alchemy_status("")
# ========================== C/C++ options ==========================
alchemy_status("")
alchemy_status("~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C/C++ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
alchemy_status("")
alchemy_status(" C++ 14 :" COMPILER_SUPPORTS_CXX14 THEN YES ELSE NO)
alchemy_status(" C++ Compiler :" ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} (ver ${CMAKE_CXX_COMPILER_VERSION}))
alchemy_status(" C++ flags (Release) :" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE})
alchemy_status(" C++ flags (Debug) :" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG})
alchemy_status(" C Compiler :" ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1})
alchemy_status(" C flags (Release) :" ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE})
alchemy_status(" C flags (Debug) :" ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG})
alchemy_status("")
# ========================== Dependencies ==========================
alchemy_status("")
alchemy_status("~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Dependencies ~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
alchemy_status("Media:")
alchemy_status(" zlib :" ZLIB_FOUND THEN YES ELSE NO)
alchemy_status(" libjpeg :" JPEG_FOUND THEN YES ELSE NO)
alchemy_status(" libpng :" PNG_FOUND THEN YES ELSE NO)
alchemy_status(" FFmpeg :" FFMPEG_FOUND THEN YES ELSE NO)
alchemy_status("Math:")
alchemy_status(" fftw :" FFTW_FOUND THEN YES ELSE NO)
alchemy_status(" Atlas :" Atlas_FOUND THEN YES ELSE NO)
alchemy_status(" NNPACK :" NNPACK_FOUND THEN YES ELSE NO)
alchemy_status("GPGPU:")
alchemy_status(" CUDA :" CUDA_FOUND THEN YES(ver ${CUDA_VERSION}) ELSE NO)
alchemy_status(" CuDNN :" CUDNN_FOUND THEN YES(ver ${CUDNN_VERSION}) ELSE NO)
alchemy_status("LOG:")
alchemy_status(" Glog :" Glog_FOUND THEN YES ELSE NO)
alchemy_status("GUI:")
if(WIN32)
alchemy_status(" WIN32 :" YES)
else()
alchemy_status(" Gtk+ 2.x :" GTK2_FOUND THEN YES(ver ${GTK2_VERSION}) ELSE NO)
endif()
# log("Install path:" ${CMAKE_INSTALL_PREFIX})
alchemy_status("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
alchemy_status("")