Skip to content

Commit

Permalink
Fixed several windows compilation problems
Browse files Browse the repository at this point in the history
  • Loading branch information
dov committed Jan 4, 2021
1 parent dc6e136 commit 2cbbbd7
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 22 deletions.
1 change: 1 addition & 0 deletions cross_mingw64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cpp = '/usr/bin/x86_64-w64-mingw32-g++'
ar = '/usr/bin/x86_64-w64-mingw32-ar'
strip = '/usr/bin/x86_64-w64-mingw32-strip'
pkgconfig = 'pkg-config'
windres = '/usr/bin/x86_64-w64-mingw32-windres'

[properties]
pkg_config_libdir = '/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig:/usr/local/mingw64/lib/pkgconfig/'
Expand Down
36 changes: 27 additions & 9 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,40 @@ name='pomelo'
name_cap = 'Pomelo'
version = '0.1.0'

exe = executable(name_cap,
sources,
resources,
dependencies: deps,
gui_app : true
)

r = run_command('git', 'rev-parse', 'HEAD')
if r.returncode() != 0
# it failed
endif

sha1 = r.stdout().strip()
# meson version 0.56 will have substr()
sha1_short = sha1[0]+sha1[1]+sha1[2]+sha1[3]+sha1[4]+sha1[5]

r = run_command('git', 'log', '--pretty=%ci', '-n1')
if r.returncode() != 0
# it failed
endif
commit_time=r.stdout().strip()

if host_machine.system() == 'windows'
cpp_args = ['-Wa,-mbig-obj']
mod_rescomp = import('windows')
sources += mod_rescomp.compile_resources('pomelo.rc')
else
cpp_args = []
endif

cpp_args += ['-DCOMMIT_ID="'+sha1+'"',
'-DCOMMIT_TIME="'+commit_time+'"'
]

exe = executable(name_cap,
sources,
resources,
dependencies: deps,
gui_app : true,
cpp_args : cpp_args
)

fs = import('fs')
builddir = fs.name(meson.current_build_dir())

Expand All @@ -73,7 +91,7 @@ if host_machine.system() == 'windows'
'-DCOMMITID_SHORT='+sha1_short,
'-DNAME='+name,
'-DNAME_CAP='+name_cap,
'-DICON_NAME='+name,
'-DICON_NAME='+name + '_logo',
'-DARCH='+arch,
'-DHOST='+host,
'-DVERSION='+version,
Expand Down
3 changes: 3 additions & 0 deletions pomelo.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ File \usr\${ARCH}\sys-root\mingw\bin\libgdkmm-3.0-1.dll
File \usr\${ARCH}\sys-root\mingw\bin\libgiomm-2.4-1.dll
File \usr\${ARCH}\sys-root\mingw\bin\gdbus.exe
File \usr\${ARCH}\sys-root\mingw\bin\libsigc-2.0-0.dll
File \usr\${ARCH}\sys-root\mingw\bin\libmpfr-6.dll
File \usr\local\mingw64\bin\libfmt.dll
File \usr\local\mingw64\bin\libgmp-10.dll
File ${OUTDIR}\${NAME}.exe

SetOutPath "$INSTDIR"
Expand Down
27 changes: 18 additions & 9 deletions src/main-input.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include "main-input.h"
#include "dov-mm-macros.h"
#include <fmt/core.h>

using namespace fmt;

static Gtk::Widget* mmLabelAligned(const gchar *markup, double xAlign)
{
Expand Down Expand Up @@ -54,7 +57,11 @@ MainInput::MainInput()
&MainInput::on_skeleton_input_changed));

m_font_picker.set_show_size(false);
#ifdef WIN32
m_font_picker.set_font_name("Arial Black Heavy 48");
#else
m_font_picker.set_font_name("Sans Bold 48");
#endif
m_font_picker.signal_font_set().connect(sigc::mem_fun(*this,
&MainInput::on_skeleton_input_changed));

Expand Down Expand Up @@ -101,7 +108,7 @@ MainInput::MainInput()
w_vbox->pack_start(*w_hbox, Gtk::PACK_SHRINK);
auto w_button = mm<Gtk::Button>("Build");
w_hbox->pack_start(*w_button, false,false);
m_skeleton_status_label.set_text("Status: ");
m_skeleton_status_label.set_markup("Status: <span foreground=\"red\">❌</span>");
w_hbox->pack_end(m_skeleton_status_label, false,false);

w_button->signal_clicked().connect( sigc::mem_fun(*this,
Expand Down Expand Up @@ -135,7 +142,8 @@ MainInput::MainInput()
m_profile_button.signal_clicked().connect( sigc::mem_fun(*this,
&MainInput::on_button_profile_clicked) );
w_hbox->pack_start(m_profile_button, false,false);
m_profile_status_label.set_label("Status: ❌");
m_profile_status_label.set_markup("Status: <span foreground=\"red\">❌</span>");

w_hbox->pack_end(m_profile_status_label, false,false);

}
Expand All @@ -145,8 +153,8 @@ void MainInput::on_button_skeleton_clicked()
auto text = m_text_buffer->get_text();
double linear_limit = m_linear_limit.get_value();
auto font_name = m_font_picker.get_font_name();
PangoFontDescription *p_font_description = pango_font_description_from_string(font_name.c_str());
Pango::FontDescription font_description(p_font_description);
print("font_name = {}\n", font_name.c_str());
Pango::FontDescription font_description(font_name);
m_signal_build_skeleton(text,linear_limit,font_description);
}

Expand All @@ -161,23 +169,24 @@ void MainInput::set_skeleton_ready_state(bool is_ready)
{
if (is_ready)
{
m_skeleton_status_label.set_text("Status: ");
m_skeleton_status_label.set_markup("Status: <span foreground=\"green\">✅</span>");
m_profile_button.set_sensitive(true);
}
else
{
m_skeleton_status_label.set_text("Status: ❌");
m_profile_status_label.set_text("Status: ❌");
m_skeleton_status_label.set_markup("Status: <span foreground=\"red\">❌</span>");

m_profile_status_label.set_markup("Status: <span foreground=\"red\">❌</span>");
m_profile_button.set_sensitive(false);
}
}

void MainInput::set_profile_ready_state(bool is_ready)
{
if (is_ready)
m_profile_status_label.set_text("Status: ");
m_profile_status_label.set_markup("Status: <span foreground=\"green\">✅</span>");
else
m_profile_status_label.set_text("Status: ");
m_profile_status_label.set_markup("Status: <span foreground=\"red\">❌</span>");
}

void MainInput::on_skeleton_input_changed()
Expand Down
6 changes: 5 additions & 1 deletion src/pangocairo-to-contour.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ using namespace fmt;
// Take a pango markup and turn it into a cairo context that is returned
Cairo::RefPtr<Cairo::Context> TeXtrusion::markup_to_context()
{
PangoFontMap *fm = pango_ft2_font_map_new();
PangoFontMap *fm;
fm = pango_ft2_font_map_new();
RefPtr<Pango::FontMap> fontmap = Glib::wrap(fm);
RefPtr<Pango::Context> context = fontmap->create_context();

// TBD: Remove this to see if works on windows
// font_description = Pango::FontDescription("DejaVu Serif Bold 48");

context->set_font_description(font_description);

auto surface = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, 500, 500);
Expand Down
12 changes: 9 additions & 3 deletions src/pomelo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -159,17 +159,23 @@ void Pomelo::on_action_help_about()

Dialog.set_version("0.0.1");
Dialog.set_copyright("Dov Grobgeld <[email protected]>");
Dialog.set_comments("A program for generating 3D meshes of text");
Dialog.set_comments(format(
"A program for generating 3D meshes of text\n\n"
"Commit-Id: {}\n"
"Commit-time: {}\n",
COMMIT_ID,
COMMIT_TIME));

Glib::RefPtr<const Glib::Bytes> copying_bytes = Gio::Resource::lookup_data_global("/about/COPYING");

gsize len=0;
const char* copying_txt = (const char*)copying_bytes->get_data(len);

Dialog.set_license(copying_txt);
Dialog.set_program_name("Pomelo");
Dialog.set_license_type(Gtk::LICENSE_GPL_3_0);
Dialog.set_program_name("Pomelo 3D");
Dialog.set_website("http://github.com/dov/pomelo");
Dialog.set_website_label("pomelo website");
Dialog.set_website_label("Pomelo 3D website");
Dialog.set_transient_for(*this);

std::vector<Glib::ustring> list_authors;
Expand Down

0 comments on commit 2cbbbd7

Please sign in to comment.