summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-04-11 17:55:13 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-04-11 17:55:13 +0200
commit511b3c469ead67be27d2d742699a23be28666b24 (patch)
tree252da80f9a8e06833924f41f0b375f281a05990e
parenta58d40b5ae336a54408201963b065ee049b43acd (diff)
Adapt CMakeFile including can-config-generator tool.
Change-Id: I154d3976c0ab91ded20c07c44a1a586a98f3057f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--CMakeLists.txt1
-rw-r--r--can-config-generator/CMakeLists.txt80
-rw-r--r--etc/config.cmake4
3 files changed, 56 insertions, 29 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4ba6136..0e3b4ff 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,6 +28,7 @@
# -----------------------
macro(PROJECT_TARGET_ADD TARGET_NAME)
set(PROJECT_TARGETS ${PROJECT_TARGETS} ${TARGET_NAME} CACHE INTERNAL PROJECT_TARGETS)
+ set(TARGET_NAME ${TARGET_NAME})
endmacro(PROJECT_TARGET_ADD)
macro(defstr name value)
diff --git a/can-config-generator/CMakeLists.txt b/can-config-generator/CMakeLists.txt
index 8eb40d5..5baf632 100644
--- a/can-config-generator/CMakeLists.txt
+++ b/can-config-generator/CMakeLists.txt
@@ -1,27 +1,53 @@
-cmake_minimum_required(VERSION 3.3)
-project(can-config-generator)
-
-if (CMAKE_VERSION VERSION_LESS "3.1")
- if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
- set (CMAKE_CXX_FLAGS "--std=gnu++11 ${CMAKE_CXX_FLAGS}")
- elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
- set (CMAKE_CXX_FLAGS "--std=c++11 ${CMAKE_CXX_FLAGS}")
- endif ()
-else ()
- set (CMAKE_CXX_STANDARD 11)
-endif ()
-
-include_directories(SYSTEM 3rdparty/json)
-
-add_executable(can-config-generator
- src/main.cpp
- src/openxc/message_set.cpp
- src/openxc/can_bus.cpp
- src/openxc/can_message.cpp
- src/openxc/command.cpp
- src/openxc/diagnostic_message.cpp
- src/openxc/mapping.cpp
- src/openxc/signal.cpp)
-
-target_link_libraries(can-config-generator)
-target_compile_features(can-config-generator PRIVATE cxx_range_for cxx_constexpr cxx_nullptr)
+###########################################################################
+# 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(can-config-generator)
+
+ # Define project Targets
+ fill_include_dir(${PROJECT_LIBDIR})
+ file(GLOB filelist "${PROJECT_LIBDIR}/*")
+ foreach(filename ${filelist})
+ if(IS_DIRECTORY ${filename})
+ include_directories(${filename})
+ STRING(REGEX REPLACE "^.*\/(.*)$" "\\1" shortname ${filename})
+ find_source_files(${PROJECT_LIBDIR})
+ add_library(${shortname} STATIC ${sources_files})
+ endif(IS_DIRECTORY ${filename})
+ endforeach()
+
+ add_executable(can-config-generator
+ src/main.cpp
+ src/openxc/message_set.cpp
+ src/openxc/can_bus.cpp
+ src/openxc/can_message.cpp
+ src/openxc/command.cpp
+ src/openxc/diagnostic_message.cpp
+ src/openxc/mapping.cpp
+ src/openxc/signal.cpp)
+
+ # Library dependencies (include updates automatically)
+ TARGET_LINK_LIBRARIES(can-config-generator
+ ${EXTRA_LINK_LIBRARIES}
+ ${link_libraries}
+ )
+
+ # installation directory
+ INSTALL(TARGETS can-config-generator
+ RUNTIME DESTINATION ${BINDINGS_INSTALL_DIR})
diff --git a/etc/config.cmake b/etc/config.cmake
index dc695b4..44018c1 100644
--- a/etc/config.cmake
+++ b/etc/config.cmake
@@ -54,11 +54,11 @@ setc(LD_LIBRARY_PATH ${CMAKE_INSTALL_PREFIX}/lib64 ${CMAKE_INSTALL_PREFIX}/lib)
# Optional dependencies order
# ---------------------------
-#set(EXTRA_DEPENDENCIES_ORDER target1 target2 ...)
+set(EXTRA_DEPENDENCIES_ORDER can-config-generator low-can-binding)
# Optional Extra global include path
# -----------------------------------
-#set(EXTRA_INCLUDE_DIRS incdir1 incdir2 ...)
+set(EXTRA_INCLUDE_DIRS can-config-generator/3rdparty/json)
# Optional extra libraries
# -------------------------