From 98c1b2ccc6da6efde9ae50d35ae6f058048b96cb Mon Sep 17 00:00:00 2001 From: Leonardo Florez-Valencia Date: Sat, 10 Oct 2015 10:47:53 -0500 Subject: [PATCH] Minor enhancements --- CMakeLists.txt | 27 +++++----- COMPILATION | 143 ++++++++++++++++++++++++++++++++++++++----------- README | 3 +- 3 files changed, 127 insertions(+), 46 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 76b21ce..fd4ebea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,19 +47,20 @@ ENDIF(BUILD_SHARED_LIBRARIES) ## = Packages and options = ## ======================== -# it seems that by default on Visual Studio Compiler supports c++11, so it only need to be test on other O.S. - if(NOT MSVC) - INCLUDE(CheckCXXCompilerFlag) - CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) - CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) - IF(COMPILER_SUPPORTS_CXX11) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - ELSEIF(COMPILER_SUPPORTS_CXX0X) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") - ELSE() - MESSAGE(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") - ENDIF() -endif(NOT MSVC) +# NOTE: It seems that by default on Visual Studio Compiler supports c++11, +# so it only need to be test on other O.S. +IF(NOT MSVC) + INCLUDE(CheckCXXCompilerFlag) + CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) + CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) + IF(COMPILER_SUPPORTS_CXX11) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + ELSEIF(COMPILER_SUPPORTS_CXX0X) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") + ELSE() + MESSAGE(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") + ENDIF() +ENDIF(NOT MSVC) # Prepare header to build shared libs (windows) INCLUDE(GenerateExportHeader) diff --git a/COMPILATION b/COMPILATION index b92c2ce..de796b5 100644 --- a/COMPILATION +++ b/COMPILATION @@ -5,49 +5,128 @@ @prerequisites + 0. A decent compiler for your system: + Linux: g++ with c++11 support + Mac: Xcode + Windows: any Visual Studio >= 2010 + 1. CMake (>=2.8.12.2) + Just use your favorite repository or get the installer from http://www.cmake.org. - 2. Visualization Toolkit -VTK- (>=6.1.0) - 2.1 Steps - Open CMake - Select the soruce and the binary folder - Select the desired version of generator to compile (Visual Studio 12 2013) and click on configure and wait until the options are enabled, and the make sure - 2.2 Required cmake flags: - BUILD_EXAMPLES OFF - BUILD_SHARED_LIBS ON - BUILD_TESTING OFF - Module_VtkGUISupportQt ON - Module_VtkGUISupportQtOpenGL ON - Module_VtkGUISupportQtSql OFF - Module_VtkGUISupportQtWebkit OFF + 2. [Optional] Qt (=4.8) + On linux just install the corresponding package. On Mac and Windows, download + the source code and compile it with your favorite compiler. Please be aware that: + - Both release and debug configs are needed. + - Compile Qt with only SHARED support. + - Compile Qt without Webkit support. + 3. Visualization Toolkit -VTK- (>=6.1.0) + 1. Download VTK source code from http://www.vtk.org, copy the downloaded + zip/tar.gz file to your work directory (say ~/sources), uncompress the + source file and create an empty folder (say ~/sources/vtk-build) + 2. Execute cmake taking care to put two directories: the source dir (where + the VTK source code is after decompression) and the build dir (the new + empty folder you just created). + 3. On linux/mac, it is easier to execute from a command line console: + $ cd ~/sources/vtk-build + *** WARNING: IF YOU INSTALLED QT *** + $ cmake -DCMAKE_CXX_FLAGS:STRING=-std=c++11 \ + -DBUILD_DOCUMENTATION:BOOL=OFF \ + -DBUILD_EXAMPLES:BOOL=OFF \ + -DBUILD_SHARED_LIBS:BOOL=ON \ + -DBUILD_TESTING:BOOL=OFF \ + -DCMAKE_BUILD_TYPE:STRING=MinSizeRel \ + -DModule_vtkGUISupportQt:BOOL=ON \ + -DModule_vtkGUISupportQtOpenGL:BOOL=ON \ + -DModule_vtkGUISupportQtSQL:BOOL=OFF \ + -DModule_vtkGUISupportQtWebkit:BOOL=OFF \ + -DCMAKE_INSTALL_PREFIX:PATH=~/local \ + ~/source/the_folder_where_vtk_was_decompressed + *** WARNING: IF YOU DIDN'T INSTALLED QT *** + $ cmake -DCMAKE_CXX_FLAGS:STRING=-std=c++11 \ + -DBUILD_DOCUMENTATION:BOOL=OFF \ + -DBUILD_EXAMPLES:BOOL=OFF \ + -DBUILD_SHARED_LIBS:BOOL=ON \ + -DBUILD_TESTING:BOOL=OFF \ + -DCMAKE_BUILD_TYPE:STRING=MinSizeRel \ + -DModule_vtkGUISupportQt:BOOL=OFF \ + -DModule_vtkGUISupportQtOpenGL:BOOL=OFF \ + -DModule_vtkGUISupportQtSQL:BOOL=OFF \ + -DModule_vtkGUISupportQtWebkit:BOOL=OFF \ + -DCMAKE_INSTALL_PREFIX:PATH=~/local \ + ~/source/the_folder_where_vtk_was_decompressed + $ make + ... WAIT A FEW MINUTES ... + $ make install + 4. On windows, make sure that the following cmake variables are configured as: + BUILD_DOCUMENTATION:BOOL=OFF + BUILD_EXAMPLES:BOOL=OFF + BUILD_SHARED_LIBS:BOOL=ON + BUILD_TESTING:BOOL=OFF + CMAKE_BUILD_TYPE:STRING=MinSizeRel + Module_vtkGUISupportQt:BOOL=[OFF/ON] ** "ON", IF YOU INSTALLED Qt + Module_vtkGUISupportQtOpenGL:BOOL=[OFF/ON] ** "ON", IF YOU INSTALLED Qt + Module_vtkGUISupportQtSQL:BOOL=OFF \ + Module_vtkGUISupportQtWebkit:BOOL=OFF \ + NOTE: Normally, windows compilers already support c++11. 3. Insight Toolkit -ITK- (>=4.6.0) - 3.1 Required cmake flags: - BUILD_SHARED_LIBS:BOOL=ON - Module_ITKVtkGlue:BOOL=ON + 1. Download ITK source code from http://www.itk.org, copy the downloaded + zip/tar.gz file to your work directory (say ~/sources), uncompress the + source file and create an empty folder (say ~/sources/itk-build) + 2. Execute cmake taking care to put two directories: the source dir (where + the ITK source code is after decompression) and the build dir (the new + empty folder you just created). + 3. On linux/mac, it is easier to execute from a command line console: + $ cd ~/sources/itk-build + $ cmake -DCMAKE_CXX_FLAGS:STRING=-std=c++11 \ + -DBUILD_DOCUMENTATION:BOOL=OFF \ + -DBUILD_EXAMPLES:BOOL=OFF \ + -DBUILD_SHARED_LIBS:BOOL=ON \ + -DBUILD_TESTING:BOOL=OFF \ + -DCMAKE_BUILD_TYPE:STRING=MinSizeRel \ + -DModule_ITKReview:BOOL=ON \ + -DModule_ITKVtkGlue:BOOL=OFF \ + -DCMAKE_INSTALL_PREFIX:PATH=~/local \ + ~/source/the_folder_where_itk_was_decompressed + $ make + ... WAIT A FEW MINUTES ... + $ make install + 4. On windows, make sure that the following cmake variables are configured as: + BUILD_DOCUMENTATION:BOOL=OFF + BUILD_EXAMPLES:BOOL=OFF + BUILD_SHARED_LIBS:BOOL=ON + BUILD_TESTING:BOOL=OFF + CMAKE_BUILD_TYPE:STRING=MinSizeRel + Module_ITKReview:BOOL=ON + Module_ITKVtkGlue:BOOL=OFF + NOTE: Normally, windows compilers already support c++11. 4. WARNING: Notes on compilation on MS-Windows - As the time being (circa dec 2014), I've been using MSVC-2013 - (compiler version 12). As expected, weird behavior is related to - this config. Please take into account the following in order to - have a successful compilation: + As the time being (circa dec 2014), I've been using MSVC-2013 (compiler + version 12). As expected, weird behavior is related to this config. Please + take into account the following in order to have a successful compilation: 4.1 If you want to build the Qt-based code, please be sure that it was compiled with EXACTLY the same compiler you are using. 4.2 Since the dll load-unload procedure in MSWin is kind of magic, - VTK should be compiled as shared libraries and ITK should be - compiled as static libraries. This allows a correct - execution of the SmartPointer's thus preventing anoying crashes. + VTK and ITK should be compiled as shared libraries. This allows a + correct execution of the SmartPointer's thus preventing anoying crashes. 4.3 If you found more problems in any MSWin config, please let us know at florez-l@javeriana.edu.co - - -@cmake_flags - BUILD_DEMOS:BOOL - Build example applications? (most of them are command line) - CMAKE_BUILD_TYPE:STRING - Debug/Release? - CMAKE_INSTALL_PREFIX:STRING - Where to put installation products? (in windows this option has no use) + +@compilation + The project uses CMake as project manager. You can use the CMake GUI to configure + it on your box. Please take into account the following variables: + USE_QT4:BOOL -> It allows you to compile the Qt support + BUILD_EXAMPLES:BOOL -> Do you want to compile the examples? + BUILD_SHARED_LIBRARIES -> Put this allways "ON". "OFF" is still experimental + CMAKE_BUILD_TYPE -> Compilation type. Possible values: Debug, Release, + MinSizeRel, RelWithDebInfo, None + ITK_DIR -> Where ITK was intalled. If you followed this list, + it should be on: ~/local/lib/cmake/ITK-X.Y (X and Y are + the version numbers) + VTK_DIR -> Where VTK was intalled. If you followed this list, + it should be on: ~/local/lib/cmake/vtk-X.Y (X and Y are + the version numbers) ## eof - $RCSfile$ diff --git a/README b/README index 667adda..46efa01 100644 --- a/README +++ b/README @@ -7,8 +7,9 @@ 0.0.1 (2014-12-31) @authors + Leonardo FLÓREZ-VALENCIA (florez-l@javeriana.edu.co) Maciej ORKISZ (maciej.orkisz@creatis.insa-lyon.fr) - Leonardo FLOREZ-VALENCIA (florez-l@javeriana.edu.co) + José Luis GUZMÁN-RODRÍGUEZ (cycopepe@gmail.com) @description -- 2.45.1