Pārlūkot izejas kodu

Merge branch 'cmakelist' of /home/ruehle/gitrepos/nice.cmake into cmakelist

Johannes Ruehle 12 gadi atpakaļ
vecāks
revīzija
127be970c9

+ 38 - 5
CMakeLists.txt

@@ -54,6 +54,14 @@ if (PNG_FOUND)
   ADD_DEFINITIONS( "-DNICE_USELIB_PNG")
 endif()
 
+
+find_package(ImageMagick COMPONENTS Magick++)
+if(ImageMagick_FOUND)
+	message(STATUS "imagemagick found: ${ImageMagick_LIBRARIES}")
+	else()
+	message(STATUS "imagemagick not found")
+endif()
+
 FIND_PACKAGE(Qt4)# COMPONENTS Qt3Support QtOpenGl)
 SET(QT_USE_QTOPENGL TRUE)
 SET(QT_USE_QT3SUPPORT TRUE)
@@ -73,11 +81,27 @@ if(OPENGL_FOUND)
   ADD_DEFINITIONS( "-DNICE_USELIB_OPENGL")
 endif()
 
-find_package(GLUT)
-if(GLUT_FOUND)
-  message(STATUS "GLUT found")
-  include_directories( ${GLUT_INCLUDE_DIRS} )
-  ADD_DEFINITIONS( "-DNICE_USELIB_GLUT")
+if(WIN32)
+	message(STATUS "find GLUT for win32")
+	set(GLUT_INCLUDE_DIR "C:/Libraries/freeglut-MSVC-2.8.0-1.mp/freeglut/include/")# , where to find GL/glut.h, etc.
+	set(GLUT_ROOT_PATH "C:/Libraries/freeglut-MSVC-2.8.0-1.mp/freeglut/") #  GLUT_LIBRARIES
+	set(tmp_OPENGL_LIBRARY_DIR "${OPENGL_LIBRARY_DIR}") #temporarily store opengl_lib path
+	set(OPENGL_LIBRARY_DIR "${GLUT_ROOT_PATH}lib")
+	find_package(GLUT)
+	if(GLUT_FOUND)
+	  message(STATUS "GLUT found")
+	  include_directories( ${GLUT_INCLUDE_DIR} )
+	  ADD_DEFINITIONS( -DNICE_USELIB_GLUT)
+	  ADD_DEFINITIONS(-DBUILD_VTI -DFREEGLUT_STATIC)
+	endif()
+	set(OPENGL_LIBRARY_DIR "${tmp_OPENGL_LIBRARY_DIR}") #reset opengl lib path
+else()
+	find_package(GLUT)
+	if(GLUT_FOUND)
+	  message(STATUS "GLUT found")
+	  include_directories( ${GLUT_INCLUDE_DIR} )
+	  ADD_DEFINITIONS(-DNICE_USELIB_GLUT)
+	endif()
 endif()
 
 #find_package(ImageMagick COMPONENTS Magick++)
@@ -86,6 +110,14 @@ endif()
 #  ADD_DEFINITIONS( "-DNICE_USELIB_LIBMAGICK")
 #endif()
 
+if(MSVC)
+  #enable solution folders
+  SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
+  SET_PROPERTY(GLOBAL PROPERTY AUTOMOC_FOLDER automoc) #in future (>cmake1.8.11 this might separate the automoc projects into a separate solution folder)
+  
+  #in Visual Studio avoid overwriting of std::max with macro definition max() in WinDef.h (http://support.microsoft.com/kb/143208/de)
+  ADD_DEFINITIONS("-DNOMINMAX")
+endif()
 
 set(BUILD_CORE_VECTOR ON)
 set(BUILD_CORE_BASICS ON)
@@ -119,6 +151,7 @@ set(NICE_CURR_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
 # endforeach()
 ADD_SUBDIRECTORY(core)
   
+
 # doxygen support
 #FIND_PROGRAM(DOXYGEN_EXECUTABLE "doxygen")
 

+ 4 - 1
core/CMakeLists.txt

@@ -6,8 +6,10 @@ include( testfiles.cmake)
 
 ADD_LIBRARY(nice_core ${NICE_BUILD_LIBS_STATIC_SHARED} ${NICE_CORE_HDR} ${NICE_CORE_SRC})
 TARGET_LINK_LIBRARIES(nice_core ${Boost_LIBRARIES} ${OPENGL_LIBRARY} ${GLUT_LIBRARY} ${QT_LIBRARIES})
+SET_PROPERTY(TARGET nice_core PROPERTY FOLDER "library")
 INSTALL(TARGETS nice_core DESTINATION lib)
 
+
 if(BUILD_CORE_PROGS)
   message(STATUS "building progs:")
   foreach(__progcpp ${NICE_PROGFILES_SRC})
@@ -17,6 +19,7 @@ if(BUILD_CORE_PROGS)
     ADD_EXECUTABLE( ${__progname} ${__progcpp})
     TARGET_LINK_LIBRARIES(${__progname} nice_core)
     INSTALL(TARGETS ${__progname} DESTINATION bin)
+	SET_PROPERTY(TARGET ${__progname} PROPERTY FOLDER "programs")
   endforeach()
 endif()
 
@@ -48,7 +51,7 @@ endif()
     RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
     INSTALL_NAME_DIR lib
   )
