Merge branch 'clang-msw' of https://github.com/MaartenBent/wxWidgets
Fixes for clang under MSW and support in CMake build system. See https://github.com/wxWidgets/wxWidgets/pull/887
This commit is contained in:
@@ -28,9 +28,9 @@ Files
|
||||
* Every function should contain a short description of it's parameters as
|
||||
a comment before the function/macro
|
||||
* install.cmake
|
||||
* Handles defintions for the `install` and `uninstall` target
|
||||
* Handles definitions for the `install` and `uninstall` target
|
||||
* init.cmake
|
||||
* Intializes various variables used during the build process and for
|
||||
* Initializes various variables used during the build process and for
|
||||
generation of setup.h and configuration files
|
||||
* main.cmake
|
||||
* Includes all other cmake files
|
||||
@@ -60,7 +60,7 @@ _.cmake_ files.
|
||||
* Defines build targets for demos via `wx_add_demo()`
|
||||
* lib
|
||||
* Defines build targets for all libraries and bundle third party libraries
|
||||
* Each library is contained in a seperate directory and uses
|
||||
* Each library is contained in a separate directory and uses
|
||||
`wx_add_library()` to define the library target
|
||||
* Bundled third party library without upstream CMake support are defined in
|
||||
a _.cmake_ file using `wx_add_builtin_library()` to define static library
|
||||
@@ -70,8 +70,8 @@ _.cmake_ files.
|
||||
* Includes the [cotire module][4] used to for precompiled header generation
|
||||
* samples
|
||||
* Defines build targets for all samples via `wx_add_sample()`
|
||||
* Defintions for trivial samples are included in _CMakeLists.txt_ more
|
||||
complex samples might have a seperate .cmake file
|
||||
* Definitions for trivial samples are included in _CMakeLists.txt_ more
|
||||
complex samples might have a separate .cmake file
|
||||
* tests
|
||||
* Defines build targets for all tests
|
||||
* utils
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#############################################################################
|
||||
|
||||
include(CMakeDependentOption)
|
||||
include(CMakeParseArguments) # For compatiblity with CMake < 3.4
|
||||
include(CMakeParseArguments) # For compatibility with CMake < 3.4
|
||||
include(ExternalProject)
|
||||
if(CMAKE_GENERATOR STREQUAL "Xcode")
|
||||
# wxWidgets does not use the unity features of cotire so we can
|
||||
@@ -314,25 +314,30 @@ macro(wx_add_library name)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Enable cotire for target if precompiled headers are enabled
|
||||
# Enable cotire for target, use optional second argument for prec. header
|
||||
macro(wx_target_enable_precomp target_name)
|
||||
if(wxBUILD_PRECOMP)
|
||||
if(APPLE AND ${target_name} STREQUAL "wxscintilla")
|
||||
# TODO: workaround/fix cotire issue with wxscintilla when using Xcode
|
||||
else()
|
||||
set_target_properties(${target_name} PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
|
||||
cotire(${target_name})
|
||||
endif()
|
||||
target_compile_definitions(${target_name} PRIVATE WX_PRECOMP)
|
||||
if(NOT ${ARGV1} STREQUAL "")
|
||||
set_target_properties(${target_name} PROPERTIES
|
||||
COTIRE_CXX_PREFIX_HEADER_INIT ${ARGV1})
|
||||
endif()
|
||||
set_target_properties(${target_name} PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
|
||||
cotire(${target_name})
|
||||
endmacro()
|
||||
|
||||
# Enable precompiled headers for tests
|
||||
macro(wx_test_enable_precomp target_name)
|
||||
if(wxBUILD_PRECOMP)
|
||||
target_compile_definitions(${target_name} PRIVATE WX_PRECOMP)
|
||||
set_target_properties(${target_name} PROPERTIES
|
||||
COTIRE_CXX_PREFIX_HEADER_INIT "${wxSOURCE_DIR}/tests/testprec.h")
|
||||
wx_target_enable_precomp(${target_name})
|
||||
wx_target_enable_precomp(${target_name} "${wxSOURCE_DIR}/tests/testprec.h")
|
||||
elseif(MSVC)
|
||||
target_compile_definitions(${target_name} PRIVATE NOPCH)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Enable precompiled headers for samples
|
||||
macro(wx_sample_enable_precomp target_name)
|
||||
if(wxBUILD_PRECOMP)
|
||||
wx_target_enable_precomp(${target_name} "${wxSOURCE_DIR}/include/wx/wxprec.h")
|
||||
elseif(MSVC)
|
||||
target_compile_definitions(${target_name} PRIVATE NOPCH)
|
||||
endif()
|
||||
@@ -343,10 +348,7 @@ macro(wx_finalize_lib target_name)
|
||||
set(wxLIB_TARGETS ${wxLIB_TARGETS} PARENT_SCOPE)
|
||||
if(wxBUILD_PRECOMP)
|
||||
if(TARGET ${target_name})
|
||||
target_compile_definitions(${target_name} PRIVATE WX_PRECOMP)
|
||||
set_target_properties(${target_name} PROPERTIES
|
||||
COTIRE_CXX_PREFIX_HEADER_INIT "${wxSOURCE_DIR}/include/wx/wxprec.h")
|
||||
wx_target_enable_precomp(${target_name})
|
||||
wx_target_enable_precomp(${target_name} "${wxSOURCE_DIR}/include/wx/wxprec.h")
|
||||
endif()
|
||||
elseif(MSVC)
|
||||
wx_lib_compile_definitions(${target_name} PRIVATE NOPCH)
|
||||
@@ -544,7 +546,7 @@ endfunction()
|
||||
# IMPORTANT does not require wxBUILD_SAMPLES=ALL
|
||||
# RES followed by WIN32 .rc files
|
||||
#
|
||||
# Additinally the following variables may be set before calling wx_add_sample:
|
||||
# Additionally the following variables may be set before calling wx_add_sample:
|
||||
# wxSAMPLE_SUBDIR subdirectory in the samples/ folder to use as base
|
||||
# wxSAMPLE_FOLDER IDE sub folder to be used for the samples
|
||||
function(wx_add_sample name)
|
||||
@@ -629,8 +631,6 @@ function(wx_add_sample name)
|
||||
if(SAMPLE_DEFINITIONS)
|
||||
target_compile_definitions(${target_name} PRIVATE ${SAMPLE_DEFINITIONS})
|
||||
endif()
|
||||
# Disable precompile headers for samples
|
||||
target_compile_definitions(${target_name} PRIVATE NOPCH)
|
||||
if(SAMPLE_DATA)
|
||||
# TODO: handle data files differently for OS X bundles
|
||||
# Copy data files to output directory
|
||||
@@ -667,6 +667,7 @@ function(wx_add_sample name)
|
||||
wx_string_append(folder "/${SAMPLE_FOLDER}")
|
||||
endif()
|
||||
wx_set_common_target_properties(${target_name})
|
||||
wx_sample_enable_precomp(${target_name})
|
||||
set_target_properties(${target_name} PROPERTIES
|
||||
FOLDER ${folder}
|
||||
)
|
||||
|
@@ -51,10 +51,12 @@ set(wxARCH_SUFFIX)
|
||||
|
||||
# TODO: include compiler version in wxCOMPILER_PREFIX ?
|
||||
if(WIN32)
|
||||
if(MSVC)
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||
set(wxCOMPILER_PREFIX "vc")
|
||||
elseif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
set(wxCOMPILER_PREFIX "gcc")
|
||||
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set(wxCOMPILER_PREFIX "clang")
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown WIN32 compiler type")
|
||||
endif()
|
||||
@@ -74,7 +76,7 @@ if(MSVC OR MINGW)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
# Include generator expression to supress default Debug/Release pair
|
||||
# Include generator expression to suppress default Debug/Release pair
|
||||
set(wxPLATFORM_LIB_DIR "$<1:/>${wxCOMPILER_PREFIX}${wxARCH_SUFFIX}_${lib_suffix}")
|
||||
else()
|
||||
set(wxPLATFORM_LIB_DIR "/${wxCOMPILER_PREFIX}${wxARCH_SUFFIX}_${lib_suffix}")
|
||||
|
@@ -164,7 +164,17 @@ target_compile_definitions(wxscintilla PUBLIC
|
||||
NO_CXX11_REGEX
|
||||
__WX__
|
||||
)
|
||||
wx_target_enable_precomp(wxscintilla)
|
||||
|
||||
if(wxBUILD_PRECOMP)
|
||||
# The auto-generated header causes undefined members and identifiers in the
|
||||
# standard c++ headers when using clang on macOS or Windows.
|
||||
# Do not disable precompiled headers entirely but use the main Scintilla
|
||||
# header as prefix header so there is at least a small speedup.
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND (APPLE OR WIN32))
|
||||
set(wxSCINTILLA_PREC_HEADER "${wxSOURCE_DIR}/src/stc/scintilla/include/Scintilla.h")
|
||||
endif()
|
||||
wx_target_enable_precomp(wxscintilla ${wxSCINTILLA_PREC_HEADER})
|
||||
endif()
|
||||
|
||||
wx_add_library(stc ${STC_FILES})
|
||||
wx_lib_include_directories(stc PRIVATE
|
||||
|
@@ -403,7 +403,6 @@ if(WIN32)
|
||||
set(wxUSE_WINRT_DEFAULT OFF)
|
||||
endif()
|
||||
wx_option(wxUSE_WINRT "enable WinRT support" ${wxUSE_WINRT_DEFAULT})
|
||||
|
||||
endif()
|
||||
|
||||
# this one is not really MSW-specific but it exists mainly to be turned off
|
||||
|
@@ -199,7 +199,7 @@ wx_list_add_prefix(WIDGETS_RC_FILES icons/
|
||||
slider.xpm spinbtn.xpm statbmp.xpm statbox.xpm
|
||||
stattext.xpm text.xpm timepick.xpm toggle.xpm
|
||||
)
|
||||
wx_add_sample(widgets IMPORTANT ${SAMPLE_WIDGETS_SRC}
|
||||
wx_add_sample(widgets IMPORTANT ${SAMPLE_WIDGETS_SRC}
|
||||
DATA ${WIDGETS_RC_FILES} textctrl.cpp
|
||||
LIBRARIES adv
|
||||
)
|
||||
@@ -258,7 +258,7 @@ if(WIN32)
|
||||
if(MSVC)
|
||||
wx_add_sample(flash)
|
||||
endif()
|
||||
#TODO: renable when sample is fixed
|
||||
#TODO: reenable when sample is fixed
|
||||
#wx_add_sample(mfc mfctest.cpp mfctest.h resource.h stdafx.h RES mfctest.rc)
|
||||
wx_add_sample(nativdlg nativdlg.cpp nativdlg.h resource.h RES nativdlg.rc)
|
||||
wx_add_sample(oleauto DEPENDS wxUSE_OLE)
|
||||
|
@@ -310,7 +310,7 @@ if(NOT WIN32)
|
||||
statfs(\"/\", &fs);"
|
||||
HAVE_STATFS_DECL)
|
||||
else()
|
||||
# TODO: implment statvfs checks
|
||||
# TODO: implement statvfs checks
|
||||
if(HAVE_STATVFS)
|
||||
set(WX_STATFS_T statvfs_t)
|
||||
endif()
|
||||
|
@@ -15,10 +15,10 @@
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/progdlg.h"
|
||||
#include "wx/stdpaths.h"
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
#include "wx/stdpaths.h"
|
||||
#include "wx/taskbarbutton.h"
|
||||
|
||||
enum
|
||||
|
@@ -73,12 +73,15 @@ struct IShellItem : public IUnknown
|
||||
|
||||
#endif // #ifndef __IShellItem_INTERFACE_DEFINED__
|
||||
|
||||
#if defined(__VISUALC__) || !defined(__IShellItem_INTERFACE_DEFINED__)
|
||||
// Define this GUID in any case, even when __IShellItem_INTERFACE_DEFINED__ is
|
||||
// defined in the headers we might still not have it in the actual uuid.lib,
|
||||
// this happens with at least VC7 used with its original (i.e. not updated) SDK
|
||||
// and there is no harm in defining the GUID unconditionally.
|
||||
// this happens with at least VC7 used with its original (i.e. not updated) SDK.
|
||||
// clang complains about multiple definitions, so only define it unconditionally
|
||||
// when using a Visual C compiler.
|
||||
DEFINE_GUID(IID_IShellItem,
|
||||
0x43826D1E, 0xE718, 0x42EE, 0xBC, 0x55, 0xA1, 0xE2, 0x61, 0xC3, 0x7B, 0xFE);
|
||||
#endif
|
||||
|
||||
struct IShellItemFilter;
|
||||
struct IFileDialogEvents;
|
||||
|
@@ -1530,7 +1530,9 @@ void wxAMMediaBackend::Move(int WXUNUSED(x), int WXUNUSED(y),
|
||||
//---------------------------------------------------------------------------
|
||||
void wxAMMediaEvtHandler::OnActiveX(wxActiveXEvent& event)
|
||||
{
|
||||
switch(event.GetDispatchId())
|
||||
// cast to unsigned long to fix narrowing error with case 0xfffffd9f
|
||||
// when using clang
|
||||
switch (static_cast<unsigned long>(event.GetDispatchId()))
|
||||
{
|
||||
case 0x00000001: // statechange in IActiveMovie
|
||||
case 0x00000bc4: // playstatechange in IMediaPlayer
|
||||
|
Reference in New Issue
Block a user