Fix some issues with building on macOS (#268)

* fixed building on macos, needs OBJC and OBJXX to be enabled
* changed to weak ordering due to string comparison not being strong ordering
* Use raw PNG bytes from "resource/embedded/resources.h" in all windows too
This commit is contained in:
Tillsunset 2022-09-18 07:39:00 -05:00 committed by GitHub
parent 12b6830546
commit 867c0c5ca2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 21 deletions

View File

@ -54,6 +54,10 @@ if (MSVC)
endif() endif()
endif() endif()
if (APPLE)
enable_language(OBJC OBJCXX)
endif()
option(ENABLE_OPENGL "Enables the OpenGL backend" ON) option(ENABLE_OPENGL "Enables the OpenGL backend" ON)
option(ENABLE_VULKAN "Enables the Vulkan backend" ON) option(ENABLE_VULKAN "Enables the Vulkan backend" ON)
option(ENABLE_DISCORD_RPC "Enables the Discord Rich Presence feature" ON) option(ENABLE_DISCORD_RPC "Enables the Discord Rich Presence feature" ON)

View File

@ -39,9 +39,7 @@
#include "config/ActiveSettings.h" #include "config/ActiveSettings.h"
#include "gui/helpers/wxHelpers.h" #include "gui/helpers/wxHelpers.h"
#if BOOST_OS_LINUX || BOOST_OS_MACOS
#include "resource/embedded/resources.h" #include "resource/embedded/resources.h"
#endif
#include "Cafe/CafeSystem.h" #include "Cafe/CafeSystem.h"
#include "Cemu/ncrypto/ncrypto.h" #include "Cemu/ncrypto/ncrypto.h"
@ -630,7 +628,7 @@ wxPanel* GeneralSettings2::AddAccountPage(wxNotebook* notebook)
row->SetFlexibleDirection(wxBOTH); row->SetFlexibleDirection(wxBOTH);
row->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED); row->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
const wxImage tmp = wxBITMAP_PNG(PNG_ERROR).ConvertToImage(); const wxImage tmp = wxBITMAP_PNG_FROM_DATA(PNG_ERROR).ConvertToImage();
m_validate_online = new wxBitmapButton(box, wxID_ANY, tmp.Scale(16, 16)); m_validate_online = new wxBitmapButton(box, wxID_ANY, tmp.Scale(16, 16));
m_validate_online->Bind(wxEVT_BUTTON, &GeneralSettings2::OnShowOnlineValidator, this); m_validate_online->Bind(wxEVT_BUTTON, &GeneralSettings2::OnShowOnlineValidator, this);
row->Add(m_validate_online, 0, wxEXPAND | wxALL, 5); row->Add(m_validate_online, 0, wxEXPAND | wxALL, 5);
@ -1220,7 +1218,7 @@ void GeneralSettings2::UpdateAccountInformation()
const auto selection = m_active_account->GetSelection(); const auto selection = m_active_account->GetSelection();
if(selection == wxNOT_FOUND) if(selection == wxNOT_FOUND)
{ {
m_validate_online->SetBitmap(wxBITMAP_PNG(PNG_ERROR).ConvertToImage().Scale(16, 16)); m_validate_online->SetBitmap(wxBITMAP_PNG_FROM_DATA(PNG_ERROR).ConvertToImage().Scale(16, 16));
m_validate_online->SetWindowStyleFlag(m_validate_online->GetWindowStyleFlag() & ~wxBORDER_NONE); m_validate_online->SetWindowStyleFlag(m_validate_online->GetWindowStyleFlag() & ~wxBORDER_NONE);
ResetAccountInformation(); ResetAccountInformation();
return; return;
@ -1253,12 +1251,12 @@ void GeneralSettings2::UpdateAccountInformation()
{ {
m_online_status->SetLabel(_("Your account is a valid online account")); m_online_status->SetLabel(_("Your account is a valid online account"));
m_validate_online->SetBitmap(wxBITMAP_PNG(PNG_CHECK_YES).ConvertToImage().Scale(16, 16)); m_validate_online->SetBitmap(wxBITMAP_PNG_FROM_DATA(PNG_CHECK_YES).ConvertToImage().Scale(16, 16));
m_validate_online->SetWindowStyleFlag(m_validate_online->GetWindowStyleFlag() | wxBORDER_NONE); m_validate_online->SetWindowStyleFlag(m_validate_online->GetWindowStyleFlag() | wxBORDER_NONE);
} }
else else
{ {
m_validate_online->SetBitmap(wxBITMAP_PNG(PNG_ERROR).ConvertToImage().Scale(16, 16)); m_validate_online->SetBitmap(wxBITMAP_PNG_FROM_DATA(PNG_ERROR).ConvertToImage().Scale(16, 16));
m_validate_online->SetWindowStyleFlag(m_validate_online->GetWindowStyleFlag() & ~wxBORDER_NONE); m_validate_online->SetWindowStyleFlag(m_validate_online->GetWindowStyleFlag() & ~wxBORDER_NONE);
} }

View File

@ -39,9 +39,8 @@
#include "Cafe/TitleList/TitleList.h" #include "Cafe/TitleList/TitleList.h"
#if BOOST_OS_LINUX || BOOST_OS_MACOS
#include "resource/embedded/resources.h" #include "resource/embedded/resources.h"
#endif
#include "Cafe/TitleList/SaveList.h" #include "Cafe/TitleList/SaveList.h"
wxDEFINE_EVENT(wxEVT_TITLE_FOUND, wxCommandEvent); wxDEFINE_EVENT(wxEVT_TITLE_FOUND, wxCommandEvent);
@ -63,14 +62,14 @@ wxPanel* TitleManager::CreateTitleManagerPage()
m_filter->Bind(wxEVT_TEXT, &TitleManager::OnFilterChanged, this); m_filter->Bind(wxEVT_TEXT, &TitleManager::OnFilterChanged, this);
row->Add(m_filter, 1, wxALL | wxEXPAND, 5); row->Add(m_filter, 1, wxALL | wxEXPAND, 5);
const wxImage refresh = wxBITMAP_PNG(PNG_REFRESH).ConvertToImage(); const wxImage refresh = wxBITMAP_PNG_FROM_DATA(PNG_REFRESH).ConvertToImage();
m_refresh_button = new wxBitmapButton(panel, wxID_ANY, refresh.Scale(16, 16)); m_refresh_button = new wxBitmapButton(panel, wxID_ANY, refresh.Scale(16, 16));
m_refresh_button->Disable(); m_refresh_button->Disable();
m_refresh_button->Bind(wxEVT_BUTTON, &TitleManager::OnRefreshButton, this); m_refresh_button->Bind(wxEVT_BUTTON, &TitleManager::OnRefreshButton, this);
m_refresh_button->SetToolTip(_("Refresh")); m_refresh_button->SetToolTip(_("Refresh"));
row->Add(m_refresh_button, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); row->Add(m_refresh_button, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
auto* help_button = new wxStaticBitmap(panel, wxID_ANY, wxBITMAP_PNG(PNG_HELP)); auto* help_button = new wxStaticBitmap(panel, wxID_ANY, wxBITMAP_PNG_FROM_DATA(PNG_HELP));
help_button->SetToolTip(wxStringFormat2(_("The following prefixes are supported:\n{0}\n{1}\n{2}\n{3}\n{4}"), help_button->SetToolTip(wxStringFormat2(_("The following prefixes are supported:\n{0}\n{1}\n{2}\n{3}\n{4}"),
"titleid:", "name:", "type:", "version:", "region:")); "titleid:", "name:", "type:", "version:", "region:"));
row->Add(help_button, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); row->Add(help_button, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);

View File

@ -302,12 +302,12 @@ void wxGameList::UpdateItemColors(sint32 startIndex)
} }
} }
static inline int strongorder_to_int(const std::strong_ordering &wo) static inline int order_to_int(const std::weak_ordering &wo)
{ {
// no easy conversion seems to exists in C++20 // no easy conversion seems to exists in C++20
if (wo < 0) if (wo == std::weak_ordering::less)
return -1; return -1;
else if (wo > 0) else if (wo == std::weak_ordering::greater)
return 1; return 1;
return 0; return 0;
} }
@ -320,9 +320,9 @@ int wxGameList::SortComparator(uint64 titleId1, uint64 titleId2, SortData* sortD
const auto& name2 = GetNameByTitleId(titleId2); const auto& name2 = GetNameByTitleId(titleId2);
if(sortData->dir > 0) if(sortData->dir > 0)
return strongorder_to_int(std::tie(isFavoriteB, name1) <=> std::tie(isFavoriteA, name2)); return order_to_int(std::tie(isFavoriteB, name1) <=> std::tie(isFavoriteA, name2));
else else
return strongorder_to_int(std::tie(isFavoriteB, name2) <=> std::tie(isFavoriteA, name1)); return order_to_int(std::tie(isFavoriteB, name2) <=> std::tie(isFavoriteA, name1));
} }
int wxGameList::SortFunction(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData) int wxGameList::SortFunction(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData)

View File

@ -3,12 +3,10 @@ add_library(CemuResource)
set_property(TARGET CemuResource PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") set_property(TARGET CemuResource PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
# icon resources # icon resources
if(UNIX) target_sources(CemuResource PRIVATE
target_sources(CemuResource PRIVATE embedded/resources.cpp
embedded/resources.cpp embedded/resources.h
embedded/resources.h )
)
endif()
target_sources(CemuResource PRIVATE CafeDefaultFont.cpp) target_sources(CemuResource PRIVATE CafeDefaultFont.cpp)