[vtkusers] Still More Questions
Mike Jackson
mike.jackson at imts.us
Fri Feb 2 08:49:02 EST 2007
--
Mike Jackson Senior Research Engineer
Innovative Management & Technology Services
On Feb 2, 2007, at 6:07 AM, ronharshbarger at mmm.com wrote:
> Thanks for the info. I feel like a fish out of water. I started
> using MSVC
> when it was first introduced and haven't dealt with script files in at
> least as long. I get the impression that most of the VTK users are
> using
> script driven systems but if I see "Using CMake is simple" one more
> time...
> I get the impression that I am making this a lot more difficult
> than it
> needs to be but I must have taken a wrong turn somewhere!
>
> QUESTIONS:
>
> 1.FROM MASTERING CMAKE : "The top two entries are the source code and
> binary directories. They allow you to specify where the source code
> is for
> what you want to compile" WHAT SOURCE CODE? IF I AM STARTING A NEW
> PROJECT
> THERE ISN'T ANY YET!
This is true.. so lets skip down a bit...
>
> 2. Why did I build the build-all binaries? Is the resulting
> directory the
> new project? Do I really need that huge directory tree to start a new
> project?
Read below...
>
> Maybe someone can walk me thru this! I have built the build-all and
> the new
> binaries are in the tree C:\VTK_New_Bin. Let's say I want to start
> a new
> project to display an array of 3D data points of type double. I
> know that
> the resulting graphic should look something like a piece of coarse
> sandpaper wrapped over the edge of my desk. I've installed CMake
> and I have
> a project name "My3DProject". Now What?
>
>
> Ron N. Harshbarger
OK.. let's boot strap the process for a new project. You have your
project directory called "MyProject". Now in that folder create a
basic "main.cpp" file and do the traditional "Hello World" thing. Now
that the source code is complete lets move on to using CMake to
generate a MSVC project files.
Create a new Text file called "CMakeLists.txt". (Note the
spelling, it MUST be named this way). In that text file put the
following:
PROJECT (MyProject)
#setup output Directories
SET (LIBRARY_OUTPUT_PATH
${PROJECT_BINARY_DIR}/Bin
CACHE PATH
"Single Directory for all Libraries"
)
#setup the Executable output Directory
SET (EXECUTABLE_OUTPUT_PATH
${PROJECT_BINARY_DIR}/Bin
CACHE PATH
"Single Directory for all Executables."
)
SET (SOURCES
main.cpp
)
# Create a Shared Library
ADD_EXECUTABLE(MyProject ${SOURCES} )
#---------------- CMakeLists.txt Complete -----------------
This will create an executable called "MyProject" and will place the
binaries in the "Build_Direcotry/Bin" (Actually MSVC will then place
"Debug" and "Release" folders in that folder which contains you
actual binaries.)
Now, the CMake folks recommend an "out of source" build style which
basically means that all the intermediate and final build products
are in a completely different directory. This does have some
advantages. Due to how I have my system setup I actually create a
directory within my Project folder called "Build" and have all the
build stuff rooted in there. So lets get started with CMake.
Fire up CMake from the windows start menu. A nice gui app should pop
up. In the "Source Code" directory listing click the button to pop up
the windows folder selection dialog. Select the "MyProject"
directory. Click OK.
Now click on the Binaries Directory (The next selection thing
down.. I am on a Mac at the moment so doing all the from memory). A
new Windows Directory selection Dialog will pop up. Navigate to your
"MyProject" directory, create a new Directory called "Build" within
the "MyProject" directory and select that as your "Binaries"
directory. Now click on the "configure" button and then the OK
Button. Also, when you first click the "Configure" button a dialog
will pop up asking what type of project files to create. Make sure
you select the type of MSVC version that matches what you have
installed on your system.
CMake should then create the MSVC files and exit. Now navigate to
your "MyProject/Build" directory in windows Explorer and then open
the "MyProject.sln" file. This will launch MSVC and allow you to
compile main.cpp.
After you get this far, then we can talk about how to make sure you
include VTK in your projects...
Mike Jackson
>
> Goodwin Lawlor
> <goodwin.lawlor at u
>
> cd.ie> To
> Sent by: vtkusers at public.kitware.com
> vtkusers-bounces
> + cc
> ronharshbarger=mm
> m.com at vtk.org
> Subject
> [vtkusers] Re: More Questions
>
> 01/30/2007 03:20
> PM
>
> Anka Kochanowska wrote:
>> Why don't you just install VTK binaries (you need openGL also) and
>> try
>> to build an MSVS project for the first example in VTK/Examples/
>> Tutorial
>> - cone?
>
> Usually, only the binary tcl interpreter with VTK wrappers are
> available... not binary VC++ imports libs
>
>> ronharshbarger at mmm.com wrote:
>>
>>> Sorry if I am being excessively anal and dense but I am really
>>> leery of
>>> installing software when I don't understand it. I bought the full
>>> set of
>>> books and the CD for VTK 5.0.2 and I use the Microsoft Visual
>>> Studio
> dot
>>> net foundation classes in C++ to do almost all of my programming
>>> which
>>> runs
>>> on XP/2000 or a Windows server. When I autorun the CD, it starts the
>>> installer and wants to install a bunch of things that are not in the
>>> "Mastering CMake" book. When I read the readme.html on the CD, under
>>> Windows it says I can install the binaries but then in the same
> paragraph
>>> it states that if I use C++ I can't use the binaries and will
>>> need to
>>> rebuild them from the source code supplied. Can't I just include the
>>> source
>>> files in my build?
>
> The best way to do it is to build the VTK libraries separately (using
> cmake and your own build environment) and then link these libs into
> your own project.
>
> There is an example of using VTK with MFC in the source tree here:
> \VTK\Examples\GUI\Win32\vtkMFC
>
> You can use cmake to configure your project to correctly link the VTK
> libs or just add the VTK includes directories, the lib directory, and
> the VTK libs to the linker
>
> hth
>
> Goodwin
>
>
More information about the vtkusers
mailing list