Fix Reset browser functionality.
[profile/tv/apps/web/browser.git] / CMakeLists.txt
1 project(BrowserApp)
2 cmake_minimum_required(VERSION 2.8)
3 #
4 ########## Defines ###########
5 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
6 SET(BINDIR "${PREFIX}/bin")
7 SET(RESDIR "${PREFIX}/res" CACHE STRING "The path of resources")
8 SET(WEBKITDIR "/opt/usr/data/webkit" CACHE STRING "The path of web engine")
9 SET(EDJE_DIR "${RESDIR}/edje/")
10 SET(CERTS_DIR "${RESDIR}/certs/")
11 SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
12 SET(GCC_COVERAGE_COMPILE_FLAGS "-fprofile-arcs -ftest-coverage")
13
14 if(NOT DEFINED PACKAGE_NAME)
15     SET(PACKAGE_NAME "org.tizen.browser")
16 endif(NOT DEFINED PACKAGE_NAME)
17
18 if(NOT DEFINED MANIFESTDIR)
19     SET(MANIFESTDIR "/usr/share/packages")
20 endif(NOT DEFINED MANIFESTDIR)
21
22 if(NOT DEFINED ICONDIR)
23     SET(ICONDIR "/usr/share/icons/default/small/")
24 endif(NOT DEFINED ICONDIR)
25
26 if(NOT DEFINED DEMODIR)
27     SET(DEMODIR "/usr/apps/org.tizen.browser/res/demo/")
28 endif(NOT DEFINED DEMODIR)
29
30 option(BUILD_UT "Build Unit tests" OFF)
31 option(TIZEN_BUILD "Build for Tizen. Default ON" ON)
32 option(DYN_INT_LIBS "Buils internal libs as dynamic" ON)
33 option(COVERAGE_STATS "Code coverage" OFF)
34
35 #Enable C++11 support
36 include(CheckCXXCompilerFlag)
37 CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
38 CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
39
40
41 if (COMPILER_SUPPORTS_CXX11)
42     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O0 -g -ggdb3")
43     elseif(COMPILER_SUPPORTS_CXX0X)
44     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -O0 -g -ggdb3")
45 else()
46     message(FATAL_ERROR "The Compiler ${CMAKE_CXX_COMPILER} doesn't support C++11")
47 endif()
48
49
50 find_package(Boost 1.49.0 REQUIRED COMPONENTS
51                                         regex
52                                         filesystem
53                                         system
54                                         date_time
55                                         )
56 if(BUILD_UT)
57 find_package(Boost 1.49.0 REQUIRED COMPONENTS unit_test_framework)
58 ENDIF(BUILD_UT)
59
60 #RPATH settings
61 set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
62 set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/services")
63
64 #disable for merge - WebView is not ready for this
65 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-variadic-macros -Wno-long-long")
66
67 if(COVERAGE_STATS)
68     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}")
69 endif(COVERAGE_STATS)
70
71 set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
72
73 # TIZEN SPECIFIC
74 # set pkg-config modules
75 if(TIZEN_BUILD)
76     include(FindPkgConfig)
77
78     set(PLATFORM_TIZEN ON)
79     SET(tizen_pkgs_list
80         dlog
81         capi-appfw-application
82         libpng
83     )
84
85     pkg_check_modules(tizen_pkgs REQUIRED "${tizen_pkgs_list}")
86
87     FOREACH(flag ${tizen_pkgs_CFLAGS})
88         SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
89     ENDFOREACH(flag)
90
91     message("${CMAKE_CXX_FLAGS}")
92     MACRO (TODAY RESULT)
93         EXECUTE_PROCESS(COMMAND "date" "+%d-%m-%Y" OUTPUT_VARIABLE ${RESULT})
94         STRING(REGEX REPLACE "(..)-(..)-(....).*" "\\1-\\2-\\3" ${RESULT} ${${RESULT}})
95     ENDMACRO (TODAY)
96
97     TODAY(BUILD_DATE)
98
99     ADD_DEFINITIONS(
100         -DBUILD_DATE=\"${BUILD_DATE}\"
101         -DVERSION=\"${VERSION}\"
102         -D__BUILD__
103         -DM_VCS_ID=\"${VCS_ID}\"
104         -DTIZEN_BUILD=\"${TIZEN_BUILD}\"
105         -DCERTS_DIR=\"${CERTS_DIR}\"
106         )
107 endif(TIZEN_BUILD)
108
109 ADD_DEFINITIONS(-DEDJE_DIR=\"${EDJE_DIR}\")
110
111 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
112 include_directories(${CMAKE_CURRENT_BINARY_DIR})
113
114 #services
115 add_subdirectory(services)
116
117 #browser core
118 add_subdirectory(core)
119
120 #compiling EDC files
121 #
122 #Temporary location of EDC files
123 #
124 # probably should be moved to Tizen section.
125 #to build unit tests add --define "build_unit_test ON" parameter to gbs build command
126 if(BUILD_UT)
127   add_subdirectory(unit_tests)
128 ENDIF(BUILD_UT)
129
130 configure_file(${CMAKE_SOURCE_DIR}/cmakeconfig.h.cmake ${CMAKE_BINARY_DIR}/cmakeconfig.h)
131
132 if(TIZEN_BUILD)
133 configure_file(${CMAKE_SOURCE_DIR}/manifest.xml.in ${CMAKE_BINARY_DIR}/${PACKAGE_NAME}.xml)
134 install(FILES ${CMAKE_BINARY_DIR}/${PACKAGE_NAME}.xml DESTINATION ${MANIFESTDIR})
135 # install desktop file & icon
136 install(FILES ${CMAKE_SOURCE_DIR}/org.tizen.browser.png DESTINATION ${ICONDIR})
137 install(FILES ${CMAKE_SOURCE_DIR}/apps_img_web_default_4x2.png DESTINATION ${ICONDIR})
138 # install demo files
139 install(FILES ${CMAKE_SOURCE_DIR}/demo/b.htm DESTINATION ${DEMODIR})
140 install(FILES ${CMAKE_SOURCE_DIR}/demo/Widget.htm DESTINATION ${DEMODIR})
141 install(FILES ${CMAKE_SOURCE_DIR}/demo/header.jpg DESTINATION ${DEMODIR})
142 install(FILES ${CMAKE_SOURCE_DIR}/demo/main_bg.jpg DESTINATION ${DEMODIR})
143 # install certs
144 INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/certs/ DESTINATION ${CERTS_DIR})
145 endif(TIZEN_BUILD)
146
147 message(STATUS "------------------------------------------")
148 message(STATUS "Build for Tizen          (TIZEN_BUILD)     :" ${TIZEN_BUILD})
149 message(STATUS "Interal libs are dynamic (DYN_INT_LIBS)    :" ${DYN_INT_LIBS})
150 message(STATUS "Building Unit tests      (BUILD_UT)        :" ${BUILD_UT})
151 message(STATUS "Code Coverage statistics (COVERAGE_STATS)  :" ${COVERAGE_STATS})
152 message(STATUS "------------------------------------------")