Browse Source

fixed win32 build for core/basics

Johannes R 12 years ago
parent
commit
07cb71f650

+ 10 - 2
CMakeLists.txt

@@ -7,10 +7,18 @@ include(CheckSymbolExists)
 set(NICELibrary_VERSION_MAJOR 1)
 set(NICELibrary_VERSION_MAJOR 1)
 set(NICELibrary_VERSION_MINOR 0)
 set(NICELibrary_VERSION_MINOR 0)
 
 
-#set(CMAKE_VERBOSE_MAKEFILE on) 
+set(CMAKE_VERBOSE_MAKEFILE on) 
 
 
 set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR})
 set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR})
 
 
+set(NICE_BUILD_LIBS_STATIC_SHARED STATIC)
+
+FIND_PACKAGE(Boost)
+IF (Boost_FOUND)
+    INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})
+    ADD_DEFINITIONS( "-DNICE_BOOST_FOUND" )
+ENDIF()
+
 #IF(WIN32)
 #IF(WIN32)
  # MESSAGE(FATAL_ERROR "not yet ready")
  # MESSAGE(FATAL_ERROR "not yet ready")
 #ENDIF(WIN32) 
 #ENDIF(WIN32) 
@@ -18,7 +26,7 @@ set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR})
 # add the binary tree to the search path for include files
 # add the binary tree to the search path for include files
 #include_directories ("${PROJECT_BINARY_DIR}")
 #include_directories ("${PROJECT_BINARY_DIR}")
 
 
-#SET(CMAKE_USE_RELATIVE_PATHS ON)
+SET(CMAKE_USE_RELATIVE_PATHS ON)
 check_symbol_exists("__assert_fail" "assert.h" HAVE_ASSERT_FAIL)
 check_symbol_exists("__assert_fail" "assert.h" HAVE_ASSERT_FAIL)
 
 
 
 

+ 9 - 0
core/CMakeDefinesConfig.h.in

@@ -0,0 +1,9 @@
+#ifndef CMAKEDEFINESCONFIG_H
+#define CMAKEDEFINESCONFIG_H
+
+#cmakedefine USE_TEST
+
+#cmakedefine WIN32
+
+
+#endif

+ 18 - 0
core/CMakeLists.txt

@@ -1,4 +1,10 @@
 
 
+CONFIGURE_FILE(
+  "CMakeDefinesConfig.h.in"
+  "${PROJECT_BINARY_DIR}/CMakeDefinesConfig.h"
+)
+include_directories("${PROJECT_BINARY_DIR}")
+
 INCLUDE_DIRECTORIES(basics)
 INCLUDE_DIRECTORIES(basics)
 INCLUDE_DIRECTORIES(algebra)
 INCLUDE_DIRECTORIES(algebra)
 INCLUDE_DIRECTORIES(vector)
 INCLUDE_DIRECTORIES(vector)
@@ -14,3 +20,15 @@ ADD_SUBDIRECTORY(algebra)
 ADD_SUBDIRECTORY(vector)
 ADD_SUBDIRECTORY(vector)
 ADD_SUBDIRECTORY(optimization)
 ADD_SUBDIRECTORY(optimization)
 ADD_SUBDIRECTORY(image)
 ADD_SUBDIRECTORY(image)
+
+#SET(core_src 
+#${core_basics_src} 
+#${core_algebra_src}
+#${core_vector_src}
+#${core_optimization}
+#${core_image}
+#)
+
+#MESSAGE(STATUS "${core_src}")
+
+#ADD_LIBRARY(core ${NICE_BUILD_LIBS_STATIC_SHARED} ${core_src})

+ 1 - 1
core/algebra/CMakeLists.txt

@@ -3,6 +3,6 @@ CholeskyRobust.cpp        EigValuesTRLAN.cpp  GMSparseVectorMatrix.cpp  ILSConju
 DiagonalMatrixApprox.cpp  GBCDSolver.cpp      GMStandard.cpp            ILSMinResLanczos.cpp              IterativeLinearSolver.cpp
 DiagonalMatrixApprox.cpp  GBCDSolver.cpp      GMStandard.cpp            ILSMinResLanczos.cpp              IterativeLinearSolver.cpp
 )
 )
 
 
