| 1 | cmake_minimum_required (VERSION 2.6) |
| 2 | project (vid.stab) |
| 3 | |
| 4 | SET(CMAKE_BUILTTYPE None) |
| 5 | |
| 6 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/") |
| 7 | |
| 8 | include (FindSSE) |
| 9 | |
| 10 | set(MAJOR_VERSION 1) |
| 11 | set(MINOR_VERSION 0) |
| 12 | set(PATCH_VERSION 0) |
| 13 | set(VIDSTAB_VERSION ${MAJOR_VERSION}.${MINOR_VERSION}${PATCH_VERSION}) |
| 14 | |
| 15 | option(BUILD_SHARED_LIBS "build shared libraries instead of static libraries" |
| 16 | ON) |
| 17 | |
| 18 | add_definitions( -Wall -O3 -g -Wno-pointer-sign -fPIC -std=gnu99) |
| 19 | # add_definitions( -Wall -O0 -g -Wno-pointer-sign ) |
| 20 | |
| 21 | ### ORC is not used in any active code at the moment ### |
| 22 | # I tried it with 0.4.14 |
| 23 | # 0.4.10 did not work (not all opcode implemented) |
| 24 | # find_package(Orc) |
| 25 | if(ORC_FOUND) |
| 26 | add_definitions( -DUSE_ORC ${ORC_DEFINITIONS} ) |
| 27 | include_directories( ${ORC_INCLUDE_DIRS} ) |
| 28 | else() |
| 29 | add_definitions( -DDISABLE_ORC ) |
| 30 | endif() |
| 31 | |
| 32 | # here we should check for SSE2 |
| 33 | # our -DUSE_SSE2_ASM code does not work with fpic |
| 34 | if(SSE2_FOUND) |
| 35 | add_definitions( -DUSE_SSE2 -msse2 -ffast-math ) |
| 36 | endif() |
| 37 | |
| 38 | set(SOURCES src/frameinfo.c src/transformtype.c src/libvidstab.c |
| 39 | src/transform.c src/transformfixedpoint.c src/motiondetect.c |
| 40 | src/motiondetect_opt.c src/serialize.c src/localmotion2transform.c |
| 41 | src/boxblur.c src/vsvector.c src/orc/motiondetectorc.c) |
| 42 | |
| 43 | set(HEADERS src/frameinfo.h src/transformtype.h src/libvidstab.h |
| 44 | src/transform.h src/motiondetect.h src/serialize.h |
| 45 | src/localmotion2transform.h src/boxblur.h src/vsvector.h ) |
| 46 | |
| 47 | |
| 48 | # Create the vidstab library |
| 49 | add_library (vidstab ${SOURCES}) |
| 50 | |
| 51 | #set version of lib |
| 52 | set_target_properties(vidstab PROPERTIES SOVERSION ${MAJOR_VERSION}.${MINOR_VERSION}) |
| 53 | |
| 54 | |
| 55 | target_link_libraries(vidstab m) |
| 56 | if(ORC_FOUND) |
| 57 | target_link_libraries(vidstab ${ORC_LIBRARIES}) |
| 58 | endif() |
| 59 | if(USE_OMP) |
| 60 | target_link_libraries(vidstab gomp) |
| 61 | endif() |
| 62 | |
| 63 | |
| 64 | #if(!NOHEADERS) |
| 65 | FILE(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/src/*.h") |
| 66 | INSTALL(FILES ${HEADERS} DESTINATION include/vid.stab) |
| 67 | #endif() |
| 68 | |
| 69 | INSTALL(TARGETS vidstab |
| 70 | RUNTIME DESTINATION bin |
| 71 | LIBRARY DESTINATION lib${LIB_SUFFIX} |
| 72 | ARCHIVE DESTINATION lib${LIB_SUFFIX} |
| 73 | ) |
| 74 | |
| 75 | include(create_pkgconfig_file) |
| 76 | create_pkgconfig_file(vidstab "Vid.Stab, a library for stabilizing video clips") |