Skip to content

Commit

Permalink
Config: Move git info to separate header
Browse files Browse the repository at this point in the history
Reduces build tasks after checkout from ~120 to 2 object files and
their dependencies
  • Loading branch information
danemtsov authored and Technius committed Jan 27, 2022
1 parent 5aebe89 commit 4ecca99
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 28 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ configure_file(
ESCAPE_QUOTES @ONLY
)

configure_file(
src/config-git.h.in
src/config-git.h
ESCAPE_QUOTES @ONLY
)

configure_file(
src/config-paths.h.in
src/config-paths.h
Expand Down
40 changes: 40 additions & 0 deletions src/config-git.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Xournal++
*
* Current git repo info
*
* @author Xournal++ Team
* https://github.com/xournalpp/xournalpp
*
* @license GNU GPLv2 or later
*/

#pragma once


/* --- Current git repo info --- */

/**
* Origin URL of current repository
*/
constexpr auto GIT_ORIGIN_URL = "@GIT_ORIGIN_URL@";

/**
* Git origin repo owner
*/
constexpr auto GIT_ORIGIN_OWNER = "@GIT_ORIGIN_OWNER@";

/**
* Git origin repo name
*/
constexpr auto GIT_ORIGIN_REPO = "@GIT_ORIGIN_REPO@";

/**
* Current branch of git repo
*/
constexpr auto GIT_BRANCH = "@GIT_BRANCH@";

/**
* Current git commit id (with "-dirty" appended if dirty source tree)
*/
constexpr auto GIT_COMMIT_ID = "@RELEASE_IDENTIFIER@";
28 changes: 0 additions & 28 deletions src/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -44,34 +44,6 @@ constexpr auto PROJECT_URL = "@PROJECT_URL@";
constexpr int FILE_FORMAT_VERSION = @DEV_FILE_FORMAT_VERSION@;


/* --- Current git repo info --- */

/**
* Origin URL of current repository
*/
constexpr auto GIT_ORIGIN_URL = "@GIT_ORIGIN_URL@";

/**
* Git origin repo owner
*/
constexpr auto GIT_ORIGIN_OWNER = "@GIT_ORIGIN_OWNER@";

/**
* Git origin repo name
*/
constexpr auto GIT_ORIGIN_REPO = "@GIT_ORIGIN_REPO@";

/**
* Current branch of git repo
*/
constexpr auto GIT_BRANCH = "@GIT_BRANCH@";

/**
* Current git commit id (with "-dirty" appended if dirty source tree)
*/
constexpr auto GIT_COMMIT_ID = "@RELEASE_IDENTIFIER@";


/* --- I18N --- */

/**
Expand Down
1 change: 1 addition & 0 deletions src/core/control/XournalMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "Control.h"
#include "ExportHelper.h"
#include "config-dev.h"
#include "config-git.h"
#include "config-paths.h"
#include "config.h"
#include "filesystem.h"
Expand Down
2 changes: 2 additions & 0 deletions src/core/gui/dialog/AboutDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include "util/StringUtils.h"
#include "util/i18n.h"

#include "config-git.h"

AboutDialog::AboutDialog(GladeSearchpath* gladeSearchPath): GladeGui(gladeSearchPath, "about.glade", "aboutDialog") {
gtk_label_set_markup(GTK_LABEL(get("lbBuildDate")), __DATE__ ", " __TIME__);
gtk_label_set_markup(GTK_LABEL(get("lbVersion")), PROJECT_VERSION);
Expand Down

0 comments on commit 4ecca99

Please sign in to comment.