[Kst] branches/work/kst/portto4/kst

Peter Kümmel syntheticpp at gmx.net
Sun Dec 5 17:49:50 CET 2010


SVN commit 1203909 by kuemmel:

cmake: add option to merge files when building, this is the fastest way to build kst

 M  +6 -0      cmake/CMakeLists.txt  
 M  +32 -3     cmake/modules/KstMacros.cmake  
 AM            cmake/modules/MergedFilesBuild.cmake  
 M  +2 -0      cmake/src/libkstapp/CMakeLists.txt  
 M  +2 -0      cmake/src/libkstmath/CMakeLists.txt  
 M  +9 -9      src/libkst/primitivefactory.cpp  
 M  +7 -8      src/libkstapp/applicationsettings.cpp  
 M  +3 -0      src/libkstapp/defaultlabelpropertiestab.h  
 M  +8 -0      src/libkstapp/histogramdialog.h  
 M  +12 -12    src/libkstmath/csd.cpp  
 M  +9 -9      src/libkstmath/relationfactory.cpp  


--- branches/work/kst/portto4/kst/cmake/CMakeLists.txt #1203908:1203909
@@ -5,6 +5,12 @@
 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules")
 include(KstMacros)
 
+message(STATUS "")
+message(STATUS "Build options:")
+message(STATUS "")
+kst_option(merge_files "Merge files to speedup build" OFFS all)
+message(STATUS "")
+
 find_package(Qt4 REQUIRED)
 find_package(Getdata)
 find_package(Gsl)
--- branches/work/kst/portto4/kst/cmake/modules/KstMacros.cmake #1203908:1203909
@@ -1,5 +1,9 @@
+include(MergedFilesBuild)
+
+
 macro(kst_init name)
 	set(kst_name ${name})
+	set(kst_${kst_name}_dont_merge)
 endmacro()
 
 
@@ -16,17 +20,38 @@
 	set(kst_${kst_name}_sources ${_sources} ${_sources_cpp} ${_mocs} ${_uis})
 	set(kst_${kst_name}_headers ${_headers})
 	set(kst_${kst_name}_folder  ${_folder})
+	set(kst_${kst_name}_mocs    ${_mocs})
+	set(kst_${kst_name}_ui_files ${_ui_files})
+	set(kst_${kst_name}_uis     ${_uis})
 	set(kst_${kst_name}_includes ${_folder} ${CMAKE_CURRENT_BINARY_DIR} CACHE STRING "Include dir for ${kst_name}" FORCE)
 	source_group("Ui" FILES ${_mocs} ${_ui_files})
 	source_group("Generated" FILES ${_mocs} ${_uis})
 endmacro()
 
+macro(kst_dont_merge)
+	set(kst_${kst_name}_dont_merge)
+	foreach(_it ${ARGV})
+		set(kst_${kst_name}_dont_merge ${kst_${kst_name}_dont_merge} ${kst_${kst_name}_folder}/${_it})
+	endforeach()
+endmacro()
 
 macro(kst_add_library type)
 	include_directories(${kst_${kst_name}_folder} ${CMAKE_CURRENT_BINARY_DIR})
 	string(TOUPPER BUILD_${kst_name} _build_macro)
 	add_definitions(-D${_build_macro})
+	if(kst_merge_files)
+		set(merge_rebuild 1)
+		foreach(_it ${kst_${kst_name}_dont_merge})
+			list(REMOVE_ITEM kst_${kst_name}_sources ${_it})
+		endforeach()
+		merged_files_build(merged kst_${kst_name}_sources)
+		set(depends_moc_uic ${kst_${kst_name}_headers} ${kst_${kst_name}_uis} ${kst_${kst_name}_ui_files} ${kst_${kst_name}_mocs})
+		set_source_files_properties(merged_const.cpp   PROPERTIES OBJECT_DEPENDS "${depends_moc_uic}")
+		set_source_files_properties(merged_touched.cpp PROPERTIES OBJECT_DEPENDS "${depends_moc_uic}")
+		add_library(${kst_name} ${type} ${merged_files} ${kst_${kst_name}_dont_merge} ${kst_${kst_name}_headers} ${kst_${kst_name}_uis})
+	else()		
 	add_library(${kst_name} ${type} ${kst_${kst_name}_sources} ${kst_${kst_name}_headers})
+	endif()
 	target_link_libraries(${kst_name} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTXML_LIBRARY})
 endmacro()
 
@@ -69,8 +94,12 @@
 		set(_file ${kst_${kst_name}_folder}/${_item})
 		set(_moc)
 		qt4_wrap_cpp(_moc ${_file}.h)
+		if(kst_${kst_name}_sources)
 		list(REMOVE_ITEM kst_${kst_name}_sources ${_file}.cpp ${_file}.c ${_moc})
-		#list(REMOVE_ITEM kst_${kst_name}_headers ${_file}.h)
+		endif()
+		if(kst_${kst_name}_headers)
+			list(REMOVE_ITEM kst_${kst_name}_headers ${_file}.h)
+		endif()
 	endforeach()
 endmacro()
 
