Add a GCC compiler version check in the CMakeList.txt file.
[platform/core/uifw/dali-toolkit.git] / build / tizen / CMakeLists.txt
index 02808bc..691ed18 100644 (file)
@@ -6,6 +6,13 @@ SET(name "dali-toolkit")
 PROJECT(${name})
 SET(PKG_NAME ${name})
 
+SET(GCC_COMPILER_VERSION_REQUIRED "6")
+if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+  if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS GCC_COMPILER_VERSION_REQUIRED)
+    message(FATAL_ERROR "The GCC required compiler version is " ${GCC_COMPILER_VERSION_REQUIRED})
+  endif()
+endif()
+
 FIND_PACKAGE( PkgConfig REQUIRED )
 FIND_PACKAGE( Doxygen QUIET )
 
@@ -30,6 +37,15 @@ OPTION(ENABLE_COVERAGE       "Coverage" OFF)
 # Define non-boolean options to CMake
 SET(WITH_STYLE               "480x800" CACHE STRING "Select the style folder to use")
 
+# from root/build/tizen, get back to root
+SET(ROOT_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../)
+
+# Make sure the path is absolute
+GET_FILENAME_COMPONENT(ROOT_SRC_DIR ${ROOT_SRC_DIR} ABSOLUTE)
+
+# Set DALi style
+SET( dali_style ${WITH_STYLE} )
+
 # Style folder
 SET( STYLE_BASE_DIR ${ROOT_SRC_DIR}/dali-toolkit/styles )
 SET( STYLE_DIR ${STYLE_BASE_DIR}/${dali_style} )
@@ -38,14 +54,14 @@ SET( toolkit_styles_base_dir ${STYLE_BASE_DIR} )
 SET( toolkit_styles_dir ${STYLE_DIR} )
 SET( toolkit_style_images_dir ${STYLE_DIR}/images )
 
-IF( $ENV{DALI_DATA_RW_DIR} )
-  SET( dataReadWriteDir ${DALI_DATA_RW_DIR}/ )
+IF( DEFINED ENV{DALI_DATA_RW_DIR} )
+  SET( dataReadWriteDir $ENV{DALI_DATA_RW_DIR} )
 ELSE()
   SET( dataReadWriteDir ${CMAKE_INSTALL_PREFIX}/share/dali/ )
 ENDIF()
 
-IF( $ENV{DALI_DATA_RO_DIR} )
-  SET( dataReadOnlyDir ${DALI_DATA_RO_DIR}/ )
+IF( DEFINED ENV{DALI_DATA_RO_DIR} )
+  SET( dataReadOnlyDir $ENV{DALI_DATA_RO_DIR} )
 ELSE()
   SET( dataReadOnlyDir ${CMAKE_INSTALL_PREFIX}/share/dali/ )
 ENDIF()
@@ -91,15 +107,6 @@ ENDIF()
 SET( PREFIX ${CMAKE_INSTALL_PREFIX})
 SET( EXEC_PREFIX ${CMAKE_INSTALL_PREFIX})
 
-# from root/build/tizen, get back to root
-SET(ROOT_SRC_DIR ${CMAKE_SOURCE_DIR}/../..)
-
-# Make sure the path is absolute
-GET_FILENAME_COMPONENT(ROOT_SRC_DIR ${ROOT_SRC_DIR} ABSOLUTE)
-
-# Set DALi style
-SET( dali_style ${WITH_STYLE} )
-
 # Set paths
 SET( toolkit_images_dir  ${ROOT_SRC_DIR}/dali-toolkit/styles/images-common )
 SET( toolkit_sounds_dir  ${ROOT_SRC_DIR}/dali-toolkit/sounds )
@@ -169,14 +176,14 @@ SET(SOURCES "")
 
 # could use INCLUDE to get the source lists a different way;
 # would then need to specify a build folder somehow...