-ADD_LIBRARY(core_algebra SHARED ${core_algebra_src}) 
+ADD_LIBRARY(core_algebra ${NICE_BUILD_LIBS_STATIC_SHARED} ${core_algebra_src}) 
 
 
 INSTALL(TARGETS core_algebra DESTINATION libs)
 INSTALL(TARGETS core_algebra DESTINATION libs)

+ 1 - 1
core/algebra/CholeskyRobustAuto.cpp

@@ -103,7 +103,7 @@ CholeskyRobustAuto::robustChol (const Matrix & A, Matrix & cholA)
 		}
 		}
 
 
 
 
-		if (isnan (m_logDetMatrix) || (m_logDetMatrix < m_minMatrixLogDeterminant))
+		if (NICE::isNaN (m_logDetMatrix) || (m_logDetMatrix < m_minMatrixLogDeterminant))
 		{
 		{
 			robust = false;
 			robust = false;
 		}
 		}

+ 2 - 2
core/algebra/GenericMatrix.cpp

@@ -16,8 +16,8 @@ GMSparse::GMSparse ( const NICE::Matrix & A, double epsilon )
   // derive a sparse matrix from a dense one
   // derive a sparse matrix from a dense one
   m_rows = A.rows ();
   m_rows = A.rows ();
   m_cols = A.cols ();
   m_cols = A.cols ();
-  for ( u_int i = 0; i < m_rows; i++ )
-    for ( u_int j = 0; j < m_cols; j++ )
+  for ( uint i = 0; i < m_rows; i++ )
+    for ( uint j = 0; j < m_cols; j++ )
       if ( fabs ( A ( i, j ) ) > epsilon )
       if ( fabs ( A ( i, j ) ) > epsilon )
         this->A.insert ( this->A.begin (), NICE::triplet < int, int,
         this->A.insert ( this->A.begin (), NICE::triplet < int, int,
                          double > ( i, j, A ( i, j ) ) );
                          double > ( i, j, A ( i, j ) ) );

+ 3 - 1
core/basics/CMakeLists.txt

@@ -4,6 +4,8 @@ Config.cpp         FileName.cpp          numerictools.cpp  Streamable.cpp
 Exception.cpp      FrameRateCounter.cpp  Observable.cpp    StringTools.cpp
 Exception.cpp      FrameRateCounter.cpp  Observable.cpp    StringTools.cpp
 )
 )
 
 
-ADD_LIBRARY(core_basics SHARED ${core_basics_src})
+ADD_SUBDIRECTORY(progs)
+
+ADD_LIBRARY(core_basics ${NICE_BUILD_LIBS_STATIC_SHARED} ${core_basics_src})
 
 
 INSTALL(TARGETS core_basics DESTINATION libs)
 INSTALL(TARGETS core_basics DESTINATION libs)

+ 41 - 0
core/basics/CrossplatformDefines.h

@@ -0,0 +1,41 @@
+#ifndef CROSSPLATFORMDEFINES_H
+#define CROSSPLATFORMDEFINES_H
+
+
+/////////////////////////////////////////////////////////////////////
+//define a consistent warning preprocessor for unix and win systems
+// see http://stackoverflow.com/questions/471935/user-warnings-on-msvc-and-gcc
+
+#define STRINGISE_IMPL(x) #x
+#define STRINGISE(x) STRINGISE_IMPL(x)
+
+// Use: #pragma message WARNING("My message")
+#if _MSC_VER
+#   define FILE_LINE_LINK __FILE__ "(" STRINGISE(__LINE__) ") : "
+#   define WARNING(exp) (FILE_LINE_LINK "WARNING: " exp)
+#else//__GNUC__ - may need other defines for different compilers
+#   define WARNING(exp) ("WARNING: " exp)
+#endif
+
+//
+/////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////
+//
+#include <math.h>
+#ifdef WIN32
+typedef unsigned int uint;
+
+
+inline double round(double r) {
+    return (r > 0.0) ? floor(r + 0.5) : ceil(r - 0.5);
+}
+inline float roundf(float r)
+{
+	return (float)round(r);
+}
+#endif
+
+
+#endif //CROSSPLATFORMDEFINES_H

