Skip to content

Commit 342cd3a

Browse files
committed
Updated cmake helpers to latest patches-track-wip
2 parents d4a3a67 + c82faf7 commit 342cd3a

File tree

81 files changed

+1718
-2104
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+1718
-2104
lines changed

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "external/glib/cppgir"]
2+
path = external/glib/cppgir
3+
url = https://gitlab.com/mnauw/cppgir.git
4+
[submodule "external/Implib.so"]
5+
path = external/Implib.so
6+
url = https://github.com/yugr/Implib.so.git

CMakeLists.txt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,6 @@
55
# https://github.com/desktop-app/legal/blob/master/LEGAL
66

77
add_subdirectory(external)
8-
if (LINUX)
9-
add_subdirectory(linux_jemalloc_helper)
10-
endif()
11-
if (LINUX AND NOT DESKTOP_APP_USE_PACKAGED)
12-
add_subdirectory(linux_xcb_helper)
13-
endif()
14-
if (LINUX
15-
AND NOT DESKTOP_APP_USE_PACKAGED
16-
AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
17-
add_subdirectory(linux_wayland_helper)
18-
endif()
198
if (DESKTOP_APP_USE_ALLOCATION_TRACER)
209
add_subdirectory(linux_allocation_tracer)
2110
endif()

external/CMakeLists.txt

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,20 @@ endmacro()
1313

1414
add_checked_subdirectory(angle)
1515
add_checked_subdirectory(auto_updates)
16+
add_checked_subdirectory(boost)
17+
if (add_cld3_library)
18+
add_checked_subdirectory(cld3)
19+
endif()
1620
add_checked_subdirectory(crash_reports)
1721
if (LINUX)
1822
add_checked_subdirectory(dispatch)
1923
endif()
2024
add_checked_subdirectory(expected)
21-
if (LINUX AND NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION)
22-
add_checked_subdirectory(fcitx_qt5)
23-
if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION)
24-
add_checked_subdirectory(fcitx5_qt)
25-
endif()
25+
if (LINUX AND TARGET Qt::DBus AND NOT DESKTOP_APP_DISABLE_X11_INTEGRATION)
26+
add_checked_subdirectory(fcitx5_qt)
2627
endif()
2728
add_checked_subdirectory(ffmpeg)
28-
if (LINUX AND NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION)
29+
if (LINUX)
2930
add_checked_subdirectory(glib)
3031
add_checked_subdirectory(glibmm)
3132
endif()
@@ -37,13 +38,9 @@ if (add_hunspell_library)
3738
add_checked_subdirectory(hunspell)
3839
endif()
3940
add_checked_subdirectory(iconv)
40-
if (LINUX)
41-
add_checked_subdirectory(jemalloc)
42-
endif()
4341
add_checked_subdirectory(jpeg)
44-
if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
45-
add_checked_subdirectory(kwayland)
46-
endif()
42+
add_checked_subdirectory(kcoreaddons)
43+
add_checked_subdirectory(kimageformats)
4744
add_checked_subdirectory(lz4)
4845
add_checked_subdirectory(minizip)
4946
if (LINUX)
@@ -57,9 +54,15 @@ add_checked_subdirectory(qr_code_generator)
5754
add_checked_subdirectory(ranges)
5855
add_checked_subdirectory(rlottie)
5956
add_checked_subdirectory(rnnoise)
57+
if (LINUX AND NOT DESKTOP_APP_DISABLE_SCUDO)
58+
add_checked_subdirectory(scudo)
59+
endif()
6060
add_checked_subdirectory(ton)
6161
add_checked_subdirectory(variant)
6262
add_checked_subdirectory(vpx)
63+
if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
64+
add_checked_subdirectory(wayland_client)
65+
endif()
6366
add_checked_subdirectory(webrtc)
6467
if (LINUX AND NOT DESKTOP_APP_DISABLE_X11_INTEGRATION)
6568
add_checked_subdirectory(xcb)

external/Implib.so

Submodule Implib.so added at 0ddaa71