-INCLUDE( ${ROOT_SRC_DIR}/dali-toolkit/sounds/file-list.cmake )
-INCLUDE( ${ROOT_SRC_DIR}/dali-toolkit/styles/file-list.cmake )
-INCLUDE( ${ROOT_SRC_DIR}/dali-toolkit/styles/images-common/file-list.cmake )
-INCLUDE( ${ROOT_SRC_DIR}/dali-toolkit/internal/file-list.cmake )
-INCLUDE( ${ROOT_SRC_DIR}/dali-toolkit/public-api/file-list.cmake )
-INCLUDE( ${ROOT_SRC_DIR}/dali-toolkit/devel-api/file-list.cmake )
-INCLUDE( ${ROOT_SRC_DIR}/dali-toolkit/third-party/file-list.cmake )
-INCLUDE( ${ROOT_SRC_DIR}/doc/file-list.cmake )
+INCLUDE( ${ROOT_SRC_DIR}/dali-toolkit/sounds/file.list )
+INCLUDE( ${ROOT_SRC_DIR}/dali-toolkit/styles/file.list )
+INCLUDE( ${ROOT_SRC_DIR}/dali-toolkit/styles/images-common/file.list )
+INCLUDE( ${ROOT_SRC_DIR}/dali-toolkit/internal/file.list )
+INCLUDE( ${ROOT_SRC_DIR}/dali-toolkit/public-api/file.list )
+INCLUDE( ${ROOT_SRC_DIR}/dali-toolkit/devel-api/file.list )
+INCLUDE( ${ROOT_SRC_DIR}/dali-toolkit/third-party/file.list )
+INCLUDE( ${ROOT_SRC_DIR}/doc/file.list )
 
 SET(LIBTYPE SHARED)
 IF(DEFINED STATIC)
@@ -184,12 +191,14 @@ IF(DEFINED STATIC)
 ENDIF()
 
 ADD_LIBRARY( ${name} ${LIBTYPE} ${SOURCES} )
-
 TARGET_LINK_LIBRARIES( ${name}
   ${DALICORE_LDFLAGS}
   ${DALIADAPTOR_LDFLAGS}
   ${COVERAGE}
 )
