Merge pull request #811 from MaartenBent/cmake-and-more

CMake and sample improvements: notably, allow more samples to find their
files.
This commit is contained in:
VZ
2018-05-19 15:02:22 +02:00
committed by GitHub
12 changed files with 53 additions and 18 deletions

View File

@@ -59,7 +59,7 @@ if(WIN32)
message(FATAL_ERROR "Unknown WIN32 compiler type")
endif()
if(CMAKE_CL_64)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(wxARCH_SUFFIX "_x64")
endif()
else()
@@ -109,7 +109,7 @@ else()
endif()
set(wxSETUP_HEADER_FILE ${wxSETUP_HEADER_PATH}/wx/setup.h)
if(NOT wxBUILD_CUSTOM_SETUP_HEADER_PATH AND MSVC)
if(DEFINED wxSETUP_HEADER_FILE_DEBUG)
# Append configuration specific suffix to setup header path
wx_string_append(wxSETUP_HEADER_PATH "$<$<CONFIG:Debug>:d>")
endif()

View File

@@ -53,7 +53,7 @@ if(MSVC OR MINGW OR CYGWIN)
else()
set(wxREQUIRED_OS_DESC "Windows Vista / Windows Server 2008")
endif()
if(CMAKE_CL_64)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
wx_string_append(wxREQUIRED_OS_DESC " (x64 Edition)")
endif()
elseif(APPLE AND NOT IPHONE)

View File

@@ -189,7 +189,20 @@ if(APPLE)
# elsewhere we just compile native.cpp directly.
list(APPEND SAMPLE_WIDGETS_SRC native_wrapper.mm)
endif()
wx_add_sample(widgets IMPORTANT ${SAMPLE_WIDGETS_SRC} LIBRARIES adv)
wx_list_add_prefix(WIDGETS_RC_FILES icons/
activityindicator.xpm bmpbtn.xpm bmpcombobox.xpm button.xpm
checkbox.xpm choice.xpm choicebk.xpm clrpicker.xpm
combobox.xpm datepick.xpm dirctrl.xpm dirpicker.xpm
filepicker.xpm fontpicker.xpm gauge.xpm header.xpm
hyperlnk.xpm listbook.xpm listbox.xpm native.xpm
notebook.xpm odcombobox.xpm radiobox.xpm scrolbar.xpm
slider.xpm spinbtn.xpm statbmp.xpm statbox.xpm
stattext.xpm text.xpm timepick.xpm toggle.xpm
)
wx_add_sample(widgets IMPORTANT ${SAMPLE_WIDGETS_SRC}
DATA ${WIDGETS_RC_FILES} textctrl.cpp
LIBRARIES adv
)
wx_add_sample(wizard LIBRARIES adv DEPENDS wxUSE_WIZARDDLG)
wx_add_sample(wrapsizer)

View File

@@ -413,7 +413,8 @@ bool MyApp::LoadImages()
pathList.Add(wxFileName(argv[0]).GetPath());
pathList.Add(wxT("."));
pathList.Add(wxT(".."));
pathList.Add(wxT("../.."));
pathList.Add(wxT("../drawing"));
pathList.Add(wxT("../../../samples/drawing"));
wxString path = pathList.FindValidPath(wxT("pat4.bmp"));
if ( !path )

View File

@@ -163,10 +163,16 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
help.UseConfig(wxConfig::Get());
bool ret;
help.SetTempDir(wxT("."));
ret = help.AddBook(wxFileName(wxT("helpfiles/testing.hhp"), wxPATH_UNIX));
wxPathList pathlist;
pathlist.Add(wxT("./helpfiles"));
pathlist.Add(wxT("../helpfiles"));
pathlist.Add(wxT("../../html/help/helpfiles"));
ret = help.AddBook(wxFileName(pathlist.FindValidPath(wxT("testing.hhp")), wxPATH_UNIX));
if (! ret)
wxMessageBox(wxT("Failed adding book helpfiles/testing.hhp"));
ret = help.AddBook(wxFileName(wxT("helpfiles/another.hhp"), wxPATH_UNIX));
ret = help.AddBook(wxFileName(pathlist.FindValidPath(wxT("another.hhp")), wxPATH_UNIX));
if (! ret)
wxMessageBox(_("Failed adding book helpfiles/another.hhp"));
}

