Fix Windows support on MinGW-w64 on Arch Linux

This commit is contained in:
Zachary Hall 2023-07-16 19:59:23 -07:00
parent 0a85c36a7d
commit fc21f91c21
6 changed files with 26 additions and 8 deletions

View file

@ -374,7 +374,7 @@ int main(int, char**)
for (auto themePath : Theme::availableThemes) { for (auto themePath : Theme::availableThemes) {
if (themePath.stem().string().starts_with(filter)) { if (themePath.stem().string().starts_with(filter)) {
const bool is_selected = themePath == theme->file_path; const bool is_selected = themePath == theme->file_path;
if (ImGui::Selectable(themePath.stem().c_str(), is_selected)) { if (ImGui::Selectable(themePath.stem().generic_string().c_str(), is_selected)) {
delete theme; delete theme;
theme = new Theme(themePath); theme = new Theme(themePath);
theme->Apply(accent_color); theme->Apply(accent_color);

View file

@ -6,9 +6,11 @@ cmake = import('cmake')
if get_option('debug') if get_option('debug')
add_global_arguments('-DDEBUG', language: 'cpp') add_global_arguments('-DDEBUG', language: 'cpp')
endif endif
add_global_arguments('-DIMGUI_IMPL_OPENGL_ES2', language: 'cpp') if get_option('gles')
add_global_arguments('-DIMGUI_IMPL_OPENGL_ES2', language: 'cpp')
endif
smx_opts = cmake.subproject_options() smx_opts = cmake.subproject_options()
smx_opts.add_cmake_defines({'SDL_MIXER_X_STATIC': true, 'SDL_MIXER_X_SHARED': false}) smx_opts.add_cmake_defines({'SDL_MIXER_X_STATIC': true, 'SDL_MIXER_X_SHARED': false, 'USE_MIDI_NATIVE_ALT': false, 'USE_MIDI_NATIVE': false})
smx_opts.set_override_option('c_std', 'c99') smx_opts.set_override_option('c_std', 'c99')
smx_subproj = cmake.subproject('SDL-Mixer-X', options: smx_opts) smx_subproj = cmake.subproject('SDL-Mixer-X', options: smx_opts)
#raudio_lib = static_library('raudio', 'raudio/src/raudio.c', c_args: ['-DRAUDIO_STANDALONE', '-DSUPPORT_MODULE_RAUDIO', '-DSUPPORT_FILEFORMAT_WAV', '-DSUPPORT_FILEFORMAT_OGG', '-DSUPPORT_FILEFORMAT_MP3', '-DSUPPORT_FILEFORMAT_QOA', '-DSUPPORT_FILEFORMAT_FLAC', '-DSUPPORT_FILEFORMAT_XM', '-DSUPPORT_FILEFORMAT_MOD', '-w']) #raudio_lib = static_library('raudio', 'raudio/src/raudio.c', c_args: ['-DRAUDIO_STANDALONE', '-DSUPPORT_MODULE_RAUDIO', '-DSUPPORT_FILEFORMAT_WAV', '-DSUPPORT_FILEFORMAT_OGG', '-DSUPPORT_FILEFORMAT_MP3', '-DSUPPORT_FILEFORMAT_QOA', '-DSUPPORT_FILEFORMAT_FLAC', '-DSUPPORT_FILEFORMAT_XM', '-DSUPPORT_FILEFORMAT_MOD', '-w'])

1
meson.options Normal file
View file

@ -0,0 +1 @@
option('gles', type: 'boolean', value: false)

View file

@ -207,7 +207,7 @@ bool Theme::ShowEditor(bool* open, Theme* &theme) {
for (auto themePath : Theme::availableThemes) { for (auto themePath : Theme::availableThemes) {
if (themePath.stem().string().starts_with(filter)) { if (themePath.stem().string().starts_with(filter)) {
const bool is_selected = themePath == selectedThemePath; const bool is_selected = themePath == selectedThemePath;
if (ImGui::Selectable(themePath.stem().c_str(), is_selected)) { if (ImGui::Selectable(themePath.stem().generic_string().c_str(), is_selected)) {
selectedThemePath = themePath; selectedThemePath = themePath;
} }
if (is_selected) { if (is_selected) {
@ -249,9 +249,9 @@ bool Theme::ShowEditor(bool* open, Theme* &theme) {
if (ImGui::BeginListBox("##Themes", ImVec2(ImGui::GetWindowWidth() - (ImGui::GetStyle().WindowPadding.x * 2.0f), -ImGui::GetFrameHeightWithSpacing() - ImGui::GetTextLineHeightWithSpacing() - ImGui::GetStyle().WindowPadding.y))) { if (ImGui::BeginListBox("##Themes", ImVec2(ImGui::GetWindowWidth() - (ImGui::GetStyle().WindowPadding.x * 2.0f), -ImGui::GetFrameHeightWithSpacing() - ImGui::GetTextLineHeightWithSpacing() - ImGui::GetStyle().WindowPadding.y))) {
for (auto themePath : Theme::availableThemes) { for (auto themePath : Theme::availableThemes) {
if (themePath.stem().string().starts_with(filter)) { if (themePath.stem().string().starts_with(filter)) {
const bool is_selected = strcmp(themePath.stem().c_str(), selectedThemeName) == 0; const bool is_selected = strcmp(themePath.stem().generic_string().c_str(), selectedThemeName) == 0;
if (ImGui::Selectable(themePath.stem().c_str(), is_selected)) { if (ImGui::Selectable(themePath.stem().generic_string().c_str(), is_selected)) {
strncpy(selectedThemeName, themePath.stem().c_str(), 1024); strncpy(selectedThemeName, themePath.stem().generic_string().c_str(), 1024);
} }
if (is_selected) { if (is_selected) {
ImGui::SetItemDefaultFocus(); ImGui::SetItemDefaultFocus();
@ -269,7 +269,7 @@ bool Theme::ShowEditor(bool* open, Theme* &theme) {
filter[0] = '\0'; filter[0] = '\0';
saveAsOpen = false; saveAsOpen = false;
theme->Save(Theme::themeDir / selectedThemePath.replace_extension(".json")); theme->Save(Theme::themeDir / selectedThemePath.replace_extension(".json"));
theme->file_path = selectedThemePath; theme->file_path = selectedThemePath.generic_string();
} }
} }
ImGui::SameLine(); ImGui::SameLine();
@ -344,6 +344,9 @@ void Theme::Save(string path) {
} }
updateAvailableThemes(); updateAvailableThemes();
} }
void Theme::Save(path path) {
Save(path.string());
}
void Theme::updateAvailableThemes() { void Theme::updateAvailableThemes() {
themeDir = path(prefPath) / path("themes"); themeDir = path(prefPath) / path("themes");
create_directories(themeDir); create_directories(themeDir);
@ -424,4 +427,7 @@ Theme::Theme(string path) : Theme() {
stream.close(); stream.close();
} }
file_path = path; file_path = path;
}
Theme::Theme(path path) : Theme(path.string()) {
} }

View file

@ -20,7 +20,9 @@ class Theme {
static bool ShowEditor(bool *open, Theme* &theme); static bool ShowEditor(bool *open, Theme* &theme);
void Apply(float hue); void Apply(float hue);
void Save(string path); void Save(string path);
void Save(path path);
Theme(); Theme();
Theme(bool dark); Theme(bool dark);
Theme(string path); Theme(string path);
Theme(path path);
}; };

View file

@ -12,3 +12,10 @@ system = 'windows'
cpu_family = 'x86_64' cpu_family = 'x86_64'
cpu = 'x86_64' cpu = 'x86_64'
endian = 'little' endian = 'little'
[properties]
cmake_toolchain_file = '/usr/share/mingw/toolchain-x86_64-w64-mingw32.cmake'
cmake_defaults = false
[cmake]