<meta charset="utf-8"><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">Thank you so much!</span><br clear="all"><div dir="ltr"><div style="padding-top:10px;padding-right:0pt;padding-bottom:5px;padding-left:0pt;font-family:arial, sans-serif;font-size:13.3px">
<span style="font-family:arial;font-size:small"><div dir="ltr"><div style="padding-top:10px;padding-right:0pt;padding-bottom:5px;padding-left:0pt;font-family:arial, sans-serif;font-size:13.3px"><span style="font-family:arial;font-size:small">Nikos Yiotis</span></div>
<div style="padding-top:10px;padding-right:0pt;padding-bottom:5px;padding-left:0pt;font-family:arial, sans-serif;font-size:13.3px;color:black"><span style="color:gray">Chat</span> <img src="http://www.images.wisestamp.com/skype.png" alt="" height="16" width="16" style="vertical-align:middle;padding-right:5px"><font style="color:gray;font-weight:bold;font-size:9pt">Skype: </font><font style="vertical-align:middle">nyiotis</font></div>
<div style="padding-top:5px;padding-right:0pt;padding-bottom:5px;padding-left:0pt;font-family:arial, sans-serif;font-size:13.3px;color:black"><span style="color:gray">Contact Me</span> <a href="http://my.wisestamp.com/link?u=ws7c27w2vnrx4d2b&site=www.linkedin.com/in/yiotis" style="padding-top:0pt;padding-right:2px;padding-bottom:0pt;padding-left:2px;color:blue;font-size:10pt" target="_blank"><img src="http://www.images.wisestamp.com/linkedin.png" alt="Linkedin" border="0" height="16" width="16" style="vertical-align:middle;padding-bottom:5px"></a></div>
<div><br></div></div><font color="#999999"></font></span><font color="#999999"></font></div></div><br><br>
<br><br><div class="gmail_quote">On Mon, Jan 3, 2011 at 9:57 AM, Nizar Khalifa Sallem <span dir="ltr"><<a href="mailto:nksallem@laas.fr">nksallem@laas.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
At Sun, 2 Jan 2011 22:15:56 +0100,<br>
<div><div></div><div class="h5">ny wrote:<br>
><br>
> ** Apologies for double-posting my earlier message got truncated **<br>
><br>
> greetings!<br>
><br>
> I spent enough time trying to make the software work,<br>
> so I'd be happy to get some feedback::<br>
> I built research code written in (templated) c++, size is approximately <br>
> ~15K lines. I am on a mac and do not use Cocoa(/xcode), straight from <br>
> command line. Note that I choose to generate a Unix makefile, not an <br>
> xcode project and I am on snow leopard 10.6.5 w/ g++ 4.2.1.<br>
> The pain was that there were no makefile coming along w/ the project, <br>
> so I had to translate the *.vcproj file from scratch to CMakelists and <br>
> then convert it to makefile. My directories structure (directories marked <br>
> w/ DIR_ else are files, indentation denotes deeper level):: <br>
><br>
> DIR_4DMPU_exampleTest<br>
> <br>
> 4DMPU_example.cpp<br>
> DIR_ann_1.1.2 <br>
> DIR_cmake<br>
> CMakeLists.txt<br>
> FindANN.cmake<br>
> Modules<br>
> FindANN.cmake<br>
><br>
> DIR_include<br>
> <br>
> DIR_mc4d_tables<br>
> num_tet_table.cpp<br>
> tet_table.cpp<br>
> vert_table.cpp <br>
><br>
> DIR_4DMPU_exampleTestBin<br>
><br>
> In the cmake GUI I add:<br>
> ANN_LIBRARY /Users/nikos/Downloads/4DMPU_exampleTest/ann_1.1.2/include<br>
> ANN_INCLUDE_DIR /Users/nikos/Downloads/4DMPU_exampleTest/ann_1.1.2/lib/libANN.a<br>
><br>
> My CMakeLists.txt is::<br>
><br>
> cmake_minimum_required(VERSION 2.8)<br>
> project( 4DMPU_example )<br>
><br>
> SET (CMAKE_BUILD_TYPE DEBUG)<br>
><br>
> set(SOURCE_FILES<br>
> 4DMPU_example.cpp<br>
> mc4d_tables/num_tet_table.cpp<br>
> mc4d_tables/tet_table.cpp<br>
> mc4d_tables/vert_table.cpp<br>
> )<br>
><br>
> set(INCLUDE_FILES<br>
> include/4dtables.h<br>
> include/ann_helper.h<br>
> ... # more headers<br>
> include/Volume.h ann_1.1.2/include<br>
> include/VolumeIO.h<br>
> )<br>
><br>
> include_directories( <br>
> ${PROJECT_SOURCE_DIR}/ann_1.1.2/include<br>
> ${PROJECT_SOURCE_DIR}/ann_1.1.2/lib<br>
> include<br>
> )<br>
><br>
> INCLUDE(FindANN.cmake)<br>
> IF(ANN_FOUND)<br>
> INCLUDE_DIRECTORIES( ${ANN_INCLUDE_DIR} )<br>
> ENDIF(ANN_FOUND)<br>
><br>
> set(LIBS ${LIBS} ${ANN_LIBRARY})<br>
><br>
> add_executable( 4DMPU_example ${SOURCE_FILES} )<br>
> target_link_libraries( 4DMPU_example ${LIBS} )<br>
><br>
> and the content of the FindANN.cmake::<br>
><br>
> FIND_LIBRARY(ANN_LIBRARY lANN<br>
> ${PROJECT_SOURCE_DIR}/ann_1.1.2/lib<br>
> )<br>
> FIND_PATH( ANN_INCLUDE_DIR ANN/ANN.h ANN/ANNperf.h ANN/ANNx.h <br>
> ${PROJECT_SOURCE_DIR}/ann_1.1.2/include<br>
> )<br>
><br>
> IF(ANN_LIBRARY)<br>
> IF(ANN_INCLUDE_DIR)<br>
> SET(ANN_FOUND TRUE)<br>
> ENDIF(ANN_INCLUDE_DIR)<br>
> ENDIF(ANN_LIBRARY)<br>
><br>
> The project compiles fine this way.<br>
><br>
> Now, the problem is that if I follow the advice below<br>
><br>
> <a href="http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries#Using_external_libraries_in_your_project" target="_blank">http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries#Using_external_libraries_in_your_project</a><br>
><br>
> and add the line<br>
><br>
> set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")<br>
><br>
> and, moreover, substitute<br>
><br>
> include_directories( <br>
> ${PROJECT_SOURCE_DIR}/ann_1.1.2/include<br>
> ${PROJECT_SOURCE_DIR}/ann_1.1.2/lib<br>
> include<br>
> )<br>
><br>
> with<br>
><br>
> find_package(ANN REQUIRED)<br>
> include_directories(${ANN_INCLUDE_DIR}<br>
> include<br>
> )<br>
><br>
> into CMakeLists.txt I get a linking problem. <br>
> I do not reproduce the message -> the point is that the ANN library is not linked<br>
> w/ my object files. Can anyone tell me what I am doing wrong in the 2nd case? <br>
><br>
> Note also that in the 2nd case I explicitly add::<br>
><br>
> ANN_DIR /Users/nikos/Downloads/4DMPU_exampleTest/cmake/Modules <br>
> <br>
> in the cmake GUI. <br>
><br>
> Thanks for any pointers<br>
> N<br>
><br>
><br>
</div></div>Hi, the problem is that you don't have a CMakeLists for your ANN<br>
library so 2 choices:<br>
1. write a CMakeLists for ANN and then just add_subdirectory(ANN) and<br>
use the ANN_library target name to link with.<br>
2. assume that ANN is a part of your project which you have done so<br>
far but the wrong way.<br>
you need to do the following:<br>
i- remove find_package(ANN REQUIRED) since as far as I know from ANN<br>
it doesn't ship with a .pc or FindANN.cmake file so you can't use find<br>
find_package(ANN REQUIRED)<br>
ii- set ANN_INCLUDE_DIR and ANN_LIBS_DIR and ANN_LIBRARIES to be user<br>
assigned values which you fill with cmake<br>
.. -DANN_INCLUDE_DIR=/path/to/ANN/install etc.<br>
<br>
Now I have submitted a while ago a CMakeLists.txt to the ANN library<br>
project and they didn't include it so if you want you can have a ANN<br>
subdirectory in your prject, place the CMakeLists.txt there and do as<br>
1.<br>
<br>
I attach the file<br>
<br>cmake_minimum_required(VERSION 2.6)<br>
<br>
project(ANN CXX)<br>
set(major 1)<br>
set(minor 1)<br>
set(revision 2)<br>
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${ANN_SOURCE_DIR}/lib)<br>
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${ANN_SOURCE_DIR}/bin)<br>
<br>
# the ANN library<br>
include_directories(include)<br>
include_directories(src)<br>
file(GLOB sources src/*.cpp)<br>
add_library(ANN SHARED ${sources})<br>
set_target_properties(ANN PROPERTIES VERSION ${major}.${minor}.${revision}<br>
SOVERSION ${major}<br>
COMPILE_FLAGS "-O3")<br>
<br>
# ANN test utility<br>
include_directories(test)<br>
file(GLOB test_sources test/*.cpp)<br>
add_executable(ann_test ${test_sources})<br>
target_link_libraries(ann_test ANN)<br>
<br>
# ANN sample utility<br>
add_executable(ann_sample sample/ann_sample.cpp)<br>
target_link_libraries(ann_sample ANN)<br>
<br>
# ann2fig utility<br>
add_executable(ann2fig ann2fig/ann2fig.cpp)<br>
target_link_libraries(ann2fig ANN)<br>
<br>
# install<br>
install(TARGETS ANN ann_test ann_sample ann2fig<br>
RUNTIME DESTINATION bin<br>
LIBRARY DESTINATION lib)<br>
install(DIRECTORY sample doc DESTINATION share/ANN)<br>
<br><br>
<br>
Cheers,<br>
--<br>
Nizar<br>
<br>
<br></blockquote></div><br>