+ 20 - 4
core/basics/FileMgt.cpp

@@ -7,11 +7,13 @@
 i*/
 i*/
 #include <stdlib.h>
 #include <stdlib.h>
 
 
-#ifndef WIN32
+#ifdef WIN32
+#include <process.h>
+#else
 #include <unistd.h>
 #include <unistd.h>
+#include <sys/file.h>
 #endif
 #endif
 
 
-#include <sys/file.h>
 #include <sys/types.h>    // For stat()
 #include <sys/types.h>    // For stat()
 #include <sys/stat.h>     // For stat()
 #include <sys/stat.h>     // For stat()
 
 
@@ -34,6 +36,7 @@ using namespace NICE;
 
 
 void FileMgt::DirectoryRecursive ( std::vector<string> & files, const std::string & dir )
 void FileMgt::DirectoryRecursive ( std::vector<string> & files, const std::string & dir )
 {	
 {	
+#ifndef WIN32
 	std::string command = "find -L \"" + dir + "\" -type f";
 	std::string command = "find -L \"" + dir + "\" -type f";
 	//cerr << "FileMgt::DirectoryRecursive: find command (" << command << ")" << endl;
 	//cerr << "FileMgt::DirectoryRecursive: find command (" << command << ")" << endl;
 
 
@@ -62,15 +65,20 @@ void FileMgt::DirectoryRecursive ( std::vector<string> & files, const std::strin
 	pclose ( pipe );
 	pclose ( pipe );
 
 
 	std::sort ( files.begin(), files.end() );
 	std::sort ( files.begin(), files.end() );
+#else
+	#pragma message WARNING("FileMgt::DirectoryRecursive() : Function not yet ported for platform WIN")
+	fthrow ( Exception, "FileMgt::DirectoryRecursive() : Function not yet ported for platform WIN");
+#endif
 }
 }
 	
 	
 std::string FileMgt::createTempFile ( const std::string & templatefn )
 std::string FileMgt::createTempFile ( const std::string & templatefn )
 {
 {
+#ifndef WIN32
     int max_iterations = 1024;
     int max_iterations = 1024;
     int iteration = 0;
     int iteration = 0;
     char fn[1024];
     char fn[1024];
     char subst[1024];
     char subst[1024];
-    int pid = (int)getpid();
+	int pid = (int)getpid();
     struct stat statbuf;
     struct stat statbuf;
     int statval = -1;
     int statval = -1;
     int fd = -1;
     int fd = -1;
@@ -100,11 +108,19 @@ std::string FileMgt::createTempFile ( const std::string & templatefn )
 	}
 	}
 
 
     return string(fn);
     return string(fn);
+#else
+	#pragma message WARNING("FileMgt::createTempFile() : Function not yet ported for platform WIN")
+	fthrow ( Exception, "FileMgt::createTempFile() : Function not yet ported for platform WIN");
+#endif
 }
 }
 	
 	
 void FileMgt::deleteTempFile ( const std::string & tempfile )
 void FileMgt::deleteTempFile ( const std::string & tempfile )
 {
 {
-    if ( unlink(tempfile.c_str()) != 0 )
+#ifdef WIN32
+    if ( _unlink(tempfile.c_str()) != 0 )
+#else
+	if ( unlink(tempfile.c_str()) != 0 )
+#endif
     {
     {
 		string errormessage = "FileMgt::deleteTempFile: FATAL ERROR removing "+tempfile+".\n";
 		string errormessage = "FileMgt::deleteTempFile: FATAL ERROR removing "+tempfile+".\n";
 		fprintf (stderr, errormessage.c_str());
 		fprintf (stderr, errormessage.c_str());

+ 41 - 1
core/basics/ResourceStatistics.cpp

@@ -11,6 +11,8 @@
 using namespace NICE;
 using namespace NICE;
 using namespace std;
 using namespace std;
 
 
+#ifndef WIN32
+
 ResourceStatistics::ResourceStatistics(int _mode)
 ResourceStatistics::ResourceStatistics(int _mode)
 {
 {
   mode = _mode;
   mode = _mode;
@@ -41,7 +43,6 @@ void ResourceStatistics::getMaximumMemory(long & memory)
     return;     
     return;     
     
     
   }
   }
-
 }
 }
     
     
 
 
@@ -133,3 +134,42 @@ void ResourceStatistics::getStatistics(long & memory, double & userCpuTime, doub
   
   
   
   
 }
 }
+
+#else 
+/// WIN32 PORT following here
+#include "CrossplatformDefines.h"
+
+#pragma message WARNING("ResourceStatistics class : not yet ported to WIN32 plattform")
+
+ResourceStatistics::ResourceStatistics(int _mode)
+{
+  mode = _mode;
+}
+      
+ResourceStatistics::~ResourceStatistics()
+{
+}
+
+void ResourceStatistics::getMaximumMemory(long & memory)
+{
+	fthrow ( Exception, "ResourceStatistics class : not yet ported to WIN32 plattform");
+}
+    
+
+void ResourceStatistics::getUserCpuTime(double & time)
+{
+	fthrow ( Exception, "ResourceStatistics class : not yet ported to WIN32 plattform");
+}
+    
+
+void ResourceStatistics::getSystemCpuTime(double & time)
+{
+	fthrow ( Exception, "ResourceStatistics class : not yet ported to WIN32 plattform");
+}
+
+void ResourceStatistics::getStatistics(long & memory, double & userCpuTime, double & systemCpuTime)
+{
+	fthrow ( Exception, "ResourceStatistics class : not yet ported to WIN32 plattform");
+}
+
+#endif

+ 11 - 0
core/basics/ResourceStatistics.h

@@ -7,8 +7,13 @@
 #ifndef _NICE_ResourceStatistics_INCLUDE
 #ifndef _NICE_ResourceStatistics_INCLUDE
 #define _NICE_ResourceStatistics_INCLUDE
 #define _NICE_ResourceStatistics_INCLUDE
 
 
+#ifdef WIN32
+#include <time.h>
+#else
 #include <sys/time.h>
 #include <sys/time.h>
 #include <sys/resource.h>
 #include <sys/resource.h>
+#endif
+
 #include <core/basics/Exception.h>
 #include <core/basics/Exception.h>
 
 
 namespace NICE {
 namespace NICE {
@@ -25,7 +30,9 @@ class ResourceStatistics
       
       
       // both variables are necessary for the function "getrusage"
       // both variables are necessary for the function "getrusage"
       int mode; 
       int mode; 
+#ifndef WIN32
       struct rusage memoryStatistics;
       struct rusage memoryStatistics;
+#endif
 
 
     public:
     public:
 
 
@@ -34,7 +41,11 @@ class ResourceStatistics
     * 
     * 
     * @param _mode mode for "getrusage", it is recommended to use the default value RUSAGE_SELF
     * @param _mode mode for "getrusage", it is recommended to use the default value RUSAGE_SELF
     */
     */
+#ifndef WIN32
     ResourceStatistics(int _mode = RUSAGE_SELF);
     ResourceStatistics(int _mode = RUSAGE_SELF);
+#else
+	ResourceStatistics(int _mode = 0);
+#endif
       
       
     /**
     /**
     * @brief simple destructor 
     * @brief simple destructor 

+ 10 - 1
core/basics/StringTools.cpp

@@ -16,11 +16,12 @@
 
 
 #include "StringTools.h"
 #include "StringTools.h"
 
 
-#define USE_REGEX_LIB
+//#define USE_REGEX_LIB
 #ifdef USE_REGEX_LIB
 #ifdef USE_REGEX_LIB
 #include <regex.h>
 #include <regex.h>
 #endif
 #endif
 
 
+
 #include "ossettings.h"
 #include "ossettings.h"
 
 
 using namespace NICE;
 using namespace NICE;
@@ -179,13 +180,18 @@ bool StringTools::regexSubstitute ( std::string & s, const std::string & regex,
 
 
 bool StringTools::regexMatch ( const string & s, const string & regex )
 bool StringTools::regexMatch ( const string & s, const string & regex )
 {
 {
+#ifdef USE_REGEX_LIB
     vector<string> submatches;
     vector<string> submatches;
     return regexMatch ( s, regex, submatches );
     return regexMatch ( s, regex, submatches );
+#else
+	fthrow ( Exception, "You have to install the regex lib to use this function!");
+#endif
 }
 }
 
 
 bool StringTools::regexMatch ( const string & s, const string & regex, 
 bool StringTools::regexMatch ( const string & s, const string & regex, 
 			 vector<string> & submatches )
 			 vector<string> & submatches )
 {
 {
+#ifdef USE_REGEX_LIB
 	submatches.clear();
 	submatches.clear();
 
 
     int    status;
     int    status;
@@ -215,6 +221,9 @@ bool StringTools::regexMatch ( const string & s, const string & regex,
  
  
     regfree(&re);
     regfree(&re);
     return true;
     return true;
+#else
+	fthrow ( Exception, "You have to install the regex lib to use this function!");
+#endif
 }
 }
 
 
 
 

+ 47 - 0
core/basics/Timer.cpp

@@ -7,6 +7,13 @@
 #include <core/basics/Exception.h>
 #include <core/basics/Exception.h>
 #include <limits>
 #include <limits>
 
 
+#ifdef WIN32
+ #ifdef NICE_BOOST_FOUND
+	#include "boost/date_time/posix_time/posix_time.hpp"
+	#include "boost/date_time/gregorian/gregorian_types.hpp"
+#endif
+#endif
+
 namespace NICE {
 namespace NICE {
 
 
 Timer::Timer() : printToLogWhenDestroyed ( false ), name ( "" ) {
 Timer::Timer() : printToLogWhenDestroyed ( false ), name ( "" ) {
@@ -29,6 +36,14 @@ Timer::~Timer() {
 }
 }
 
 
 double Timer::getCurrentAbsoluteTime() const {
 double Timer::getCurrentAbsoluteTime() const {
+#ifdef WIN32
+ #ifdef NICE_BOOST_FOUND
+	return getNow();
+ #else
+	return -1.0;
+	#pragma message WARNING("Timer::getCurrentAbsoluteTime() : not yet ported to WIN32 plattform, returning -1")
+ #endif
+#else
 #ifdef LIMUN_AIBO_MODE
 #ifdef LIMUN_AIBO_MODE
   struct SystemTime t;
   struct SystemTime t;
   GetSystemTime ( &t );
   GetSystemTime ( &t );
@@ -39,6 +54,7 @@ double Timer::getCurrentAbsoluteTime() const {
   gettimeofday ( &tv, &tz );
   gettimeofday ( &tv, &tz );
   return convertTime ( tv );
   return convertTime ( tv );
 #endif
 #endif
+#endif
 }
 }
 
 
 void Timer::start() {
 void Timer::start() {
@@ -69,6 +85,17 @@ double Timer::getStartTime() const
 
 
 double Timer::getNow()
 double Timer::getNow()
 {
 {
+#ifdef WIN32
+ #ifdef NICE_BOOST_FOUND
+	boost::posix_time::ptime time_t_epoch( boost::gregorian::date(1970,1,1)); 
+	boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
+	boost::posix_time::time_duration diff = now - time_t_epoch;
+	return  diff.total_seconds();
+ #else
+	return -1.0;
+	#pragma message WARNING("Timer::getNow() : not yet ported to WIN32 plattform, returning -1")
+ #endif
+#else
 #ifdef LIMUN_AIBO_MODE
 #ifdef LIMUN_AIBO_MODE
   fthrow ( Exception, "Not supported on AIBO." );
   fthrow ( Exception, "Not supported on AIBO." );
 #else
 #else
@@ -77,6 +104,7 @@ double Timer::getNow()
   gettimeofday ( &actTime, &tz );
   gettimeofday ( &actTime, &tz );
   return Timer::convertTime ( actTime );
   return Timer::convertTime ( actTime );
 #endif
 #endif
+#endif
 }
 }
 
 
 std::string Timer::getNowString() {
 std::string Timer::getNowString() {
@@ -92,6 +120,15 @@ std::string Timer::getNowString() {
 }
 }
 
 
 long int Timer::getMicroseconds() {
 long int Timer::getMicroseconds() {
+#ifdef WIN32
+ #ifdef NICE_BOOST_FOUND
+	return getNow();
+ #else
+	return -1.0;
+	#pragma message WARNING("Timer::getMicroseconds() : not yet ported to WIN32 plattform, returning -1")
+ #endif
+#else
+
 #ifdef LIMUN_AIBO_MODE
 #ifdef LIMUN_AIBO_MODE
   fthrow ( Exception, "Not supported on AIBO." );
   fthrow ( Exception, "Not supported on AIBO." );
 #else
 #else
@@ -100,6 +137,7 @@ long int Timer::getMicroseconds() {
   gettimeofday ( &actTime, &tz );
   gettimeofday ( &actTime, &tz );
   return actTime.tv_usec;
   return actTime.tv_usec;
 #endif
 #endif
+#endif
 }
 }
 
 
 
 
@@ -131,5 +169,14 @@ void Timer::reset() {
   sumAbsolute = 0.0;
   sumAbsolute = 0.0;
 }
 }
 
 
+ inline double Timer::convertTime ( const struct timeval &time ) {
+#ifndef WIN32
+      return double ( time.tv_sec ) + double ( time.tv_usec ) * 1e-6;
+#else
+		return -1.0;
+		#pragma message WARNING("Timer::convertTime() : not yet ported to WIN32 plattform, returning -1")
+#endif
+    }
+
 } // namespace
 } // namespace
 
 

+ 7 - 4
core/basics/Timer.h

@@ -15,7 +15,12 @@
 #include <Shared/TimeET.h>
 #include <Shared/TimeET.h>
 #else
 #else
 #include <ctime>
 #include <ctime>
-#include <sys/time.h>
+ #ifdef WIN32
+  #include <time.h>
+  #include "CrossplatformDefines.h"
+#else
+  #include <sys/time.h>
+ #endif
 #endif
 #endif
 #include <string>
 #include <string>
 #include <core/basics/Log.h>
 #include <core/basics/Log.h>
@@ -192,9 +197,7 @@ class Timer {
      * (00:00:00 UTC, January 1, 1970)
      * (00:00:00 UTC, January 1, 1970)
      * @return double value of time in seconds
      * @return double value of time in seconds
      */
      */
-    static inline double convertTime ( const struct timeval &time ) {
-      return double ( time.tv_sec ) + double ( time.tv_usec ) * 1e-6;
-    }
+    static inline double convertTime ( const struct timeval &time );
 
 
     /**
     /**
      * Date string from time since Epoch (00:00:00 UTC, January 1, 1970),
      * Date string from time since Epoch (00:00:00 UTC, January 1, 1970),

+ 9 - 2
core/basics/binstream.h

@@ -35,6 +35,7 @@
 #include <vector>
 #include <vector>
 #include <core/basics/types.h>
 #include <core/basics/types.h>
 #include <string.h>
 #include <string.h>
+#include "CrossplatformDefines.h"
 #ifdef NICE_USELIB_LINAL
 #ifdef NICE_USELIB_LINAL
 #include <cstddef>
 #include <cstddef>
 #include "LinAl/matrix.h"
 #include "LinAl/matrix.h"
@@ -109,9 +110,15 @@ public:
   ibinstream &operator>>(std::string &n) {
   ibinstream &operator>>(std::string &n) {
     int l=0;
     int l=0;
     read((char*) &l, sizeof(int));
     read((char*) &l, sizeof(int));
-    char buf[l];
+#ifdef WIN32
+	char* buf = new char[l];
+    read( buf, l);
+    n.assign(buf,l);
+#else
+	char buf[l];
     read((char*) buf, l);
     read((char*) buf, l);
     n.assign(buf,l);
     n.assign(buf,l);
+#endif
     return *this;
     return *this;
   }
   }
   
   
@@ -320,7 +327,7 @@ inline obinstream& operator<<(obinstream &s, const LinAl::MatrixC<Tp> &A) {
 
 
 #else
 #else
 #ifndef LINAL_WARNING
 #ifndef LINAL_WARNING
-#warning LinAl addons will not be compiled.
+#pragma message WARNING("LinAl addons will not be compiled.")
 #define LINAL_WARNING
 #define LINAL_WARNING
 #endif
 #endif
 #endif
 #endif

+ 3 - 1
core/basics/bzstream.cpp

@@ -27,6 +27,8 @@
 // ============================================================================
 // ============================================================================
 
 
 #include <core/basics/bzstream.h>
 #include <core/basics/bzstream.h>
+#include "CrossplatformDefines.h"
+
 #ifdef NICE_USELIB_BZLIB
 #ifdef NICE_USELIB_BZLIB
 #include <iostream>
 #include <iostream>
 #include <string.h>  // for memcpy
 #include <string.h>  // for memcpy
@@ -161,7 +163,7 @@ void bzstreambase::close() {
 } // namespace
 } // namespace
 
 
 #else
 #else
-#warning "bzstream will not be compiled." 
+#pragma message WARNING("bzstream will not be compiled.")
 #endif
 #endif
 
 
 // ============================================================================
 // ============================================================================

+ 2 - 1
core/basics/gzstream.cpp

@@ -161,7 +161,8 @@ void gzstreambase::close() {
 } // namespace
 } // namespace
 
 
 #else
 #else
-#warning "gzstream will not be compiled." 
+#include "CrossplatformDefines.h"
+#pragma message WARNING("gzstream will not be compiled.")
 #endif
 #endif
 
 
 // ============================================================================
 // ============================================================================

+ 26 - 8
core/basics/numerictools.h

@@ -5,10 +5,18 @@
  *  - libfbasics - library of some basic tools
  *  - libfbasics - library of some basic tools
  * See file License for license information.
  * See file License for license information.
  */
  */
-
 #define _USE_MATH_DEFINES
 #define _USE_MATH_DEFINES
 #include <cmath>
 #include <cmath>
-// #include <math.h>
+#ifdef WIN32
+	#include <math.h>
+#endif
+
+#include "CrossplatformDefines.h"
+
+#ifdef NICE_BOOST_FOUND
+#include <boost/math/special_functions/fpclassify.hpp> // isnan
+#endif
+
 #include <stdlib.h>
 #include <stdlib.h>
 #include <limits>
 #include <limits>
 #include <string>
 #include <string>
@@ -204,10 +212,16 @@ inline double cubeRoot(const double& t) {
  * Check if a floating point value is NaN
  * Check if a floating point value is NaN
  */
  */
 inline bool isNaN(double x) {
 inline bool isNaN(double x) {
-#if (__GNUC__ > 3)
-  return isnan(x);
+	
+
+#ifdef NICE_BOOST_FOUND
+	return  boost::math::isnan(x);
 #else
 #else
-  return x != x;
+	#if (__GNUC__ > 3)
+	  return isnan(x);
+	#else
+	  return x != x;
+	#endif
 #endif
 #endif
 }
 }
 
 
@@ -215,10 +229,14 @@ inline bool isNaN(double x) {
  * Check if a floating point value is NaN
  * Check if a floating point value is NaN
  */
  */
 inline bool isNaN(float x) {
 inline bool isNaN(float x) {
-#if (__GNUC__ > 3)
-  return isnan(x);
+#ifdef NICE_BOOST_FOUND
+	return  boost::math::isnan(x);
 #else
 #else
-  return x != x;
+	#if (__GNUC__ > 3)
+	  return isnan(x);
+	#else
+	  return x != x;
+	#endif
 #endif
 #endif
 }
 }
 
 

+ 9 - 0
core/basics/progs/CMakeLists.txt

@@ -0,0 +1,9 @@
+
+ADD_EXECUTABLE(testConfig testConfig.cpp)
+ADD_EXECUTABLE(testMemoryUsage testMemoryUsage.cpp) 
+
+TARGET_LINK_LIBRARIES(testConfig core_basics)
+TARGET_LINK_LIBRARIES(testMemoryUsage core_basics)
+
+INSTALL(TARGETS testConfig DESTINATION bin)
+INSTALL(TARGETS testMemoryUsage DESTINATION bin)

+ 2 - 0
core/basics/types.h

@@ -5,4 +5,6 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include <sys/types.h>
 #include <sys/types.h>
 
 
+#include "CrossplatformDefines.h"
+
 #endif
 #endif

+ 1 - 1
core/image/CMakeLists.txt

@@ -47,6 +47,6 @@ RectT.tcc
 Region.cpp
 Region.cpp
 )
 )
 
 
-ADD_LIBRARY(core_image ${core_image_src})
+ADD_LIBRARY(core_image ${NICE_BUILD_LIBS_STATIC_SHARED} ${core_image_src})
 
 
 INSTALL(TARGETS core_image DESTINATION libs)
 INSTALL(TARGETS core_image DESTINATION libs)

+ 1 - 1
core/optimization/blackbox/CMakeLists.txt

@@ -8,6 +8,6 @@ SimpleOptimizer.cpp
 SimpleOptProblem.cpp
 SimpleOptProblem.cpp
 )
 )
 
 
-ADD_LIBRARY(core_optimization_blackbox SHARED ${core_optimization_blackbox_src})
+ADD_LIBRARY(core_optimization_blackbox ${NICE_BUILD_LIBS_STATIC_SHARED} ${core_optimization_blackbox_src})
 
 
 INSTALL(TARGETS core_optimization_blackbox DESTINATION libs)
 INSTALL(TARGETS core_optimization_blackbox DESTINATION libs)

+ 1 - 1
core/optimization/gradientBased/CMakeLists.txt

@@ -8,6 +8,6 @@ SecondOrderTrustRegion.cpp
 TrustRegionBase.cpp
 TrustRegionBase.cpp
 )
 )
 
 
