[Share] CGAL 3.6 with Qt 4.7 on vs2010

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[Share] CGAL 3.6 with Qt 4.7 on vs2010

Chad Liu
I am successly porting CGAL 3.6 with Qt 4.7 on vs2010

you can read my note from my blog:

or read text below

To install CGAL 3.6 on Visual Studio 2010, Win 7

1. install cmake (using latest 2.8.1)
1.1. There is remark that you need to change CMakeVS10FindMake.cmake
where is that ?
If using Binary distribution, it will be $(CMAKE_DIR)\share\cmake-2.8\Modules

If you like to complie by yourself, it will be &(CMAKE_DIR)\Modules

1.2 To complie by yourself, you need to change the file first, and download cmake Binary to make project(it sounds wired but please see Installing CMake).

1.3 After making project, you can use Visual Studio 2010 to make binary
Sample open .sln file and run release

2. Configure your "system envirnoment", add $(CMAKE_DIR)\bin in "path" for you can execute cmake anytime.
For Binary ditribution: $(CMAKE_DIR)\bin (example)
For src compiled: $(CMAKE_DIR)\bin\$(OUTDIR)

3. Install Boost (latest 1.43.0)
because boostpro do not support vs 2010, you have to compile by yourself.

3.1 download Boost http://www.boost.org/users/download/

3.2 for build Boost "Boost Jam" http://sourceforge.net/projects/boost/files/boost-jam/3.1.18/

3.3 copy bjam.exe to $(boost_DIR)

3.4 run bjam --build-dir="d:\build-boost" --build-type=complete msvc

build-dir: is the dir to work

build-type=complete means to build all
remark: I have try skip this, and it works.

it takes about 1 hr to build complete, and about 20 min to do default
after building, file will in $(BOOST_DIR)/stage/lib

3.5 add "system environment" in "path" add "$(BOOST_DIR)"
this for CGAL know where is BOOST

4. Install Exact Arithmetic

This time the program I use only needs GMP + MPFR
CGAL said they provide precompile GMP + MPFR, but they do not support 2010 at this time.
Everything have do by yourself.
GMP is not support visual Studio. (may they don't like M$)
Luckly, there is someone porting to visual studio call MPIR

4.1 install MPIR
download from http://www.mpir.org/#release
they even have visual studio 2010 version very cool.
Sample unzip and open .sln
run release.

copy all ".h" file in the $(outdir) to $(CGAL)/auxiliary/gmp/include
copy all .lib and ".dll" file in the $(outdir) to $(CGAL)/auxiliary/gmp/lib

4.2 install MPFR
again, MPFR does not support VS
you can find someone provide vs 2008 project file here http://gladman.plushost.co.uk/oldsite/computing/gmp4win.php
just download here

4.2.1 download MPFR http://www.mpfr.org/
because the project support 2.4.1 only, I use version 2.4.1
4.2.2 copy vs 2009 project file to $(MPFR_DIR)

4.2.3 copy all MPIR in $(OUT_DIR) files to $(MPFR_DIR)/../mpir

4.2.4 run $(MPFR_DIR)/build.vc9/lib_mpfr.sln

vs2010 will convert for you. it takes about 2 mins

change the lib_mpfr property... / configuration Property / Librarian /

additional Dependencies

../../mpir/....... -> ../../mpir/mpir.lib (or the path you put mpir.lib)

and run release..

4.2.5 run $(MPFR_DIR)/build.vc9/dll_mpfr.sln

change the dll_mpfr property... / configuration Property / Linker /

additional Dependencies

../../mpir/....... -> ../../mpir/mpir.lib (or the path you put mpir.lib)

and run release..

4.2.6 copy all ".h" file in the $(outdir) to $(CGAL)/auxiliary/gmp/include
copy all .lib and ".dll" file in the $(outdir) to $(CGAL)/auxiliary/gmp/lib
copy $(mpfr)/mpfr.h to $(CGAL)/auxiliary/gmp/include

5. Visualization
5.1 install Qt
Qt is going to support windows 7 and visual Studio 2010 at version Qt 4.7
so I download Qt 4.7 beta filename: qt-everywhere-opensource-src-4.7.0-beta1

5.2 unzip and set environments
environments set PATH += $(QT_DIR)/bin
set LIB += C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib
set Include += C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include

5.3 fix some error
in $(QTDIR)\src\3rdparty\webkit\JavaScriptCore\runtime

at line 171
transitionTable()->add(key, Transition(structure, 0));
change to
transitionTable()->add(key, Transition(structure, nullptr));

at line 178
transitionTable()->add(key, Transition(0, structure));
change to
transitionTable()->add(key, Transition(nullptr, structure));

5.4 run configure at $(QT_DIR) using Visual Studio Command Prompt

because Qt didn't support vs2010, just use vs2008 setting

configure.exe -platform win32-msvc2008 -fast

on internet there is simple run command (less warning and no error): http://stackoverflow.com/questions/1644172/building-qt-4-5-with-visual-c-2010

configure.exe -platform win32-msvc2008 -no-webkit -no-phonon -no-phonon-backend -no-script -no-scripttools -no-multimedia -no-qt3support -fast

you can choose any one is ok.

5.5 nmake

it takes long time if there is no error.

5.6 you finish installing QT

6. Miscellaneous
I didn't use this, so Skip this part

7. install CGAL
7.1 download CGAL http://www.cgal.org/download.html

7.2 unzip

7.3 fix cmake files
7.3.1 in $(CGAL)/cmake/modules/FindBoost.cmake

at line 569

if (MSVC90)
SET (_boost_COMPILER "-vc90")

add after that

elseif (MSVC10)
SET (_boost_COMPILER "-vc100")

7.3.2 in $(CGAL)/cmake/modules/CGAL_GeneratorSpecificSettings.cmake

at line 11

if ( MSVC90 )
set(CGAL_TOOLSET "vc90")
message( STATUS "Using VC90 compiler." )

add after that
elseif ( MSVC10 )
set(CGAL_TOOLSET "vc100")
message( STATUS "Using VC100 compiler." )

7.4 change GMP and MPFR lib name

CGAL will find GMP and MPFR lib name like $()-vc??-mt.lib
so please change "mpir.lib" to "gmp-vc100-mt.lib"
"mpfr.lib" to "mpfr-vc100-mt.lib"

7.5 use cmd.exe
and go to $(CGAL_DIR)
run cmake .

7.6 There si small bug in mpfr.h
at line 298 add #include
it fixed at version 2.4.2, however, i did not try this one.

7.6 open $(CGAL_DIR)/CGAL.sln
run release

7.7 fix auto_link.h
at $(CGAL_DIR)/include/CGAL/auto_link/auto_link.h
at line 141

#elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1500)

// vc90:
# define CGAL_LIB_TOOLSET "vc90"

change to:
#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1500)

// vc90:
# define CGAL_LIB_TOOLSET "vc90"

#elif defined(BOOST_MSVC) && (BOOST_MSVC > 1500)
// vc10:
# define CGAL_LIB_TOOLSET "vc100"

congratulations!! you finish installing CGAL

you can run some example from there

good luck!

if your program can not find mpir.dll, just copy mpir.dll to your root of program