├── .gitignore
├── AUTHORS
├── CMakeLists.txt
├── FindBoost.cmake
├── FindOctave.cmake
├── INSTALL.md
├── LICENSE
├── README
├── cmake_uninstall.cmake.in
├── examples
├── test0.jpg
├── test1.jpg
├── test2.jpg
└── testsiftfast.py
├── install_manifest.txt
├── libsiftfast.cpp
├── makerelease.sh
├── profiler.cpp
├── profiler.h
├── runcmake.bat
├── siftfast.cpp
├── siftfast.h
├── siftfast.m
├── siftfastpy.cpp
└── siftmex.cpp
/.gitignore:
--------------------------------------------------------------------------------
1 | *.eprj
2 | *.svn
3 | *.pyc
4 | *.orig
5 | .DS_Store
6 | *~
7 | \#*\#
8 |
9 | *.a
10 | *.o
11 | *.so
12 | *.dylib
13 |
14 | *.dmg
15 | *.jar
16 |
17 | *.hg
18 | *.hgignore
19 | .hg/*
20 | .hgignore
21 |
22 | *.dropbox
23 | .dropbox
24 |
25 | Icon*
26 | install_manifest.txt
27 | CMakeCache.txt
28 | CMakeFiles/
29 | siftfast
30 | Makefile
31 | cmake_install.cmake
32 | cmake_uninstall.cmake
33 |
34 |
--------------------------------------------------------------------------------
/AUTHORS:
--------------------------------------------------------------------------------
1 | zerofrog(@gmail.com)
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # exact C++ implementation of lowe's sift program
2 | # author: zerofrog(@gmail.com), Sep 2008
3 | #
4 | # This program is free software: you can redistribute it and/or modify
5 | # it under the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # at your option) any later version.
8 | #
9 | # This program is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # Lesser GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with this program. If not, see .
16 | cmake_minimum_required (VERSION 2.4.7)
17 | project (libsiftfast)
18 | set( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE )
19 | set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
20 |
21 | # Differences between CMake 2.4 and 2.6
22 | if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.4)
23 | message(STATUS "Using cmake version ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" )
24 | # some developers may be using an cmake cvs version which didn't have set_property() yet
25 | # Tell them that a more recent version is required.
26 | if(NOT COMMAND SET_PROPERTY)
27 | message(FATAL_ERROR "You are using an old version of CMake from cvs, please update to CMake >= 2.6.0 or cvs at least from Feb 20th, 2008")
28 | endif(NOT COMMAND SET_PROPERTY)
29 |
30 | # CMP0003: add the link paths to the link command as with cmake 2.4
31 | cmake_policy(SET CMP0003 OLD)
32 | endif()
33 |
34 | # Add the automatically determined parts of the RPATH
35 | # which point to directories outside the build tree to the install RPATH
36 | set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
37 |
38 | include(CheckCXXSourceRuns)
39 |
40 | if( CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX )
41 | set(CMAKE_CXX_FLAGS_RELEASE "-O3 -g")
42 | add_definitions(" -Wall -fPIC -v ")
43 |
44 | # check for x86-64 system
45 | check_cxx_source_runs("
46 | int main()
47 | {
48 | int a = 0;
49 | int*pa = &a;
50 | asm(\".intel_syntax\\\\n\"
51 | \"mov %%rax, %0\\\\n\"
52 | \"mov %%eax, [%%rax]\\\\n\"
53 | \".att_syntax\\\\n\"
54 | : : \"r\"(pa) : \"%rax\");
55 | return 0;
56 | }"
57 | IS_X86_64)
58 |
59 | if( IS_X86_64 )
60 | add_definitions("-D__x86_64__")
61 | endif()
62 | else()
63 | set(IS_X86_64 0)
64 | endif()
65 |
66 | include(CheckIncludeFile)
67 | include(CheckLibraryExists)
68 | include(CheckCXXSourceRuns)
69 | include(CheckCXXCompilerFlag)
70 |
71 | if( UNIX OR CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX )
72 | set(STDC_LIBRARY stdc++)
73 | else()
74 | set(STDC_LIBRARY)
75 | endif()
76 |
77 | # check for SSE extensions
78 | if( CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX )
79 | set(SSE_FLAGS)
80 |
81 | set(CMAKE_REQUIRED_FLAGS "-msse2")
82 | check_cxx_source_runs("
83 | #include
84 |
85 | int main()
86 | {
87 | __m128d a, b;
88 | double vals[2] = {0};
89 | a = _mm_loadu_pd(vals);
90 | b = _mm_add_pd(a,a);
91 | _mm_storeu_pd(vals,b);
92 | return 0;
93 | }"
94 | HAS_SSE2_EXTENSIONS)
95 |
96 | set(CMAKE_REQUIRED_FLAGS "-msse")
97 | check_cxx_source_runs("
98 | #include
99 | int main()
100 | {
101 | __m128 a, b;
102 | float vals[4] = {0};
103 | a = _mm_loadu_ps(vals);
104 | b = a;
105 | b = _mm_add_ps(a,b);
106 | _mm_storeu_ps(vals,b);
107 | return 0;
108 | }"
109 | HAS_SSE_EXTENSIONS)
110 |
111 | set(CMAKE_REQUIRED_FLAGS)
112 |
113 | if(HAS_SSE2_EXTENSIONS)
114 | message(STATUS "Using SSE2 extensions")
115 | set(SSE_FLAGS "-msse2 -mfpmath=sse")
116 | elseif(HAS_SSE_EXTENSIONS)
117 | message(STATUS "Using SSE extensions")
118 | set(SSE_FLAGS "-msse -mfpmath=sse")
119 | endif()
120 |
121 | add_definitions(${SSE_FLAGS})
122 | elseif(MSVC)
123 | check_cxx_source_runs("
124 | #include
125 |
126 | int main()
127 | {
128 | __m128d a, b;
129 | double vals[2] = {0};
130 | a = _mm_loadu_pd(vals);
131 | b = _mm_add_pd(a,a);
132 | _mm_storeu_pd(vals,b);
133 | return 0;
134 | }"
135 | HAS_SSE2_EXTENSIONS)
136 | if( HAS_SSE2_EXTENSIONS )
137 | message(STATUS "Using SSE2 extensions")
138 | add_definitions( "/arch:SSE2 /fp:fast -D__SSE__ -D__SSE2__" )
139 | endif()
140 | endif()
141 |
142 | set(Boost_ADDITIONAL_VERSIONS "1.40" "1.39" "1.38" "1.37.0" "1.37" "1.35.0" "1.34.1" "1.34.0" "1.34" "1.33.1" "1.33.0" "1.33")
143 | if( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" )
144 | set(Boost_INCLUDE_DIR $ENV{BOOST_INCLUDEDIR})
145 | endif()
146 | if( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" )
147 | set(Boost_LIBRARY_DIRS $ENV{BOOST_LIBRARYDIR})
148 | endif()
149 |
150 | find_package(Boost
151 | COMPONENTS python
152 | )
153 |
154 | if( Boost_FOUND )
155 | message(STATUS "found boost version: ${Boost_VERSION}")
156 | else()
157 | message(STATUS "Could not find boost libraries!")
158 | endif()
159 |
160 |
161 | #find_library(
162 | # CPPUNIT_LIBRARY_RELEASE
163 | # NAMES
164 | # PATHS /usr/local/Cellar/cppunit/1.12.1/lib
165 | # /usr/lib
166 | # /usr/lib64
167 | # /usr/local/lib
168 | # /usr/local/lib64
169 | #)
170 |
171 | add_library(libsiftfast SHARED libsiftfast.cpp)
172 | add_library(libsiftfast-static STATIC libsiftfast.cpp)
173 |
174 |
175 |
176 |
177 | if( CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX )
178 | target_link_libraries(libsiftfast m stdc++)
179 | endif()
180 |
181 | target_link_libraries(libsiftfast m stdc++ dl python2.7)
182 |
183 | set_target_properties(libsiftfast PROPERTIES OUTPUT_NAME siftfast CLEAN_DIRECT_OUTPUT 1)
184 | if( MSVC )
185 | set(LIBSIFTFAST_NAME libsiftfast-s)
186 | else()
187 | set(LIBSIFTFAST_NAME siftfast)
188 | endif()
189 | set_target_properties(libsiftfast-static PROPERTIES OUTPUT_NAME ${LIBSIFTFAST_NAME} CLEAN_DIRECT_OUTPUT 1)
190 |
191 | #if(UNIX AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
192 | # set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "libsiftfast install prefix" FORCE )
193 | #endif()
194 |
195 | message(STATUS "installing to ${CMAKE_INSTALL_PREFIX}")
196 |
197 | # compile without depending on libsiftfast
198 | include_directories(${CMAKE_CURRENT_SOURCE_DIR})
199 | add_executable(siftfast libsiftfast.cpp siftfast.cpp)# profiler.cpp)
200 | #set_target_properties(siftfast PROPERTIES COMPILE_FLAGS "-DDVPROFILE")
201 | target_link_libraries(siftfast libsiftfast m stdc++ dl python2.7)
202 |
203 | #
204 | # generate python bindings via boost-python
205 | #
206 | set(BUILD_SIFTFASTPY)
207 | if( Boost_PYTHON_FOUND )
208 | find_package(PythonLibs)
209 |
210 | if( PYTHONLIBS_FOUND OR PYTHON_LIBRARIES )
211 |
212 | find_package(PythonInterp)
213 | if( NOT PYTHON_EXECUTABLE )
214 | # look specifically for 2.6
215 | FIND_PROGRAM(PYTHON_EXECUTABLE
216 | NAMES python2.7 python
217 | PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.6\\InstallPath])
218 | endif()
219 |
220 | if( PYTHON_EXECUTABLE )
221 | # get the site-packages directory
222 | execute_process(
223 | COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
224 | OUTPUT_VARIABLE _python_sitepackage
225 | RESULT_VARIABLE _python_failed)
226 | if( ${_python_failed} EQUAL 0 )
227 | string(REGEX REPLACE "[\r\n]" "" _python_sitepackage "${_python_sitepackage}")
228 | set(PYTHON_INCLUDE_PATH ${PYTHON_INCLUDE_PATH} ${_python_sitepackage}/numpy/core/include)
229 | else()
230 | message(STATUS "failed to get python site-package directory")
231 | endif()
232 | endif()
233 |
234 | add_definitions(${Boost_CFLAGS})
235 | set(CMAKE_REQUIRED_INCLUDES ${PYTHON_INCLUDE_PATH} ${Boost_INCLUDE_DIR} )
236 | set(CMAKE_REQUIRED_LIBRARIES ${PYTHON_LIBRARIES} ${Boost_PYTHON_LIBRARY} ${Boost_THREAD_LIBRARY})
237 | set(CMAKE_REQUIRED_FLAGS ${Boost_CFLAGS})
238 |
239 | # check if all header files can be included
240 | check_cxx_source_runs("
241 | #include
242 | #include
243 | #include
244 | #include
245 | #include
246 | #define PY_ARRAY_UNIQUE_SYMBOL PyArrayHandle
247 | #include
248 | #include
249 | #include
250 | int main()
251 | {
252 | return 0;
253 | }"
254 | HAVE_ALL_PYTHON_HEADERS)
255 |
256 | if( HAVE_ALL_PYTHON_HEADERS )
257 | message(STATUS "python and boost-python found")
258 | include_directories(${PYTHON_INCLUDE_PATH} ${Boost_INCLUDE_DIRS})
259 | link_directories(${Boost_LIBRARY_DIRS})
260 | add_library(siftfastpy SHARED siftfastpy.cpp libsiftfast.cpp)
261 | # stdc++ has to be included before opengl libraries due to some ATI bug (http://wiki.fifengine.de/Segfault_in_cxa_allocate_exception#Workaround)
262 | target_link_libraries(siftfastpy ${STDC_LIBRARY} ${PYTHON_LIBRARIES} ${Boost_PYTHON_LIBRARY})
263 |
264 | set_target_properties(siftfastpy PROPERTIES PREFIX "")
265 | if( WIN32 )
266 | set_target_properties(siftfastpy PROPERTIES SUFFIX ".pyd")
267 | endif()
268 | set(BUILD_SIFTFASTPY 1)
269 | install(TARGETS siftfastpy DESTINATION lib/python2.7/site-packages PERMISSIONS
270 | OWNER_READ OWNER_WRITE OWNER_EXECUTE
271 | GROUP_READ GROUP_EXECUTE
272 | WORLD_READ WORLD_EXECUTE)
273 | else()
274 | message(STATUS "failed to use boost python libraries, check if python-numpy is installed.")
275 | endif()
276 | else()
277 | message(STATUS "failed to find python-dev please install it")
278 | endif()
279 | else()
280 | message(STATUS "failed to find boost-python, please install it")
281 | endif()
282 |
283 | # check for OpenMP
284 | if( NOT DEFINED USE_OPENMP OR USE_OPENMP )
285 |
286 | if( WIN32 )
287 | CHECK_INCLUDE_FILE(omp.h HAVE_OMP_H)
288 | if( HAVE_OMP_H )
289 | message(STATUS "Using OpenMP")
290 | check_cxx_compiler_flag(/openmp HAVE_OPENMP)
291 |
292 | if( HAVE_OPENMP )
293 | message(STATUS "compiling with openmp support")
294 | add_definitions("/openmp")
295 | endif()
296 | endif()
297 |
298 | elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
299 |
300 | # check if compilers supports -fopenmp
301 | INCLUDE(CheckCCompilerFlag)
302 | check_cxx_compiler_flag(-fopenmp HAVE_OPENMP)
303 | check_library_exists(gomp omp_get_num_threads "" HAS_GOMP_LIB)
304 |
305 | if( HAVE_OPENMP AND HAS_GOMP_LIB )
306 | message(STATUS "compiling with openmp support")
307 | add_definitions("-fopenmp")
308 | target_link_libraries(siftfast gomp)
309 | target_link_libraries(libsiftfast gomp)
310 | target_link_libraries(libsiftfast-static gomp)
311 | if( BUILD_SIFTFASTPY )
312 | target_link_libraries(siftfastpy gomp)
313 | endif()
314 | set(OPENMP_LFLAGS "-lgomp")
315 | endif()
316 | endif()
317 | endif()
318 |
319 | #
320 | # generate mex files
321 | #
322 |
323 | set(MATLAB MATLAB-NOTFOUND)
324 | if( WIN32 )
325 | FIND_PROGRAM(MATLAB NAME "mex.bat" PATHS )
326 | else()
327 | FIND_PROGRAM(MATLAB NAME "mex" PATHS )
328 | endif()
329 |
330 | set(MEX_LIBS)
331 | if( CMAKE_COMPILER_IS_GNUC OR CMAKE_COMPILER_IS_GNUCXX )
332 | if( WIN32 )
333 | set(MEX_CXXFLAGS "${OPENMP_LFLAGS} ")
334 | else()
335 | # check for lapack
336 | check_library_exists(lapack _init "" HAS_LAPACK_LIB)
337 | if( HAS_LAPACK_LIB )
338 | set(MEX_LIBS "-llapack")
339 | endif()
340 | set(MEX_CXXFLAGS "-Wl,-rpath,${CMAKE_INSTALL_PREFIX}/lib ${OPENMP_LFLAGS}")
341 | endif()
342 | elseif(MSVC)
343 | set(MEX_CXXFLAGS "-L\"${libsiftfast_BINARY_DIR}/Release\" -L\"${libsiftfast_BINARY_DIR}/Debug\"")
344 | else()
345 | set(MEX_CXXFLAGS)
346 | endif()
347 |
348 | if(MATLAB)
349 | # check if the mex file is actually matlab (can be confused with latex)
350 | EXEC_PROGRAM(${MATLAB} ARGS "-version" OUTPUT_VARIABLE MEX_TEST_OUT RETURN_VALUE MEX_TEST_RETURN)
351 | #message(STATUS "mex result: ${MEX_TEST_OUT}")
352 | string(REGEX MATCH "MATLAB" IS_MATLAB "${MEX_TEST_OUT}")
353 |
354 | if( IS_MATLAB )
355 | set(USE_MATLAB 1)
356 | else()
357 | set(USE_MATLAB)
358 | endif()
359 | endif()
360 |
361 | if(USE_MATLAB)
362 |
363 | if( DARWIN OR APPLE )
364 | set(MEXEXT "mexmac")
365 | elseif( UNIX )
366 | if( IS_X86_64 )
367 | set(MEXEXT "mexa64")
368 | else()
369 | set(MEXEXT "mexglx")
370 | endif()
371 | elseif( WIN64 )
372 | set(MEXEXT "mexw64")
373 | elseif( WIN32 OR CYGWIN OR WINDOWS )
374 | set(MEXEXT "mexw32")
375 | else()
376 | set(MEXEXT "mex")
377 | endif()
378 |
379 | set(MATLAB_MEX "siftfast.${MEXEXT}")
380 |
381 | if( MSVC )
382 | set(MATLAB_MEX_OUT "${CMAKE_CURRENT_BINARY_DIR}/matlab")
383 | else()
384 | set(MATLAB_MEX_OUT ${CMAKE_CURRENT_BINARY_DIR})
385 | endif()
386 |
387 | add_custom_command(
388 | OUTPUT ${MATLAB_MEX_OUT}/${MATLAB_MEX}
389 | COMMAND mex
390 | ARGS -I\"${CMAKE_SOURCE_DIR}\" -L\"${libsiftfast_BINARY_DIR}\" ${MEX_LIBS} ${MEX_CXXFLAGS} -lsiftfast -outdir \"${MATLAB_MEX_OUT}\" -output \"${MATLAB_MEX}\" \"${CMAKE_CURRENT_SOURCE_DIR}/siftmex.cpp\"
391 | DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/siftmex.cpp libsiftfast libsiftfast-static
392 | )
393 | add_custom_target(siftfast_matlab ALL DEPENDS ${MATLAB_MEX_OUT}/${MATLAB_MEX})
394 | install(FILES ${MATLAB_MEX_OUT}/${MATLAB_MEX} siftfast.m DESTINATION share/siftfast/matlab)
395 | else()
396 | message(STATUS "MATLAB installation not found")
397 | endif(USE_MATLAB)
398 |
399 |
400 | # include(${CMAKE_SOURCE_DIR}/FindOctave.cmake)
401 | # if(OCTAVE_FOUND)
402 | # if( MSVC )
403 | # # need _mex since mkoctfile generates a siftfast.lib which messes with windows stuff
404 | # set(OCTAVE_MEX ${CMAKE_CURRENT_BINARY_DIR}/octave/siftfast_mex.mex)
405 | # else()
406 | # set(OCTAVE_MEX ${CMAKE_CURRENT_BINARY_DIR}/siftfast.mex)
407 | # endif()
408 | #
409 | # add_custom_command(
410 | # OUTPUT ${OCTAVE_MEX}
411 | # COMMAND ${MKOCTFILE_EXECUTABLE}
412 | # ARGS --mex -I${CMAKE_SOURCE_DIR} -L\"${libsiftfast_BINARY_DIR}\" ${MEX_LIBS} ${MEX_CXXFLAGS} -lsiftfast -o \"${OCTAVE_MEX}\" \"${CMAKE_CURRENT_SOURCE_DIR}/siftmex.cpp\"
413 | # DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/siftmex.cpp libsiftfast libsiftfast-static
414 | # )
415 | #
416 | # add_custom_target(siftfast_octave ALL DEPENDS ${OCTAVE_MEX})
417 | # if( MSVC )
418 | # add_custom_command(
419 | # OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/octave/siftfast.mex
420 | # COMMAND ${CMAKE_COMMAND} -E copy
421 | # ARGS \"${OCTAVE_MEX}\" \"${CMAKE_CURRENT_BINARY_DIR}/octave/siftfast.mex\"
422 | # DEPENDS ${OCTAVE_MEX}
423 | # )
424 | # add_custom_target(siftfast_octave2 ALL DEPENDS DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/octave/siftfast.mex)
425 | # endif()
426 | #
427 | # install(FILES ${OCTAVE_MEX} siftfast.m DESTINATION share/siftfast/octave)
428 | #
429 | # else(OCTAVE_FOUND)
430 | # message(STATUS "Octave installation not found")
431 | # endif(OCTAVE_FOUND)
432 |
433 | install(FILES siftfast.h DESTINATION include/siftfast)
434 | install(TARGETS siftfast DESTINATION bin)
435 | if( MSVC )
436 | install(TARGETS libsiftfast RUNTIME DESTINATION bin LIBRARY DESTINATION bin ARCHIVE DESTINATION lib)
437 | else()
438 | install(TARGETS libsiftfast DESTINATION lib PERMISSIONS
439 | OWNER_READ OWNER_WRITE OWNER_EXECUTE
440 | GROUP_READ GROUP_EXECUTE
441 | WORLD_READ WORLD_EXECUTE)
442 | endif()
443 |
444 | file(GLOB jpg_files ${CMAKE_CURRENT_SOURCE_DIR}/examples/*.jpg)
445 | install(FILES ${jpg_files} DESTINATION share/siftfast/examples)
446 | install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/examples/testsiftfast.py DESTINATION share/siftfast/examples)
447 |
448 | # add make uninstall capability
449 | CONFIGURE_FILE(
450 | "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
451 | "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
452 | IMMEDIATE @ONLY)
453 |
454 | ADD_CUSTOM_TARGET(uninstall
455 | "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
456 |
--------------------------------------------------------------------------------
/FindBoost.cmake:
--------------------------------------------------------------------------------
1 | # - Try to find Boost include dirs and libraries
2 | # Usage of this module as follows:
3 | #
4 | # SET(Boost_USE_STATIC_LIBS ON)
5 | # SET(Boost_USE_MULTITHREAD OFF)
6 | # FIND_PACKAGE( Boost 1.34.1 COMPONENTS date_time filesystem iostreams ... )
7 | #
8 | # The Boost_ADDITIONAL_VERSIONS variable can be used to specify a list of
9 | # boost version numbers that should be taken into account when searching
10 | # for the libraries. Unfortunately boost puts the version number into the
11 | # actual filename for the libraries, so this might be needed in the future
12 | # when new Boost versions are released.
13 | #
14 | # Currently this module searches for the following version numbers:
15 | # 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0, 1.35.1, 1.36,
16 | # 1.36.0, 1.36.1
17 | #
18 | # The components list needs to be the actual names of boost libraries, that is
19 | # the part of the actual library files that differ on different libraries. So
20 | # its "date_time" for "libboost_date_time...". Anything else will result in
21 | # errors
22 | #
23 | # You can provide a minimum version number that should be used. If you provide this
24 | # version number and specify the REQUIRED attribute, this module will fail if it
25 | # can't find the specified or a later version. If you specify a version number this is
26 | # automatically put into the considered list of version numbers and thus doesn't need
27 | # to be specified in the Boost_ADDITIONAL_VERSIONS variable
28 | #
29 | # Variables used by this module, they can change the default behaviour and need to be set
30 | # before calling find_package:
31 | # Boost_USE_MULTITHREAD Can be set to OFF to use the non-multithreaded
32 | # boost libraries. Defaults to ON.
33 | # Boost_USE_STATIC_LIBS Can be set to ON to force the use of the static
34 | # boost libraries. Defaults to OFF.
35 | # Boost_ADDITIONAL_VERSIONS A list of version numbers to use for searching
36 | # the boost include directory. The default list
37 | # of version numbers is:
38 | # 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1,
39 | # 1.35, 1.35.0, 1.35.1, 1.36, 1.36.0, 1.36.1
40 | # If you want to look for an older or newer
41 | # version set this variable to a list of
42 | # strings, where each string contains a number, i.e.
43 | # SET(Boost_ADDITIONAL_VERSIONS "0.99.0" "1.35.0")
44 | # BOOST_ROOT or BOOSTROOT Preferred installation prefix for searching for Boost,
45 | # set this if the module has problems finding the proper Boost installation
46 | # BOOST_INCLUDEDIR Set this to the include directory of Boost, if the
47 | # module has problems finding the proper Boost installation
48 | # BOOST_LIBRARYDIR Set this to the lib directory of Boost, if the
49 | # module has problems finding the proper Boost installation
50 | #
51 | # The last three variables are available also as environment variables
52 | #
53 | #
54 | # Variables defined by this module:
55 | #
56 | # Boost_FOUND System has Boost, this means the include dir was found,
57 | # as well as all the libraries specified in the COMPONENTS list
58 | # Boost_INCLUDE_DIRS Boost include directories, not cached
59 | # Boost_INCLUDE_DIR This is almost the same as above, but this one is cached and may be
60 | # modified by advanced users
61 | # Boost_LIBRARIES Link these to use the Boost libraries that you specified, not cached
62 | # Boost_LIBRARY_DIRS The path to where the Boost library files are.
63 | # Boost_VERSION The version number of the boost libraries that have been found,
64 | # same as in version.hpp from Boost
65 | # Boost_LIB_VERSION The version number in filename form as its appended to the library filenames
66 | # Boost_MAJOR_VERSION major version number of boost
67 | # Boost_MINOR_VERSION minor version number of boost
68 | # Boost_SUBMINOR_VERSION subminor version number of boost
69 | # Boost_LIB_DIAGNOSTIC_DEFINITIONS Only set on windows. Can be used with add_definitions
70 | # to print diagnostic information about the automatic
71 | # linking done on windows.
72 |
73 | # For each component you list the following variables are set.
74 | # ATTENTION: The component names need to be in lower case, just as the boost
75 | # library names however the cmake variables use upper case for the component
76 | # part. So you'd get Boost_SERIALIZATION_FOUND for example.
77 | #
78 | # Boost_${COMPONENT}_FOUND True IF the Boost library "component" was found.
79 | # Boost_${COMPONENT}_LIBRARY The absolute path of the Boost library "component".
80 | # Boost_${COMPONENT}_LIBRARY_DEBUG The absolute path of the debug version of the
81 | # Boost library "component".
82 | # Boost_${COMPONENT}_LIBRARY_RELEASE The absolute path of the release version of the
83 | # Boost library "component"
84 | #
85 | # Copyright (c) 2006-2008 Andreas Schneider
86 | # Copyright (c) 2007 Wengo
87 | # Copyright (c) 2007 Mike Jackson
88 | # Copyright (c) 2008 Andreas Pakulat
89 | #
90 | # Redistribution AND use is allowed according to the terms of the New
91 | # BSD license.
92 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
93 | #
94 | OPTION(Boost_USE_MULTITHREADED
95 | "Use the multithreaded versions of the Boost libraries" ON)
96 |
97 | if (Boost_FIND_VERSION_EXACT)
98 | if (Boost_FIND_VERSION_PATCH)
99 | set( _boost_TEST_VERSIONS
100 | "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}")
101 | else (Boost_FIND_VERSION_PATCH)
102 | set( _boost_TEST_VERSIONS
103 | "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.0"
104 | "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
105 | endif (Boost_FIND_VERSION_PATCH)
106 | else (Boost_FIND_VERSION_EXACT)
107 | set( _boost_TEST_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
108 | "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0"
109 | "1.34" "1.33.1" "1.33.0" "1.33" )
110 | endif (Boost_FIND_VERSION_EXACT)
111 |
112 | # The reason that we failed to find Boost. This will be set to a
113 | # user-friendly message when we fail to find some necessary piece of
114 | # Boost.
115 | set(Boost_ERROR_REASON)
116 |
117 | ############################################
118 | #
119 | # Check the existence of the libraries.
120 | #
121 | ############################################
122 | # This macro was taken directly from the FindQt4.cmake file that is included
123 | # with the CMake distribution. This is NOT my work. All work was done by the
124 | # original authors of the FindQt4.cmake file. Only minor modifications were
125 | # made to remove references to Qt and make this file more generally applicable
126 | #########################################################################
127 |
128 | MACRO (_Boost_ADJUST_LIB_VARS basename)
129 | IF (Boost_INCLUDE_DIR )
130 | IF (Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE)
131 | # if the generator supports configuration types then set
132 | # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
133 | IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
134 | SET(Boost_${basename}_LIBRARY optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG})
135 | ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
136 | # if there are no configuration types and CMAKE_BUILD_TYPE has no value
137 | # then just use the release libraries
138 | SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} )
139 | ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
140 | SET(Boost_${basename}_LIBRARIES optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG})
141 | ENDIF (Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE)
142 |
143 | # if only the release version was found, set the debug variable also to the release version
144 | IF (Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG)
145 | SET(Boost_${basename}_LIBRARY_DEBUG ${Boost_${basename}_LIBRARY_RELEASE})
146 | SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE})
147 | SET(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE})
148 | ENDIF (Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG)
149 |
150 | # if only the debug version was found, set the release variable also to the debug version
151 | IF (Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE)
152 | SET(Boost_${basename}_LIBRARY_RELEASE ${Boost_${basename}_LIBRARY_DEBUG})
153 | SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_DEBUG})
154 | SET(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_DEBUG})
155 | ENDIF (Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE)
156 |
157 | IF (Boost_${basename}_LIBRARY)
158 | SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY} CACHE FILEPATH "The Boost ${basename} library")
159 | GET_FILENAME_COMPONENT(Boost_LIBRARY_DIRS "${Boost_${basename}_LIBRARY}" PATH)
160 | SET(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS} CACHE FILEPATH "Boost library directory")
161 | SET(Boost_${basename}_FOUND ON CACHE INTERNAL "Whether the Boost ${basename} library found")
162 | ENDIF (Boost_${basename}_LIBRARY)
163 |
164 | ENDIF (Boost_INCLUDE_DIR )
165 | # Make variables changeble to the advanced user
166 | MARK_AS_ADVANCED(
167 | Boost_${basename}_LIBRARY
168 | Boost_${basename}_LIBRARY_RELEASE
169 | Boost_${basename}_LIBRARY_DEBUG
170 | )
171 | ENDMACRO (_Boost_ADJUST_LIB_VARS)
172 |
173 | #-------------------------------------------------------------------------------
174 |
175 |
176 | SET( _boost_IN_CACHE TRUE)
177 | IF(Boost_INCLUDE_DIR)
178 | FOREACH(COMPONENT ${Boost_FIND_COMPONENTS})
179 | STRING(TOUPPER ${COMPONENT} COMPONENT)
180 | IF(NOT Boost_${COMPONENT}_FOUND)
181 | SET( _boost_IN_CACHE FALSE)
182 | ENDIF(NOT Boost_${COMPONENT}_FOUND)
183 | ENDFOREACH(COMPONENT)
184 | ELSE(Boost_INCLUDE_DIR)
185 | SET( _boost_IN_CACHE FALSE)
186 | ENDIF(Boost_INCLUDE_DIR)
187 |
188 | IF (_boost_IN_CACHE)
189 | # in cache already
190 | SET(Boost_FOUND TRUE)
191 | FOREACH(COMPONENT ${Boost_FIND_COMPONENTS})
192 | STRING(TOUPPER ${COMPONENT} COMPONENT)
193 | _Boost_ADJUST_LIB_VARS( ${COMPONENT} )
194 | SET(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${COMPONENT}_LIBRARY})
195 | ENDFOREACH(COMPONENT)
196 | SET(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
197 | IF(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0")
198 | MATH(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
199 | MATH(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
200 | MATH(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100")
201 | ENDIF(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0")
202 | ELSE (_boost_IN_CACHE)
203 | # Need to search for boost
204 |
205 | IF(WIN32)
206 | # In windows, automatic linking is performed, so you do not have
207 | # to specify the libraries. If you are linking to a dynamic
208 | # runtime, then you can choose to link to either a static or a
209 | # dynamic Boost library, the default is to do a static link. You
210 | # can alter this for a specific library "whatever" by defining
211 | # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be
212 | # linked dynamically. Alternatively you can force all Boost
213 | # libraries to dynamic link by defining BOOST_ALL_DYN_LINK.
214 |
215 | # This feature can be disabled for Boost library "whatever" by
216 | # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining
217 | # BOOST_ALL_NO_LIB.
218 |
219 | # If you want to observe which libraries are being linked against
220 | # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking
221 | # code to emit a #pragma message each time a library is selected
222 | # for linking.
223 | SET(Boost_LIB_DIAGNOSTIC_DEFINITIONS
224 | "-DBOOST_LIB_DIAGNOSTIC" CACHE STRING "Boost diagnostic define")
225 | ENDIF(WIN32)
226 |
227 | SET(_boost_INCLUDE_SEARCH_DIRS
228 | C:/boost/include
229 | "C:/boost"
230 | "$ENV{ProgramFiles}/boost/boost_${Boost_FIND_VERSION_MAJOR}_${Boost_FIND_VERSION_MINOR}_${Boost_FIND_VERSION_PATCH}"
231 | "$ENV{ProgramFiles}/Boost"
232 | /sw/local/include
233 | )
234 |
235 | SET(_boost_LIBRARIES_SEARCH_DIRS
236 | C:/boost/lib
237 | "C:/boost"
238 | "$ENV{ProgramFiles}/boost/boost_${Boost_FIND_VERSION_MAJOR}_${Boost_FIND_VERSION_MINOR}_${Boost_FIND_VERSION_PATCH}/lib"
239 | "$ENV{ProgramFiles}/Boost"
240 | /sw/local/lib
241 | )
242 |
243 | # If BOOST_ROOT was defined in the environment, use it.
244 | if (NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "")
245 | set(BOOST_ROOT $ENV{BOOST_ROOT})
246 | endif(NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "")
247 |
248 | # If BOOSTROOT was defined in the environment, use it.
249 | if (NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "")
250 | set(BOOST_ROOT $ENV{BOOSTROOT})
251 | endif(NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "")
252 |
253 | # If BOOST_INCLUDEDIR was defined in the environment, use it.
254 | IF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" )
255 | set(BOOST_INCLUDEDIR $ENV{BOOST_INCLUDEDIR})
256 | ENDIF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" )
257 |
258 | # If BOOST_LIBRARYDIR was defined in the environment, use it.
259 | IF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" )
260 | set(BOOST_LIBRARYDIR $ENV{BOOST_LIBRARYDIR})
261 | ENDIF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" )
262 |
263 | IF( BOOST_ROOT )
264 | file(TO_CMAKE_PATH ${BOOST_ROOT} BOOST_ROOT)
265 | SET(_boost_INCLUDE_SEARCH_DIRS
266 | ${BOOST_ROOT}/include
267 | ${BOOST_ROOT}
268 | ${_boost_INCLUDE_SEARCH_DIRS})
269 | SET(_boost_LIBRARIES_SEARCH_DIRS
270 | ${BOOST_ROOT}/lib
271 | ${BOOST_ROOT}/stage/lib
272 | ${_boost_LIBRARIES_SEARCH_DIRS})
273 | ENDIF( BOOST_ROOT )
274 |
275 | IF( BOOST_INCLUDEDIR )
276 | file(TO_CMAKE_PATH ${BOOST_INCLUDEDIR} BOOST_INCLUDEDIR)
277 | SET(_boost_INCLUDE_SEARCH_DIRS
278 | ${BOOST_INCLUDEDIR} ${_boost_INCLUDE_SEARCH_DIRS})
279 | ENDIF( BOOST_INCLUDEDIR )
280 |
281 | IF( BOOST_LIBRARYDIR )
282 | file(TO_CMAKE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR)
283 | SET(_boost_LIBRARIES_SEARCH_DIRS
284 | ${BOOST_LIBRARYDIR} ${_boost_LIBRARIES_SEARCH_DIRS})
285 | ENDIF( BOOST_LIBRARYDIR )
286 |
287 | # Try to find Boost by stepping backwards through the Boost versions
288 | # we know about.
289 | IF( NOT Boost_INCLUDE_DIR )
290 | # Build a list of path suffixes for each version.
291 | SET(_boost_PATH_SUFFIXES)
292 | FOREACH(_boost_VER ${_boost_TEST_VERSIONS})
293 | # Add in a path suffix, based on the required version, ideally
294 | # we could read this from version.hpp, but for that to work we'd
295 | # need to know the include dir already
296 | if (WIN32 AND NOT CYGWIN)
297 | set(_boost_PATH_SUFFIX boost_${_boost_VER})
298 | else (WIN32 AND NOT CYGWIN)
299 | set(_boost_PATH_SUFFIX boost-${_boost_VER})
300 | endif (WIN32 AND NOT CYGWIN)
301 |
302 | IF(_boost_PATH_SUFFIX MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
303 | STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3"
304 | _boost_PATH_SUFFIX ${_boost_PATH_SUFFIX})
305 | ELSEIF(_boost_PATH_SUFFIX MATCHES "[0-9]+\\.[0-9]+")
306 | STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2"
307 | _boost_PATH_SUFFIX ${_boost_PATH_SUFFIX})
308 | ENDIF(_boost_PATH_SUFFIX MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
309 | LIST(APPEND _boost_PATH_SUFFIXES "${_boost_PATH_SUFFIX}")
310 | ENDFOREACH(_boost_VER)
311 |
312 | # Look for a standard boost header file.
313 | FIND_PATH(Boost_INCLUDE_DIR
314 | NAMES boost/config.hpp
315 | HINTS ${_boost_INCLUDE_SEARCH_DIRS}
316 | PATH_SUFFIXES ${_boost_PATH_SUFFIXES}
317 | )
318 | ENDIF( NOT Boost_INCLUDE_DIR )
319 |
320 | IF(Boost_INCLUDE_DIR)
321 | # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp
322 | # Read the whole file:
323 | #
324 | SET(BOOST_VERSION 0)
325 | SET(BOOST_LIB_VERSION "")
326 | FILE(READ "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS)
327 |
328 | STRING(REGEX REPLACE ".*#define BOOST_VERSION ([0-9]+).*" "\\1" Boost_VERSION "${_boost_VERSION_HPP_CONTENTS}")
329 | STRING(REGEX REPLACE ".*#define BOOST_LIB_VERSION \"([0-9_]+)\".*" "\\1" Boost_LIB_VERSION "${_boost_VERSION_HPP_CONTENTS}")
330 |
331 | SET(Boost_LIB_VERSION ${Boost_LIB_VERSION} CACHE INTERNAL "The library version string for boost libraries")
332 | SET(Boost_VERSION ${Boost_VERSION} CACHE INTERNAL "The version number for boost libraries")
333 |
334 | IF(NOT "${Boost_VERSION}" STREQUAL "0")
335 | MATH(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
336 | MATH(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
337 | MATH(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100")
338 |
339 | set(Boost_ERROR_REASON
340 | "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}")
341 | ENDIF(NOT "${Boost_VERSION}" STREQUAL "0")
342 | ELSE(Boost_INCLUDE_DIR)
343 | set(Boost_ERROR_REASON
344 | "${Boost_ERROR_REASON}Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.")
345 | ENDIF(Boost_INCLUDE_DIR)
346 |
347 | # Setting some more suffixes for the library
348 | SET (Boost_LIB_PREFIX "")
349 | IF ( WIN32 AND Boost_USE_STATIC_LIBS )
350 | SET (Boost_LIB_PREFIX "lib")
351 | ENDIF ( WIN32 AND Boost_USE_STATIC_LIBS )
352 | SET (_boost_COMPILER "-gcc")
353 | IF (MSVC90)
354 | SET (_boost_COMPILER "-vc90")
355 | ELSEIF (MSVC80)
356 | SET (_boost_COMPILER "-vc80")
357 | ELSEIF (MSVC71)
358 | SET (_boost_COMPILER "-vc71")
359 | ENDIF(MSVC90)
360 | IF (MINGW)
361 | EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
362 | ARGS -dumpversion
363 | OUTPUT_VARIABLE _boost_COMPILER_VERSION
364 | )
365 | STRING(REGEX REPLACE "([0-9])\\.([0-9])\\.[0-9]" "\\1\\2"
366 | _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION})
367 | SET (_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}")
368 | ENDIF(MINGW)
369 | IF (UNIX)
370 | IF (NOT CMAKE_COMPILER_IS_GNUCC)
371 | # We assume that we have the Intel compiler.
372 | SET (_boost_COMPILER "-il")
373 | ELSE (NOT CMAKE_COMPILER_IS_GNUCC)
374 | # Determine which version of GCC we have.
375 | EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
376 | ARGS -dumpversion
377 | OUTPUT_VARIABLE _boost_COMPILER_VERSION
378 | )
379 | STRING(REGEX REPLACE "([0-9])\\.([0-9])\\.[0-9]" "\\1\\2"
380 | _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION})
381 | IF(APPLE)
382 | IF(Boost_MINOR_VERSION)
383 | IF(${Boost_MINOR_VERSION} GREATER 35)
384 | # In Boost 1.36.0 and newer, the mangled compiler name used
385 | # on Mac OS X/Darwin is "xgcc".
386 | SET(_boost_COMPILER "-xgcc${_boost_COMPILER_VERSION}")
387 | ELSE(${Boost_MINOR_VERSION} GREATER 35)
388 | # In Boost <= 1.35.0, there is no mangled compiler name for
389 | # the Mac OS X/Darwin version of GCC.
390 | SET(_boost_COMPILER "")
391 | ENDIF(${Boost_MINOR_VERSION} GREATER 35)
392 | ELSE(Boost_MINOR_VERSION)
393 | # We don't know the Boost version, so assume it's
394 | # pre-1.36.0.
395 | SET(_boost_COMPILER "")
396 | ENDIF(Boost_MINOR_VERSION)
397 | ELSE()
398 | SET (_boost_COMPILER "-gcc${_boost_COMPILER_VERSION}")
399 | ENDIF()
400 | ENDIF (NOT CMAKE_COMPILER_IS_GNUCC)
401 | ENDIF(UNIX)
402 |
403 | SET (_boost_MULTITHREADED "-mt")
404 |
405 | IF( NOT Boost_USE_MULTITHREADED )
406 | SET (_boost_MULTITHREADED "")
407 | ENDIF( NOT Boost_USE_MULTITHREADED )
408 |
409 | SET( _boost_STATIC_TAG "")
410 | IF (WIN32)
411 | IF(MSVC)
412 | SET (_boost_ABI_TAG "g")
413 | ENDIF(MSVC)
414 | IF( Boost_USE_STATIC_LIBS )
415 | SET( _boost_STATIC_TAG "-s")
416 | ENDIF( Boost_USE_STATIC_LIBS )
417 | ENDIF(WIN32)
418 | SET (_boost_ABI_TAG "${_boost_ABI_TAG}d")
419 |
420 | # ------------------------------------------------------------------------
421 | # Begin finding boost libraries
422 | # ------------------------------------------------------------------------
423 | FOREACH(COMPONENT ${Boost_FIND_COMPONENTS})
424 | STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
425 | SET( Boost_${UPPERCOMPONENT}_LIBRARY "Boost_${UPPERCOMPONENT}_LIBRARY-NOTFOUND" )
426 | SET( Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE-NOTFOUND" )
427 | SET( Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG-NOTFOUND")
428 |
429 | # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
430 | IF( Boost_USE_STATIC_LIBS )
431 | SET( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
432 | IF(WIN32)
433 | SET(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
434 | ELSE(WIN32)
435 | SET(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
436 | ENDIF(WIN32)
437 | ENDIF( Boost_USE_STATIC_LIBS )
438 |
439 | FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE
440 | NAMES ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${Boost_LIB_VERSION}
441 | ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}-${Boost_LIB_VERSION}
442 | ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}
443 | ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}
444 | ${Boost_LIB_PREFIX}boost_${COMPONENT}
445 | HINTS ${_boost_LIBRARIES_SEARCH_DIRS}
446 | PATHS ${_boost_LIBRARIES_SEARCH_DIRS}
447 | )
448 |
449 | FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG
450 | NAMES ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${_boost_ABI_TAG}-${Boost_LIB_VERSION}
451 | ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}-${Boost_LIB_VERSION}
452 | ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}-${_boost_ABI_TAG}
453 | ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}
454 | ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_boost_ABI_TAG}
455 | HINTS ${_boost_LIBRARIES_SEARCH_DIRS}
456 | )
457 |
458 | _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT})
459 | IF( Boost_USE_STATIC_LIBS )
460 | SET(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
461 | ENDIF( Boost_USE_STATIC_LIBS )
462 | ENDFOREACH(COMPONENT)
463 | # ------------------------------------------------------------------------
464 | # End finding boost libraries
465 | # ------------------------------------------------------------------------
466 |
467 | SET(Boost_INCLUDE_DIRS
468 | ${Boost_INCLUDE_DIR}
469 | )
470 |
471 | SET(Boost_FOUND FALSE)
472 | IF(Boost_INCLUDE_DIR)
473 | SET( Boost_FOUND TRUE )
474 |
475 | # Check the version of Boost against the requested version.
476 | if (Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR)
477 | message(SEND_ERROR "When requesting a specific version of Boost, you must provide at least the major and minor version numbers, e.g., 1.34")
478 | endif (Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR)
479 | if(Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" )
480 | set( Boost_FOUND FALSE )
481 | set(_Boost_VERSION_AGE "old")
482 | elseif(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
483 | if(Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" )
484 | set( Boost_FOUND FALSE )
485 | set(_Boost_VERSION_AGE "old")
486 | elseif(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
487 | if( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" )
488 | set( Boost_FOUND FALSE )
489 | set(_Boost_VERSION_AGE "old")
490 | endif( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" )
491 | endif( Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" )
492 | endif( Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" )
493 |
494 | if (Boost_FOUND AND Boost_FIND_VERSION_EXACT)
495 | # If the user requested an exact version of Boost, check
496 | # that. We already know that the Boost version we have is >= the
497 | # requested version.
498 | set(_Boost_VERSION_AGE "new")
499 |
500 | # If the user didn't specify a patchlevel, it's 0.
501 | if (NOT Boost_FIND_VERSION_PATCH)
502 | set(Boost_FIND_VERSION_PATCH 0)
503 | endif (NOT Boost_FIND_VERSION_PATCH)
504 |
505 | # We'll set Boost_FOUND true again if we have an exact version match.
506 | set(Boost_FOUND FALSE)
507 | if(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
508 | if(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
509 | if(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" )
510 | set( Boost_FOUND TRUE )
511 | endif(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" )
512 | endif( Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
513 | endif( Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
514 | endif (Boost_FOUND AND Boost_FIND_VERSION_EXACT)
515 |
516 | if(NOT Boost_FOUND)
517 | # State that we found a version of Boost that is too new or too old.
518 | set(Boost_ERROR_REASON
519 | "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
520 | if (Boost_FIND_VERSION_PATCH)
521 | set(Boost_ERROR_REASON
522 | "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}")
523 | endif (Boost_FIND_VERSION_PATCH)
524 | if (NOT Boost_FIND_VERSION_EXACT)
525 | set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)")
526 | endif (NOT Boost_FIND_VERSION_EXACT)
527 | set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.")
528 | endif (NOT Boost_FOUND)
529 |
530 | if (Boost_FOUND)
531 | set(_boost_CHECKED_COMPONENT FALSE)
532 | set(_Boost_MISSING_COMPONENTS)
533 | foreach(COMPONENT ${Boost_FIND_COMPONENTS})
534 | string(TOUPPER ${COMPONENT} COMPONENT)
535 | set(_boost_CHECKED_COMPONENT TRUE)
536 | if(NOT Boost_${COMPONENT}_FOUND)
537 | string(TOLOWER ${COMPONENT} COMPONENT)
538 | list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT})
539 | set( Boost_FOUND FALSE)
540 | endif(NOT Boost_${COMPONENT}_FOUND)
541 | endforeach(COMPONENT)
542 | endif (Boost_FOUND)
543 |
544 | if (_Boost_MISSING_COMPONENTS)
545 | # We were unable to find some libraries, so generate a sensible
546 | # error message that lists the libraries we were unable to find.
547 | set(Boost_ERROR_REASON
548 | "${Boost_ERROR_REASON}\nThe following Boost libraries could not be found:\n")
549 | foreach(COMPONENT ${_Boost_MISSING_COMPONENTS})
550 | set(Boost_ERROR_REASON
551 | "${Boost_ERROR_REASON} boost_${COMPONENT}\n")
552 | endforeach(COMPONENT)
553 |
554 | list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED)
555 | list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS)
556 | if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
557 | set(Boost_ERROR_REASON
558 | "${Boost_ERROR_REASON}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.")
559 | else (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
560 | set(Boost_ERROR_REASON
561 | "${Boost_ERROR_REASON}Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set Boost_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.")
562 | endif (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
563 | endif (_Boost_MISSING_COMPONENTS)
564 |
565 | IF( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT )
566 | # Compatibility Code for backwards compatibility with CMake
567 | # 2.4's FindBoost module.
568 |
569 | # Look for the boost library path.
570 | # Note that the user may not have installed any libraries
571 | # so it is quite possible the Boost_LIBRARY_PATH may not exist.
572 | SET(_boost_LIB_DIR ${Boost_INCLUDE_DIR})
573 |
574 | IF("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+")
575 | GET_FILENAME_COMPONENT(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
576 | ENDIF ("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+")
577 |
578 | IF("${_boost_LIB_DIR}" MATCHES "/include$")
579 | # Strip off the trailing "/include" in the path.
580 | GET_FILENAME_COMPONENT(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
581 | ENDIF("${_boost_LIB_DIR}" MATCHES "/include$")
582 |
583 | IF(EXISTS "${_boost_LIB_DIR}/lib")
584 | SET (_boost_LIB_DIR ${_boost_LIB_DIR}/lib)
585 | ELSE(EXISTS "${_boost_LIB_DIR}/lib")
586 | IF(EXISTS "${_boost_LIB_DIR}/stage/lib")
587 | SET(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib)
588 | ELSE(EXISTS "${_boost_LIB_DIR}/stage/lib")
589 | SET(_boost_LIB_DIR "")
590 | ENDIF(EXISTS "${_boost_LIB_DIR}/stage/lib")
591 | ENDIF(EXISTS "${_boost_LIB_DIR}/lib")
592 |
593 | IF(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
594 | SET(Boost_LIBRARY_DIRS ${_boost_LIB_DIR} CACHE FILEPATH "Boost library directory")
595 | ENDIF(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
596 |
597 | ENDIF( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT )
598 |
599 | ELSE(Boost_INCLUDE_DIR)
600 | SET( Boost_FOUND FALSE)
601 | ENDIF(Boost_INCLUDE_DIR)
602 |
603 | IF (Boost_FOUND)
604 | IF (NOT Boost_FIND_QUIETLY)
605 | MESSAGE(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
606 | ENDIF(NOT Boost_FIND_QUIETLY)
607 | IF (NOT Boost_FIND_QUIETLY)
608 | MESSAGE(STATUS "Found the following Boost libraries:")
609 | ENDIF(NOT Boost_FIND_QUIETLY)
610 | FOREACH ( COMPONENT ${Boost_FIND_COMPONENTS} )
611 | STRING( TOUPPER ${COMPONENT} UPPERCOMPONENT )
612 | IF ( Boost_${UPPERCOMPONENT}_FOUND )
613 | IF (NOT Boost_FIND_QUIETLY)
614 | MESSAGE (STATUS " ${COMPONENT}")
615 | ENDIF(NOT Boost_FIND_QUIETLY)
616 | SET(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${UPPERCOMPONENT}_LIBRARY})
617 | ENDIF ( Boost_${UPPERCOMPONENT}_FOUND )
618 | ENDFOREACH(COMPONENT)
619 | ELSE (Boost_FOUND)
620 | IF (Boost_FIND_REQUIRED)
621 | message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}")
622 | ENDIF(Boost_FIND_REQUIRED)
623 | ENDIF(Boost_FOUND)
624 |
625 | # Under Windows, automatic linking is performed, so no need to specify the libraries.
626 | IF (WIN32)
627 | IF (NOT MINGW)
628 | SET(Boost_LIBRARIES "")
629 | ENDIF (NOT MINGW)
630 | ENDIF(WIN32)
631 |
632 | # show the Boost_INCLUDE_DIRS AND Boost_LIBRARIES variables only in the advanced view
633 | MARK_AS_ADVANCED(Boost_INCLUDE_DIR
634 | Boost_INCLUDE_DIRS
635 | Boost_LIBRARY_DIRS
636 | Boost_USE_MULTITHREADED
637 | )
638 | ENDIF(_boost_IN_CACHE)
639 |
640 |
--------------------------------------------------------------------------------
/FindOctave.cmake:
--------------------------------------------------------------------------------
1 | # Try to find the build flags to compile octave shared objects (oct and mex files)
2 | # Once done this will define
3 | #
4 | # OCTAVE_FOUND - if Coin3d is found
5 | # OCTAVE_CXXFLAGS - extra flags
6 | # OCTAVE_INCLUDE_DIRS - include directories
7 | # OCTAVE_LINK_DIRS - link directories
8 | # OCTAVE_LIBRARY_RELEASE - the relase version
9 | # OCTAVE_LIBRARY_DEBUG - the debug version
10 | # OCTAVE_LIBRARY - a default library, with priority debug.
11 |
12 | # use mkoctfile
13 | set(MKOCTFILE_EXECUTABLE MKOCTFILE_EXECUTABLE-NOTFOUND)
14 | find_program(MKOCTFILE_EXECUTABLE NAME mkoctfile PATHS)
15 | mark_as_advanced(MKOCTFILE_EXECUTABLE)
16 |
17 | if(MKOCTFILE_EXECUTABLE)
18 | set(OCTAVE_FOUND 1)
19 |
20 | execute_process(
21 | COMMAND ${MKOCTFILE_EXECUTABLE} -p ALL_CXXFLAGS
22 | OUTPUT_VARIABLE _mkoctfile_cppflags
23 | RESULT_VARIABLE _mkoctfile_failed)
24 | string(REGEX REPLACE "[\r\n]" " " _mkoctfile_cppflags "${_mkoctfile_cppflags}")
25 | execute_process(
26 | COMMAND ${MKOCTFILE_EXECUTABLE} -p INCFLAGS
27 | OUTPUT_VARIABLE _mkoctfile_includedir
28 | RESULT_VARIABLE _mkoctfile_failed)
29 | string(REGEX REPLACE "[\r\n]" " " _mkoctfile_includedir "${_mkoctfile_includedir}")
30 | execute_process(
31 | COMMAND ${MKOCTFILE_EXECUTABLE} -p ALL_LDFLAGS
32 | OUTPUT_VARIABLE _mkoctfile_ldflags
33 | RESULT_VARIABLE _mkoctfile_failed)
34 | string(REGEX REPLACE "[\r\n]" " " _mkoctfile_ldflags "${_mkoctfile_ldflags}")
35 | execute_process(
36 | COMMAND ${MKOCTFILE_EXECUTABLE} -p LFLAGS
37 | OUTPUT_VARIABLE _mkoctfile_lflags
38 | RESULT_VARIABLE _mkoctfile_failed)
39 | string(REGEX REPLACE "[\r\n]" " " _mkoctfile_lflags "${_mkoctfile_lflags}")
40 | execute_process(
41 | COMMAND ${MKOCTFILE_EXECUTABLE} -p LIBS
42 | OUTPUT_VARIABLE _mkoctfile_libs
43 | RESULT_VARIABLE _mkoctfile_failed)
44 | string(REGEX REPLACE "[\r\n]" " " _mkoctfile_libs "${_mkoctfile_libs}")
45 | execute_process(
46 | COMMAND ${MKOCTFILE_EXECUTABLE} -p OCTAVE_LIBS
47 | OUTPUT_VARIABLE _mkoctfile_octlibs
48 | RESULT_VARIABLE _mkoctfile_failed)
49 | string(REGEX REPLACE "[\r\n]" " " _mkoctfile_octlibs "${_mkoctfile_octlibs}")
50 | set(_mkoctfile_libs "${_mkoctfile_libs} ${_mkoctfile_octlibs}")
51 |
52 | string(REGEX MATCHALL "(^| )-l([./+-_\\a-zA-Z]*)" _mkoctfile_libs "${_mkoctfile_libs}")
53 | string(REGEX REPLACE "(^| )-l" "" _mkoctfile_libs "${_mkoctfile_libs}")
54 |
55 | string(REGEX MATCHALL "(^| )-L([./+-_\\a-zA-Z]*)" _mkoctfile_ldirs "${_mkoctfile_lflags}")
56 | string(REGEX REPLACE "(^| )-L" "" _mkoctfile_ldirs "${_mkoctfile_ldirs}")
57 |
58 | string(REGEX REPLACE "(^| )-l([./+-_\\a-zA-Z]*)" " " _mkoctfile_ldflags "${_mkoctfile_ldflags}")
59 | string(REGEX REPLACE "(^| )-L([./+-_\\a-zA-Z]*)" " " _mkoctfile_ldflags "${_mkoctfile_ldflags}")
60 |
61 | string(REGEX REPLACE "(^| )-I" " " _mkoctfile_includedir "${_mkoctfile_includedir}")
62 |
63 | separate_arguments(_mkoctfile_includedir)
64 |
65 | set( OCTAVE_CXXFLAGS "${_mkoctfile_cppflags}" )
66 | set( OCTAVE_LINK_FLAGS "${_mkoctfile_ldflags}" )
67 | set( OCTAVE_INCLUDE_DIRS ${_mkoctfile_includedir})
68 | set( OCTAVE_LINK_DIRS ${_mkoctfile_ldirs})
69 | set( OCTAVE_LIBRARY ${_mkoctfile_libs})
70 | set( OCTAVE_LIBRARY_RELEASE ${OCTAVE_LIBRARY})
71 | set( OCTAVE_LIBRARY_DEBUG ${OCTAVE_LIBRARY})
72 | endif(MKOCTFILE_EXECUTABLE)
73 |
74 | MARK_AS_ADVANCED(
75 | OCTAVE_LIBRARY_FOUND
76 | OCTAVE_CXXFLAGS
77 | OCTAVE_LINK_FLAGS
78 | OCTAVE_INCLUDE_DIRS
79 | OCTAVE_LINK_DIRS
80 | OCTAVE_LIBRARY
81 | OCTAVE_LIBRARY_RELEASE
82 | OCTAVE_LIBRARY_DEBUG
83 | )
84 |
--------------------------------------------------------------------------------
/INSTALL.md:
--------------------------------------------------------------------------------
1 | # libsiftfast: author zerofrog(@gmail.com)
2 |
3 | The compilation system uses a cross-platform tool called cmake.
4 |
5 | It must be installed on either Windows or Linux.
6 |
7 | ## Linux/Mac OSX Instructions:
8 |
9 | Change into the root directory.
10 |
11 | Then have cmake generate the Makefile.
12 |
13 | $ cmake .
14 |
15 | Then run the generated Makefile.
16 |
17 | $ make
18 |
19 | This will set the project to be installed in /usr/local. To change the install
20 | directory type
21 |
22 | $ make prefix=/my/new/dir
23 |
24 | To change other environment variables that cmake uses after initially making,
25 | type "cmake build"
26 |
27 | ## Windows Instructions:
28 |
29 | Download [cmake](http://www.cmake.org/), make sure to install it in the PATH.
30 | Then run runcmake.bat, that should generate visual studio files in the build
31 | folder. Open libsiftfast.sln and compile.
32 |
33 | OpenMP:
34 |
35 | cmake will use OpenMP if it exists in your system. Note that OpenMP is
36 | available only on gcc versions >= 4.2. CMake checks this automatically, but you
37 | can force usage or disabling of it by adding "-DUSE_OPENMP=OFF" when manually
38 | running cmake. Use ON to force enabling.
39 |
40 | Sometimes siftfast might fail to compile with OpenMP because libgomp.so is not
41 | setup properly to be used by shared objects. Checkout this tutorial here on how
42 | to compile the correct
43 | [libgomp](http://openrave.programmingvision.com/index.php?title=Misc:MatlabOpenMP)
44 |
45 | Basically the problem is that the default libgomp might be compiled with
46 | nodlopen flag refusing it to be dynamically loaded. The only way around this is
47 | to compile your own libgomp library and make sure libsiftfast is linking to it.
48 |
49 | Matlab:
50 |
51 | Read this if you are interested in using siftfast.m for matlab on Linux. When
52 | compiling a matlab mex file, you might get a message saying the gcc version is
53 | too high. If so, matlab will have a hard time locating the correct libstdc++.so
54 | file. In this case, go into /usr/local/share/sys/os/glnx86 and make
55 | libgcc_s and libstdc++ point to the /usr/lib versions
56 |
57 | sudo mv libgcc_s.so.1 libgcc_s.so.1.back
58 | sudo ln -s /lib/libgcc_s.so.1 libgcc_s.so.1
59 | sudo rm libstdc++.so.6 (this was already a symbolic link)
60 | sudo ln -s /usr/lib/libstdc++.so.6.0.9 libstdc++.so.6
61 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU LESSER GENERAL PUBLIC LICENSE
2 |
3 | Version 3, 29 June 2007
4 |
5 | Copyright (C) 2007 Free Software Foundation, Inc.
6 |
7 | Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
8 |
9 | This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.
10 | 0. Additional Definitions.
11 |
12 | As used herein, “this License” refers to version 3 of the GNU Lesser General Public License, and the “GNU GPL” refers to version 3 of the GNU General Public License.
13 |
14 | “The Library” refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.
15 |
16 | An “Application” is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.
17 |
18 | A “Combined Work” is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the “Linked Version”.
19 |
20 | The “Minimal Corresponding Source” for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.
21 |
22 | The “Corresponding Application Code” for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.
23 | 1. Exception to Section 3 of the GNU GPL.
24 |
25 | You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.
26 | 2. Conveying Modified Versions.
27 |
28 | If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:
29 |
30 | * a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or
31 | * b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.
32 |
33 | 3. Object Code Incorporating Material from Library Header Files.
34 |
35 | The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following:
36 |
37 | * a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License.
38 | * b) Accompany the object code with a copy of the GNU GPL and this license document.
39 |
40 | 4. Combined Works.
41 |
42 | You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:
43 |
44 | * a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.
45 | * b) Accompany the Combined Work with a copy of the GNU GPL and this license document.
46 | * c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.
47 | * d) Do one of the following:
48 | o 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
49 | o 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.
50 | * e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)
51 |
52 | 5. Combined Libraries.
53 |
54 | You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:
55 |
56 | * a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License.
57 | * b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
58 |
59 | 6. Revised Versions of the GNU Lesser General Public License.
60 |
61 | The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
62 |
63 | Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.
64 |
65 | If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.
66 |
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
1 | libsiftfast: author zerofrog(@gmail.com)
2 | ----------------------------------------
3 | Various utilities to compute the SIFT features of a greyscale image. Packages offered:
4 |
5 | *libsiftfast.so - main library that contains the sift code
6 |
7 | *siftfast - really fast SIFT implementation using SSE and OpenMP (also fixes some bugs from lowe's code, so outputs are similar, but not exact). The usage is very similar to David Lowe's sift program. To input a greyscale image test.pgm and get the SIFT keys test.key use
8 |
9 | > siftfast < test.pgm > test.key
10 |
11 | The format of test.key is pretty self explanatory:
12 |
13 | #keys #key_dimension
14 | (for #keys) [x y scale orientation (for #key_dimension)[value] ]
15 |
16 |
17 | *siftfast.m - matlab/octave mex file that uses sift_fast, just do [frames,descr]=sift_mex(grayscale_image);
18 | frames is a 4xN matrix of [X,Y,scale,orientation],
19 | descr is a 128xN matrix of normalized descriptors
20 | To use the mex files, libsift_fast.so, Octave/Matlab need to be able to load it. A way to do it is to add its path to your LD_LIBRARY_PATH in your ~/.bashrc file, or in matlab with:
21 | setenv('LD_LIBRARY_PATH',[getenv('LD_LIBRARY_PATH') ':' libsift_directory]);
22 |
23 |
24 | SIFT is based on
25 | David G. Lowe, "Distinctive image features from scale-invariant keypoints,
26 | "International Journal of Computer Vision, 60, 2 (2004), pp. 91-110.
27 |
28 | Using the Octave/Matlab mex files
29 | ---------------------------------
30 |
31 | the octave and matlab mex files are installed in $prefix/share/siftfast/octave and $prefix/share/siftfast/matlab where $prefix is the installation directory you've provided (via CMAKE_INSTALL_PREFIX). The default value for $prefix is /usr/local
32 |
33 | Add the path via addpath('$prefix/share/siftfast/matlab'), and then in octave/matlab type:
34 |
35 | > help siftfast
36 |
37 | this should give a help file on how to use it.
38 |
39 | Comparisons with other SIFT Code
40 | --------------------------------
41 |
42 | The default setting of siftfast produce the same output as Lowe's free sift program. On a quad-core Core2Duo machine with OpenMP, siftfast goes about 6x faster than lowe's sift program for 640x480 images.
43 |
--------------------------------------------------------------------------------
/cmake_uninstall.cmake.in:
--------------------------------------------------------------------------------
1 | IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
2 | MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
3 | ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
4 |
5 | FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
6 | STRING(REGEX REPLACE "\n" ";" files "${files}")
7 | FOREACH(file ${files})
8 | MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
9 | IF(EXISTS "$ENV{DESTDIR}${file}")
10 | EXEC_PROGRAM(
11 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
12 | OUTPUT_VARIABLE rm_out
13 | RETURN_VALUE rm_retval
14 | )
15 | IF(NOT "${rm_retval}" STREQUAL 0)
16 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
17 | ENDIF(NOT "${rm_retval}" STREQUAL 0)
18 | ELSE(EXISTS "$ENV{DESTDIR}${file}")
19 | MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
20 | ENDIF(EXISTS "$ENV{DESTDIR}${file}")
21 | ENDFOREACH(file)
22 |
--------------------------------------------------------------------------------
/examples/test0.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fish2000/libsiftfast/bbce4712d81361a328addfabe695296928a90920/examples/test0.jpg
--------------------------------------------------------------------------------
/examples/test1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fish2000/libsiftfast/bbce4712d81361a328addfabe695296928a90920/examples/test1.jpg
--------------------------------------------------------------------------------
/examples/test2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fish2000/libsiftfast/bbce4712d81361a328addfabe695296928a90920/examples/test2.jpg
--------------------------------------------------------------------------------
/examples/testsiftfast.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # exact C++ implementation of lowe's sift program
3 | # Copyright (C) zerofrog(@gmail.com), 2008-2009
4 | #
5 | # This program is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU Lesser General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # at your option) any later version.
9 | #
10 | # This program is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # Lesser GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU Lesser General Public License
16 | # along with this program. If not, see .
17 | from numpy import *
18 | import time, Image
19 | from optparse import OptionParser
20 |
21 | import siftfastpy
22 |
23 | if __name__=='__main__':
24 | parser = OptionParser(description='Compute SIFT features of an image.')
25 | parser.add_option('--image',
26 | action="store",type='string',dest='image',default='test0.jpg',
27 | help='Image to test')
28 | (options, args) = parser.parse_args()
29 | im = Image.open(options.image)
30 | im = im.convert(mode='L') # convert to greyscale
31 | siftimage = siftfastpy.Image(im.size[0], im.size[1])
32 | siftimage.setData(reshape(im.getdata(), im.size[::-1]))
33 |
34 | starttime = time.time()
35 | frames, desc = siftfastpy.GetKeypoints(siftimage)
36 |
37 | print '%d keypoints found in %fs' % (
38 | frames.shape[0], time.time()-starttime)
39 |
40 | # print '%d %d'%(desc.shape[0],desc.shape[1])
41 | # for i in xrange(frames.shape[0]):
42 | # print '%d %d %f %f'%(frames[i,1],frames[i,0],frames[i,3],frames[i,2])
43 | # s = ''
44 | # for j,d in enumerate(desc[i]):
45 | # s += str(min(255,int(d*512.0))) + ' '
46 | # if mod(j,16) == 15:
47 | # s += '\n'
48 | # print s
49 |
--------------------------------------------------------------------------------
/install_manifest.txt:
--------------------------------------------------------------------------------
1 | /usr/local/lib/python2.7/site-packages/siftfastpy.dylib
2 | /usr/local/include/siftfast/siftfast.h
3 | /usr/local/bin/siftfast
4 | /usr/local/lib/libsiftfast.dylib
5 | /usr/local/share/siftfast/examples/test0.jpg
6 | /usr/local/share/siftfast/examples/test1.jpg
7 | /usr/local/share/siftfast/examples/test2.jpg
8 | /usr/local/share/siftfast/examples/testsiftfast.py
9 |
--------------------------------------------------------------------------------
/libsiftfast.cpp:
--------------------------------------------------------------------------------
1 | // exact C++ implementation of lowe's sift program
2 | // Copyright (C) zerofrog(@gmail.com), 2008-2009
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU Lesser General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // at your option) any later version.
8 | //
9 | //This program is distributed in the hope that it will be useful,
10 | //but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | //Lesser GNU General Public License for more details.
13 | //
14 | //You should have received a copy of the GNU Lesser General Public License
15 | //along with this program. If not, see .
16 |
17 | // This source code was carefully calibrated to match David Lowe's SIFT features program
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 |
26 | #include
27 | #include
28 | #include