forked from smasherprog/screen_capture_lite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
145 lines (136 loc) · 4.01 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
cmake_minimum_required(VERSION 3.8)
project(screen_capture_lite)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
option(BUILD_SHARED_LIBS "Build shared library" OFF)
option(BUILD_EXAMPLE "Build example" ON)
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic")
endif()
if(WIN32)
set(SCREEN_CAPTURE_PLATFORM_SRC
src/windows/GetWindows.cpp
src/windows/GetMonitors.cpp
src/windows/DXFrameProcessor.cpp
include/windows/DXFrameProcessor.h
src/windows/GDIFrameProcessor.cpp
include/windows/GDIFrameProcessor.h
src/windows/GDIMouseProcessor.cpp
include/windows/GDIMouseProcessor.h
src/windows/ThreadRunner.cpp
include/windows/GDIHelpers.h
)
set(SCREEN_CAPTURE_PLATFORM_INC
include/windows
)
add_definitions(-DNOMINMAX)
elseif(APPLE)
set(SCREEN_CAPTURE_PLATFORM_SRC
src/ios/GetWindows.cpp
src/ios/NSMouseCapture.m
include/ios/NSMouseCapture.h
src/ios/NSFrameProcessor.cpp
src/ios/NSFrameProcessor.mm
include/ios/NSFrameProcessorm.h
include/ios/NSFrameProcessor.h
src/ios/NSMouseProcessor.cpp
include/ios/NSMouseProcessor.h
src/ios/CGFrameProcessor.cpp
include/ios/CGFrameProcessor.h
src/ios/GetMonitors.cpp
src/ios/ThreadRunner.cpp
)
set(SCREEN_CAPTURE_PLATFORM_INC
include/ios
)
else()
set(SCREEN_CAPTURE_PLATFORM_SRC
include/linux/X11MouseProcessor.h
src/linux/X11MouseProcessor.cpp
include/linux/X11FrameProcessor.h
src/linux/X11FrameProcessor.cpp
src/linux/GetMonitors.cpp
src/linux/GetWindows.cpp
src/linux/ThreadRunner.cpp
)
find_package(X11 REQUIRED)
if(!X11_XTest_FOUND)
message(FATAL_ERROR "X11 extensions are required, but not found!")
endif()
if(!X11_Xfixes_LIB)
message(FATAL_ERROR "X11 fixes extension is required, but not found!")
endif()
set(SCREEN_CAPTURE_PLATFORM_INC
include/linux
${X11_INCLUDE_DIR}
)
endif()
include_directories(
include
${SCREEN_CAPTURE_PLATFORM_INC}
)
add_library(${PROJECT_NAME}
include/ScreenCapture.h
include/internal/SCCommon.h
include/internal/ThreadManager.h
src/ScreenCapture.cpp
src/SCCommon.cpp
src/ThreadManager.cpp
${SCREEN_CAPTURE_PLATFORM_SRC}
)
if(${BUILD_SHARED_LIBS})
set_target_properties(${PROJECT_NAME} PROPERTIES DEFINE_SYMBOL SC_LITE_DLL)
if(WIN32)
target_link_libraries(${PROJECT_NAME} ${COMMON_LIBRARIES} Dwmapi)
install (FILES $<TARGET_PDB_FILE:${PROJECT_NAME}> DESTINATION bin OPTIONAL)
elseif(APPLE)
find_package(Threads REQUIRED)
find_library(corefoundation_lib CoreFoundation REQUIRED)
find_library(cocoa_lib Cocoa REQUIRED)
find_library(coremedia_lib CoreMedia REQUIRED)
find_library(avfoundation_lib AVFoundation REQUIRED)
find_library(coregraphics_lib CoreGraphics REQUIRED)
find_library(corevideo_lib CoreVideo REQUIRED)
target_link_libraries(
${PROJECT_NAME}
${CMAKE_THREAD_LIBS_INIT}
${corefoundation_lib}
${cocoa_lib}
${coremedia_lib}
${avfoundation_lib}
${coregraphics_lib}
${corevideo_lib}
)
else()
find_package(X11 REQUIRED)
if(!X11_XTest_FOUND)
message(FATAL_ERROR "X11 extensions are required, but not found!")
endif()
if(!X11_Xfixes_LIB)
message(FATAL_ERROR "X11 fixes extension is required, but not found!")
endif()
find_package(Threads REQUIRED)
set(${PROJECT_NAME}_PLATFORM_LIBS
${X11_LIBRARIES}
${X11_Xfixes_LIB}
${X11_XTest_LIB}
${X11_Xinerama_LIB}
${CMAKE_THREAD_LIBS_INIT}
)
target_link_libraries(${PROJECT_NAME} ${COMMON_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} dl)
endif()
endif()
install (TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)
install (FILES
include/ScreenCapture.h
DESTINATION include
)
enable_testing()
add_subdirectory(Example)