From 49a446c3648ea8c0a4beaae3e7a3293c43939704 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Thu, 29 Oct 2015 13:55:01 -0400 Subject: [PATCH] More tweaking of Cmake files --- .travis.yml | 1 + CMakeLists.txt | 12 +++++++-- src/widgets/PrefPane.cpp | 54 +++++++++++++++++++--------------------- src/widgets/widget.h | 4 +-- 4 files changed, 37 insertions(+), 34 deletions(-) diff --git a/.travis.yml b/.travis.yml index a078535..a34b49e 100755 --- a/.travis.yml +++ b/.travis.yml @@ -23,5 +23,6 @@ addons: - gcc-4.8 - g++-4.8 - clang + - libgtk2.0-dev script: make clean run-tests diff --git a/CMakeLists.txt b/CMakeLists.txt index 2055964..9aedbf9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ ################################################################################ cmake_minimum_required (VERSION 3.0) - +set(CMAKE_CXX_STANDARD 11) # Hunter for dependency management include("cmake/HunterGate.cmake") @@ -30,9 +30,15 @@ else() message(FATAL_ERROR "Compiler ${CMAKE_CXX_COMPILER} has no C++11 support.") endif() +# Silence some useless errors +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wno-potentially-evaluated-expression) +endif() + # wxwidgets stuff set(wxWidgets_CONFIG_OPTIONS --static) +unset(WXSETUP_wxUSE_WEBVIEW_WEBKIT) hunter_add_package(wxWidgets) find_package(wxWidgets COMPONENTS core base aui stc adv REQUIRED) include("${wxWidgets_USE_FILE}") @@ -51,8 +57,10 @@ include_directories(${INCLUDE_DIRS}) # set some platform-specific flags if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set(CMAKE_CXX_FLAGS "--sysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS} -stdlib=libc++ -Wno-potentially-evaluated-expression") + set(CMAKE_CXX_FLAGS "--sysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS} -stdlib=libc++") add_definitions(-D_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_ -D__WXMAC__) +else() + add_definitions(-D_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_) endif() ################################################################################ diff --git a/src/widgets/PrefPane.cpp b/src/widgets/PrefPane.cpp index 949757d..6956114 100644 --- a/src/widgets/PrefPane.cpp +++ b/src/widgets/PrefPane.cpp @@ -1,4 +1,3 @@ -#ifndef TRAVIS #include "src/widgets/PrefPane.h" #include "src/widgets/MainFrame.h" @@ -10,19 +9,19 @@ public: : wxPanel(parent) { this->frame = (MainFrame *) parent; - + this->showLineNumbers = new wxCheckBox(this, myID_PREFS_LINE_NUMBERS, "Show line numbers"); this->showIndentGuides = new wxCheckBox(this, myID_PREFS_IDENT_GUIDES, "Show indent guides"); this->showCodeFolding = new wxCheckBox(this, myID_PREFS_CODE_FOLDING, "Show code folding"); - + wxSizer *sizer = new wxBoxSizer(wxVERTICAL); - + // Check that version of OS X is less than 10.10 for wxWidgets < 3.0.3 // Otherwise the font control will segfault if( ! HAS_FONT_BUG()) { this->fontPicker = new wxFontPickerCtrl( - this, + this, myID_PREFS_FONT, wxNullFont, wxDefaultPosition, @@ -33,13 +32,13 @@ public: fontSizer->Add(this->fontPicker, wxSizerFlags().Border()); sizer->Add(fontSizer, wxSizerFlags().Border()); } - + sizer->Add(this->showLineNumbers, wxSizerFlags().Border()); sizer->Add(this->showIndentGuides, wxSizerFlags().Border()); sizer->Add(this->showCodeFolding, wxSizerFlags().Border()); - + this->SetSizerAndFit(sizer); - + // Change settings on selection, rather than on apply button // On supported platforms if (wxPreferencesEditor::ShouldApplyChangesImmediately()) @@ -52,19 +51,19 @@ public: Glob_config->Flush(); }, myID_PREFS_FONT); } - + this->showLineNumbers->Bind(wxEVT_CHECKBOX, [=] (wxCommandEvent &event) { Glob_config->Write("show_line_numbers", event.IsChecked()); this->frame->OnPrefsChanged(event); Glob_config->Flush(); }, myID_PREFS_LINE_NUMBERS); - + this->showIndentGuides->Bind(wxEVT_CHECKBOX, [=] (wxCommandEvent &event) { Glob_config->Write("show_indent_guides", event.IsChecked()); this->frame->OnPrefsChanged(event); Glob_config->Flush(); }, myID_PREFS_IDENT_GUIDES); - + this->showCodeFolding->Bind(wxEVT_CHECKBOX, [=] (wxCommandEvent &event) { Glob_config->Write("show_code_folding", event.IsChecked()); this->frame->OnPrefsChanged(event); @@ -72,14 +71,14 @@ public: }, myID_PREFS_CODE_FOLDING); } } - + ~GeneralPrefPanePage() { } - + /** * Apply current settings to the pref window - * + * * @return bool */ virtual bool TransferDataToWindow() @@ -87,43 +86,43 @@ public: this->showLineNumbers->SetValue(Glob_config->ReadBool("show_line_numbers", true)); this->showIndentGuides->SetValue(Glob_config->ReadBool("show_indent_guides", false)); this->showCodeFolding->SetValue(Glob_config->ReadBool("show_code_folding", false)); - + if ( ! HAS_FONT_BUG()) { wxFont globalFont; Glob_config->Read("global_font", &globalFont); - + this->fontPicker->SetSelectedFont(globalFont); } - + return true; } - + /** - * Called on platforms with modal preferences dialog to save + * Called on platforms with modal preferences dialog to save * and apply the changes - * - * @return bool + * + * @return bool */ virtual bool TransferDataFromWindow() { Glob_config->Write("show_line_numbers", this->showLineNumbers->IsChecked()); Glob_config->Write("show_indent_guides", this->showIndentGuides->IsChecked()); Glob_config->Write("show_code_folding", this->showCodeFolding->IsChecked()); - + if ( ! HAS_FONT_BUG()) { Glob_config->Write("global_font", this->fontPicker->GetSelectedFont()); } - + wxCommandEvent evt = wxCommandEvent(); this->frame->OnPrefsChanged(evt); - + Glob_config->Flush(); - + return true; } - + private: MainFrame *frame; wxFontPickerCtrl *fontPicker = nullptr; @@ -160,6 +159,3 @@ void PrefPane::Show(wxWindow *parent) { this->pref_window->Show(parent); } - -#endif // ifndef TRAVIS - diff --git a/src/widgets/widget.h b/src/widgets/widget.h index ba9b12d..408e58e 100644 --- a/src/widgets/widget.h +++ b/src/widgets/widget.h @@ -16,10 +16,8 @@ #include #include #include - -#ifndef TRAVIS #include -#endif + #endif /* TYRO_WIDGET_H */