Fixed error after hard c/c ...
[apps/low-level-can-service.git] / conf.d / cmake / config.cmake
1 ###########################################################################
2 # Copyright 2015, 2016, 2017 IoT.bzh
3 #
4 # author: Fulup Ar Foll <fulup@iot.bzh>
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #     http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 ###########################################################################
18
19 # Project Info
20 # ------------------
21 set(PROJECT_NAME low-can-service)
22 set(PROJECT_PRETTY_NAME "Low level CAN binding")
23 set(PROJECT_DESCRIPTION "Expose CAN Low Level APIs through AGL Framework")
24 set(PROJECT_URL "https://gerrit.automotivelinux.org/gerrit/apps/low-level-can-service")
25 set(PROJECT_ICON "icon.png")
26 set(PROJECT_AUTHOR "Romain Forlot")
27 set(PROJECT_AUTHOR_MAIL "romain.forlot@iot.bzh")
28 set(PROJECT_LICENSE "APL2.0")
29 set(PROJECT_LANGUAGES,"C CXX")
30
31 # Where are stored default templates files from submodule or subtree app-templates in your project tree
32 # relative to the root project directory
33 set(PROJECT_APP_TEMPLATES_DIR "conf.d/app-templates")
34
35 # Where are stored your external libraries for your project. This is 3rd party library that you don't maintain
36 # but used and must be built and linked.
37 # set(PROJECT_LIBDIR "libs")
38
39 # Where are stored data for your application. Pictures, static resources must be placed in that folder.
40 # set(PROJECT_RESOURCES "data")
41
42 # Which directories inspect to find CMakeLists.txt target files
43 # set(PROJECT_SRC_DIR_PATTERN "*")
44
45 # Compilation Mode (DEBUG, RELEASE)
46 # ----------------------------------
47 set(CMAKE_BUILD_TYPE "DEBUG")
48
49 # Kernel selection if needed. You can choose between a
50 # mandatory version to impose a minimal version.
51 # Or check Kernel minimal version and just print a Warning
52 # about missing features and define a preprocessor variable
53 # to be used as preprocessor condition in code to disable
54 # incompatibles features. Preprocessor define is named
55 # KERNEL_MINIMAL_VERSION_OK.
56 #
57 # NOTE*** FOR NOW IT CHECKS KERNEL Yocto environment and
58 # Yocto SDK Kernel version.
59 # -----------------------------------------------
60 #set (kernel_mandatory_version 4.8)
61 set (kernel_minimal_version 4.8)
62
63 # Compiler selection if needed. Impose a minimal version.
64 # -----------------------------------------------
65 set (gcc_minimal_version 4.9)
66
67 # PKG_CONFIG required packages
68 # -----------------------------
69 set (PKG_REQUIRED_LIST
70         json-c
71         libsystemd>=222
72         afb-daemon
73         libmicrohttpd>=0.9.55
74 )
75
76 # Prefix path where will be installed the files
77 # Default: /usr/local (need root permission to write in)
78 # ------------------------------------------------------
79 set(CMAKE_INSTALL_PREFIX $ENV{HOME}/opt)
80
81 # Customize link option
82 # -----------------------------
83 list (APPEND link_libraries -pthread)
84
85 # Compilation options definition
86 # Use CMake generator expressions to specify only for a specific language
87 # Values are prefilled with default options that is currently used.
88 # Either separate options with ";", or each options must be quoted separately
89 # DO NOT PUT ALL OPTION QUOTED AT ONCE , COMPILATION COULD FAILED !
90 # ----------------------------------------------------------------------------
91 set(COMPILE_OPTIONS
92  -Wall
93  -Wextra
94  -Wconversion
95  -Wno-unused-parameter
96  -Wno-sign-compare
97  -Wno-sign-conversion
98  -Werror=maybe-uninitialized
99  -Werror=implicit-function-declaration
100  -ffunction-sections
101  -fdata-sections
102  -fPIC
103  -DPB_FIELD_16BIT
104  CACHE STRING "Compilation flags")
105 #set(C_COMPILE_OPTIONS "" CACHE STRING "Compilation flags for C language.")
106 set(CXX_COMPILE_OPTIONS -pthread CACHE STRING "Compilation flags for C++ language.")#set(PROFILING_COMPILE_OPTIONS
107 # -g
108 # -O0
109 # -pg
110 # -Wp,-U_FORTIFY_SOURCE
111 # CACHE STRING "Compilation flags for PROFILING build type.")
112 #set(DEBUG_COMPILE_OPTIONS
113 # -g
114 # -ggdb
115 # -Wp,-U_FORTIFY_SOURCE
116 # CACHE STRING "Compilation flags for DEBUG build type.")
117 #set(CCOV_COMPILE_OPTIONS
118 # -g
119 # -O2
120 # --coverage
121 # CACHE STRING "Compilation flags for CCOV build type.")
122 #set(RELEASE_COMPILE_OPTIONS
123 # -g
124 # -O2
125 # CACHE STRING "Compilation flags for RELEASE build type.")
126
127 # (BUG!!!) as PKG_CONFIG_PATH does not work [should be an env variable]
128 # ---------------------------------------------------------------------
129 set(CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}/lib64/pkgconfig ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
130 set(LD_LIBRARY_PATH ${CMAKE_INSTALL_PREFIX}/lib64 ${CMAKE_INSTALL_PREFIX}/lib)
131
132 # Optional location for config.xml.in
133 # -----------------------------------
134 #set(WIDGET_ICON "\"${CMAKE_SOURCE_DIR}conf.d/wgt/${PROJECT_ICON}\"" CACHE PATH "Path to the widget icon")
135 #set(WIDGET_CONFIG_TEMPLATE "\"${CMAKE_SOURCE_DIR}/conf.d/wgt/config.xml.in\"" CACHE PATH "Path to widget config file template (config.xml.in)")
136
137 # Mandatory widget Mimetype specification of the main unit
138 # --------------------------------------------------------------------------
139 # Choose between :
140 #- text/html : HTML application,
141 #       content.src designates the home page of the application
142 #
143 #- application/vnd.agl.native : AGL compatible native,
144 #       content.src designates the relative path of the binary.
145 #
146 # - application/vnd.agl.service: AGL service, content.src is not used.
147 #
148 #- ***application/x-executable***: Native application,
149 #       content.src designates the relative path of the binary.
150 #       For such application, only security setup is made.
151 #
152 set(WIDGET_TYPE application/vnd.agl.service)
153
154 # Mandatory Widget entry point file of the main unit
155 # --------------------------------------------------------------
156 # This is the file that will be executed, loaded,
157 # at launch time by the application framework.
158 #
159 set(WIDGET_ENTRY_POINT lib/afb-low-can.so)
160
161 # Optional dependencies order
162 # ---------------------------
163 #set(EXTRA_DEPENDENCIES_ORDER)
164
165 # Optional Extra global include path
166 # -----------------------------------
167 #set(EXTRA_INCLUDE_DIRS)
168
169 # Optional extra libraries
170 # -------------------------
171 #set(EXTRA_LINK_LIBRARIES)
172
173 # Optional force binding Linking flag
174 # ------------------------------------
175 # set(BINDINGS_LINK_FLAG LinkOptions )
176
177 # Optional force package prefix generation, like widget
178 # -----------------------------------------------------
179 # set(PKG_PREFIX DestinationPath)
180
181 # Optional Application Framework security token
182 # and port use for remote debugging.
183 #------------------------------------------------------------
184 set(AFB_TOKEN   ""     CACHE STRING "Default binder security token")
185 set(AFB_REMPORT "1234" CACHE STRING "Default binder listening port")
186
187 # Print a helper message when every thing is finished
188 # ----------------------------------------------------
189 set(CLOSING_MESSAGE "Typical binding launch: afb-daemon --port=${AFB_REMPORT} --workdir=${CMAKE_BINARY_DIR}/package --ldpaths=lib --roothttp=htdocs  --token=\"${AFB_TOKEN}\" --tracereq=common --verbose")
190 set(PACKAGE_MESSAGE "Install widget file using in the target : afm-util install ${PROJECT_NAME}.wgt")
191
192 # Optional schema validator about now only XML, LUA and JSON
193 # are supported
194 #------------------------------------------------------------
195 #set(LUA_CHECKER "luac" "-p" CACHE STRING "LUA compiler")
196 #set(XML_CHECKER "xmllint" CACHE STRING "XML linter")
197 #set(JSON_CHECKER "json_verify" CACHE STRING "JSON linter")
198
199 # This include is mandatory and MUST happens at the end
200 # of this file, else you expose you to unexpected behavior
201 # -----------------------------------------------------------
202 include(${PROJECT_APP_TEMPLATES_DIR}/cmake/common.cmake)