external/boost/CMakeLists.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This file is part of Desktop App Toolkit,
2+
# a set of libraries for developing nice desktop applications.
3+
#
4+
# For license and copyright information please follow this link:
5+
# https://github.com/desktop-app/legal/blob/master/LEGAL
6+
7+
add_library(external_boost_regex INTERFACE IMPORTED GLOBAL)
8+
add_library(desktop-app::external_boost_regex ALIAS external_boost_regex)
9+
10+
target_compile_definitions(external_boost_regex
11+
INTERFACE
12+
BOOST_NO_INTRINSIC_WCHAR_T
13+
BOOST_REGEX_NO_W32
14+
)
15+
16+
if (DESKTOP_APP_USE_PACKAGED OR LINUX)
17+
find_package(Boost COMPONENTS regex REQUIRED)
18+
target_link_libraries(external_boost_regex INTERFACE Boost::regex)
19+
return()
20+
endif()
21+
22+
target_include_directories(external_boost_regex SYSTEM
23+
INTERFACE
24+
${libs_loc}/regex/include
25+
)

external/cld3/CMakeLists.txt

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# This file is part of Desktop App Toolkit,
2+
# a set of libraries for developing nice desktop applications.
3+
#
4+
# For license and copyright information please follow this link:
5+
# https://github.com/desktop-app/legal/blob/master/LEGAL
6+
7+
add_library(external_cld3 INTERFACE IMPORTED GLOBAL)
8+
add_library(desktop-app::external_cld3 ALIAS external_cld3)
9+
10+
add_library(external_cld3_bundled STATIC)
11+
init_target(external_cld3_bundled "(external)")
12+
13+
set(cld3_loc ${third_party_loc}/cld3)
14+
set(cld3_src ${cld3_loc}/src)
15+
16+
set(gen_loc ${cld3_loc}/build/gen)
17+
set(gen_dst ${gen_loc}/cld_3/protos)
18+
19+
if (DESKTOP_APP_USE_PACKAGED)
20+
find_package(Protobuf)
21+
if (NOT Protobuf_FOUND)
22+
find_package(protobuf REQUIRED CONFIG)
23+
endif()
24+
set(protoc_executable protobuf::protoc)
25+
set(protobuf_lib protobuf::libprotobuf-lite)
26+
elseif (WIN32)
27+
set(build_loc ${libs_loc}/protobuf/build/$<IF:$<CONFIG:Debug>,Debug,Release>)
28+
set(protoc_executable ${build_loc}/protoc.exe)
29+
set(protobuf_lib ${build_loc}/libprotobuf-lite.lib)
30+
else()
31+
set(protoc_executable ${libs_loc}/protobuf/build/protoc)
32+
set(protobuf_lib ${libs_loc}/protobuf/build/libprotobuf-lite.a)
33+
if (LINUX)
34+
target_compile_options(external_cld3_bundled PRIVATE -Wno-implicit-fallthrough)
35+
endif()
36+
endif()
37+
if (PROTOBUF_PROTOC_EXECUTABLE)
38+
set(protoc_executable ${PROTOBUF_PROTOC_EXECUTABLE})
39+
endif()
40+
41+
include(generate_protobuf.cmake)
42+
43+
function(generate protobuf_name)
44+
generate_single_protobuf(
45+
external_cld3_bundled
46+
${gen_dst}
47+
${protobuf_name}
48+
${protoc_executable})
49+
endfunction()
50+
51+
generate(feature_extractor.proto)
52+
generate(sentence.proto)
53+
generate(task_spec.proto)
54+
55+
nice_target_sources(external_cld3_bundled ${cld3_src}
56+
PRIVATE
57+
feature_extractor.proto
58+
sentence.proto
59+
task_spec.proto
60+
61+
base.cc
62+
embedding_feature_extractor.cc
63+
embedding_network.cc
64+
feature_extractor.cc
65+
feature_extractor.h
66+
feature_types.cc
67+
fml_parser.cc
68+
language_identifier_features.cc
69+
lang_id_nn_params.cc
70+
nnet_language_identifier.cc
71+
registry.cc
72+
relevant_script_feature.cc
73+
sentence_features.cc
74+
task_context.cc
75+
task_context_params.cc
76+
unicodetext.cc
77+
utils.cc
78+
workspace.cc
79+
80+
script_span/generated_entities.cc
81+
script_span/getonescriptspan.cc
82+
script_span/getonescriptspan.h
83+
script_span/utf8statetable.cc
84+
script_span/offsetmap.cc
85+
script_span/text_processing.cc
86+
script_span/text_processing.h
87+
script_span/fixunicodevalue.cc
88+
)
89+
90+
target_include_directories(external_cld3_bundled
91+
PUBLIC
92+
${cld3_src}
93+
${gen_loc}
94+
)
95+
96+
if (NOT DESKTOP_APP_USE_PACKAGED)
97+
target_include_directories(external_cld3_bundled
98+
PUBLIC
99+
${libs_loc}/protobuf/src
100+
${libs_loc}/protobuf/third_party/abseil-cpp
101+
)
102+
endif()
103+
104+
target_link_libraries(external_cld3_bundled
105+
PRIVATE
106+
${protobuf_lib}
107+
)
108+
109+
target_link_libraries(external_cld3
110+
INTERFACE
111+
external_cld3_bundled
112+
)
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
function(generate_single_protobuf target_name gen_dst protobuf_name executable)
2+
file(MAKE_DIRECTORY ${gen_dst})
3+
4+
# Copied from myprotobuf.cmake.
5+
if (PROTOBUF_GENERATE_CPP_APPEND_PATH)
6+
# Create an include path for each file specified
7+
set(FIL ${cld3_src}/${protobuf_name})
8+
get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
9+
get_filename_component(ABS_PATH ${ABS_FIL} PATH)
10+
list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
11+
if (${_contains_already} EQUAL -1)
12+
list(APPEND _protobuf_include_path -I ${ABS_PATH})
13+
endif()
14+
else()
15+
set(_protobuf_include_path -I ${cld3_src})
16+
endif()
17+
18+
if (DEFINED PROTOBUF_IMPORT_DIRS)
19+
foreach (DIR ${PROTOBUF_IMPORT_DIRS})
20+
get_filename_component(ABS_PATH ${DIR} ABSOLUTE)
21+
list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
22+
if (${_contains_already} EQUAL -1)
23+
list(APPEND _protobuf_include_path -I ${ABS_PATH})
24+
endif()
25+
endforeach()
26+
endif()
27+
#
28+
29+
get_filename_component(protobuf_name_we ${protobuf_name} NAME_WE)
30+
31+
set(gen_timestamp ${gen_dst}/${protobuf_name}.timestamp)
32+
set(gen_files
33+
${gen_dst}/${protobuf_name_we}.pb.cc
34+
${gen_dst}/${protobuf_name_we}.pb.h
35+
)
36+
37+
set(gen_src ${cld3_src}/${protobuf_name})
38+
add_custom_command(
39+
OUTPUT
40+
${gen_timestamp}
41+
BYPRODUCTS
42+
${gen_files}
43+
COMMAND
44+
${executable}
45+
--cpp_out
46+
${gen_dst}
47+
${_protobuf_include_path}
48+
${gen_src}
49+
COMMAND
50+
echo 1> ${gen_timestamp}
51+
COMMENT "Generating protobuf ${protobuf_name} (${target_name})"
52+
DEPENDS
53+
${executable}
54+
${gen_src}
55+
VERBATIM
56+
)
57+
generate_target(${target_name} ${protobuf_name} ${gen_timestamp} "${gen_files}" ${gen_dst})
58+
endfunction()