@@ -89,11 +118,11 @@
 		set(_system ${_sys})
 	endif()
 	if(${_system} MATCHES "all")
-		option(KST_${_name} ${_description} ${_default})
+		option(kst_${_name} ${_description} ${_default})
 		set(_msg ON)
 	else()
 		if(${${_system}})
-			option(KST_${_name} ${_description} ${_default})
+			option(kst_${_name} ${_description} ${_default})
 			set(_msg ON)
 		endif()
 	endif()
--- branches/work/kst/portto4/kst/cmake/src/libkstapp/CMakeLists.txt #1203908:1203909
@@ -5,3 +5,5 @@
 kst_include_directories(kstcore kstmath kstwidgets)
 
 kst_add_library(STATIC)
+
+kst_link(kstcore kstmath kstwidgets)
\ No newline at end of file
--- branches/work/kst/portto4/kst/cmake/src/libkstmath/CMakeLists.txt #1203908:1203909
@@ -2,6 +2,8 @@
 
 kst_files_find(src/libkstmath)
 
+kst_dont_merge(eparse.cpp escan.cpp fftsg_h.c)
+
 kst_include_directories(kstcore)
 
 kst_add_library(SHARED)
--- branches/work/kst/portto4/kst/src/libkst/primitivefactory.cpp #1203908:1203909
@@ -17,14 +17,14 @@
 
 namespace Kst {
 
-static QMap<QString, PrimitiveFactory*> *factories = 0;
+static QMap<QString, PrimitiveFactory*> *primitive_factories = 0;
 
 void cleanupPrimitives() {
-  foreach (PrimitiveFactory *f, *factories) {
+  foreach (PrimitiveFactory *f, *primitive_factories) {
     delete f;
   }
-  delete factories;
-  factories = 0;
+  delete primitive_factories;
+  primitive_factories = 0;
 }
 
 
@@ -37,11 +37,11 @@
 
 
 void PrimitiveFactory::registerFactory(const QString& node, PrimitiveFactory *factory) {
-  if (!factories) {
-    factories = new QMap<QString,PrimitiveFactory*>;
+  if (!primitive_factories) {
+    primitive_factories = new QMap<QString,PrimitiveFactory*>;
     qAddPostRoutine(cleanupPrimitives);
   }
-  factories->insert(node, factory);
+  primitive_factories->insert(node, factory);
 }
 
 
@@ -53,11 +53,11 @@
 
 
 PrimitivePtr PrimitiveFactory::parse(ObjectStore *store, QXmlStreamReader& stream) {
-  if (!factories) {
+  if (!primitive_factories) {
     return 0;
   }
 
-  PrimitiveFactory *f = factories->value(stream.name().toString());
+  PrimitiveFactory *f = primitive_factories->value(stream.name().toString());
   if (!f) {
     return 0;
   }
--- branches/work/kst/portto4/kst/src/libkstapp/applicationsettings.cpp #1203908:1203909
@@ -13,6 +13,7 @@
 #include "applicationsettings.h"
 
 #include "updatemanager.h"
+#include "defaultlabelpropertiestab.h"
 
 #include <QCoreApplication>
 #include <QGLPixelBuffer>
@@ -26,22 +27,20 @@
 
 namespace Kst {
 
-const double A4Width = (29.7 - 3.0); //  A4 with a 1.5 cm margin;
-const double A4Height = (21.0 - 3.0); // A4 with a 1.5 cm margin;
 
-static ApplicationSettings *_self = 0;
+static ApplicationSettings *settings_self = 0;
 void ApplicationSettings::cleanup() {
-  delete _self;
-  _self = 0;
+  delete settings_self;
+  settings_self = 0;
 }
 
 
 ApplicationSettings *ApplicationSettings::self() {
-  if (!_self) {
-    _self = new ApplicationSettings;
+  if (!settings_self) {
+    settings_self = new ApplicationSettings;
     qAddPostRoutine(cleanup);
   }
-  return _self;
+  return settings_self;
 }
 
 
--- branches/work/kst/portto4/kst/src/libkstapp/defaultlabelpropertiestab.h #1203908:1203909
@@ -50,6 +50,9 @@
     void referenceViewSizeComboChanged(int i);
 };
 
+extern const double A4Width; //  A4 with a 1.5 cm margin;
+extern const double A4Height; // A4 with a 1.5 cm margin;
+
 }
 
 #endif
--- branches/work/kst/portto4/kst/src/libkstapp/histogramdialog.h #1203908:1203909
@@ -24,6 +24,14 @@
 
 #include "kst_export.h"
 
+#ifdef min
+#undef min
+#endif
+
+#ifdef max
+#undef max
+#endif
+
 namespace Kst {
 
 class HistogramTab : public DataTab, Ui::HistogramTab {
--- branches/work/kst/portto4/kst/src/libkstmath/csd.cpp #1203908:1203909
@@ -37,7 +37,7 @@
 const QString CSD::staticTypeString = I18N_NOOP("Cumulative Spectral Decay");
 const QString CSD::staticTypeTag = I18N_NOOP("csd");
 
-static const QLatin1String INVECTOR = QLatin1String("I");
+static const QLatin1String CSD_INVECTOR = QLatin1String("I");
 static const QLatin1String& OUTMATRIX = QLatin1String("M");
 
 #define KSTCSDMAXLEN 27
@@ -69,7 +69,7 @@
     PSDType in_outputType, const QString& in_vectorUnits,
     const QString& in_rateUnits) {
 
-  _inputVectors[INVECTOR] = in_V;
+  _inputVectors[CSD_INVECTOR] = in_V;
   QString vecName = in_V ? in_V->Name() : QString();
   _frequency = in_freq;
   _average = in_average;
@@ -101,7 +101,7 @@
 
 void CSD::internalUpdate() {
 
-  VectorPtr inVector = _inputVectors[INVECTOR];
+  VectorPtr inVector = _inputVectors[CSD_INVECTOR];
 
   writeLockInputsAndOutputs();
 
@@ -151,7 +151,7 @@
 
 void CSD::save(QXmlStreamWriter &s) {
   s.writeStartElement(staticTypeTag);
-  s.writeAttribute("vector", _inputVectors[INVECTOR]->Name());
+  s.writeAttribute("vector", _inputVectors[CSD_INVECTOR]->Name());
   s.writeAttribute("samplerate", QString::number(_frequency));
   s.writeAttribute("gaussiansigma", QString::number(_gaussianSigma));
   s.writeAttribute("average", QVariant(_average).toString());
@@ -170,7 +170,7 @@
 
 
 void CSD::setVector(VectorPtr new_v) {
-  VectorPtr v = _inputVectors[INVECTOR];
+  VectorPtr v = _inputVectors[CSD_INVECTOR];
   if (v) {
     if (v == new_v) {
       return;
@@ -178,14 +178,14 @@
     v->unlock();
   }
 
-  _inputVectors.remove(INVECTOR);
+  _inputVectors.remove(CSD_INVECTOR);
   new_v->writeLock();
-  _inputVectors[INVECTOR] = new_v;
+  _inputVectors[CSD_INVECTOR] = new_v;
 }
 
 
 VectorPtr CSD::vector() const {
-  return _inputVectors[INVECTOR];
+  return _inputVectors[CSD_INVECTOR];
 }
 
 
@@ -195,7 +195,7 @@
 
 
 QString CSD::propertyString() const {
-  return i18n("CSD: %1").arg(_inputVectors[INVECTOR]->Name());
+  return i18n("CSD: %1").arg(_inputVectors[CSD_INVECTOR]->Name());
 }
 
 
@@ -327,7 +327,7 @@
 DataObjectPtr CSD::makeDuplicate() const{
 
   CSDPtr csd = store()->createObject<CSD>();
-  csd->change(_inputVectors[INVECTOR],
+  csd->change(_inputVectors[CSD_INVECTOR],
               _frequency,
               _average,
               _removeMean,
@@ -366,7 +366,7 @@
     label = i18n("Power Spectrum \\[%1^2\\]").arg(_vectorUnits);
     break;
   }
-  label += " of " + _inputVectors[INVECTOR]->descriptiveName();
+  label += " of " + _inputVectors[CSD_INVECTOR]->descriptiveName();
   _outMatrix->setLabel(label);
 
 }
@@ -386,7 +386,7 @@
     if (apodize()) tip += i18n("Apodize; ");
     if (removeMean()) tip += i18n("Remove Mean;");
   }
-  tip += i18n("\nInput: %1").arg(_inputVectors[INVECTOR]->descriptionTip());
+  tip += i18n("\nInput: %1").arg(_inputVectors[CSD_INVECTOR]->descriptionTip());
   return tip;
  
 }
--- branches/work/kst/portto4/kst/src/libkstmath/relationfactory.cpp #1203908:1203909
@@ -17,14 +17,14 @@
 
 namespace Kst {
 
-static QMap<QString, RelationFactory*> *factories = 0;
+static QMap<QString, RelationFactory*> *relation_factories = 0;
 
 void cleanupRelations() {
-  foreach (RelationFactory *f, *factories) {
+  foreach (RelationFactory *f, *relation_factories) {
     delete f;
   }
-  delete factories;
-  factories = 0;
+  delete relation_factories;
+  relation_factories = 0;
 }
 
 
@@ -37,11 +37,11 @@
 
 
 void RelationFactory::registerFactory(const QString& node, RelationFactory *factory) {
-  if (!factories) {
-    factories = new QMap<QString,RelationFactory*>;
+  if (!relation_factories) {
+    relation_factories = new QMap<QString,RelationFactory*>;
     qAddPostRoutine(cleanupRelations);
   }
-  factories->insert(node, factory);
+  relation_factories->insert(node, factory);
 }
 
 
@@ -53,11 +53,11 @@
 
 
 RelationPtr RelationFactory::parse(ObjectStore *store, QXmlStreamReader& stream) {
-  if (!factories) {
+  if (!relation_factories) {
     return 0;
   }
 
-  RelationFactory *f = factories->value(stream.name().toString());
+  RelationFactory *f = relation_factories->value(stream.name().toString());
   if (!f) {
     return 0;
   }


More information about the Kst mailing list