CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(media-thumbnail C) SET(VERSION_MAJOR 1) SET(VERSION "${VERSION_MAJOR}.0.0") SET(MEDIATHUMB-LIB "media-thumbnail") SET(MEDIAHASH-LIB "media-hash") SET(SRCS src/media-thumbnail.c src/media-thumb-internal.c src/util/media-thumb-debug.c src/util/media-thumb-util.c src/util/media-thumb-db.c src/codec/IfegDecodeAGIF.c src/codec/img-codec.c src/codec/img-codec-osal.c src/codec/img-codec-parser.c src/ipc/media-thumb-ipc.c ) SET(HASH_SRCS md5/md5.c md5/media-thumb-hash.c ) SET(THUMB-SERVER server/thumb-server.c server/thumb-server-internal.c) SET(TEST-THUMB test/test-thumb.c) SET(VENDOR "samsung") SET(PACKAGE ${PROJECT_NAME}) SET(PKGNAME "com.${VENDOR}.${PACKAGE}") SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(BINDIR "${PREFIX}/bin") SET(LOCALBINDIR "${PREFIX}/local/bin") SET(DATADIR "${PREFIX}/share") SET(EXEC_PREFIX "\${prefix}") SET(LIBDIR "\${prefix}/lib") SET(INCLUDEDIR "\${prefix}/include") IF("${CMAKE_BUILD_TYPE}" STREQUAL "") SET(CMAKE_BUILD_TYPE "Release") ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") MESSAGE("Build type: ${CMAKE_BUILD_TYPE}") INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src/include ${CMAKE_SOURCE_DIR}/src/include/util ${CMAKE_SOURCE_DIR}/src/include/codec ${CMAKE_SOURCE_DIR}/src/include/util ${CMAKE_SOURCE_DIR}/src/include/ipc ${CMAKE_SOURCE_DIR}/server/include ${CMAKE_SOURCE_DIR}/md5) INCLUDE(FindPkgConfig) pkg_check_modules(pkgs REQUIRED glib-2.0 gthread-2.0 dlog mm-fileinfo drm-client aul libexif ecore-evas evas mmutil-imgp mmutil-jpeg heynoti) FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC") SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") SET(CMAKE_C_FLAGS_RELEASE "-O2 -fPIC") FIND_PROGRAM(UNAME NAMES uname) EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH") IF("${ARCH}" STREQUAL "arm") ADD_DEFINITIONS("-DTARGET") MESSAGE("add -DTARGET") ENDIF("${ARCH}" STREQUAL "arm") ADD_DEFINITIONS("-DVENDOR=\"${VENDOR}\"") ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE}\"") ADD_DEFINITIONS("-DPACKAGE_NAME=\"${PKGNAME}\"") ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") #ADD_DEFINITIONS("-D_PERFORMANCE_CHECK_") ADD_DEFINITIONS("-D_USE_NEW_MEDIA_DB_") SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--hash-style=both") CONFIGURE_FILE(media-thumbnail.pc.in media-thumbnail.pc @ONLY) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/media-thumbnail.pc DESTINATION lib/pkgconfig) LINK_DIRECTORIES(lib) ADD_LIBRARY(${MEDIAHASH-LIB} SHARED ${HASH_SRCS}) SET_TARGET_PROPERTIES(${MEDIAHASH-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR}) SET_TARGET_PROPERTIES(${MEDIAHASH-LIB} PROPERTIES VERSION ${VERSION}) ADD_LIBRARY(${MEDIATHUMB-LIB} SHARED ${SRCS}) TARGET_LINK_LIBRARIES(${MEDIATHUMB-LIB} ${pkgs_LDFLAGS} ${MEDIAHASH-LIB}) SET_TARGET_PROPERTIES(${MEDIATHUMB-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR}) SET_TARGET_PROPERTIES(${MEDIATHUMB-LIB} PROPERTIES VERSION ${VERSION}) INSTALL(TARGETS ${MEDIATHUMB-LIB} LIBRARY DESTINATION lib) INSTALL(TARGETS ${MEDIAHASH-LIB} LIBRARY DESTINATION lib) ADD_EXECUTABLE(media-thumbnail-server ${THUMB-SERVER}) TARGET_LINK_LIBRARIES(media-thumbnail-server ${pkgs_LDFLAGS} ${MEDIATHUMB-LIB} ) INSTALL(TARGETS media-thumbnail-server DESTINATION ${BINDIR}) ADD_EXECUTABLE(test-thumb ${TEST-THUMB}) TARGET_LINK_LIBRARIES(test-thumb ${pkgs_LDFLAGS} ${MEDIATHUMB-LIB} ) INSTALL(TARGETS test-thumb DESTINATION ${LOCALBINDIR}) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/media-thumbnail.h DESTINATION include/${MEDIATHUMB-LIB}) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/media-thumbnail-private.h DESTINATION include/${MEDIATHUMB-LIB}) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/media-thumb-error.h DESTINATION include/${MEDIATHUMB-LIB}) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/media-thumb-types.h DESTINATION include/${MEDIATHUMB-LIB}) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/thumbsvr DESTINATION /etc/init.d)