external/crash_reports/breakpad/CMakeLists.txt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,19 @@
77
add_library(external_breakpad INTERFACE IMPORTED GLOBAL)
88
add_library(desktop-app::external_breakpad ALIAS external_breakpad)
99

10-
target_include_directories(external_breakpad SYSTEM
11-
INTERFACE
12-
${libs_loc}/breakpad/src
13-
)
10+
if (LINUX)
11+
find_package(PkgConfig REQUIRED)
12+
pkg_check_modules(BREAKPAD REQUIRED breakpad)
13+
target_include_directories(external_breakpad SYSTEM
14+
INTERFACE
15+
${BREAKPAD_INCLUDE_DIRS}
16+
)
17+
else()
18+
target_include_directories(external_breakpad SYSTEM
19+
INTERFACE
20+
${libs_loc}/breakpad/src
21+
)
22+
endif()
1423

1524
if (build_win64)
1625
set(breakpad_config_add _x64)

external/dispatch/CMakeLists.txt

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,37 @@ set(dispatch_prefix ${CMAKE_CURRENT_BINARY_DIR}/dispatch-prefix)
99
set(dispatch_binary_dir ${dispatch_prefix}/src/dispatch-build)
1010

1111
if (DESKTOP_APP_USE_PACKAGED)
12-
find_library(DISPATCH_LIBRARIES dispatch)
13-
find_path(DISPATCH_INCLUDE_DIRS dispatch/dispatch.h)
12+
find_library(DESKTOP_APP_DISPATCH_LIBRARIES dispatch)
13+
find_path(DESKTOP_APP_DISPATCH_INCLUDE_DIRS dispatch/dispatch.h)
1414
endif()
1515

