cmake: compile git hash into separate object
Should improve incremental compile speeds
This commit is contained in:
@@ -165,12 +165,6 @@ if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
if(DEFINED GIT_HASH)
|
||||
message("Olive: Git hash = " "${GIT_HASH}")
|
||||
list(APPEND OLIVE_DEFINITIONS -DGITHASH="${GIT_HASH}")
|
||||
else()
|
||||
message("Olive: No Git hash defined!")
|
||||
endif()
|
||||
|
||||
# Optional: Find Doxygen if requested
|
||||
if(BUILD_DOXYGEN)
|
||||
|
||||
@@ -59,6 +59,17 @@ set(OLIVE_RESOURCES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/ts/translations.qrc
|
||||
)
|
||||
|
||||
# Add version object
|
||||
add_library(olive-version-obj
|
||||
OBJECT
|
||||
version.cpp
|
||||
version.h
|
||||
)
|
||||
target_link_libraries(olive-version-obj PRIVATE Qt5::Core)
|
||||
if(DEFINED GIT_HASH)
|
||||
target_compile_options(olive-version-obj PRIVATE -DGITHASH="${GIT_HASH}")
|
||||
endif()
|
||||
|
||||
# Add main library
|
||||
add_library(libolive-editor
|
||||
OBJECT
|
||||
@@ -73,6 +84,7 @@ set_target_properties(libolive-editor PROPERTIES PREFIX "")
|
||||
add_executable(olive-editor
|
||||
main.cpp
|
||||
$<TARGET_OBJECTS:libolive-editor>
|
||||
$<TARGET_OBJECTS:olive-version-obj>
|
||||
)
|
||||
|
||||
# Create docs if doxygen was found
|
||||
|
||||
@@ -19,6 +19,7 @@ add_executable(
|
||||
olive-crashhandler
|
||||
crashhandler.cpp
|
||||
crashhandler.h
|
||||
$<TARGET_OBJECTS:olive-version-obj>
|
||||
)
|
||||
|
||||
# Disable console appearing on crash handler dialog
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
|
||||
#include "common/crashpadutils.h"
|
||||
#include "common/filefunctions.h"
|
||||
#include "version.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
@@ -227,7 +228,7 @@ void CrashHandlerDialog::SendErrorReport()
|
||||
QHttpPart commit_part;
|
||||
commit_part.setHeader(QNetworkRequest::ContentTypeHeader, QStringLiteral("text/plain; charset=UTF-8"));
|
||||
commit_part.setHeader(QNetworkRequest::ContentDispositionHeader, QStringLiteral("form-data; name=\"commit\""));
|
||||
commit_part.setBody(GITHASH);
|
||||
commit_part.setBody(kGitHash);
|
||||
multipart->append(commit_part);
|
||||
|
||||
// Create dump section
|
||||
|
||||
+6
-5
@@ -40,6 +40,7 @@ extern "C" {
|
||||
#include "core.h"
|
||||
#include "common/commandlineparser.h"
|
||||
#include "common/debug.h"
|
||||
#include "version.h"
|
||||
|
||||
#ifdef USE_CRASHPAD
|
||||
#include "common/crashpadinterface.h"
|
||||
@@ -52,12 +53,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Generate version string
|
||||
QString app_version = APPVERSION;
|
||||
#ifdef GITHASH
|
||||
// Anything after the hyphen is considered "unimportant" information. Text BEFORE the hyphen is used in version
|
||||
// checking project files and config files
|
||||
if (!olive::kGitHash.isEmpty()) {
|
||||
// Anything after the hyphen is considered "unimportant" information. Text BEFORE the hyphen is
|
||||
// used in version checking project files and config files
|
||||
app_version.append("-");
|
||||
app_version.append(GITHASH);
|
||||
#endif
|
||||
app_version.append(olive::kGitHash);
|
||||
}
|
||||
|
||||
// Set application metadata
|
||||
QCoreApplication::setOrganizationName("olivevideoeditor.org");
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2021 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "version.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
#ifdef GITHASH
|
||||
QString kGitHash = QStringLiteral(GITHASH);
|
||||
#else
|
||||
QString kGitHash;
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2021 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef GITHASH_H
|
||||
#define GITHASH_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
namespace olive {
|
||||
|
||||
extern QString kGitHash;
|
||||
|
||||
}
|
||||
|
||||
#endif // GITHASH_H
|
||||
Reference in New Issue
Block a user