summarylogtreecommitdiffstats
path: root/Flags-for-precompiled-header-and-MOC.patch
blob: 558d0fbed0e8e7876cf15a58ba24e488e4ea3aa8 (plain)
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
Description: Specify preprocessor and compiler flags for precompiled header and Qt object files
Author: Nicholas Guriev <guriev-ns@ya.ru>
Last-Update: 2017-01-26

diff --git a/Telegram/gyp/qt.gypi b/Telegram/gyp/qt.gypi
index 24ededb..0cfd178 100644
--- a/Telegram/gyp/qt.gypi
+++ b/Telegram/gyp/qt.gypi
@@ -241,11 +231,12 @@
       '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/moc/moc_<(RULE_INPUT_ROOT).cpp',
     ],
     'action': [
-      '<(qt_loc)/bin/moc<(exe_ext)',
+      '/usr/bin/moc',
 
       # Silence "Note: No relevant classes found. No output generated."
       '--no-notes',
 
+      '<!@(echo $CPPFLAGS | grep -Po "[-]([IDU]\s*\S*|E)")',
       '<!@(python -c "for s in \'<@(_defines)\'.split(\' \'): print(\'-D\' + s)")',
       # '<!@(python -c "for s in \'<@(_include_dirs)\'.split(\' \'): print(\'-I\' + s)")',
       '<(RULE_INPUT_PATH)',
diff --git a/Telegram/gyp/PrecompiledHeader.cmake b/Telegram/gyp/PrecompiledHeader.cmake
index fc189e4..30becec 100644
--- a/Telegram/gyp/PrecompiledHeader.cmake
+++ b/Telegram/gyp/PrecompiledHeader.cmake
@@ -112,7 +112,7 @@ function(add_precompiled_header _target _input)
       set(_compiler_FLAGS "@${_pch_c_flags_file}")
       add_custom_command(
         OUTPUT "${_output_c}"
-        COMMAND "${CMAKE_C_COMPILER}" ${_compiler_FLAGS} -x c-header -o "${_output_c}" -c "${_pchfile}"
+        COMMAND "${CMAKE_C_COMPILER}" "$(C_DEFINES)" "$(C_INCLUDES)" "$(C_FLAGS)" -x c-header -o "${_output_c}" -c "${_pchfile}"
         DEPENDS "${_pchfile}" "${_pch_c_flags_file}"
         IMPLICIT_DEPENDS C "${_pch_header}"
         COMMENT "Precompiling ${_name} for ${_target} (C)")
@@ -123,7 +123,7 @@ function(add_precompiled_header _target _input)
       set(_compiler_FLAGS "@${_pch_cpp_flags_file}")
       add_custom_command(
         OUTPUT "${_output_cxx}"
-        COMMAND "${CMAKE_CXX_COMPILER}" ${_compiler_FLAGS} -x c++-header -o "${_output_cxx}" -c "${_pchfile}"
+        COMMAND "${CMAKE_CXX_COMPILER}" "$(CXX_DEFINES)" "$(CXX_INCLUDES)" "$(CXX_FLAGS)" -x c++-header -o "${_output_cxx}" -c "${_pchfile}"
         DEPENDS "${_pchfile}" "${_pch_cpp_flags_file}"
         IMPLICIT_DEPENDS CXX "${_pch_header}"
         COMMENT "Precompiling ${_name} for ${_target} (C++)")