16-
if (NOT DISPATCH_LIBRARIES OR NOT DISPATCH_INCLUDE_DIRS)
16+
if (NOT DESKTOP_APP_DISPATCH_LIBRARIES OR NOT DESKTOP_APP_DISPATCH_INCLUDE_DIRS)
17+
if (NOT DESKTOP_APP_USE_PACKAGED OR DESKTOP_APP_SPECIAL_TARGET)
18+
set(dispatch_extra_args
19+
-DCMAKE_BUILD_TYPE=Release
20+
"-DCMAKE_C_FLAGS=-g -pipe -fPIC -fno-omit-frame-pointer -fstack-protector-all -fstack-clash-protection -fcf-protection -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS"
21+
"-DCMAKE_CXX_FLAGS=-g -pipe -fPIC -fno-omit-frame-pointer -fstack-protector-all -fstack-clash-protection -fcf-protection -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS"
22+
)
23+
elseif (DEFINED CMAKE_BUILD_TYPE)
24+
set(dispatch_extra_args
25+
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
26+
)
27+
else()
28+
set(dispatch_extra_args)
29+
endif()
1730
execute_process(
1831
COMMAND ${CMAKE_COMMAND} ${dispatch_loc}
1932
-B ${dispatch_binary_dir}
2033
-GNinja
21-
-DCMAKE_BUILD_TYPE=Release
2234
-DCMAKE_C_COMPILER=clang
2335
-DCMAKE_CXX_COMPILER=clang++
2436
-DBUILD_SHARED_LIBS=OFF
2537
-DBUILD_TESTING=OFF
38+
${dispatch_extra_args}
2639
)
2740

2841
execute_process(
29-
COMMAND ${CMAKE_COMMAND} --build ${dispatch_binary_dir}
42+
COMMAND ${CMAKE_COMMAND} --build ${dispatch_binary_dir} --parallel
3043
)
3144

3245
if (NOT EXISTS ${dispatch_binary_dir}/src/libdispatch.a)
@@ -41,9 +54,9 @@ endif()
4154
add_library(external_dispatch INTERFACE IMPORTED GLOBAL)
4255
add_library(desktop-app::external_dispatch ALIAS external_dispatch)
4356

44-
if (DESKTOP_APP_USE_PACKAGED AND DISPATCH_LIBRARIES AND DISPATCH_INCLUDE_DIRS)
45-
target_include_directories(external_dispatch SYSTEM INTERFACE ${DISPATCH_INCLUDE_DIRS})
46-
target_link_libraries(external_dispatch INTERFACE ${DISPATCH_LIBRARIES})
57+
if (DESKTOP_APP_USE_PACKAGED AND DESKTOP_APP_DISPATCH_LIBRARIES AND DESKTOP_APP_DISPATCH_INCLUDE_DIRS)
58+
target_include_directories(external_dispatch SYSTEM INTERFACE ${DESKTOP_APP_DISPATCH_INCLUDE_DIRS})
59+
target_link_libraries(external_dispatch INTERFACE ${DESKTOP_APP_DISPATCH_LIBRARIES})
4760
return()
4861
endif()
4962

0 commit comments

Comments
 (0)