+IF( ANDROID )
+TARGET_LINK_LIBRARIES( ${name} log )
+ENDIF()
 
 SET_TARGET_PROPERTIES( ${name}
   PROPERTIES
@@ -202,7 +211,7 @@ SET_TARGET_PROPERTIES( ${name}
 INSTALL( TARGETS ${name} DESTINATION ${LIB_DIR} )
 
 # Install the pkg-config file
-INSTALL( FILES ${CMAKE_BINARY_DIR}/${CORE_PKG_CFG_FILE} DESTINATION ${LIB_DIR}/pkgconfig )
+INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/${CORE_PKG_CFG_FILE} DESTINATION ${LIB_DIR}/pkgconfig )
 
 # Glob for resources
 MACRO( COPY_RESOURCES FILE_LIST SRC_RELATIVE_DIRECTORY DESTINATION EXPLICIT_DESTINATION )
@@ -244,11 +253,30 @@ INSTALL( FILES ${ROOT_SRC_DIR}/dali-toolkit/dali-toolkit.h DESTINATION ${DEV_INC
 # package doxygen file (contains doxygen grouping information)
 INSTALL( FILES ${package_doxy_files} DESTINATION ${DEV_INCLUDE_PATH}/dali-toolkit/doc )
 
-COPY_RESOURCES( "${dali_toolkit_style_files}" "${ROOT_SRC_DIR}" "${dataReadOnlyDir}" "./toolkit/styles" )
-COPY_RESOURCES( "${dali_toolkit_image_files}" "${ROOT_SRC_DIR}" "${dataReadOnlyDir}" "./toolkit/images" )
-COPY_RESOURCES( "${dali_toolkit_sound_files}" "${ROOT_SRC_DIR}" "${dataReadOnlyDir}" "./toolkit/sounds" )
-COPY_RESOURCES( "${dali_toolkit_style_images}" "${ROOT_SRC_DIR}" "${dataReadOnlyDir}" "./toolkit/styles/images" )
+# On some platforms we want to install the data files to different location compare to
+# the data location used runtime. For example, on Android we want the toolkit library to load
+# the files from /data/data/com.sec.dali_demo/files but to install the files into ${PREFIX}/files
+# for SDK to pick them up for the archive.
+IF( DEFINED ENV{DALI_DATA_RW_INSTALL_DIR} )
+  SET( dataReadWriteInstallDir $ENV{DALI_DATA_RW_INSTALL_DIR} )
+ELSE()
+  SET( dataReadWriteInstallDir ${dataReadWriteDir} )
+ENDIF()
+
+IF( DEFINED ENV{DALI_DATA_RO_INSTALL_DIR} )
+  SET( dataReadOnlyInstallDir $ENV{DALI_DATA_RO_INSTALL_DIR} )
+ELSE()
+  SET( dataReadOnlyInstallDir ${dataReadOnlyDir} )
+ENDIF()
+
+COPY_RESOURCES( "${dali_toolkit_style_files}" "${ROOT_SRC_DIR}" "${dataReadOnlyInstallDir}" "./toolkit/styles" )
+COPY_RESOURCES( "${dali_toolkit_image_files}" "${ROOT_SRC_DIR}" "${dataReadOnlyInstallDir}" "./toolkit/images" )
+COPY_RESOURCES( "${dali_toolkit_sound_files}" "${ROOT_SRC_DIR}" "${dataReadOnlyInstallDir}" "./toolkit/sounds" )
+COPY_RESOURCES( "${dali_toolkit_style_images}" "${ROOT_SRC_DIR}" "${dataReadOnlyInstallDir}" "./toolkit/styles/images" )
 
+# The DALI_TOOLKIT_PREFIX must be set if this CMakeLists.txt is executed
+# from the top-level CMake script using ADD_SUBDIRECTORY() to avoid
+# target names duplication with other DALi modules.
 IF( UNIX )
   FIND_PROGRAM( LCOV_BIN "lcov" )
   IF( LCOV_BIN )
@@ -265,20 +293,20 @@ IF( UNIX )
       SET(LCOV_OPTS --rc lcov_branch_coverage=1)
     ENDIF()
 
-    ADD_CUSTOM_TARGET( rename_cov_data ./rename-cov-data )
+    ADD_CUSTOM_TARGET( ${DALI_TOOLKIT_PREFIX}rename_cov_data ./rename-cov-data )
 
-    ADD_CUSTOM_TARGET( cov_data ${LCOV_BIN} ${LCOV_OPTS} --base-directory . --directory . -c -o dali.info
+    ADD_CUSTOM_TARGET( ${DALI_TOOLKIT_PREFIX}cov_data ${LCOV_BIN} ${LCOV_OPTS} --base-directory . --directory . -c -o dali.info
       COMMAND ${LCOV_BIN} ${LCOV_OPTS} --remove dali.info \"*/dali-env/*\" \"/usr/include/*\" "*/dali-env/*" "*solid-color-actor*" "*/dali-toolkit/third-party/*" -o dali.info )
 
-    ADD_CUSTOM_TARGET( coverage genhtml ${LCOV_OPTS} -o ${COVERAGE_OUTPUT_DIR} dali.info
+    ADD_CUSTOM_TARGET( ${DALI_TOOLKIT_PREFIX}coverage genhtml ${LCOV_OPTS} -o ${COVERAGE_OUTPUT_DIR} dali.info
       DEPENDS cov_data )
 
-    ADD_CUSTOM_TARGET( reset_coverage @${LCOV_BIN} -z --directory `pwd` )
+    ADD_CUSTOM_TARGET( ${DALI_TOOLKIT_PREFIX}reset_coverage @${LCOV_BIN} -z --directory `pwd` )
 
     # Define custom rule for distclean
-    ADD_CUSTOM_TARGET( distclean @echo cleaning for source distribution )
+    ADD_CUSTOM_TARGET( ${DALI_TOOLKIT_PREFIX}distclean @echo cleaning for source distribution )
     ADD_CUSTOM_COMMAND(
-          DEPENDS clean
+          DEPENDS ${DALI_TOOLKIT_PREFIX}clean
           COMMENT "distribution clean"
           COMMAND find
           ARGS    .
@@ -304,7 +332,7 @@ IF( UNIX )
           -name *~ -or
           -name libdali*.so* \)
           | grep -v TC | xargs rm -rf
-          TARGET  distclean
+          TARGET  ${DALI_TOOLKIT_PREFIX}distclean
           VERBATIM
           )
 
@@ -345,18 +373,20 @@ CONFIGURE_FILE( ${ROOT_SRC_DIR}/automated-tests/CMakeLists.txt.in
 
 # Configuration Messages
 MESSAGE( STATUS "Configuration:\n" )
-MESSAGE( STATUS "Prefix:                " ${PREFIX} )
-MESSAGE( STATUS "Lib Dir:               " ${LIB_DIR} )
-MESSAGE( STATUS "Include Dir:           " ${INCLUDE_DIR} )
-MESSAGE( STATUS "Debug build:           " ${ENABLE_DEBUG} )
-MESSAGE( STATUS "Export all symbols:    " ${ENABLE_EXPORTALL} )
-MESSAGE( STATUS "Coverage:              " ${ENABLE_COVERAGE} )
-MESSAGE( STATUS "Trace:                 " ${ENABLE_TRACE} )
-MESSAGE( STATUS "Doxygen:               " ${doxygenEnabled} )
-MESSAGE( STATUS "Data Dir (Read/Write): " ${dataReadWriteDir} )
-MESSAGE( STATUS "Data Dir (Read Only):  " ${dataReadOnlyDir} )
-MESSAGE( STATUS "Style Dir:             " ${STYLE_DIR} )
-MESSAGE( STATUS "Style:                 " ${dali_style} )
-MESSAGE( STATUS "i18n:                  " ${ENABLE_I18N} )
-MESSAGE( STATUS "CXXFLAGS:              " ${CMAKE_CXX_FLAGS} )
-MESSAGE( STATUS "LDFLAGS:               " ${CMAKE_SHARED_LINKER_FLAGS_INIT}${CMAKE_SHARED_LINKER_FLAGS} )
+MESSAGE( STATUS "Prefix:                        " ${PREFIX} )
+MESSAGE( STATUS "Lib Dir:                       " ${LIB_DIR} )
+MESSAGE( STATUS "Include Dir:                   " ${INCLUDE_DIR} )
+MESSAGE( STATUS "Debug build:                   " ${ENABLE_DEBUG} )
+MESSAGE( STATUS "Export all symbols:            " ${ENABLE_EXPORTALL} )
+MESSAGE( STATUS "Coverage:                      " ${ENABLE_COVERAGE} )
+MESSAGE( STATUS "Trace:                         " ${ENABLE_TRACE} )
+MESSAGE( STATUS "Doxygen:                       " ${doxygenEnabled} )
+MESSAGE( STATUS "Data Dir (Read/Write):         " ${dataReadWriteDir} )
+MESSAGE( STATUS "Data Dir (Read Only):          " ${dataReadOnlyDir} )
+MESSAGE( STATUS "Data Install Dir (Read/Write): " ${dataReadWriteInstallDir} )
+MESSAGE( STATUS "Data Install Dir (Read Only):  " ${dataReadOnlyInstallDir} )
+MESSAGE( STATUS "Style Dir:                     " ${STYLE_DIR} )
+MESSAGE( STATUS "Style:                         " ${dali_style} )
+MESSAGE( STATUS "i18n:                          " ${ENABLE_I18N} )
+MESSAGE( STATUS "CXXFLAGS:                      " ${CMAKE_CXX_FLAGS} )
+MESSAGE( STATUS "LDFLAGS:                       " ${CMAKE_SHARED_LINKER_FLAGS_INIT}${CMAKE_SHARED_LINKER_FLAGS} )