-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
91 lines (74 loc) · 2.44 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
cmake_minimum_required(VERSION 2.6.4)
project(oms CXX)
if (POLICY CMP0003)
cmake_policy(SET CMP0003 NEW)
endif ()
if (POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif ()
if (POLICY CMP0064)
cmake_policy(SET CMP0064 NEW)
endif ()
# Check support of C++11
include(CheckCXXCompilerFlag)
#if (CMAKE_VERSION VERSION_LESS 3.1)
# CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
# CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
# if (COMPILER_SUPPORTS_CXX11)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
# endif ()
#
# if (COMPILER_SUPPORTS_CXX0X)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
# endif ()
#else()
# set(CMAKE_CXX_STANDARD 11)
#endif ()
set(CMAKE_CXX_STANDARD 98)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wshadow")
set(CMAKE_VERBOSE_MAKEFILE ON)
math(EXPR BITS "8*${CMAKE_SIZEOF_VOID_P}")
if(BITS EQUAL 64)
set(LIB_NAME "lib64")
else()
set(LIB_NAME "lib")
endif()
#set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-rpath,'$ORIGIN/jdk8m/lib/amd64/server/'")
include_directories(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/sdk/include)
if(DEFINED ENV{JAVA_HOME})
find_package(JNI REQUIRED)
else()
if (UNIX AND NOT APPLE)
set(JNI_INCLUDE_DIRS
${CMAKE_SOURCE_DIR}/third_party/jdk8m/include
${CMAKE_SOURCE_DIR}/third_party/jdk8m/include/linux)
set(JAVA_JVM_LIBRARY
${CMAKE_SOURCE_DIR}/third_party/jdk8m/lib/amd64/server/libjvm.so)
option(USE_EMBEDDED_VM ON)
else()
find_package(JNI REQUIRED)
endif ()
endif()
include_directories(SYSTEM ${JNI_INCLUDE_DIRS})
add_subdirectory(sdk)
option(BUILD_EXAMPLE "Build examples flag" ON)
if (BUILD_EXAMPLE)
add_subdirectory(example)
endif ()
option(TEST "Build test cases" ON)
if(TEST)
enable_testing()
option(gtest_build_tests OFF)
add_subdirectory(third_party/googletest/googletest)
include_directories(SYSTEM ${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
add_subdirectory(tests)
endif()
option(BENCHMARK "Build benchmark test cases" OFF)
if (BENCHMARK)
add_subdirectory(third_party/benchmark)
include_directories(SYSTEM third_party/benchmark/include)
add_subdirectory(benchmark)
endif ()
install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION include)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/third_party/vendor DESTINATION ${LIB_NAME}/oms)