1 ###########################################################################
2 # Copyright 2015, 2016, 2017 IoT.bzh
4 # author: Fulup Ar Foll <fulup@iot.bzh>
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
10 # http://www.apache.org/licenses/LICENSE-2.0
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 ###########################################################################
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
27 add_custom_target(${API_DEF_NAME}_OPENAPI DEPENDS ${API_DEF_NAME}.h)
28 add_dependencies(${TARGET_NAME} ${API_DEF_NAME}_OPENAPI)
30 endmacro(SET_TARGET_GENSKEL)
32 # Add target to project dependency list
33 PROJECT_TARGET_ADD(ucs2-afb)
35 # Define project Targets
36 ADD_LIBRARY(${TARGET_NAME} MODULE ucs_apihat.c ucs_binding.c )
38 # Generate API-v2 hat from OpenAPI json definition
39 SET_TARGET_GENSKEL(${TARGET_NAME} ucs_apidef)
41 # Binder exposes a unique public entry point
42 SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES
45 LINK_FLAGS ${BINDINGS_LINK_FLAG}
50 # Library dependencies (include updates automatically)
51 TARGET_LINK_LIBRARIES(${TARGET_NAME}
56 # installation directory
57 INSTALL(TARGETS ${TARGET_NAME}
58 LIBRARY DESTINATION ${BINDINGS_INSTALL_DIR})