View File

@@ -741,7 +741,13 @@ void WebFrame::OnMode(wxCommandEvent& WXUNUSED(evt))
void WebFrame::OnLoadScheme(wxCommandEvent& WXUNUSED(evt))
{
wxFileName helpfile("../help/doc.zip");
wxPathList pathlist;
pathlist.Add(wxT("."));
pathlist.Add(wxT(".."));
pathlist.Add(wxT("../help"));
pathlist.Add(wxT("../../../samples/help"));
wxFileName helpfile(pathlist.FindValidPath(wxT("doc.zip")));
helpfile.MakeAbsolute();
wxString path = helpfile.GetFullPath();
//Under MSW we need to flip the slashes

View File

@@ -694,6 +694,8 @@ void BitmapComboBoxWidgetsPage::LoadWidgetImages( wxArrayString* strings, wxImag
// Get size of existing images in list
wxSize foundSize = m_combobox->GetBitmapSize();
if ( !foundSize.IsFullySpecified() )
foundSize = images->GetSize();
for ( i=0; i<strings->size(); i++ )
{

View File

@@ -90,7 +90,13 @@ void StatBmpWidgetsPage::CreateContent()
wxString testImage;
#if wxUSE_LIBPNG
wxFileName fn("../image/toucan.png");
wxPathList pathlist;
pathlist.Add(wxT("."));
pathlist.Add(wxT(".."));
pathlist.Add(wxT("../image"));
pathlist.Add(wxT("../../../samples/image"));
wxFileName fn(pathlist.FindValidPath(wxT("toucan.png")));
if ( fn.FileExists() )
testImage = fn.GetFullPath();
#endif // wxUSE_LIBPNG

View File

@@ -913,6 +913,7 @@ void TextWidgetsPage::OnButtonLoad(wxCommandEvent& WXUNUSED(event))
wxPathList pathlist;
pathlist.Add(wxT("."));
pathlist.Add(wxT(".."));
pathlist.Add(wxT("../widgets"));
pathlist.Add(wxT("../../../samples/widgets"));
wxString filename = pathlist.FindValidPath(wxT("textctrl.cpp"));

View File

@@ -381,8 +381,6 @@ bool WidgetsApp::OnInit()
WidgetsFrame::WidgetsFrame(const wxString& title)
: wxFrame(NULL, wxID_ANY, title)
{
const bool sizeSet = wxPersistentRegisterAndRestore(this, "Main");
// set the frame icon
SetIcon(wxICON(sample));
@@ -514,6 +512,8 @@ WidgetsFrame::WidgetsFrame(const wxString& title)
m_panel->SetSizer(sizerTop);
const bool sizeSet = wxPersistentRegisterAndRestore(this, "Main");
const wxSize sizeMin = m_panel->GetBestSize();
if ( !sizeSet )
SetClientSize(sizeMin);

View File

@@ -280,11 +280,11 @@ wxSize wxArtProvider::GetNativeSizeHint(const wxArtClient& client)
{
if ( client == wxART_TOOLBAR )
{
return wxSize(24, 24);
return wxWindow::FromDIP(wxSize(24, 24), NULL);
}
else if ( client == wxART_MENU )
{
return wxSize(16, 16);
return wxWindow::FromDIP(wxSize(16, 16), NULL);
}
else if ( client == wxART_FRAME_ICON )
{
@@ -299,11 +299,11 @@ wxSize wxArtProvider::GetNativeSizeHint(const wxArtClient& client)
}
else if (client == wxART_BUTTON)
{
return wxSize(16, 16);
return wxWindow::FromDIP(wxSize(16, 16), NULL);
}
else if (client == wxART_LIST)
{
return wxSize(16, 16);
return wxWindow::FromDIP(wxSize(16, 16), NULL);
}
return wxDefaultSize;

View File

@@ -195,7 +195,7 @@ wxSize wxHeaderCtrl::DoGetBestSize() const
return wxControl::DoGetBestSize();
}
return wxSize(wpos.cx, wpos.cy);
return wxSize(wxDefaultCoord, wpos.cy);
}
// ----------------------------------------------------------------------------