-ADD_LIBRARY(core_optimization_gradientBased SHARED ${core_optimization_gradientBased_src})
+ADD_LIBRARY(core_optimization_gradientBased ${NICE_BUILD_LIBS_STATIC_SHARED} ${core_optimization_gradientBased_src})
 
 
 INSTALL(TARGETS core_optimization_gradientBased DESTINATION libs)
 INSTALL(TARGETS core_optimization_gradientBased DESTINATION libs)

+ 1 - 1
core/vector/CMakeLists.txt

@@ -11,6 +11,6 @@ VectorT.tcc
 VVector.cpp
 VVector.cpp
 )
 )
 
 
-ADD_LIBRARY(core_vector SHARED ${core_vector_src})
+ADD_LIBRARY(core_vector ${NICE_BUILD_LIBS_STATIC_SHARED} ${core_vector_src})
 
 
 INSTALL(TARGETS core_vector DESTINATION libs)
 INSTALL(TARGETS core_vector DESTINATION libs)

+ 15 - 0
readme.txt

@@ -0,0 +1,15 @@
+notes on porting NICE to WIN using CMAKE:
+
+
+------------------------------------------
+porting core/basics/timer.h/cpp
+highly unix dependend
+better use 3rd party time functionality for now()
+better use
+boost::timer ??
+
+---------------------------
+stringtools highly os dependented
+->recursive dir scan with "ls -r" syntax!!
+use 3rd party lib like boost oder qt
+use boost regex for regex syntax in stringtools::regex bla