forked from cztomczak/cefpython
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
63 lines (57 loc) · 2.09 KB
/
Copy pathCMakeLists.txt
File metadata and controls
63 lines (57 loc) · 2.09 KB
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
file(GLOB _all_cpp "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
if(APPLE)
file(GLOB _mm_files "${CMAKE_CURRENT_SOURCE_DIR}/*.mm")
list(APPEND _all_cpp ${_mm_files})
endif()
set(_sources "")
foreach(_f IN LISTS _all_cpp)
get_filename_component(_name "${_f}" NAME)
set(_skip FALSE)
if(_name MATCHES "_win\\.cpp$" AND NOT WIN32)
set(_skip TRUE)
elseif(_name MATCHES "_linux\\.cpp$" AND NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(_skip TRUE)
elseif(_name MATCHES "_mac\\.(cpp|mm)$" AND NOT APPLE)
set(_skip TRUE)
elseif(_name MATCHES "^x11\\.cpp$" AND NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(_skip TRUE)
elseif(_name MATCHES "gtk" AND NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(_skip TRUE)
endif()
if(NOT _skip)
list(APPEND _sources "${_f}")
endif()
endforeach()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
endif()
add_library(client_handler STATIC ${_sources})
add_dependencies(client_handler cefpython_headers)
target_include_directories(client_handler PRIVATE
"${CEFPYTHON_SRC_DIR}"
"${CEFPYTHON_SRC_DIR}/common"
"${CEFPYTHON_PYX_STAGE_DIR}"
${Python_INCLUDE_DIRS}
)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_include_directories(client_handler PRIVATE ${GTK3_INCLUDE_DIRS})
endif()
if(WIN32)
target_compile_options(client_handler PRIVATE /EHsc /wd4190)
target_compile_definitions(client_handler PRIVATE
WIN32 _WIN32 _WINDOWS
NTDDI_VERSION=0x06010000 WINVER=0x0601 _WIN32_WINNT=0x0601
NDEBUG _NDEBUG _CRT_SECURE_NO_WARNINGS NOMINMAX
BROWSER_PROCESS
CEFPYTHON_API_H_FILE="cefpython_api_fixed.h"
)
elseif(APPLE)
target_compile_options(client_handler PRIVATE -DNDEBUG -O3)
target_compile_definitions(client_handler PRIVATE
CEFPYTHON_API_H_FILE="cefpython_api_fixed.h")
else()
target_compile_options(client_handler PRIVATE -DNDEBUG -O3 -Wno-stringop-overflow)
target_compile_definitions(client_handler PRIVATE
CEFPYTHON_API_H_FILE="cefpython_api_fixed.h")
endif()