2015-05-06 99 views
1

我看到許多關於此問題的相同問題。恐怕他們的答案都不適合我。CMake無法找到增強庫(CGAL,Windows)

我正在嘗試安裝CGAL。我按照following tutorial一步一步描述了這個過程。唯一的區別是我使用的是CodeBlocks,而且我選擇了「指定本機編譯器」,並指出它們是mingw32-gcc.exemingw32-g++.exe,這似乎很好。當我運行cmake貴然後單擊配置,我得到下面的輸出,與高級選項打勾:

The CXX compiler identification is GNU 4.4.1 
The C compiler identification is GNU 4.4.1 
Check for working CXX compiler: E:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-g++.exe 
Check for working CXX compiler: E:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-g++.exe -- works 
Detecting CXX compiler ABI info 
Detecting CXX compiler ABI info - done 
Check for working C compiler: E:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-gcc.exe 
Check for working C compiler: E:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-gcc.exe -- works 
Detecting C compiler ABI info 
Detecting C compiler ABI info - done 
== Setting paths == 
Build CGAL from release in directory CGAL-4.6 
Packagenames: CGAL-4.6 
== Setting paths (DONE) == 

== Generate version files == 
CGAL_MAJOR_VERSION=4 
CGAL_MINOR_VERSION=6 
CGAL_BUGFIX_VERSION=0 
CGAL_SONAME_VERSION=11 
CGAL_SOVERSION  =11.0.0 
CGAL_REFERENCE_CACHE_DIR= 
Building shared libraries 
Targetting MinGW Makefiles 
Using E:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-g++.exe compiler. 
USING CMake version: 2.8.8 
System: Windows 
USING GCC_VERSION = '4.4.1' 
Using gcc version 4 or later. Adding -frounding-math 
== Generate version files (DONE) == 

== Set up flags == 
Build type: Release 
USING CXXFLAGS = ' -frounding-math -O3 -DNDEBUG' 
USING LDFLAGS = ' ' 
== Set up flags (DONE) == 

== Detect external libraries == 
External libraries supported: GMP;MPFR;ZLIB;OpenGL;LEDA;MPFI;RS;RS3;OpenNL;Eigen3;BLAS;LAPACK;QGLViewer;ESBTL;Coin3D;NTL;IPE 
Preconfiguring library: GMP ... 
Found GMP: e:/Users/Bombax/Cpp/Libraries/CGAL-4.6/auxiliary/gmp/lib/libgmp-10.dll 
GMP has been preconfigured: 
    UseGMP-file:  
    GMP include:  e:/Users/Bombax/Cpp/Libraries/CGAL-4.6/auxiliary/gmp/include 
    GMP libraries: e:/Users/Bombax/Cpp/Libraries/CGAL-4.6/auxiliary/gmp/lib/libgmp-10.dll 
    GMP definitions: 
USING GMP_VERSION = '5.0.1' 
Preconfiguring library: MPFR ... 
Found MPFR: e:/Users/Bombax/Cpp/Libraries/CGAL-4.6/auxiliary/gmp/lib/libmpfr-4.dll 
MPFR has been preconfigured: 
    UseMPFR-file:  
    MPFR include:  e:/Users/Bombax/Cpp/Libraries/CGAL-4.6/auxiliary/gmp/include 
    MPFR libraries: e:/Users/Bombax/Cpp/Libraries/CGAL-4.6/auxiliary/gmp/lib/libmpfr-4.dll 
    MPFR definitions: 
USING MPFR_VERSION = '3.0.0' 
CMake Error at E:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:1200 (message): 
    Unable to find the requested Boost libraries. 

    Boost version: 1.58.0 

    Boost include path: e:/Users/Bombax/Cpp/Libraries/boost_1_58_0 

    The following Boost libraries could not be found: 

      boost_thread 
      boost_system 

    No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the 
    directory containing Boost libraries or BOOST_ROOT to the location of 
    Boost. 
Call Stack (most recent call first): 
    cmake/modules/CGAL_SetupBoost.cmake:6 (find_package) 
    cmake/modules/CGAL_SetupDependencies.cmake:85 (include) 
    CMakeLists.txt:640 (include) 


Boost include:  e:/Users/Bombax/Cpp/Libraries/boost_1_58_0 
Boost libraries: 
Boost definitions: 
USING BOOST_VERSION = '1.58.0' 
== Detect external libraries (DONE) == 

== Write compiler_config.h == 
Performing Test CGAL_CFG_BOOST_VARIANT_SWAP_BUG - Failed 
Performing Test CGAL_CFG_DENORMALS_COMPILE_BUG - Success 
Performing Test CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG - Success 
Performing Test CGAL_CFG_IEEE_754_BUG - Success 
Performing Test CGAL_CFG_ISTREAM_INT_BUG - Success 
Performing Test CGAL_CFG_MATCHING_BUG_5 - Success 
Performing Test CGAL_CFG_MATCHING_BUG_6 - Success 
Performing Test CGAL_CFG_MATCHING_BUG_7 - Success 
Performing Test CGAL_CFG_MATCHING_BUG_8 - Success 
Performing Test CGAL_CFG_NESTED_CLASS_FRIEND_DECLARATION_BUG - Success 
Performing Test CGAL_CFG_NO_LIMITS - Success 
Performing Test CGAL_CFG_NO_NEXTAFTER - Success 
Performing Test CGAL_CFG_NO_STL - Success 
Performing Test CGAL_CFG_NO_WARNING_CPP_DIRECTIVE_BUG - Success 
Performing Test CGAL_CFG_NUMERIC_LIMITS_BUG - Success 
Performing Test CGAL_CFG_OUTOFLINE_MEMBER_DEFINITION_BUG - Success 
Performing Test CGAL_CFG_TEMPLATE_IN_DEFAULT_PARAMETER_BUG - Success 
Performing Test CGAL_CFG_TYPENAME_BEFORE_DEFAULT_ARGUMENT_BUG - Success 
Performing Test CGAL_CFG_USING_BASE_MEMBER_BUG_2 - Success 
== Write compiler_config.h (DONE) == 

