mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-13 00:07:24 +00:00
better management of nightly version to improve compile times
This commit is contained in:
parent
ac52ffdd76
commit
ae4feb8b9d
@ -5,13 +5,14 @@ if (MESHLAB_IS_NIGHTLY_VERSION)
|
||||
# nightly version is in the form:
|
||||
# YYYY.mm[d]_nightly_GIT_SHA1
|
||||
# YYYY and mm are computed by cmake and not read from file
|
||||
# the GIT_SHA1 is stored in file, which will be read at runtime
|
||||
find_package(Git)
|
||||
execute_process(COMMAND
|
||||
"${GIT_EXECUTABLE}" describe --match=NeVeRmAtCh --always --abbrev=7
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE GIT_SHA1
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
set(MESHLAB_VERSION "${MESHLAB_VERSION}_nightly_${GIT_SHA1}")
|
||||
file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/resources/git_sha.txt ${GIT_SHA1})
|
||||
else()
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../../ML_VERSION")
|
||||
# YYYY and mm are read from file
|
||||
@ -19,18 +20,17 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# if double precision version, "d" is inserted after 7 chars (YYYY.mmd*)
|
||||
if (BUILD_WITH_DOUBLE_SCALAR)
|
||||
string(LENGTH ${MESHLAB_VERSION} MLV_LEN)
|
||||
MATH(EXPR MLV_POSTFIX_LEN "${MLV_LEN}-7") # how many chars there are adter YYYY.mm
|
||||
string(SUBSTRING ${MESHLAB_VERSION} 0 7 MLV_PREFIX)
|
||||
string(SUBSTRING ${MESHLAB_VERSION} 7 ${MLV_POSTFIX_LEN} MLV_POSTFIX)
|
||||
set(MESHLAB_VERSION "${MLV_PREFIX}d${MLV_POSTFIX}")
|
||||
set(MESHLAB_VERSION "${MESHLAB_VERSION}d")
|
||||
endif()
|
||||
|
||||
|
||||
set(MESHLAB_VERSION ${MESHLAB_VERSION} PARENT_SCOPE)
|
||||
message(STATUS "MeshLab version: ${MESHLAB_VERSION}")
|
||||
if (MESHLAB_IS_NIGHTLY_VERSION)
|
||||
message(STATUS "MeshLab version: ${MESHLAB_VERSION}_nightly_${GIT_SHA1}")
|
||||
else()
|
||||
message(STATUS "MeshLab version: ${MESHLAB_VERSION}")
|
||||
endif()
|
||||
|
||||
if (BUILD_WITH_DOUBLE_SCALAR)
|
||||
message(STATUS "Building with double precision")
|
||||
@ -138,6 +138,12 @@ target_compile_definitions(meshlab-common
|
||||
MESHLAB_VERSION=${MESHLAB_VERSION}
|
||||
MESHLAB_SCALAR=${MESHLAB_SCALAR})
|
||||
|
||||
if (MESHLAB_IS_NIGHTLY_VERSION)
|
||||
target_compile_definitions(meshlab-common
|
||||
PUBLIC
|
||||
MESHLAB_IS_NIGHTLY)
|
||||
endif()
|
||||
|
||||
target_include_directories(meshlab-common
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
|
||||
@ -124,7 +124,7 @@ QString meshlab::defaultShadersPath()
|
||||
QString meshlab::logDebugFileName()
|
||||
{
|
||||
static QString filename = QDir::homePath() + "/MeshLab" +
|
||||
QString::fromStdString(meshlab::meshlabVersion()) + " " +
|
||||
QString::fromStdString(meshlab::meshlabCompleteVersion()) + " " +
|
||||
QDateTime::currentDateTime().toString() + ".log";
|
||||
return filename;
|
||||
}
|
||||
@ -147,6 +147,20 @@ ActionSearcher& meshlab::actionSearcherInstance()
|
||||
return as;
|
||||
}
|
||||
|
||||
std::string meshlab::meshlabCompleteVersion()
|
||||
{
|
||||
std::string ver = meshlabVersion();
|
||||
#ifdef MESHLAB_IS_NIGHTLY
|
||||
QFile f(":/resources/git_sha.txt");
|
||||
if (f.open(QFile::ReadOnly | QFile::Text)) {
|
||||
QTextStream in(&f);
|
||||
ver += "_nightly_" + in.readAll().toStdString();
|
||||
f.close();
|
||||
}
|
||||
#endif
|
||||
return ver;
|
||||
}
|
||||
|
||||
pymeshlab::FunctionSet& pymeshlab::functionSetInstance()
|
||||
{
|
||||
static FunctionSet fs(meshlab::pluginManagerInstance());
|
||||
|
||||
@ -28,6 +28,11 @@
|
||||
#define mlstringify(a) #a
|
||||
|
||||
#include <QString>
|
||||
#ifdef MESHLAB_IS_NIGHTLY
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#endif
|
||||
|
||||
#ifndef MESHLAB_VERSION
|
||||
#error "MESHLAB_VERSION needs to be defined!"
|
||||
#endif
|
||||
@ -57,6 +62,8 @@ inline std::string meshlabVersion()
|
||||
return std::string(meshlab_xstr(MESHLAB_VERSION));
|
||||
}
|
||||
|
||||
std::string meshlabCompleteVersion();
|
||||
|
||||
inline bool builtWithDoublePrecision()
|
||||
{
|
||||
return std::string(meshlab_xstr(MESHLAB_SCALAR)) == std::string("double");
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>img/dummy.png</file>
|
||||
<file>resources/images/dummy.png</file>
|
||||
<file>resources/git_sha.txt</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@ -87,7 +87,7 @@ QString MeshModel::relativePathName(const QString& path) const
|
||||
* and these names will be mapped with the actual loaded image in the map
|
||||
* "textures".
|
||||
*
|
||||
* When a texture is not found, a dummy texture will be used (":/img/dummy.png").
|
||||
* When a texture is not found, a dummy texture will be used (":/resources/images/dummy.png").
|
||||
*
|
||||
* Returns the list of non-loaded textures that have been modified with
|
||||
* ":/img/dummy.png" in the contained mesh.
|
||||
@ -99,7 +99,7 @@ std::list<std::string> MeshModel::loadTextures(
|
||||
std::list<std::string> unloadedTextures;
|
||||
for (std::string& textName : cm.textures){
|
||||
if (textures.find(textName) == textures.end()){
|
||||
QImage img(":/img/dummy.png");
|
||||
QImage img(":/resources/images/dummy.png");
|
||||
QFileInfo finfo(QString::fromStdString(textName));
|
||||
try {
|
||||
img = meshlab::loadImage(finfo.absoluteFilePath(), log, cb);
|
||||
|
||||
@ -42,7 +42,7 @@ bool MeshLabApplication::notify( QObject * rec, QEvent * ev )
|
||||
|
||||
const QString MeshLabApplication::appVer()
|
||||
{
|
||||
return QString::fromStdString(meshlab::meshlabVersion());
|
||||
return QString::fromStdString(meshlab::meshlabCompleteVersion());
|
||||
}
|
||||
|
||||
const QString MeshLabApplication::compilerVersion()
|
||||
|
||||
0
src/common/resources/git_sha.txt
Normal file
0
src/common/resources/git_sha.txt
Normal file
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
@ -339,7 +339,7 @@ QImage loadImage(const QString& filename, GLLogStream* log, vcg::CallBackPos* cb
|
||||
|
||||
QImage getDummyTexture()
|
||||
{
|
||||
return QImage(":/img/dummy.png");
|
||||
return QImage(":/resources/images/dummy.png");
|
||||
}
|
||||
|
||||
void saveImage(
|
||||
|
||||
@ -51,7 +51,7 @@ int main(int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
if (versOpt1==argv[1] || versOpt2==argv[1]){
|
||||
std::cout << "MeshLab " << meshlab::meshlabVersion() << "\n";
|
||||
std::cout << "MeshLab " << meshlab::meshlabCompleteVersion() << "\n";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user