-
+  
   if(BUILD_SHARED_LIBS)
     if(MSVC)
       set_target_properties(${the_module} PROPERTIES DEFINE_SYMBOL CVAPI_EXPORTS)

+ 1 - 1
core/imagedisplay/ImageDisplay.cpp

@@ -421,7 +421,7 @@ void ImageDisplay::menuSave() {
   }
 
   NICE::FileName filename ( s.local8Bit() );
-  const std::string ext = filename.extractExtension();
+  const std::string ext = filename.extractExtension().str();
   const bool extensionOk
   = ( ext == std::string ( ".ppm" ) || ext == std::string ( ".pgm" )
       || ext == std::string ( ".png" ) || ext == std::string ( ".jpg" ) );

+ 4 - 0
core/imagedisplay/QtFramework.cpp

@@ -21,14 +21,18 @@ QtFramework::QtFramework()
   //application.reset(new QApplication(argc, argv));
   application = new QApplication(fake_argc, fake_argv);
   glutInit(&fake_argc, fake_argv);
+#ifndef WIN32
   std::set_terminate(__gnu_cxx::__verbose_terminate_handler);
+#endif
 }
 
 QtFramework::QtFramework(int& argc, char** argv)
     : application(new QApplication(argc, argv)), mainWindow(NULL) {
   fake_argv = NULL;
   glutInit(&argc, argv);
+#ifndef WIN32
   std::set_terminate(__gnu_cxx::__verbose_terminate_handler);
+#endif
 }
 
 QtFramework::~QtFramework() {

+ 2 - 0
core/imagedisplay/progs/showImage.cpp

@@ -18,7 +18,9 @@ using namespace std;
 */
 int main ( int argc, char **argv )
 {
+#ifndef WIN32
   std::set_terminate ( __gnu_cxx::__verbose_terminate_handler );
+#endif
 
   for ( int i = 1 ; i < argc ; i++ )
   {

+ 30 - 0
readme.txt

@@ -4,7 +4,37 @@
 1. Never use GLOB_RECURSE. It's evil. E.g. if you add or remove source files, CMake has no way of knowing that it should be re-run. Just list all the files in your CMakeLists.txt (or, if you think the list is excessively long, create a file called e.g. files.cmake, put the list in there and INCLUDE it in the CMakeLists.txt file.
 2. Never do in-source builds. CMake creates many, many files, and you don't want to delete them all individually for a clean build. And there's no way to implement a safe "make clean" (e.g. your build system might be running a custom utility which generates files CMake knows nothing about).
 
+%%%% todos
+- libmagic++ scheint sehr aufwendig in der benutzung unter Windows: How to build it with vs, anleitung:http://www.graphicsmagick.org/INSTALL-windows.html#windows-xp-vista-7-visual-c-6-0-through-9-0-compilation
+unter windows doch einfacher: http://www.imagemagick.org/script/binary-releases.php#windows (sind nur die binaries, keine includes und libs)
+http://www.imagemagick.org/Magick++/ sources runterladen
+braucht man überhaupt libmagick? warum nicht lieber opencv zum bilderlesen benutzen: momentan ist das lesen und schreiben eh mit throw exception not implemented verbunden:
+void ImageFile::readerMagick ( GrayColorImageCommonImplementationT<P> *image )
+{
+  fthrow ( ImageException, "Format not yet implemented (only available for standard images)." );
+}
+weil magick momentan der default imagereader ist: void ImageFile::reader(...)
+
+
+
+- make compilable without Qt
+- make compileable without opengl
+
+- regex lib nutzen von boost (->config.h)
+- substitue FileMgt::DirectoryRecursive by platform independend code using boost::filesystem
+
+- Implement ResouceStatistics for windows
+- 
+- braucht man GLUT noch ? Alt??? enable build without glut atleast!!
+
+- remove all warnings for function shadowing
+- remove all warning unreachable code
+%%%%%
+needed libraries windows:
+freeglut (download from: http://freeglut.sourceforge.net/index.php#download)
+adjust pathes GLUT_ROOT_PATH in root-CMakeLists.txt
 
+%%%%%%
 
 fixing all these includes of template definitons:
 //#ifdef __GNUC__