CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-#SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
PROJECT(app2ext C)
SET(VERSION_MAJOR 0)
SET(VERSION "${VERSION_MAJOR}.4.2")
-ADD_DEFINITIONS("-DTIZEN_FEATURE_APP2SD_DMCRYPT_ENCRYPTION")
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -Wall -Werror")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
-#Add your submodule directory name
-ADD_SUBDIRECTORY(plugin/app2sd)
-
-### Required packages
INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED dlog)
-FOREACH(flag ${pkgs_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
+IF(TIZEN_FEATURE_APP2SD_PLUGIN)
+ ADD_DEFINITIONS("-DTIZEN_FEATURE_APP2SD_PLUGIN")
+ ADD_DEFINITIONS("-DTIZEN_FEATURE_APP2SD_DMCRYPT_ENCRYPTION")
+ ADD_SUBDIRECTORY(plugin/app2sd)
+ENDIF(TIZEN_FEATURE_APP2SD_PLUGIN)
-pkg_check_modules(libpkgs REQUIRED dlog)
+# app2ext library
+pkg_check_modules(app2ext_libpkgs REQUIRED dlog glib-2.0)
-FOREACH(flag ${libpkgs_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+FOREACH(flag ${app2ext_libpkgs_CFLAGS})
+ SET(APP2EXT_CFLAGS "${APP2EXT_CFLAGS} ${flag}")
ENDFOREACH(flag)
+SET(CMAKE_C_FLAGS "${EXTRA_CFLAGS} ${APP2EXT_CFLAGS}")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+ADD_DEFINITIONS("-DLIBPREFIX=\"${LIB_INSTALL_DIR}\"")
-### Local include directories
+# Local include directories
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/inc
${CMAKE_SOURCE_DIR}/common/inc)
-## build app2ext library
-SET(app2ext_dir "${CMAKE_SOURCE_DIR}")
-SET(app2ext_src_dir "${app2ext_dir}/src")
+# build app2ext library
SET(APP2EXT "app2ext")
+SET(app2ext_src_dir "${CMAKE_SOURCE_DIR}/src")
SET(libapp2ext_SOURCES
${app2ext_src_dir}/app2ext_interface.c
${CMAKE_SOURCE_DIR}/common/src/app2ext_utils.c)
-SET(libapp2ext_LDFLAGS " -L${LIB_INSTALL_DIR} -module -avoid-version -ldl ")
-SET(libapp2ext_CFLAGS " ${CFLAGS} -fPIC ")
-
-ADD_DEFINITIONS("-DLIBPREFIX=\"${LIB_INSTALL_DIR}\"")
ADD_LIBRARY(${APP2EXT} SHARED ${libapp2ext_SOURCES})
SET_TARGET_PROPERTIES(${APP2EXT} PROPERTIES SOVERSION ${VERSION_MAJOR})
SET_TARGET_PROPERTIES(${APP2EXT} PROPERTIES VERSION ${VERSION})
-SET_TARGET_PROPERTIES(${APP2EXT} PROPERTIES COMPILE_FLAGS "${libapp2ext_CFLAGS}")
-TARGET_LINK_LIBRARIES(${APP2EXT} ${libpkgs_LDFLAGS})
-
-SET(CMAKE_INSTALL_PREFIX "/usr")
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET_TARGET_PROPERTIES(${APP2EXT} PROPERTIES COMPILE_FLAGS ${CFLAGS} "-fPIC")
+TARGET_LINK_LIBRARIES(${APP2EXT} ${app2ext_libpkgs_LDFLAGS})
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/app2sd.manifest.in ${CMAKE_BINARY_DIR}/app2sd.manifest @ONLY)
-
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/app2sd.pc.in ${CMAKE_BINARY_DIR}/app2sd.pc @ONLY)
INSTALL(TARGETS ${APP2EXT} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/app2sd.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/inc/app2ext_interface.h DESTINATION include)
+IF(TIZEN_FEATURE_APP2SD_PLUGIN)
ADD_SUBDIRECTORY(test)
+ENDIF(TIZEN_FEATURE_APP2SD_PLUGIN)