Merge pull request #812 from jbfove/master
Build fixes for CMake monolithic build. Also fix building with wxUSE_{DISPLAY,PALETTE}==0.
This commit is contained in:
@@ -35,7 +35,7 @@ function(wx_add_demo name)
|
||||
if(wxBUILD_SHARED)
|
||||
target_compile_definitions(${DEMO_NAME} PRIVATE WXUSINGDLL)
|
||||
endif()
|
||||
target_link_libraries(${DEMO_NAME} core ${DEMO_LIBRARIES})
|
||||
wx_exe_link_libraries(${DEMO_NAME} core ${DEMO_LIBRARIES})
|
||||
wx_set_common_target_properties(${DEMO_NAME})
|
||||
set_target_properties(${DEMO_NAME} PROPERTIES FOLDER "Demos")
|
||||
set_target_properties(${DEMO_NAME} PROPERTIES
|
||||
|
@@ -20,19 +20,24 @@ include(CMakePrintHelpers)
|
||||
|
||||
# This function adds a list of headers to a variable while prepending
|
||||
# include/ to the path
|
||||
function(wx_add_headers src_var)
|
||||
macro(wx_add_headers src_var)
|
||||
set(headers)
|
||||
list(REMOVE_AT ARGV 0)
|
||||
foreach(header ${ARGV})
|
||||
foreach(header ${ARGN})
|
||||
list(APPEND headers ${wxSOURCE_DIR}/include/${header})
|
||||
if(header MATCHES "\\.cpp$")
|
||||
# .cpp files in include directory should not be compiled
|
||||
set_source_files_properties(${wxSOURCE_DIR}/include/${header}
|
||||
PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
if (wxBUILD_MONOLITHIC)
|
||||
# set_source_files_properties only works within the same CMakeLists.txt
|
||||
list(APPEND wxMONO_NONCOMPILED_CPP_FILES ${wxSOURCE_DIR}/include/${header})
|
||||
set(wxMONO_NONCOMPILED_CPP_FILES ${wxMONO_NONCOMPILED_CPP_FILES} PARENT_SCOPE)
|
||||
else()
|
||||
set_source_files_properties(${wxSOURCE_DIR}/include/${header}
|
||||
PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
set(${src_var} ${${src_var}} ${headers} PARENT_SCOPE)
|
||||
endfunction()
|
||||
list(APPEND ${src_var} ${headers})
|
||||
endmacro()
|
||||
|
||||
# Add sources from a ..._SRC variable and headers from a ..._HDR
|
||||
macro(wx_append_sources src_var source_base_name)
|
||||
@@ -269,45 +274,45 @@ endfunction()
|
||||
# first parameter is the name of the library
|
||||
# if the second parameter is set to IS_BASE a non UI lib is created
|
||||
# all additional parameters are source files for the library
|
||||
function(wx_add_library name)
|
||||
macro(wx_add_library name)
|
||||
cmake_parse_arguments(wxADD_LIBRARY "IS_BASE" "" "" ${ARGN})
|
||||
set(src_files ${wxADD_LIBRARY_UNPARSED_ARGUMENTS})
|
||||
|
||||
if(wxBUILD_MONOLITHIC AND NOT name STREQUAL "mono")
|
||||
if(wxBUILD_MONOLITHIC AND NOT ${name} STREQUAL "mono")
|
||||
# collect all source files for mono library
|
||||
set(wxMONO_SRC_FILES ${wxMONO_SRC_FILES} ${src_files} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(wxBUILD_PRECOMP AND MSVC)
|
||||
# Add dummy source file to be used by cotire for PCH creation
|
||||
list(INSERT src_files 0 "${wxSOURCE_DIR}/src/common/dummy.cpp")
|
||||
endif()
|
||||
list(APPEND src_files ${wxSETUP_HEADER_FILE})
|
||||
|
||||
if(wxBUILD_SHARED)
|
||||
set(wxBUILD_LIB_TYPE SHARED)
|
||||
if(WIN32)
|
||||
# Add WIN32 version information
|
||||
list(APPEND src_files "${wxSOURCE_DIR}/src/msw/version.rc" "${wxSOURCE_DIR}/include/wx/msw/genrcdefs.h")
|
||||
endif()
|
||||
else()
|
||||
set(wxBUILD_LIB_TYPE STATIC)
|
||||
|
||||
if(wxBUILD_PRECOMP AND MSVC)
|
||||
# Add dummy source file to be used by cotire for PCH creation
|
||||
list(INSERT src_files 0 "${wxSOURCE_DIR}/src/common/dummy.cpp")
|
||||
endif()
|
||||
list(APPEND src_files ${wxSETUP_HEADER_FILE})
|
||||
|
||||
if(wxBUILD_SHARED)
|
||||
set(wxBUILD_LIB_TYPE SHARED)
|
||||
if(WIN32)
|
||||
# Add WIN32 version information
|
||||
list(APPEND src_files "${wxSOURCE_DIR}/src/msw/version.rc" "${wxSOURCE_DIR}/include/wx/msw/genrcdefs.h")
|
||||
endif()
|
||||
else()
|
||||
set(wxBUILD_LIB_TYPE STATIC)
|
||||
endif()
|
||||
|
||||
add_library(${name} ${wxBUILD_LIB_TYPE} ${src_files})
|
||||
wx_set_target_properties(${name} ${wxADD_LIBRARY_IS_BASE})
|
||||
|
||||
# Setup install
|
||||
wx_install(TARGETS ${name}
|
||||
LIBRARY DESTINATION "lib${wxPLATFORM_LIB_DIR}"
|
||||
ARCHIVE DESTINATION "lib${wxPLATFORM_LIB_DIR}"
|
||||
RUNTIME DESTINATION "lib${wxPLATFORM_LIB_DIR}"
|
||||
BUNDLE DESTINATION Applications/wxWidgets
|
||||
)
|
||||
|
||||
list(APPEND wxLIB_TARGETS ${name})
|
||||
endif()
|
||||
|
||||
add_library(${name} ${wxBUILD_LIB_TYPE} ${src_files})
|
||||
wx_set_target_properties(${name} ${wxADD_LIBRARY_IS_BASE})
|
||||
|
||||
# Setup install
|
||||
wx_install(TARGETS ${name}
|
||||
LIBRARY DESTINATION "lib${wxPLATFORM_LIB_DIR}"
|
||||
ARCHIVE DESTINATION "lib${wxPLATFORM_LIB_DIR}"
|
||||
RUNTIME DESTINATION "lib${wxPLATFORM_LIB_DIR}"
|
||||
BUNDLE DESTINATION Applications/wxWidgets
|
||||
)
|
||||
|
||||
set(wxLIB_TARGETS ${wxLIB_TARGETS} ${name} PARENT_SCOPE)
|
||||
endfunction()
|
||||
endmacro()
|
||||
|
||||
# Enable cotire for target if precompiled headers are enabled
|
||||
macro(wx_target_enable_precomp target_name)
|
||||
@@ -336,13 +341,15 @@ endmacro()
|
||||
# Enable precompiled headers for wx libraries
|
||||
macro(wx_finalize_lib target_name)
|
||||
set(wxLIB_TARGETS ${wxLIB_TARGETS} PARENT_SCOPE)
|
||||
if(wxBUILD_PRECOMP AND 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})
|
||||
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})
|
||||
endif()
|
||||
elseif(MSVC)
|
||||
target_compile_definitions(${target_name} PRIVATE NOPCH)
|
||||
wx_lib_compile_definitions(${target_name} PRIVATE NOPCH)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
@@ -354,6 +361,8 @@ macro(wx_lib_link_libraries name)
|
||||
cmake_parse_arguments(_LIB_LINK "" "" "PUBLIC;PRIVATE" ${ARGN})
|
||||
list(APPEND wxMONO_LIBS_PUBLIC ${_LIB_LINK_PUBLIC})
|
||||
list(APPEND wxMONO_LIBS_PRIVATE ${_LIB_LINK_PRIVATE})
|
||||
set(wxMONO_LIBS_PUBLIC ${wxMONO_LIBS_PUBLIC} PARENT_SCOPE)
|
||||
set(wxMONO_LIBS_PRIVATE ${wxMONO_LIBS_PRIVATE} PARENT_SCOPE)
|
||||
else()
|
||||
target_link_libraries(${name};${ARGN})
|
||||
endif()
|
||||
@@ -377,6 +386,8 @@ macro(wx_lib_include_directories name)
|
||||
cmake_parse_arguments(_LIB_INCLUDE_DIRS "" "" "PUBLIC;PRIVATE" ${ARGN})
|
||||
list(APPEND wxMONO_INCLUDE_DIRS_PUBLIC ${_LIB_INCLUDE_DIRS_PUBLIC})
|
||||
list(APPEND wxMONO_INCLUDE_DIRS_PRIVATE ${_LIB_INCLUDE_DIRS_PRIVATE})
|
||||
set(wxMONO_INCLUDE_DIRS_PUBLIC ${wxMONO_INCLUDE_DIRS_PUBLIC} PARENT_SCOPE)
|
||||
set(wxMONO_INCLUDE_DIRS_PRIVATE ${wxMONO_INCLUDE_DIRS_PRIVATE} PARENT_SCOPE)
|
||||
else()
|
||||
target_include_directories(${name};BEFORE;${ARGN})
|
||||
endif()
|
||||
@@ -390,6 +401,8 @@ macro(wx_lib_compile_definitions name)
|
||||
cmake_parse_arguments(_LIB_DEFINITIONS "" "" "PUBLIC;PRIVATE" ${ARGN})
|
||||
list(APPEND wxMONO_DEFINITIONS_PUBLIC ${_LIB_DEFINITIONS_PUBLIC})
|
||||
list(APPEND wxMONO_DEFINITIONS_PRIVATE ${_LIB_DEFINITIONS_PRIVATE})
|
||||
set(wxMONO_DEFINITIONS_PUBLIC ${wxMONO_DEFINITIONS_PUBLIC} PARENT_SCOPE)
|
||||
set(wxMONO_DEFINITIONS_PRIVATE ${wxMONO_DEFINITIONS_PRIVATE} PARENT_SCOPE)
|
||||
else()
|
||||
target_compile_definitions(${name};${ARGN})
|
||||
endif()
|
||||
|
@@ -17,6 +17,7 @@ if(wxBUILD_MONOLITHIC)
|
||||
set(wxMONO_LIBS_PUBLIC)
|
||||
set(wxMONO_INCLUDE_DIRS_PRIVATE)
|
||||
set(wxMONO_INCLUDE_DIRS_PUBLIC)
|
||||
set(wxMONO_NONCOMPILED_CPP_FILES)
|
||||
endif()
|
||||
|
||||
# Define third party libraries
|
||||
@@ -39,7 +40,6 @@ endmacro()
|
||||
# Define base libraries
|
||||
set(LIBS base)
|
||||
add_opt_lib(net wxUSE_SOCKETS)
|
||||
add_opt_lib(xml wxUSE_XML)
|
||||
|
||||
# Define UI libraries
|
||||
if(wxUSE_GUI)
|
||||
@@ -62,6 +62,12 @@ if(wxUSE_GUI)
|
||||
add_opt_lib(qa wxUSE_DEBUGREPORT)
|
||||
endif() # wxUSE_GUI
|
||||
|
||||
# Include XML library last
|
||||
# In the monolithic build, where all target properties (include dirs) from different targets are concatenated,
|
||||
# wxml might include system expat, which might use Mono, which has it's own copy of png.
|
||||
# Thus to ensure wx's core library includes the right png class, core must be processed first before xml
|
||||
add_opt_lib(xml wxUSE_XML)
|
||||
|
||||
# Include cmake file for every library
|
||||
foreach(LIB ${LIBS})
|
||||
add_subdirectory(${LIB})
|
||||
@@ -87,6 +93,10 @@ if(wxBUILD_MONOLITHIC)
|
||||
target_compile_definitions(mono ${vis} ${wxMONO_DEFINITIONS_${vis}})
|
||||
endif()
|
||||
endforeach()
|
||||
foreach(file ${wxMONO_NONCOMPILED_CPP_FILES})
|
||||
set_source_files_properties(${file} PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
endforeach()
|
||||
wx_finalize_lib(mono)
|
||||
endif()
|
||||
|
||||
# Propagate variable(s) to parent scope
|
||||
|
@@ -194,7 +194,7 @@ class WXDLLIMPEXP_BASE wxConsoleAppTraitsBase : public wxAppTraits
|
||||
{
|
||||
public:
|
||||
#if !wxUSE_CONSOLE_EVENTLOOP
|
||||
virtual wxEventLoopBase *CreateEventLoop() { return NULL; }
|
||||
virtual wxEventLoopBase *CreateEventLoop() wxOVERRIDE { return NULL; }
|
||||
#endif // !wxUSE_CONSOLE_EVENTLOOP
|
||||
|
||||
#if wxUSE_LOG
|
||||
|
@@ -83,7 +83,10 @@ public:
|
||||
virtual void SetBrush(const wxBrush& brush) wxOVERRIDE;
|
||||
virtual void SetBackground(const wxBrush& brush) wxOVERRIDE;
|
||||
virtual void SetBackgroundMode(int mode) wxOVERRIDE;
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
virtual void SetPalette(const wxPalette& palette) wxOVERRIDE;
|
||||
#endif
|
||||
|
||||
virtual void DestroyClippingRegion() wxOVERRIDE;
|
||||
|
||||
|
@@ -86,7 +86,10 @@ public:
|
||||
virtual void SetTextForeground( const wxColour &col ) wxOVERRIDE;
|
||||
virtual void SetTextBackground( const wxColour &col ) wxOVERRIDE;
|
||||
virtual void SetBackgroundMode( int mode ) wxOVERRIDE;
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
virtual void SetPalette( const wxPalette& palette ) wxOVERRIDE;
|
||||
#endif
|
||||
|
||||
virtual void DestroyClippingRegion() wxOVERRIDE;
|
||||
|
||||
|
@@ -457,10 +457,12 @@ void* wxGCDCImpl::GetHandle() const
|
||||
return cgctx;
|
||||
}
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
void wxGCDCImpl::SetPalette( const wxPalette& WXUNUSED(palette) )
|
||||
{
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
void wxGCDCImpl::SetBackgroundMode( int mode )
|
||||
{
|
||||
|
@@ -129,7 +129,7 @@ bool wxBMPHandler::SaveDib(wxImage *image,
|
||||
(format == wxBMP_8BPP_RED) || (format == wxBMP_8BPP_PALETTE) )
|
||||
{
|
||||
// need to set a wxPalette to use this, HOW TO CHECK IF VALID, SIZE?
|
||||
if ((format == wxBMP_8BPP_PALETTE)
|
||||
if (format == wxBMP_8BPP_PALETTE
|
||||
#if wxUSE_PALETTE
|
||||
&& !image->HasPalette()
|
||||
#endif // wxUSE_PALETTE
|
||||
|
@@ -1863,10 +1863,12 @@ void wxWindowDCImpl::SetBackgroundMode( int mode )
|
||||
m_backgroundMode = mode;
|
||||
}
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
void wxWindowDCImpl::SetPalette( const wxPalette& WXUNUSED(palette) )
|
||||
{
|
||||
wxFAIL_MSG( wxT("wxWindowDCImpl::SetPalette not implemented") );
|
||||
}
|
||||
#endif
|
||||
|
||||
void wxWindowDCImpl::UpdateClipBox()
|
||||
{
|
||||
|
@@ -24,6 +24,8 @@
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#include "wx/msw/wrapwin.h"
|
||||
|
||||
#if wxUSE_DISPLAY
|
||||
|
||||
#include "wx/display.h"
|
||||
@@ -38,7 +40,6 @@
|
||||
#include "wx/sysopt.h"
|
||||
|
||||
#include "wx/display_impl.h"
|
||||
#include "wx/msw/wrapwin.h"
|
||||
#include "wx/msw/missing.h"
|
||||
#include "wx/msw/private.h"
|
||||
#include "wx/msw/private/hiddenwin.h"
|
||||
|
@@ -159,6 +159,7 @@ wxString wxGetOsDescription()
|
||||
}
|
||||
|
||||
/* static */
|
||||
#if wxUSE_DATETIME
|
||||
bool wxDateTime::GetFirstWeekDay(wxDateTime::WeekDay *firstDay)
|
||||
{
|
||||
wxCHECK_MSG( firstDay, false, wxS("output parameter must be non-null") );
|
||||
@@ -169,3 +170,4 @@ bool wxDateTime::GetFirstWeekDay(wxDateTime::WeekDay *firstDay)
|
||||
*firstDay = wxDateTime::WeekDay(([calendar firstWeekday] - 1) % 7);
|
||||
return true;
|
||||
}
|
||||
#endif // wxUSE_DATETIME
|
||||
|
Reference in New Issue
Block a user