Now libraries are cleanly included and built.
Change-Id: Iaa85639578b55b2da8357bc438426403e2cca8de
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
# Optional Extra global include path
# -----------------------------------
-set(EXTRA_INCLUDE_DIRS libs/openxc-message-format/gen/cpp libs/nanopb libs/uds-c/src libs/isotp-c/src libs/bitfield-c/src libs/ini-config)
+#set(EXTRA_INCLUDE_DIRS)
# Optional extra libraries
# -------------------------
# Optional force binding Linking flag
# ------------------------------------
# set(BINDINGS_LINK_FLAG LinkOptions )
-
-
###########################################################################
# Add target to project dependency list
-fill_include_dir(${CMAKE_CURRENT_SOURCE_DIR})
-file(GLOB filelist "${CMAKE_CURRENT_SOURCE_DIR}/*")
-foreach(filename ${filelist})
- if(IS_DIRECTORY ${filename})
- STRING(REGEX REPLACE "^.*\/(.*)$" "\\1" shortname ${filename})
- find_source_files(${filename})
- PROJECT_TARGET_ADD(${shortname})
- add_library(${shortname} STATIC ${sources_files})
- endif(IS_DIRECTORY ${filename})
-endforeach()
+search_targets()
\ No newline at end of file
--- /dev/null
+###########################################################################
+# Copyright 2015, 2016, 2017 IoT.bzh
+#
+# author: Fulup Ar Foll <fulup@iot.bzh>
+# contrib: Romain Forlot <romain.forlot@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+# Add target to project dependency list
+PROJECT_TARGET_ADD(bitfield-c)
+
+ # Define project Target
+ add_library(${TARGET_NAME} STATIC
+ src/bitfield/8byte.c
+ src/bitfield/bitarray.c
+ src/bitfield/bitfield.c
+ src/canutil/read.c
+ src/canutil/write.c)
+
+ # Binder exposes a unique public entry point
+ SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES
+ OUTPUT_NAME ${TARGET_NAME}
+ )
+
+ # Define target includes
+ TARGET_INCLUDE_DIRECTORIES(${TARGET_NAME}
+ PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src
+ )
+
+ # Library dependencies (include updates automatically)
+ TARGET_LINK_LIBRARIES(${TARGET_NAME}
+ ${link_libraries})
\ No newline at end of file
--- /dev/null
+###########################################################################
+# Copyright 2015, 2016, 2017 IoT.bzh
+#
+# author: Fulup Ar Foll <fulup@iot.bzh>
+# contrib: Romain Forlot <romain.forlot@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+# Add target to project dependency list
+PROJECT_TARGET_ADD(ini-config)
+
+ # Define project Target
+ add_library(${TARGET_NAME} STATIC ${TARGET_NAME}.cpp)
+
+ # Binder exposes a unique public entry point
+ SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES
+ OUTPUT_NAME ${TARGET_NAME}
+ )
+
+ # Define target includes
+ TARGET_INCLUDE_DIRECTORIES(${TARGET_NAME}
+ PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
+ )
+
+ # Library dependencies (include updates automatically)
+ TARGET_LINK_LIBRARIES(${TARGET_NAME}
+ ${link_libraries})
--- /dev/null
+###########################################################################
+# Copyright 2015, 2016, 2017 IoT.bzh
+#
+# author: Fulup Ar Foll <fulup@iot.bzh>
+# contrib: Romain Forlot <romain.forlot@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+# Add target to project dependency list
+PROJECT_TARGET_ADD(isotp-c)
+
+ # Define project Target
+ add_library(${TARGET_NAME} STATIC
+ src/isotp/isotp.c
+ src/isotp/receive.c
+ src/isotp/send.c)
+
+ # Binder exposes a unique public entry point
+ SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES
+ OUTPUT_NAME ${TARGET_NAME}
+ )
+
+ # Define target includes
+ get_target_property(Bitfield_inc bitfield-c INCLUDE_DIRECTORIES)
+ TARGET_INCLUDE_DIRECTORIES(${TARGET_NAME}
+ PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src
+ ${Bitfield_inc}
+ )
+
+ # Library dependencies (include updates automatically)
+ TARGET_LINK_LIBRARIES(${TARGET_NAME}
+ ${link_libraries})
+++ /dev/null
-cmake_minimum_required(VERSION 2.8)
-
-project(nanopb C)
-
-set(nanopb_VERSION_STRING nanopb-0.3.9-dev)
-
-string(REPLACE "nanopb-" "" nanopb_VERSION ${nanopb_VERSION_STRING})
-
-option(nanopb_BUILD_RUNTIME "Build the headers and libraries needed at runtime" ON)
-option(nanopb_BUILD_GENERATOR "Build the protoc plugin for code generation" ON)
-option(nanopb_MSVC_STATIC_RUNTIME "Link static runtime libraries" ON)
-
-if(NOT DEFINED CMAKE_DEBUG_POSTFIX)
- set(CMAKE_DEBUG_POSTFIX "d")
-endif()
-
-include(GNUInstallDirs)
-
-if(MSVC AND nanopb_MSVC_STATIC_RUNTIME)
- foreach(flag_var
- CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
- CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
- if(${flag_var} MATCHES "/MD")
- string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
- endif(${flag_var} MATCHES "/MD")
- endforeach(flag_var)
-endif()
-
-if(NOT DEFINED CMAKE_INSTALL_CMAKEDIR)
- set(CMAKE_INSTALL_CMAKEDIR "lib/cmake/nanopb")
-endif()
-
-if(nanopb_BUILD_GENERATOR)
- set(generator_protos nanopb plugin)
-
- find_package(PythonInterp 2.7 REQUIRED)
- execute_process(
- COMMAND ${PYTHON_EXECUTABLE} -c
- "from distutils import sysconfig; print(sysconfig.get_python_lib(prefix='${CMAKE_INSTALL_PREFIX}'))"
- OUTPUT_VARIABLE PYTHON_INSTDIR
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
-
- foreach(generator_proto IN LISTS generator_protos)
- string(REGEX REPLACE "([^;]+)" "${PROJECT_SOURCE_DIR}/generator/proto/\\1.proto" generator_proto_file "${generator_proto}")
- string(REGEX REPLACE "([^;]+)" "\\1_pb2.py" generator_proto_py_file "${generator_proto}")
- add_custom_command(
- OUTPUT ${generator_proto_py_file}
- COMMAND protoc --python_out=${PROJECT_BINARY_DIR} -I${PROJECT_SOURCE_DIR}/generator/proto ${generator_proto_file}
- DEPENDS ${generator_proto_file}
- )
- add_custom_target("generate_${generator_proto_py_file}" ALL DEPENDS ${generator_proto_py_file})
- install(
- FILES ${PROJECT_BINARY_DIR}/${generator_proto_py_file}
- DESTINATION ${PYTHON_INSTDIR}
- )
- endforeach()
-endif()
-
-if(nanopb_BUILD_RUNTIME)
- add_library(protobuf-nanopb STATIC
- pb.h
- pb_common.h
- pb_common.c
- pb_encode.h
- pb_encode.c
- pb_decode.h
- pb_decode.c)
-
- target_include_directories(protobuf-nanopb INTERFACE
- $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
- )
-
- configure_file(extra/nanopb-config-version.cmake.in
- nanopb-config-version.cmake @ONLY)
-
- install(TARGETS protobuf-nanopb EXPORT nanopb-targets
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
-
- install(EXPORT nanopb-targets
- DESTINATION ${CMAKE_INSTALL_CMAKEDIR}
- NAMESPACE nanopb::)
-
- install(FILES extra/nanopb-config.cmake
- ${CMAKE_CURRENT_BINARY_DIR}/nanopb-config-version.cmake
- DESTINATION ${CMAKE_INSTALL_CMAKEDIR})
-
- install(FILES pb.h pb_common.h pb_encode.h pb_decode.h
- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
-endif()
--- /dev/null
+###########################################################################
+# Copyright 2015, 2016, 2017 IoT.bzh
+#
+# author: Fulup Ar Foll <fulup@iot.bzh>
+# contrib: Romain Forlot <romain.forlot@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+# Add target to project dependency list
+PROJECT_TARGET_ADD(openxc-message-format)
+
+ # Define project Target
+ add_library(${TARGET_NAME} STATIC
+ gen/cpp/openxc.pb.c
+ ${PROJECT_LIBDIR}/nanopb/pb_encode.c
+ ${PROJECT_LIBDIR}/nanopb/pb_decode.c
+ ${PROJECT_LIBDIR}/nanopb/pb_common.c)
+
+ # Binder exposes a unique public entry point
+ SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES
+ OUTPUT_NAME ${TARGET_NAME}
+ )
+
+ # Define target includes
+ TARGET_INCLUDE_DIRECTORIES(${TARGET_NAME}
+ PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/gen/cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/libs/nanopb
+ )
+
+ # Library dependencies (include updates automatically)
+ TARGET_LINK_LIBRARIES(${TARGET_NAME}
+ ${link_libraries})
+++ /dev/null
-Subproject commit b947dc6e2c0d63a29e83ebf9c8af450d2531aef2
--- /dev/null
+###########################################################################
+# Copyright 2015, 2016, 2017 IoT.bzh
+#
+# author: Fulup Ar Foll <fulup@iot.bzh>
+# contrib: Romain Forlot <romain.forlot@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+# Add target to project dependency list
+PROJECT_TARGET_ADD(uds-c)
+
+ # Define project Target
+ add_library(${TARGET_NAME} STATIC
+ src/uds/extras.c
+ src/uds/uds.c)
+
+ # Binder exposes a unique public entry point
+ SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES
+ OUTPUT_NAME ${TARGET_NAME}
+ )
+
+ # Define target includes
+ get_target_property(IsoTP_inc isotp-c INCLUDE_DIRECTORIES)
+ TARGET_INCLUDE_DIRECTORIES(${TARGET_NAME}
+ PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src
+ ${IsoTP_inc}
+ )
+
+ # Library dependencies (include updates automatically)
+ TARGET_LINK_LIBRARIES(${TARGET_NAME}
+ ${link_libraries})
TARGET_LINK_LIBRARIES(${TARGET_NAME}
ini-config
openxc-message-format
- nanopb
uds-c
isotp-c
bitfield-c