summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcus Fritzsch <marcus_fritzsch@mentor.com>2017-09-12 12:17:11 +0200
committerMarcus Fritzsch <marcus_fritzsch@mentor.com>2017-09-14 14:04:51 +0200
commit2c3e2c9868754294af4db0943954d2e0ef3d4d5e (patch)
treeb8e93e6cac67d3564021d29951f6bbea1b256821
parent530b7054a0f2800936ef312f016b9d55f9defddf (diff)
client-lib: add cmakelists
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
-rw-r--r--CMakeLists.txt1
-rw-r--r--client-lib/CMakeLists.txt71
2 files changed, 72 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1babad4..f5d68e6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -78,4 +78,5 @@ set(SANITIZER_MODE "none" CACHE STRING "Build using a specific sanitizer (e.g. '
set(LINK_LIBCXX OFF CACHE BOOL "Link against LLVMs libc++")
+add_subdirectory(client-lib)
add_subdirectory(src)
diff --git a/client-lib/CMakeLists.txt b/client-lib/CMakeLists.txt
new file mode 100644
index 0000000..2478da4
--- /dev/null
+++ b/client-lib/CMakeLists.txt
@@ -0,0 +1,71 @@
+#
+# Copyright (C) 2017 Mentor Graphics Development (Deutschland) GmbH
+#
+# 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.
+#
+
+include(FindPkgConfig)
+
+pkg_check_modules(AFB REQUIRED afb-daemon)
+pkg_check_modules(SD REQUIRED libsystemd>=222)
+
+add_library(afbclient SHARED
+ AFBClient.cpp
+ AFBClient.h)
+
+target_include_directories(afbclient
+ PRIVATE
+ ${AFB_INCLUDE_DIRS}
+ ${SD_INCLUDE_DIRS})
+
+target_link_libraries(afbclient
+ PRIVATE
+ ${AFB_LIBRARIES}
+ ${WLC_LIBRARIES}
+ ${SD_LIBRARIES})
+
+target_compile_definitions(afbclient
+ PRIVATE
+ _GNU_SOURCE) # XXX should I define this here?!
+
+if(NOT ${CMAKE_BUILD_TYPE} STREQUAL "Release")
+ target_compile_definitions(afbclient
+ PRIVATE
+ _GLIBCXX_DEBUG)
+endif()
+
+target_compile_options(afbclient
+ PRIVATE
+ -Wall -Wextra -Wno-unused-parameter -Wno-comment)
+
+set_target_properties(afbclient
+ PROPERTIES
+ # INTERPROCEDURAL_OPTIMIZATION ON
+ CXX_EXTENSIONS OFF
+ CXX_STANDARD 14
+ CXX_STANDARD_REQUIRED ON)
+
+if (LINK_LIBCXX)
+ set_target_properties(afbclient
+ PROPERTIES
+ LINK_FLAGS "-lc++")
+endif()
+
+if (NOT ${SANITIZER_MODE} STREQUAL "none" AND NOT ${SANITIZER_MODE} STREQUAL "")
+ target_compile_options(afbclient
+ PRIVATE
+ -fsanitize=${SANITIZER_MODE} -g -fno-omit-frame-pointer)
+ set_target_properties(afbclient
+ PROPERTIES
+ LINK_FLAGS "-fsanitize=${SANITIZER_MODE} -g")
+endif()