1 CMAKE_MINIMUM_REQUIRED(VERSION 3.8.2)
2 CMAKE_POLICY(SET CMP0012 NEW) # Prevent dereferencing of OFF/ON as variables
4 SET(CMAKE_C_STANDARD 99)
5 SET(CMAKE_CXX_STANDARD 17)
9 SET(name "dali2-adaptor")
11 SET(GCC_COMPILER_VERSION_REQUIRED "6")
12 IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
13 IF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS GCC_COMPILER_VERSION_REQUIRED)
14 MESSAGE(FATAL_ERROR "The GCC required compiler version is " ${GCC_COMPILER_VERSION_REQUIRED})
18 OPTION(ENABLE_PKG_CONFIGURE "Use pkgconfig" ON)
19 OPTION(ENABLE_LINK_TEST "Enable the link test" ON)
20 OPTION(ENABLE_ATSPI "Enable AT-SPI accessibility" ON)
22 # Include additional macros
23 INCLUDE( common.cmake )
25 IF(CMAKE_BUILD_TYPE MATCHES Debug)
26 MESSAGE( STATUS "CMAKE_BUILD_TYPE: " Debug )
27 SET( ENABLE_DEBUG "ON" CACHE STRING "" )
28 SET( ENABLE_EXPORTALL "ON" CACHE STRING "" )
30 MESSAGE( STATUS "CMAKE_BUILD_TYPE: " Release )
33 # from root/build/tizen, get back to root.
34 # set the variable only if it's not set yet. it allows to access build script
35 # from top-level directory
36 IF( NOT ROOT_SRC_DIR )
37 SET(ROOT_SRC_DIR ${CMAKE_SOURCE_DIR}/../..)
39 # Make sure the path is absolute
40 GET_FILENAME_COMPONENT(ROOT_SRC_DIR ${ROOT_SRC_DIR} ABSOLUTE)
42 # API VERSION (Not DALi release version)
43 SET(${name}_VERSION_MAJOR 2)
44 SET(${name}_VERSION_MINOR 0)
45 SET(${name}_VERSION_PATCH 0)
46 SET(${name}_VERSION ${${name}_VERSION_MAJOR}.${${name}_VERSION_MINOR}.${${name}_VERSION_PATCH})
48 SET(DALI_ADAPTOR_VERSION ${${name}_VERSION} )
50 IF( WIN32 ) # WIN32 includes x64 as well according to the cmake doc.
51 FIND_PACKAGE( dali-windows-dependencies REQUIRED)
52 FIND_PACKAGE( dali2-core REQUIRED)
55 SET( VCPKG_INCLUDE_DIR "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include")
58 ADD_DEFINITIONS(-DPLATFORM_TIZEN)
59 ADD_DEFINITIONS(-DPIC -DSTDC_HEADERS)
61 IF("${ARCH}" STREQUAL "arm")
62 ADD_DEFINITIONS("-DTARGET")
63 ENDIF("${ARCH}" STREQUAL "arm")
64 ELSEIF( WIN32 ) # WIN32 includes x64 as well according to the cmake doc.
65 IF(NOT DEFINED STATIC)
66 ADD_DEFINITIONS( "-DBUILDING_DALI_ADAPTOR" )
69 ADD_DEFINITIONS( "-DDALI_ADAPTOR_COMPILATION" )
70 ADD_DEFINITIONS( "-D_NSIG=65" )
73 # Deployment folder should come from spec file or command line:
74 SET( PREFIX ${CMAKE_INSTALL_PREFIX})
75 SET( EXEC_PREFIX ${CMAKE_INSTALL_PREFIX})
77 # Set up the include dir
78 SET( INCLUDE_DIR $ENV{includedir} )
80 SET( INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR} )
83 SET( INCLUDE_DIR ${PREFIX}/include )
87 SET( LIB_DIR $ENV{libdir} )
89 SET( LIB_DIR ${CMAKE_INSTALL_LIBDIR} )
92 SET( LIB_DIR ${PREFIX}/lib )
96 SET( BIN_DIR $ENV{bindir} )
98 SET( BIN_DIR ${CMAKE_INSTALL_BINDIR} )
101 SET( BIN_DIR ${PREFIX}/bin )
105 INCLUDE( deps-check.cmake )
108 IF( NOT DALI_ELDBUS_AVAILABLE )
109 SET( ENABLE_ATSPI OFF )
112 # Set up compiler flags and warnings
114 ADD_COMPILE_OPTIONS( -Wall ${DALI_CFLAGS} )# -Wextra -Wno-unused-parameter )# -Wfloat-equal )
115 ELSEIF( WIN32 ) # WIN32 includes x64 as well according to the cmake doc.
116 ADD_COMPILE_OPTIONS( /FIdali-windows-dependencies.h ) #
117 ADD_COMPILE_OPTIONS( /FIextern-definitions.h ) # Adds missing definitions.
118 ADD_COMPILE_OPTIONS( /FIpreprocessor-definitions.h ) #
119 ADD_COMPILE_OPTIONS( /vmg ) # Avoids a 'reinterpret_cast' compile error while compiling signals and callbacks.
120 ADD_COMPILE_OPTIONS( /wd4251 ) # Ignores warning C4251: "'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'"
123 ADD_DEFINITIONS( -DNON_POWER_OF_TWO_TEXTURES
126 # from root/build/tizen, get back to root
127 SET(ROOT_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../)
129 # Make sure the path is absolute
130 GET_FILENAME_COMPONENT(ROOT_SRC_DIR ${ROOT_SRC_DIR} ABSOLUTE)
132 SET(SOURCE_DIR "${ROOT_SRC_DIR}/dali")
133 SET(ADAPTOR_ROOT ${ROOT_SRC_DIR})
134 SET(PACKAGE_DOXY_SRC_DIR "${ROOT_SRC_DIR}/doc")
137 # Include list of modules
138 INCLUDE( module-list.cmake )
140 # Include profile specific setup
141 INCLUDE( profiles/${PROFILE_LCASE}-profile.cmake )
144 SET( SOURCES ${SOURCES} ${adaptor_accessibility_atspi_bridge_src_files} )
146 SET( SOURCES ${SOURCES} ${adaptor_accessibility_atspi_dummy_src_files} )
149 IF( ENABLE_PKG_CONFIGURE )
150 # Configure the pkg-config file
151 # Requires the following variables to be setup:
152 # @PREFIX@ @EXEC_PREFIX@ @DALI_ADAPTOR_VERSION@ @LIB_DIR@ @DEV_INCLUDE_PATH@
153 SET( DEV_INCLUDE_PATH ${INCLUDE_DIR} )
154 SET( ADAPTOR_PKG_CFG_FILE ${CMAKE_CURRENT_SOURCE_DIR}/dali2-adaptor.pc )
155 SET( ADAPTOR_INTEGRATION_PKG_CFG_FILE ${CMAKE_CURRENT_SOURCE_DIR}/dali2-adaptor-integration.pc )
156 CONFIGURE_FILE( ${ADAPTOR_PKG_CFG_FILE}.in ${ADAPTOR_PKG_CFG_FILE} @ONLY )
157 CONFIGURE_FILE( ${ADAPTOR_INTEGRATION_PKG_CFG_FILE}.in ${ADAPTOR_INTEGRATION_PKG_CFG_FILE} @ONLY )
160 CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/system-cache-path.in ${ADAPTOR_ROOT}/dali/internal/adaptor/common/system-cache-path.cpp @ONLY)
162 SET( THIRD_PARTY_WINDOWS_PLATFORM "" )
164 SET( THIRD_PARTY_WINDOWS_PLATFORM ${ROOT_SRC_DIR}/third-party/windows-platform )
169 ${PROFILE_INCLUDE_DIRECTORIES}
170 ${THIRD_PARTY_WINDOWS_PLATFORM}
180 ADD_LIBRARY( ${name} ${LIBTYPE} ${SOURCES} )
183 # pthread required due to gcc issue
184 FIND_LIBRARY( PTHREAD pthread )
185 IF( PTHREAD AND NOT ANDROID_PROFILE )
186 SET( OPTIONAL_LIBS ${OPTIONAL_LIBS} -lpthread )
190 TARGET_LINK_LIBRARIES( ${name}
197 SET_TARGET_PROPERTIES( ${name}
199 VERSION ${DALI_ADAPTOR_VERSION}
200 SOVERSION ${${name}_VERSION_MAJOR}
204 IF( INSTALL_CMAKE_MODULES )
206 SET( BIN_DIR "${BIN_DIR}/debug" )
207 SET( LIB_DIR "${LIB_DIR}/debug" )
210 # Install the library files.
211 INSTALL( TARGETS ${name}
212 EXPORT ${name}-targets
213 LIBRARY DESTINATION ${LIB_DIR}
214 ARCHIVE DESTINATION ${LIB_DIR}
215 RUNTIME DESTINATION ${BIN_DIR}
218 # Install the cmake modules.
220 EXPORT ${name}-targets
222 FILE ${name}-targets.cmake
223 DESTINATION share/${name}
226 FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${name}-config.cmake "
227 include(CMakeFindDependencyMacro)
228 include(\${CMAKE_CURRENT_LIST_DIR}/${name}-targets.cmake)
230 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}-config.cmake DESTINATION share/${name})
232 # Install the pdb file.
234 install( FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/${name}.pdb DESTINATION ${BIN_DIR} )
237 # Install the library so file and symlinks
238 INSTALL( TARGETS ${name} DESTINATION ${LIB_DIR} )
241 IF( ENABLE_PKG_CONFIGURE )
242 # Install the pkg-config file
243 INSTALL( FILES ${ADAPTOR_PKG_CFG_FILE} DESTINATION ${LIB_DIR}/pkgconfig )
244 INSTALL( FILES ${ADAPTOR_INTEGRATION_PKG_CFG_FILE} DESTINATION ${LIB_DIR}/pkgconfig )
247 # macro for installing headers by replacing prefix. (TODO, investigate
248 # if there is a CMAKE way of doing this automatically)
249 MACRO(INSTALL_HEADERS_WITH_DIRECTORY HEADER_LIST STRIP_PREFIX REPLACE_PREFIX)
250 GET_FILENAME_COMPONENT( SPREFIX ${STRIP_PREFIX} ABSOLUTE )
251 FOREACH(HEADER ${${HEADER_LIST}})
252 STRING(REGEX MATCH "(.*)[/]" DIR ${HEADER})
253 STRING(REPLACE ${SPREFIX} ${REPLACE_PREFIX} NEWDIR ${DIR})
254 INSTALL(FILES ${HEADER} DESTINATION ${INCLUDE_DIR}/${NEWDIR})
256 ENDMACRO(INSTALL_HEADERS_WITH_DIRECTORY)
259 ########################################################################################
261 # Set deployment directories
262 # Due to complicated adaptor deployment the install section is pretty much converted from
263 # the automake counterpart.
264 SET( tizenadaptorpublicapidir ${INCLUDE_DIR}/dali/public-api )
265 SET( tizenadaptordevelapidir ${INCLUDE_DIR}/dali/devel-api )
266 SET( tizenadaptorintegrationapidir ${INCLUDE_DIR}/dali/integration-api/adaptor-framework )
267 SET( tizenadaptorframeworkpublicapidir ${tizenadaptorpublicapidir}/adaptor-framework )
268 SET( tizenadaptorframeworkdevelapidir ${tizenadaptordevelapidir}/adaptor-framework )
269 SET( tizentextabstractiondevelapidir ${tizenadaptordevelapidir}/text-abstraction )
270 SET( tizenadaptordaliheaderdir ${INCLUDE_DIR}/dali )
271 SET( tizenwatchpublicapidir ${tizenadaptorpublicapidir}/watch )
272 SET( tizencapturepublicapidir ${tizenadaptorpublicapidir}/capture )
274 # Android framework headers for Android build
275 SET( androidadaptorintegrationapidir ${INCLUDE_DIR}/dali/integration-api/adaptor-framework/android )
278 INSTALL( FILES ${public_api_header_files} DESTINATION ${tizenadaptorpublicapidir} )
279 INSTALL( FILES ${adaptor_integration_api_header_files} DESTINATION ${tizenadaptorintegrationapidir} )
280 INSTALL( FILES ${public_api_adaptor_framework_header_files} DESTINATION ${tizenadaptorframeworkpublicapidir} )
281 INSTALL( FILES ${devel_api_adaptor_framework_header_files} DESTINATION ${tizenadaptorframeworkdevelapidir} )
282 INSTALL( FILES ${text_abstraction_header_files} DESTINATION ${tizentextabstractiondevelapidir} )
284 # Install Android framework headers for Android build
285 INSTALL( FILES ${adaptor_integration_api_android_header_files} DESTINATION ${androidadaptorintegrationapidir} )
288 SET( packagedoxydir ${INCLUDE_DIR}/dali/doc )
289 SET( package_doxy_dir ${ADAPTOR_ROOT}/doc )
290 INCLUDE( ${ADAPTOR_ROOT}/doc/file.list )
291 INSTALL( FILES ${package_doxy_files} DESTINATION ${packagedoxydir} )
293 IF( NOT UBUNTU_PROFILE AND NOT ANDROID_PROFILE AND NOT WINDOWS_PROFILE )
294 INSTALL( FILES ${public_api_adaptor_tizen_header_files} DESTINATION ${tizenadaptorframeworkpublicapidir} )
296 INSTALL( FILES ${devel_api_adaptor_tizen_x11_header_files} DESTINATION ${tizenadaptorframeworkdevelapidir} )
300 INSTALL( FILES ${adaptor_dali_header_file} DESTINATION ${tizenadaptordaliheaderdir} )
301 INSTALL( FILES ${adaptor_dali_wearable_header_file} DESTINATION ${tizenadaptorpublicapidir} )
302 INSTALL( FILES ${public_dali_watch_header_files} DESTINATION ${tizenwatchpublicapidir} )
303 INSTALL( FILES ${public_dali_capture_header_files} DESTINATION ${tizencapturepublicapidir} )
305 IF( ANDROID_PROFILE )
306 SET( daliShaderbinCacheDir ${CMAKE_INSTALL_PREFIX}/core/shaderbin/)
307 INSTALL( DIRECTORY DESTINATION ${daliShaderbinCacheDir} )
309 SET( daliShaderbinCacheDir ${CMAKE_BINARY_DIR}/${dataReadOnlyDir}/core/shaderbin/)
310 INSTALL( DIRECTORY DESTINATION ${dataReadOnlyDir}/core/shaderbin )
313 INSTALL( FILES ${ADAPTOR_ROOT}/adaptors/scripts/dalireslog.sh DESTINATION ${CMAKE_INSTALL_PREFIX}/bin )
315 ########################################################################################
317 # The DALI_ADAPTOR_PREFIX must be set if this CMakeLists.txt is executed
318 # from the top-level CMake script using ADD_SUBDIRECTORY() to avoid
319 # target names duplication with other DALi modules.
320 IF( ENABLE_COVERAGE )
321 FIND_PROGRAM( LCOV_BIN "lcov" )
324 # Define custom rules for coverage
325 SET(COVERAGE_DIR .cov)
326 SET(COVERAGE_OUTPUT_DIR doc/coverage)
328 # lcov prior to 1.10 doesn't have -rc option; this and subsequent version don't output
329 # branch coverage. Determine the lcov version, and enable branch coverage accordingly.
330 EXECUTE_PROCESS( COMMAND bash -c "${LCOV_BIN} --version | cut -d' ' -f4" OUTPUT_VARIABLE LCOV_VERSION )
331 STRING( REPLACE "." ";" LCOV_VLIST ${LCOV_VERSION})
332 IF( NOT $<VERSION_LESS:${LCOV_VERSION},"1.10"> )
333 SET(LCOV_OPTS --rc lcov_branch_coverage=1)
336 ADD_CUSTOM_TARGET( ${DALI_ADAPTOR_PREFIX}rename_cov_data ./rename-cov-data )
338 ADD_CUSTOM_TARGET( ${DALI_ADAPTOR_PREFIX}cov_data ${LCOV_BIN} ${LCOV_OPTS} --base-directory . --directory . -c -o dali.info
339 COMMAND ${LCOV_BIN} ${LCOV_OPTS} --remove dali.info \"*/dali-env/*\" \"/usr/include/*\" -o dali.info )
341 ADD_CUSTOM_TARGET( ${DALI_ADAPTOR_PREFIX}coverage genhtml ${LCOV_OPTS} -o ${COVERAGE_OUTPUT_DIR} dali.info
344 ADD_CUSTOM_TARGET( ${DALI_ADAPTOR_PREFIX}reset_coverage @${LCOV_BIN} -z --directory `pwd` )
346 # Define custom rule for distclean
347 ADD_CUSTOM_TARGET( ${DALI_ADAPTOR_PREFIX}distclean @echo cleaning for source distribution )
350 COMMENT "distribution clean"
353 -not -name config.cmake -and \(
358 -name cmake.depends -or
359 -name cmake.check_depends -or
360 -name CMakeCache.txt -or
361 -name cmake.check_cache -or
367 -name install_manifest.txt -or
373 -name libdali*.so* \)
374 | grep -v TC | xargs rm -rf
375 TARGET ${DALI_ADAPTOR_PREFIX}distclean
382 IF( ENABLE_LINK_TEST )
384 SET( DALI_TEST_SUITE_DIR ${ROOT_SRC_DIR}/automated-tests/src/dali/dali-test-suite-utils )
385 SET( LINKER_TEST_NAME ${DALI_ADAPTOR_PREFIX}linker-test )
386 SET( LINKER_TEST_SOURCES
389 ADD_EXECUTABLE( ${LINKER_TEST_NAME} ${LINKER_TEST_SOURCES} )
390 MESSAGE(STATUS "libs: ${DALICORE_LDFLAGS}")
391 TARGET_COMPILE_OPTIONS( ${LINKER_TEST_NAME} PRIVATE -I${ROOT_SRC_DIR} ${DALICORE_CFLAGS} )
392 TARGET_LINK_LIBRARIES(${LINKER_TEST_NAME} ${name} ${DALICORE_LDFLAGS} ${VCONF_LDFLAGS} ${HARFBUZZ_LDFLAGS} )
393 TARGET_INCLUDE_DIRECTORIES( ${LINKER_TEST_NAME} PRIVATE ${DALI_TEST_SUITE_DIR} )
396 # Configuration Messages
397 MESSAGE( STATUS "Configuration:\n" )
398 MESSAGE( STATUS "Prefix: ${PREFIX}")
399 MESSAGE( STATUS "Lib Dir: ${LIB_DIR}" )
400 MESSAGE( STATUS "Include Dir: ${INCLUDE_DIR}" )
401 MESSAGE( STATUS "Coverage: ${ENABLE_COVERAGE}" )
402 MESSAGE( STATUS "Debug Build: ${ENABLE_DEBUG}")
403 MESSAGE( STATUS "Freetype bitmap support (Emoji): ${freetype_bitmap_support_ENABLED}")
404 MESSAGE( STATUS "Profile: ${ENABLE_PROFILE}")
405 MESSAGE( STATUS "Data Dir (Read/Write): ${dataReadWriteDir}")
406 MESSAGE( STATUS "Data Dir (Read Only): ${dataReadOnlyDir}")
407 MESSAGE( STATUS "WebP: ${webp_available_ENABLED}")
408 MESSAGE( STATUS "Shader Binary Cache: ${ENABLE_SHADERBINCACHE}")
409 MESSAGE( STATUS "Network logging enabled: ${ENABLE_NETWORKLOGGING}")
410 MESSAGE( STATUS "Font config file: ${fontConfigurationFile}")
411 MESSAGE( STATUS "Using Tizen APP FW libraries: ${ENABLE_APPFW}")
412 MESSAGE( STATUS "Use pkg configure: ${ENABLE_PKG_CONFIGURE}" )
413 MESSAGE( STATUS "Enable link test: ${ENABLE_LINK_TEST}" )
414 MESSAGE( STATUS "Enable AT-SPI: ${ENABLE_ATSPI}" )
415 MESSAGE( STATUS "Tizen Platform Config supported ${TIZEN_PLATFORM_CONFIG_SUPPORTED_LOGMSG}")
416 MESSAGE( STATUS "Compile flags: ${CMAKE_CXX_FLAGS}")
417 MESSAGE( STATUS "Compile flags: ${CMAKE_C_FLAGS}")
418 IF( enable_feedback )
419 ADD_SUBDIRECTORY( plugins )