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:
@@ -59,7 +59,7 @@ if(WIN32)
|
|||||||
message(FATAL_ERROR "Unknown WIN32 compiler type")
|
message(FATAL_ERROR "Unknown WIN32 compiler type")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_CL_64)
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
set(wxARCH_SUFFIX "_x64")
|
set(wxARCH_SUFFIX "_x64")
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
@@ -109,7 +109,7 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
set(wxSETUP_HEADER_FILE ${wxSETUP_HEADER_PATH}/wx/setup.h)
|
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
|
# Append configuration specific suffix to setup header path
|
||||||
wx_string_append(wxSETUP_HEADER_PATH "$<$<CONFIG:Debug>:d>")
|
wx_string_append(wxSETUP_HEADER_PATH "$<$<CONFIG:Debug>:d>")
|
||||||
endif()
|
endif()
|
||||||
|
@@ -53,7 +53,7 @@ if(MSVC OR MINGW OR CYGWIN)
|
|||||||
else()
|
else()
|
||||||
set(wxREQUIRED_OS_DESC "Windows Vista / Windows Server 2008")
|
set(wxREQUIRED_OS_DESC "Windows Vista / Windows Server 2008")
|
||||||
endif()
|
endif()
|
||||||
if(CMAKE_CL_64)
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
wx_string_append(wxREQUIRED_OS_DESC " (x64 Edition)")
|
wx_string_append(wxREQUIRED_OS_DESC " (x64 Edition)")
|
||||||
endif()
|
endif()
|
||||||
elseif(APPLE AND NOT IPHONE)
|
elseif(APPLE AND NOT IPHONE)
|
||||||
|
@@ -189,7 +189,20 @@ if(APPLE)
|
|||||||
# elsewhere we just compile native.cpp directly.
|
# elsewhere we just compile native.cpp directly.
|
||||||
list(APPEND SAMPLE_WIDGETS_SRC native_wrapper.mm)
|
list(APPEND SAMPLE_WIDGETS_SRC native_wrapper.mm)
|
||||||
endif()
|
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(wizard LIBRARIES adv DEPENDS wxUSE_WIZARDDLG)
|
||||||
wx_add_sample(wrapsizer)
|
wx_add_sample(wrapsizer)
|
||||||
|
|
||||||
|
@@ -413,7 +413,8 @@ bool MyApp::LoadImages()
|
|||||||
pathList.Add(wxFileName(argv[0]).GetPath());
|
pathList.Add(wxFileName(argv[0]).GetPath());
|
||||||
pathList.Add(wxT("."));
|
pathList.Add(wxT("."));
|
||||||
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"));
|
wxString path = pathList.FindValidPath(wxT("pat4.bmp"));
|
||||||
if ( !path )
|
if ( !path )
|
||||||
|
@@ -163,10 +163,16 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
|||||||
help.UseConfig(wxConfig::Get());
|
help.UseConfig(wxConfig::Get());
|
||||||
bool ret;
|
bool ret;
|
||||||
help.SetTempDir(wxT("."));
|
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)
|
if (! ret)
|
||||||
wxMessageBox(wxT("Failed adding book helpfiles/testing.hhp"));
|
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)
|
if (! ret)
|
||||||
wxMessageBox(_("Failed adding book helpfiles/another.hhp"));
|
wxMessageBox(_("Failed adding book helpfiles/another.hhp"));
|
||||||
}
|
}
|
||||||
|
@@ -741,7 +741,13 @@ void WebFrame::OnMode(wxCommandEvent& WXUNUSED(evt))
|
|||||||
|
|
||||||
void WebFrame::OnLoadScheme(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();
|
helpfile.MakeAbsolute();
|
||||||
wxString path = helpfile.GetFullPath();
|
wxString path = helpfile.GetFullPath();
|
||||||
//Under MSW we need to flip the slashes
|
//Under MSW we need to flip the slashes
|
||||||
|
@@ -694,6 +694,8 @@ void BitmapComboBoxWidgetsPage::LoadWidgetImages( wxArrayString* strings, wxImag
|
|||||||
|
|
||||||
// Get size of existing images in list
|
// Get size of existing images in list
|
||||||
wxSize foundSize = m_combobox->GetBitmapSize();
|
wxSize foundSize = m_combobox->GetBitmapSize();
|
||||||
|
if ( !foundSize.IsFullySpecified() )
|
||||||
|
foundSize = images->GetSize();
|
||||||
|
|
||||||
for ( i=0; i<strings->size(); i++ )
|
for ( i=0; i<strings->size(); i++ )
|
||||||
{
|
{
|
||||||
|
@@ -90,7 +90,13 @@ void StatBmpWidgetsPage::CreateContent()
|
|||||||
|
|
||||||
wxString testImage;
|
wxString testImage;
|
||||||
#if wxUSE_LIBPNG
|
#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() )
|
if ( fn.FileExists() )
|
||||||
testImage = fn.GetFullPath();
|
testImage = fn.GetFullPath();
|
||||||
#endif // wxUSE_LIBPNG
|
#endif // wxUSE_LIBPNG
|
||||||
|
@@ -913,6 +913,7 @@ void TextWidgetsPage::OnButtonLoad(wxCommandEvent& WXUNUSED(event))
|
|||||||
wxPathList pathlist;
|
wxPathList pathlist;
|
||||||
pathlist.Add(wxT("."));
|
pathlist.Add(wxT("."));
|
||||||
pathlist.Add(wxT(".."));
|
pathlist.Add(wxT(".."));
|
||||||
|
pathlist.Add(wxT("../widgets"));
|
||||||
pathlist.Add(wxT("../../../samples/widgets"));
|
pathlist.Add(wxT("../../../samples/widgets"));
|
||||||
|
|
||||||
wxString filename = pathlist.FindValidPath(wxT("textctrl.cpp"));
|
wxString filename = pathlist.FindValidPath(wxT("textctrl.cpp"));
|
||||||
|
@@ -381,8 +381,6 @@ bool WidgetsApp::OnInit()
|
|||||||
WidgetsFrame::WidgetsFrame(const wxString& title)
|
WidgetsFrame::WidgetsFrame(const wxString& title)
|
||||||
: wxFrame(NULL, wxID_ANY, title)
|
: wxFrame(NULL, wxID_ANY, title)
|
||||||
{
|
{
|
||||||
const bool sizeSet = wxPersistentRegisterAndRestore(this, "Main");
|
|
||||||
|
|
||||||
// set the frame icon
|
// set the frame icon
|
||||||
SetIcon(wxICON(sample));
|
SetIcon(wxICON(sample));
|
||||||
|
|
||||||
@@ -514,6 +512,8 @@ WidgetsFrame::WidgetsFrame(const wxString& title)
|
|||||||
|
|
||||||
m_panel->SetSizer(sizerTop);
|
m_panel->SetSizer(sizerTop);
|
||||||
|
|
||||||
|
const bool sizeSet = wxPersistentRegisterAndRestore(this, "Main");
|
||||||
|
|
||||||
const wxSize sizeMin = m_panel->GetBestSize();
|
const wxSize sizeMin = m_panel->GetBestSize();
|
||||||
if ( !sizeSet )
|
if ( !sizeSet )
|
||||||
SetClientSize(sizeMin);
|
SetClientSize(sizeMin);
|
||||||
|
@@ -280,11 +280,11 @@ wxSize wxArtProvider::GetNativeSizeHint(const wxArtClient& client)
|
|||||||
{
|
{
|
||||||
if ( client == wxART_TOOLBAR )
|
if ( client == wxART_TOOLBAR )
|
||||||
{
|
{
|
||||||
return wxSize(24, 24);
|
return wxWindow::FromDIP(wxSize(24, 24), NULL);
|
||||||
}
|
}
|
||||||
else if ( client == wxART_MENU )
|
else if ( client == wxART_MENU )
|
||||||
{
|
{
|
||||||
return wxSize(16, 16);
|
return wxWindow::FromDIP(wxSize(16, 16), NULL);
|
||||||
}
|
}
|
||||||
else if ( client == wxART_FRAME_ICON )
|
else if ( client == wxART_FRAME_ICON )
|
||||||
{
|
{
|
||||||
@@ -299,11 +299,11 @@ wxSize wxArtProvider::GetNativeSizeHint(const wxArtClient& client)
|
|||||||
}
|
}
|
||||||
else if (client == wxART_BUTTON)
|
else if (client == wxART_BUTTON)
|
||||||
{
|
{
|
||||||
return wxSize(16, 16);
|
return wxWindow::FromDIP(wxSize(16, 16), NULL);
|
||||||
}
|
}
|
||||||
else if (client == wxART_LIST)
|
else if (client == wxART_LIST)
|
||||||
{
|
{
|
||||||
return wxSize(16, 16);
|
return wxWindow::FromDIP(wxSize(16, 16), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return wxDefaultSize;
|
return wxDefaultSize;
|
||||||
|
@@ -195,7 +195,7 @@ wxSize wxHeaderCtrl::DoGetBestSize() const
|
|||||||
return wxControl::DoGetBestSize();
|
return wxControl::DoGetBestSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
return wxSize(wpos.cx, wpos.cy);
|
return wxSize(wxDefaultCoord, wpos.cy);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user