Update Installation Documentation
[apps/agl-service-unicens.git] / ucs2-afb / CMakeLists.txt
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
20 # Generate API-v2 hat from OpenAPI json definition
21 macro(SET_TARGET_GENSKEL TARGET_NAME API_DEF_NAME)
22     add_custom_command(OUTPUT ${API_DEF_NAME}.h
23         WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
24         DEPENDS ${API_DEF_NAME}.json
25         COMMAND afb-genskel  ${API_DEF_NAME}.json >${API_DEF_NAME}.h 
26     )
27     add_custom_target(${API_DEF_NAME}_OPENAPI DEPENDS ${API_DEF_NAME}.h)
28     add_dependencies(${TARGET_NAME} ${API_DEF_NAME}_OPENAPI)
29     
30 endmacro(SET_TARGET_GENSKEL)
31
32 # Add target to project dependency list
33 PROJECT_TARGET_ADD(ucs2-afb)
34
35     # Define project Targets
36     ADD_LIBRARY(${TARGET_NAME} MODULE ucs_apihat.c ucs_binding.c )
37
38     # Generate API-v2 hat from OpenAPI json definition
39     SET_TARGET_GENSKEL(${TARGET_NAME} ucs_apidef)
40
41     # Binder exposes a unique public entry point
42     SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES
43         PREFIX "afb-"
44         LABELS "BINDING"
45         LINK_FLAGS  ${BINDINGS_LINK_FLAG}
46         OUTPUT_NAME ucs2
47
48     )
49
50     # Library dependencies (include updates automatically)
51     TARGET_LINK_LIBRARIES(${TARGET_NAME}
52         ucs2-inter
53         ${link_libraries}
54     )
55
56     # installation directory
57     INSTALL(TARGETS ${TARGET_NAME}
58         LIBRARY DESTINATION ${BINDINGS_INSTALL_DIR})
59