Clang build fixes
This commit is contained in:
parent
5217f71542
commit
1c8cfe49c5
5 changed files with 70 additions and 21 deletions
14
external/hime_qt/hime_im_client/CMakeLists.txt
vendored
14
external/hime_qt/hime_im_client/CMakeLists.txt
vendored
|
|
@ -55,6 +55,20 @@ else()
|
||||||
GTK_DISABLE_DEPRECATED
|
GTK_DISABLE_DEPRECATED
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
|
add_library(external_hime_im_client_options INTERFACE)
|
||||||
|
|
||||||
|
target_compile_options(external_hime_im_client_options
|
||||||
|
INTERFACE
|
||||||
|
-Wno-sometimes-uninitialized
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(external_hime_im_client
|
||||||
|
PRIVATE
|
||||||
|
external_hime_im_client_options
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_link_libraries(external_hime_im_client
|
target_link_libraries(external_hime_im_client
|
||||||
PRIVATE
|
PRIVATE
|
||||||
desktop-app::external_glib
|
desktop-app::external_glib
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
# https://github.com/desktop-app/legal/blob/master/LEGAL
|
# https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||||
|
|
||||||
set(MAXIMUM_CXX_STANDARD cxx_std_20)
|
set(MAXIMUM_CXX_STANDARD cxx_std_20)
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
set(MAXIMUM_CXX_STANDARD cxx_std_17)
|
set(MAXIMUM_CXX_STANDARD cxx_std_17)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,10 @@ void (*gtk_color_chooser_set_use_alpha)(
|
||||||
gboolean use_alpha);
|
gboolean use_alpha);
|
||||||
GType (*gtk_container_get_type)(void);
|
GType (*gtk_container_get_type)(void);
|
||||||
void (*gtk_container_remove)(GtkContainer *container, GtkWidget *widget);
|
void (*gtk_container_remove)(GtkContainer *container, GtkWidget *widget);
|
||||||
|
GtkWidget *(*gtk_dialog_add_button)(
|
||||||
|
GtkDialog *dialog,
|
||||||
|
const gchar *button_text,
|
||||||
|
gint response_id);
|
||||||
GType (*gtk_dialog_get_type)(void);
|
GType (*gtk_dialog_get_type)(void);
|
||||||
GtkWidget* (*gtk_dialog_get_widget_for_response)(
|
GtkWidget* (*gtk_dialog_get_widget_for_response)(
|
||||||
GtkDialog *dialog,
|
GtkDialog *dialog,
|
||||||
|
|
@ -71,12 +75,7 @@ gint (*gtk_dialog_run)(GtkDialog *dialog);
|
||||||
void (*gtk_file_chooser_add_filter)(
|
void (*gtk_file_chooser_add_filter)(
|
||||||
GtkFileChooser *chooser,
|
GtkFileChooser *chooser,
|
||||||
GtkFileFilter *filter);
|
GtkFileFilter *filter);
|
||||||
GtkWidget *(*gtk_file_chooser_dialog_new)(
|
GType (*gtk_file_chooser_dialog_get_type)(void);
|
||||||
const gchar *title,
|
|
||||||
GtkWindow *parent,
|
|
||||||
GtkFileChooserAction action,
|
|
||||||
const gchar *first_button_text,
|
|
||||||
...);
|
|
||||||
gchar *(*gtk_file_chooser_get_current_folder)(GtkFileChooser *chooser);
|
gchar *(*gtk_file_chooser_get_current_folder)(GtkFileChooser *chooser);
|
||||||
gchar *(*gtk_file_chooser_get_filename)(GtkFileChooser *chooser);
|
gchar *(*gtk_file_chooser_get_filename)(GtkFileChooser *chooser);
|
||||||
GSList *(*gtk_file_chooser_get_filenames)(GtkFileChooser *chooser);
|
GSList *(*gtk_file_chooser_get_filenames)(GtkFileChooser *chooser);
|
||||||
|
|
@ -179,6 +178,7 @@ void (*gtk_widget_set_visible)(GtkWidget *widget, gboolean visible);
|
||||||
void (*gtk_widget_show)(GtkWidget *widget);
|
void (*gtk_widget_show)(GtkWidget *widget);
|
||||||
GType (*gtk_window_get_type)(void);
|
GType (*gtk_window_get_type)(void);
|
||||||
void (*gtk_window_set_title)(GtkWindow *window, const gchar *title);
|
void (*gtk_window_set_title)(GtkWindow *window, const gchar *title);
|
||||||
|
void (*gtk_window_set_transient_for)(GtkWindow *window, GtkWindow *parent);
|
||||||
void (*pango_font_description_free)(PangoFontDescription *desc);
|
void (*pango_font_description_free)(PangoFontDescription *desc);
|
||||||
PangoFontDescription *(*pango_font_description_from_string)(const char *str);
|
PangoFontDescription *(*pango_font_description_from_string)(const char *str);
|
||||||
const char *(*pango_font_description_get_family)(
|
const char *(*pango_font_description_get_family)(
|
||||||
|
|
@ -264,11 +264,12 @@ bool Resolve() {
|
||||||
&& LOAD_SYMBOL(lib, gtk_color_chooser_set_use_alpha)
|
&& LOAD_SYMBOL(lib, gtk_color_chooser_set_use_alpha)
|
||||||
&& LOAD_SYMBOL(lib, gtk_container_get_type)
|
&& LOAD_SYMBOL(lib, gtk_container_get_type)
|
||||||
&& LOAD_SYMBOL(lib, gtk_container_remove)
|
&& LOAD_SYMBOL(lib, gtk_container_remove)
|
||||||
|
&& LOAD_SYMBOL(lib, gtk_dialog_add_button)
|
||||||
&& LOAD_SYMBOL(lib, gtk_dialog_get_type)
|
&& LOAD_SYMBOL(lib, gtk_dialog_get_type)
|
||||||
&& LOAD_SYMBOL(lib, gtk_dialog_get_widget_for_response)
|
&& LOAD_SYMBOL(lib, gtk_dialog_get_widget_for_response)
|
||||||
&& LOAD_SYMBOL(lib, gtk_dialog_run)
|
&& LOAD_SYMBOL(lib, gtk_dialog_run)
|
||||||
&& LOAD_SYMBOL(lib, gtk_file_chooser_add_filter)
|
&& LOAD_SYMBOL(lib, gtk_file_chooser_add_filter)
|
||||||
&& LOAD_SYMBOL(lib, gtk_file_chooser_dialog_new)
|
&& LOAD_SYMBOL(lib, gtk_file_chooser_dialog_get_type)
|
||||||
&& LOAD_SYMBOL(lib, gtk_file_chooser_get_current_folder)
|
&& LOAD_SYMBOL(lib, gtk_file_chooser_get_current_folder)
|
||||||
&& LOAD_SYMBOL(lib, gtk_file_chooser_get_filename)
|
&& LOAD_SYMBOL(lib, gtk_file_chooser_get_filename)
|
||||||
&& LOAD_SYMBOL(lib, gtk_file_chooser_get_filenames)
|
&& LOAD_SYMBOL(lib, gtk_file_chooser_get_filenames)
|
||||||
|
|
@ -325,6 +326,7 @@ bool Resolve() {
|
||||||
&& LOAD_SYMBOL(lib, gtk_widget_show)
|
&& LOAD_SYMBOL(lib, gtk_widget_show)
|
||||||
&& LOAD_SYMBOL(lib, gtk_window_get_type)
|
&& LOAD_SYMBOL(lib, gtk_window_get_type)
|
||||||
&& LOAD_SYMBOL(lib, gtk_window_set_title)
|
&& LOAD_SYMBOL(lib, gtk_window_set_title)
|
||||||
|
&& LOAD_SYMBOL(lib, gtk_window_set_transient_for)
|
||||||
&& LOAD_SYMBOL(lib, pango_font_description_free)
|
&& LOAD_SYMBOL(lib, pango_font_description_free)
|
||||||
&& LOAD_SYMBOL(lib, pango_font_description_from_string)
|
&& LOAD_SYMBOL(lib, pango_font_description_from_string)
|
||||||
&& LOAD_SYMBOL(lib, pango_font_description_get_family)
|
&& LOAD_SYMBOL(lib, pango_font_description_get_family)
|
||||||
|
|
@ -546,12 +548,35 @@ GtkWidget *gtk_file_chooser_dialog_new(
|
||||||
const gchar *first_button_text,
|
const gchar *first_button_text,
|
||||||
...) {
|
...) {
|
||||||
GtkHelper::Resolve();
|
GtkHelper::Resolve();
|
||||||
__builtin_return(
|
|
||||||
__builtin_apply(
|
va_list varargs;
|
||||||
reinterpret_cast<void (*)(...)>(
|
va_start(varargs, first_button_text);
|
||||||
GtkHelper::gtk_file_chooser_dialog_new),
|
|
||||||
__builtin_apply_args(),
|
const auto result = static_cast<GtkWidget*>(g_object_new(
|
||||||
1000));
|
GtkHelper::gtk_file_chooser_dialog_get_type(),
|
||||||
|
"title",
|
||||||
|
title,
|
||||||
|
"action",
|
||||||
|
action,
|
||||||
|
nullptr));
|
||||||
|
|
||||||
|
if (parent) {
|
||||||
|
GtkHelper::gtk_window_set_transient_for(GTK_WINDOW(result), parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto button_text = first_button_text;
|
||||||
|
gint response_id;
|
||||||
|
while (button_text) {
|
||||||
|
response_id = va_arg(varargs, gint);
|
||||||
|
GtkHelper::gtk_dialog_add_button(
|
||||||
|
GTK_DIALOG(result),
|
||||||
|
button_text,
|
||||||
|
response_id);
|
||||||
|
button_text = va_arg(varargs, const gchar *);
|
||||||
|
}
|
||||||
|
|
||||||
|
va_end(varargs);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
gchar *gtk_file_chooser_get_current_folder(GtkFileChooser *chooser) {
|
gchar *gtk_file_chooser_get_current_folder(GtkFileChooser *chooser) {
|
||||||
|
|
|
||||||
|
|
@ -16,17 +16,23 @@ INTERFACE
|
||||||
-Wno-unused-function
|
-Wno-unused-function
|
||||||
-Wno-switch
|
-Wno-switch
|
||||||
-Wno-comment
|
-Wno-comment
|
||||||
-Wno-unused-but-set-variable
|
|
||||||
-Wno-missing-field-initializers
|
-Wno-missing-field-initializers
|
||||||
-Wno-sign-compare
|
-Wno-sign-compare
|
||||||
-Wno-attributes
|
-Wno-attributes
|
||||||
-Wno-parentheses
|
-Wno-parentheses
|
||||||
-Wno-stringop-overflow
|
|
||||||
-Wno-maybe-uninitialized
|
|
||||||
-Wno-error=class-memaccess
|
|
||||||
$<$<NOT:$<COMPILE_LANGUAGE:C>>:-Wno-register>
|
$<$<NOT:$<COMPILE_LANGUAGE:C>>:-Wno-register>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
|
target_compile_options(common_options
|
||||||
|
INTERFACE
|
||||||
|
-Wno-unused-but-set-variable
|
||||||
|
-Wno-stringop-overflow
|
||||||
|
-Wno-maybe-uninitialized
|
||||||
|
-Wno-error=class-memaccess
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (DESKTOP_APP_SPECIAL_TARGET)
|
if (DESKTOP_APP_SPECIAL_TARGET)
|
||||||
target_compile_options(common_options
|
target_compile_options(common_options
|
||||||
INTERFACE
|
INTERFACE
|
||||||
|
|
@ -43,8 +49,12 @@ if (DESKTOP_APP_SPECIAL_TARGET)
|
||||||
target_compile_options(common_options INTERFACE -g0)
|
target_compile_options(common_options INTERFACE -g0)
|
||||||
target_link_options(common_options INTERFACE -g0)
|
target_link_options(common_options INTERFACE -g0)
|
||||||
else()
|
else()
|
||||||
target_compile_options(common_options INTERFACE $<IF:$<CONFIG:Debug>,,-g -flto>)
|
target_compile_options(common_options INTERFACE $<IF:$<CONFIG:Debug>,,-g>)
|
||||||
target_link_options(common_options INTERFACE $<IF:$<CONFIG:Debug>,,-g -flto -fuse-linker-plugin>)
|
target_link_options(common_options INTERFACE $<IF:$<CONFIG:Debug>,,-g>)
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
|
target_compile_options(common_options INTERFACE $<IF:$<CONFIG:Debug>,,-flto>)
|
||||||
|
target_link_options(common_options INTERFACE $<IF:$<CONFIG:Debug>,,-flto -fuse-linker-plugin>)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ else()
|
||||||
report_bad_special_target()
|
report_bad_special_target()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if (DESKTOP_APP_SPECIAL_TARGET)
|
if (DESKTOP_APP_SPECIAL_TARGET AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
set(CMAKE_AR "gcc-ar")
|
set(CMAKE_AR "gcc-ar")
|
||||||
set(CMAKE_RANLIB "gcc-ranlib")
|
set(CMAKE_RANLIB "gcc-ranlib")
|
||||||
set(CMAKE_NM "gcc-nm")
|
set(CMAKE_NM "gcc-nm")
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue