Skip to content

Commit

Permalink
Reuse akira-library in Akira (akiraux#576)
Browse files Browse the repository at this point in the history
Instead of essentially building the entire project twice, we can reduce
build times by only building src/Main.vala and then statically linking
it with akira-library.
  • Loading branch information
Prince781 authored May 3, 2021
1 parent f2a6b24 commit 2a1ac19
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 20 deletions.
3 changes: 2 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# project name and programming language
project('com.github.akiraux.akira', 'vala', 'c')
project('com.github.akiraux.akira', 'vala', 'c',
default_options: 'default_library=static')

akira_prefix = get_option('prefix')
akira_datadir = join_paths(akira_prefix, get_option('datadir'))
Expand Down
2 changes: 1 addition & 1 deletion src/Dialogs/SettingsDialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ public class Akira.Dialogs.SettingsDialog : Gtk.Dialog {
app_icon.pixel_size = 64;
app_icon.margin_top = 12;

var app_name = new Gtk.Label (APP_NAME);
var app_name = new Gtk.Label (Constants.APP_NAME);
app_name.get_style_context ().add_class ("h2");
app_name.margin_top = 6;

Expand Down
7 changes: 2 additions & 5 deletions src/Main.vala
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,13 @@
* Authored by: Alessandro "Alecaddd" Castellani <[email protected]>
*/

public const string APP_NAME = "Akira";
public const string TERMINAL_NAME = "akira";

public static bool verbose = false;

public static int main (string[] args) {
verbose = "-d" in args;

Environment.set_application_name (APP_NAME);
Environment.set_prgname (APP_NAME);
Environment.set_application_name (Constants.APP_NAME);
Environment.set_prgname (Constants.APP_NAME);

var application = new Akira.Application ();

Expand Down
19 changes: 11 additions & 8 deletions src/config.vala.in
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
namespace Constants {
public const string DATADIR = "@DATADIR@";
public const string PKGDATADIR = "@PKGDATADIR@";
public const string GETTEXT_PACKAGE = "@GETTEXT_PACKAGE@";
public const string PROJECT_NAME = "@PROJECT_NAME@";
public const string VERSION = "@VERSION@";
public const string INSTALL_PREFIX = "@PREFIX@";
public const string APP_ID = "@APP_ID@";
public const string PROFILE = "@PROFILE@";
public const string DATADIR = "@DATADIR@";
public const string PKGDATADIR = "@PKGDATADIR@";
public const string GETTEXT_PACKAGE = "@GETTEXT_PACKAGE@";
public const string PROJECT_NAME = "@PROJECT_NAME@";
public const string VERSION = "@VERSION@";
public const string INSTALL_PREFIX = "@PREFIX@";
public const string APP_ID = "@APP_ID@";
public const string PROFILE = "@PROFILE@";

public const string APP_NAME = "Akira";
public const string TERMINAL_NAME = "akira";
}
8 changes: 3 additions & 5 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ config_header = configure_file(
)

sources = files(
'Main.vala',
'Application.vala',
'Window.vala',

Expand Down Expand Up @@ -134,7 +133,7 @@ deps = [
m_dep
]

akira_library = shared_library(
akira_library = library(
'akira-library-1.0',
sources,
asresources,
Expand All @@ -151,9 +150,8 @@ akira_dep = declare_dependency(
# Create a new executable, list the files we want to compile, list the dependencies we need, and install
executable(
application_id,
sources,
'Main.vala',
asresources,
config_header,
dependencies: deps,
dependencies: deps + [akira_dep],
install: true
)

0 comments on commit 2a1ac19

Please sign in to comment.