== Generating build files == 
Configuring libCGAL 
Requested component: MPFR 
Requested component: GMP 
libCGAL is configured 
Sources for CGAL component library 'CGAL_Core' detected 
Configuring libCGAL_Core 
Requested component: MPFR 
Requested component: GMP 
libCGAL_Core is configured 
Sources for CGAL component library 'CGAL_ImageIO' detected 
Configuring libCGAL_ImageIO 
Found OpenGL: opengl32 
Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) 
OpenGL include:  
OpenGL libraries: glu32;opengl32 
Requested component: MPFR 
Requested component: GMP 
libCGAL_ImageIO is configured 
NOTICE: libCGAL_ImageIO needs ZLib to read compressed files. That feature will not be activated. 
Sources for CGAL component library 'CGAL_Qt3' detected 
Configuring libCGAL_Qt3 
libCGAL_Qt3 needs Qt3, cannot be configured. 
Sources for CGAL component library 'CGAL_Qt4' detected 
Configuring libCGAL_Qt4 
libCGAL_Qt4 needs Qt4, cannot be configured. 
Sources for CGAL component libraries 'CGAL_Core;CGAL_ImageIO;CGAL_Qt3;CGAL_Qt4' detected 
== Generating build files (DONE) == 

Configuring incomplete, errors occurred! 

我確實設置BOOST_ROOT在CMake的GUI的一個路徑,以e:/Users/Bombax/Cpp/Libraries/boost_1_58_0,它存在。它提到的兩個庫肯定是安裝的。我注意到,在我的升級安裝中沒有明確包含文件夾(儘管它們是libs)。我試過檢查CGAL_Boost_USE_STATIC_LIBS選項沒有更好的結果。這裏發生了什麼?我需要做什麼?

+0

如果您想在項目中使用boost庫,則需要使用boost includes。如果您只是將已構建的可執行文件/庫與動態增壓歸檔鏈接起來,則不需要包含這些內容。 – huu

+0

然後我下載了錯誤的提示嗎?我在這裏下載了ZIP文件:http://sourceforge.net/projects/boost/files/boost/1.58.0/boost_1_58_0.zip/download – bombax

+0

解壓縮歸檔文件後,包含文件位於'boost_1_58_0/boost'中。 – huu

回答

2

好吧,我終於把所有東西都拿到了我需要的狀態。接下來的內容基本上就是描述如何在Windows 7上使用Code :: Blocks獲取您想要的神奇libCGAL.dll和libCGAL.a(庫文件)。

  1. 我下載並安裝了CMake。
  2. 我下載並安裝了Boost 1.58.0,其中包含了手冊和GMP(但沒有示例,因爲我不想用Qt)。目的地是一個沒有空格的文件夾。
  3. 我下載並安裝了CGAL-4.6。再次,目的地是沒有空格的文件夾。
  4. 我將CodeBlocks \ MingW \ bin添加到我的PATH環境變量中。
  5. 我走進boost_1_58_0文件夾,打開命令提示符,然後鍵入bootstrap gcc,然後b2 --toolset=gcc,都很好。這似乎將Boost編譯到stage \ lib文件夾中。
  6. 我做了一個新的Code :: Blocks項目來測試Boost文件。在項目構建選項中,我選擇了根,在鏈接器設置下添加到libboost_regex-mgw44-mt-1_58.a的直接路徑下,在編譯器boost_1_58_0文件夾下,在鏈接器boost_1_58_0 \ stage \ lib文件夾下添加的搜索目錄下。然後,我成功編譯並運行了示例正則表達式程序here(第6節)。
  7. 我進入CGAL-4.6文件夾並打開命令提示符。我輸入了cmake-gui。我跟着this tutorial寫了這封信,除了我認爲我選擇了「指定本機編譯器」並將它們指向MingW文件夾中的mingw32-gcc.exemingw32-g++.exe(如果您已將MingW \ bin添加到路徑中,它可能會與第一個選項一起使用就像你不得不在後面)
  8. 正確配置和構建之後,會創建一個Code :: Blocks項目文件以及一個Makefile。 Code :: Blocks文件無用,因爲它試圖運行make.exe而不是mingw32-make.exe,所以無法正確構建。我不知道如何解決這個問題,所以我只需進入我的Code :: Blocks文件夾,打開一個命令提示符並鍵入mingw32-make.exe -s -f <path-to-the-makefile> all。它沒有問題。
  9. 最後,我做了一個測試項目。就像在第6步中,我從Boost(stage/lib中的blah-blah-NOT-d.a)和CGAL-4.6 \ lib中的libCGAL.dll.a庫中添加了所有非調試庫。我還像步驟6中那樣添加了Boost目錄,並且還添加了CGAL-4.6 \ include目錄。
  10. 超級終於,我編寫了示例here沒有問題。在運行之前。我必須將CGAL-4.6 \ bin \ libCGAL.dll移動到exe文件文件夾中,即bin \ Debug。

現在,這完全是直截了當的,不是嗎?!

如果有人遇到這個問題,請發送一條消息,我可以向您發送每個人都想要的實際文件:libCGAL.dll,libCGAL.dll.a,所有Boost庫文件和所有頭文件。