-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
85 lines (72 loc) · 2.7 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
cmake_minimum_required(VERSION 3.0)
if (OpenMP_C_FLAGS)
string(REPLACE ${OpenMP_C_FLAGS} "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
endif (OpenMP_C_FLAGS)
if (OpenMP_CXX_FLAGS)
string(REPLACE ${OpenMP_CXX_FLAGS} "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
endif (OpenMP_CXX_FLAGS)
project(RemoteCaptury)
set (CMAKE_CXX_STANDARD 11)
message(STATUS "working on remotecaptury library")
include_directories(../include)
add_library(RemoteCaptury SHARED RemoteCaptury.cpp)
add_library(RemoteCapturyStatic STATIC RemoteCaptury.cpp)
set(Python3_USE_STATIC_LIBS OFF)
find_package (Python3 COMPONENTS Development)
if (NOT TARGET Python3::Python)
find_package(PythonLibs)
if (PYTHONLIBS_FOUND)
add_library(Python3::Python UNKNOWN IMPORTED)
set_target_properties(Python3::Python PROPERTIES
IMPORTED_LOCATION ${PYTHON_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${PYTHON_INCLUDE_DIR})
set(Python3_FOUND ON)
endif (PYTHONLIBS_FOUND)
endif (NOT TARGET Python3::Python)
if (TARGET Python3::Python)
add_library(RemoteCapturyPython SHARED RemoteCapturyPython.cpp RemoteCaptury.cpp)
target_link_libraries(RemoteCapturyPython Python3::Python)
set_target_properties(RemoteCapturyPython
PROPERTIES
PREFIX ""
OUTPUT_NAME "remotecaptury"
LINKER_LANGUAGE C
)
if (WIN32)
set_target_properties(RemoteCapturyPython
PROPERTIES
SUFFIX ".pyd"
FOLDER "plugins"
)
elseif (APPLE)
set_target_properties(RemoteCapturyPython
PROPERTIES
SUFFIX ".so"
)
endif ()
endif (TARGET Python3::Python)
if (ANDROID_NDK_FOUND)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Android.mk jni/Android.mk)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Application.mk jni/Application.mk)
add_custom_target(RemoteCapturyAndroid
COMMAND ${CMAKE_COMMAND} -E env NDK_LIBS_OUT=${CMAKE_CURRENT_BINARY_DIR} ${ANDROID_NDK_BUILD}
DEPENDS RemoteCaptury.cpp RemoteCaptury.h
)
endif(ANDROID_NDK_FOUND)
#
# add examples
#
find_package(Threads REQUIRED)
add_executable(PollingExample examples/polling.cpp)
target_include_directories(PollingExample PRIVATE ".")
target_link_libraries(PollingExample RemoteCapturyStatic Threads::Threads)
add_executable(CallbackExample examples/callback.cpp)
target_include_directories(CallbackExample PRIVATE ".")
target_link_libraries(CallbackExample RemoteCapturyStatic Threads::Threads)
add_executable(CurvesExample examples/curves.cpp)
target_include_directories(CurvesExample PRIVATE ".")
target_link_libraries(CurvesExample RemoteCapturyStatic Threads::Threads)
add_executable(SearchExample examples/search.cpp)
target_include_directories(SearchExample PRIVATE ".")
target_link_libraries(SearchExample RemoteCapturyStatic Threads::Threads)
add_custom_target(Examples DEPENDS PollingExample CallbackExample CurvesExample SearchExample)