forked from wgwjifeng/op
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathCMakeLists.txt
108 lines (91 loc) · 3.08 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
# CMakeList.txt: 顶层 CMake 项目文件,在此处执行全局配置
# 并包含子项目。
#
cmake_minimum_required (VERSION 3.0)
# set(VCPKG_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR})
option(build_swig_py "build swig py,requrie python" OFF)
option(build_qttool "buid qt tool,requrie qt lib" OFF)
# 编译开关
set(build_qttool ON)
set(build_swig_py OFF)
# blackbone 源码路径,必须设置!!!
set(blackbone_include_path "E:/git_pro/Blackbone/src")
# blackbone 32位静态库路径,必须设置!!!
set(blackbone_lib32_path "E:/git_pro/Blackbone/build/Win32/Release")
# blackbone 64位静态库路径,必须设置!!!
set(blackbone_lib64_path "E:/git_pro/Blackbone/build/X64/Release")
# 检查头文件是否设置正确
if(EXISTS ${blackbone_include_path}/BlackBone/Process/Process.h)
message(STATUS "${blackbone_include_path}/BlackBone/Process/Process.h finded" )
else()
message(FATAL_ERROR "${blackbone_include_path}/BlackBone/Process/Process.h not finded" )
endif()
# 检查库是否设置正确
if(EXISTS ${blackbone_lib32_path}/blackbone.lib)
message(STATUS "32 blackbone lib find" )
else()
message(FATAL_ERROR "${blackbone_lib32_path}/blackbone.lib NOT find" )
endif()
if(EXISTS ${blackbone_lib64_path}/blackbone.lib)
message(STATUS "64 blackbone lib find" )
else()
message(FATAL_ERROR "${blackbone_lib64_path}/blackbone.lib NOT find" )
endif()
project ("op")
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
set(CMAKE_CXX_STANDARD 17)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
MESSAGE(STATUS "----------------Now is MSVC EHA----------------")
set(CMAKE_CXX_FLAGS_RELEASE "/MT /O2 /EHa")
set(CMAKE_C_FLAGS_RELEASE "/MT /O2 /EHa")
set(CMAKE_CXX_FLAGS_DEBUG "/MT /Zi /EHa")
set(CMAKE_C_FLAGS_DEBUG "/MT /Zi /EHa")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MT /O2 /EHa")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/MT /O2 /EHa")
endif()
IF(CMAKE_CL_64)
link_directories(
${CMAKE_SOURCE_DIR}/3rd_party/lib/x64
${blackbone_lib64_path}
)
set(op_com op_x64)
MESSAGE(STATUS "----------------Platform x64----------------")
ELSE(CMAKE_CL_64)
link_directories(
${CMAKE_SOURCE_DIR}/3rd_party/lib/x86
${blackbone_lib32_path}
)
set(op_com op_x86)
MESSAGE(STATUS "----------------Platform x86----------------")
ENDIF(CMAKE_CL_64)
include_directories(
./
${CMAKE_SOURCE_DIR}/3rd_party/include/
${CMAKE_SOURCE_DIR}/3rd_party/include/3rd_party
${blackbone_include_path}
${blackbone_include_path}/3rd_party
)
# 包含子项目。
## libop主项目
add_subdirectory ("libop")
## python测试项目
add_subdirectory("python")
## lua测试项目
add_subdirectory("lua")
## tools项目
add_subdirectory("tools")
## 测试项目
add_subdirectory("tests")
message(STATUS ${build_swig_py})
## swig 项目
if(build_swig_py)
message(STATUS "build swig is on")
add_subdirectory("swig")
endif()
message(STATUS ${build_qttool})
## qttool项目
if(build_qttool)
message(STATUS "build qt tool is on")
add_subdirectory("qttool")
endif()