From 13b1fd19091ff6c6387828eac816f91152620346 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 20 Sep 2014 15:25:47 +0200 Subject: avoid rebuild after commit Issue: #59 --- CMakeLists.txt | 15 +++++++++------ facetracknoir/facetracknoir.cpp | 5 +++-- facetracknoir/facetracknoir.h | 2 -- facetracknoir/version.c | 5 +++++ opentrack-version.h | 7 ------- 5 files changed, 17 insertions(+), 17 deletions(-) create mode 100644 facetracknoir/version.c delete mode 100644 opentrack-version.h diff --git a/CMakeLists.txt b/CMakeLists.txt index ae54f90f..633bf587 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -196,6 +196,8 @@ opentrack_module(opentrack-tracker-rift ftnoir_tracker_rift) opentrack_module(opentrack-tracker-hydra ftnoir_tracker_hydra) opentrack_module(opentrack-tracker-freepie-udp ftnoir_tracker_freepie-udp) +file(GLOB opentrack-version-c "facetracknoir/version.c") + file(GLOB opentrack-csv-c "ftnoir_csv/*.cpp" "ftnoir_csv/*.h") # compat lib for POSIX/win32 @@ -257,6 +259,11 @@ target_link_libraries(opentrack-pose-widget ${MY_QT_LIBS}) add_library(opentrack-spline-widget SHARED ${opentrack-spline-widget-c}) target_link_libraries(opentrack-spline-widget ${MY_QT_LIBS}) +add_library(opentrack-version STATIC ${opentrack-version-c}) +set_target_properties(opentrack-version PROPERTIES + COMPILE_DEFINITIONS + "IN_VERSION_UNIT;OPENTRACK_VERSION=\"${OPENTRACK__COMMIT}\"") + opentrack_library(opentrack-filter-accela) opentrack_library(opentrack-filter-kalman) opentrack_library(opentrack-filter-ewma) @@ -419,17 +426,13 @@ if(UNIX OR APPLE) target_link_libraries(opentrack-qxt-mini X11) endif() endif() + add_executable(opentrack ${opentrack-win32-executable} ${opentrack-bin-c} ${opentrack-bin-uih} ${opentrack-bin-rcc}) -set_target_properties(opentrack PROPERTIES COMPILE_DEFINITIONS OPENTRACK_VERSION=\"${OPENTRACK__COMMIT}\") -set(OPENTRACK_COMMIT_VERSION \"${OPENTRACK__COMMIT}\") -configure_file("${CMAKE_SOURCE_DIR}/opentrack-version.h" "${CMAKE_BINARY_DIR}/opentrack-version.h" @ONLY NEWLINE_STYLE UNIX) if(APPLE) SET_TARGET_PROPERTIES(opentrack-qxt-mini PROPERTIES LINK_FLAGS "-framework Carbon -framework CoreFoundation") endif() -set_target_properties(opentrack PROPERTIES COMPILE_DEFINITIONS OPENTRACK_VERSION=\"${OPENTRACK__COMMIT}\") - if(UNIX OR APPLE) target_link_libraries(opentrack opentrack-qxt-mini) endif() @@ -446,7 +449,7 @@ if(CMAKE_SYSTEM STREQUAL LINUX) link_libraries(rt) endif() -target_link_libraries(opentrack opentrack-pose-widget opentrack-spline-widget ${MY_QT_LIBS} ${QXT_QXTCORE_LIB_RELEASE} ${QXT_QXTWIDGETS_LIB_RELEASE}) +target_link_libraries(opentrack opentrack-version opentrack-pose-widget opentrack-spline-widget ${MY_QT_LIBS} ${QXT_QXTCORE_LIB_RELEASE} ${QXT_QXTWIDGETS_LIB_RELEASE}) if(NOT WIN32) target_link_libraries(opentrack dl) endif() diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index dfa13577..43c96f13 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -25,7 +25,6 @@ #include "shortcuts.h" #include "tracker.h" #include "curve-config.h" -#include "opentrack-version.h" #include #if defined(_WIN32) @@ -581,6 +580,8 @@ void FaceTrackNoIR::exit() { QCoreApplication::exit(0); } +extern "C" volatile const char* opentrack_version; + void FaceTrackNoIR::fill_profile_cbx() { if (looping) @@ -590,7 +591,7 @@ void FaceTrackNoIR::fill_profile_cbx() QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); qDebug() << "Config file now" << currentFile; QFileInfo pathInfo ( currentFile ); - setWindowTitle(QString( OPENTRACK_VERSION " :: ") + pathInfo.fileName()); + setWindowTitle(QString( const_cast(opentrack_version) + QStringLiteral(" :: ")) + pathInfo.fileName()); QDir settingsDir( pathInfo.dir() ); QStringList filters; filters << "*.ini"; diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index f6f4afdf..713a51f0 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -55,8 +55,6 @@ using namespace options; #include "ftnoir_tracker_base/ftnoir_tracker_base.h" #include "ftnoir_filter_base/ftnoir_filter_base.h" -#include "opentrack-version.h" - class Tracker; // pre-define class to avoid circular includes class FaceTrackNoIR; diff --git a/facetracknoir/version.c b/facetracknoir/version.c new file mode 100644 index 00000000..0ef4ec14 --- /dev/null +++ b/facetracknoir/version.c @@ -0,0 +1,5 @@ +#ifdef IN_VERSION_UNIT +# define IN_CRAPOLA_COMPILE_UNIT +volatile const char* opentrack_version = OPENTRACK_VERSION; +#else +#endif diff --git a/opentrack-version.h b/opentrack-version.h deleted file mode 100644 index f31d5edf..00000000 --- a/opentrack-version.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef OPENTRACK_VERSION -# define OPENTRACK_VERSION @OPENTRACK_COMMIT_VERSION@ -#else -# ifndef OPENTRACK_VERSION -# define OPENTRACK_VERSION "Mourns-For-Trees" -# endif -#endif -- cgit v1.2.3