Warning, /sdk/dferry/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 project(dferry) 0002 0003 cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) 0004 list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) 0005 0006 if (CMAKE_COMPILER_IS_GNUCXX) 0007 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wpedantic -Wextra -Wzero-as-null-pointer-constant") 0008 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-error=unused-result -Wno-error=suggest-override") 0009 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden") 0010 endif() 0011 set(CMAKE_CXX_STANDARD 11) 0012 0013 if (WIN32 AND CMAKE_SYSTEM_VERSION VERSION_LESS 6.0) 0014 message(FATAL_ERROR "Windows Vista or later is required.") 0015 endif() 0016 0017 include(TestBigEndian) 0018 if (BIGENDIAN) 0019 add_definitions(-DBIGENDIAN) 0020 endif() 0021 if (UNIX) 0022 add_definitions(-D__unix__) # help for platforms that don't define this standard macro 0023 endif() 0024 0025 option(DFERRY_BUILD_ANALYZER "Build the dfer-analyzer bus analyzer GUI" TRUE) 0026 option(DFERRY_BUILD_CLIENTLIB "Build (incomplete, experimental) introspection support" FALSE) 0027 0028 include(GNUInstallDirs) 0029 0030 if (WIN32) 0031 # Windows doesn't have an RPATH equivalent, so just make sure that all .dll and .exe files 0032 # are located together, so that the .exes find the .dlls at runtime 0033 set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) 0034 else() 0035 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) 0036 0037 set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}) # add libdfer install dir to rpath 0038 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) # add Qt (etc.) dir to rpath, if necessary 0039 endif() 0040 0041 include_directories(${CMAKE_SOURCE_DIR}/client 0042 ${CMAKE_SOURCE_DIR}/connection 0043 ${CMAKE_SOURCE_DIR}/events 0044 ${CMAKE_SOURCE_DIR}/serialization 0045 ${CMAKE_SOURCE_DIR}/transport 0046 ${CMAKE_SOURCE_DIR}/util) 0047 0048 set(DFER_SOURCES 0049 connection/authclient.cpp 0050 connection/connectaddress.cpp 0051 connection/connection.cpp 0052 connection/iconnectionstatelistener.cpp 0053 connection/imessagereceiver.cpp 0054 connection/inewconnectionlistener.cpp 0055 connection/pendingreply.cpp 0056 connection/server.cpp 0057 events/event.cpp 0058 events/eventdispatcher.cpp 0059 events/foreigneventloopintegrator.cpp 0060 events/ieventpoller.cpp 0061 events/iioeventforwarder.cpp 0062 events/iioeventlistener.cpp 0063 events/iioeventsource.cpp 0064 events/platformtime.cpp 0065 events/timer.cpp 0066 serialization/arguments.cpp 0067 serialization/argumentsreader.cpp 0068 serialization/argumentswriter.cpp 0069 serialization/message.cpp 0070 transport/ipserver.cpp 0071 transport/ipsocket.cpp 0072 transport/ipresolver.cpp 0073 transport/iserver.cpp 0074 transport/itransport.cpp 0075 transport/itransportlistener.cpp 0076 transport/stringtools.cpp 0077 util/error.cpp 0078 util/icompletionlistener.cpp 0079 util/types.cpp) 0080 if (UNIX) 0081 list(APPEND DFER_SOURCES 0082 transport/localserver.cpp 0083 transport/localsocket.cpp) 0084 endif() 0085 0086 set(DFER_PUBLIC_HEADERS 0087 connection/connectaddress.h 0088 connection/connection.h 0089 connection/iconnectionstatelistener.h 0090 connection/imessagereceiver.h 0091 connection/inewconnectionlistener.h 0092 connection/pendingreply.h 0093 connection/server.h 0094 client/introspection.h 0095 events/eventdispatcher.h 0096 events/foreigneventloopintegrator.h 0097 events/timer.h 0098 serialization/message.h 0099 serialization/arguments.h 0100 util/commutex.h 0101 util/error.h 0102 util/export.h 0103 util/icompletionlistener.h 0104 util/types.h 0105 util/valgrind-noop.h) 0106 0107 set(DFER_PRIVATE_HEADERS 0108 connection/authclient.h 0109 events/event.h 0110 events/ieventpoller.h 0111 events/iioeventforwarder.h 0112 events/iioeventlistener.h 0113 events/iioeventsource.h 0114 events/platformtime.h 0115 serialization/basictypeio.h 0116 transport/ipserver.h 0117 transport/ipsocket.h 0118 transport/ipresolver.h 0119 transport/iserver.h 0120 transport/itransport.h 0121 transport/itransportlistener.h 0122 transport/platform.h 0123 transport/stringtools.h) 0124 if (UNIX) 0125 list(APPEND DFER_PRIVATE_HEADERS 0126 transport/localserver.h 0127 transport/localsocket.h) 0128 endif() 0129 if (CMAKE_SYSTEM_NAME STREQUAL "Linux") 0130 list(APPEND DFER_SOURCES events/epolleventpoller.cpp) 0131 list(APPEND DFER_PRIVATE_HEADERS events/epolleventpoller.h) 0132 elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") 0133 list(APPEND DFER_SOURCES events/selecteventpoller_win32.cpp util/winutil.cpp) 0134 list(APPEND DFER_PRIVATE_HEADERS events/selecteventpoller_win32.h util/winutil.h) 0135 elseif(UNIX) 0136 list(APPEND DFER_SOURCES events/selecteventpoller_unix.cpp) 0137 list(APPEND DFER_PRIVATE_HEADERS events/selecteventpoller_unix.h) 0138 else() 0139 message(FATAL_ERROR "This operating system is not supported.") 0140 endif() 0141 0142 set(DFER_HEADERS ${DFER_PUBLIC_HEADERS} ${DFER_PRIVATE_HEADERS}) 0143 0144 add_library(dfer SHARED ${DFER_SOURCES} ${DFER_HEADERS}) 0145 target_include_directories(dfer INTERFACE "$<INSTALL_INTERFACE:include/dferry>") 0146 if (WIN32) 0147 target_link_libraries(dfer PRIVATE ws2_32) 0148 endif() 0149 0150 if (DFER_BUILD_CLIENTLIB) 0151 find_package(LibTinyxml2 REQUIRED) # for the introspection parser in dferclient 0152 include_directories(${LIBTINYXML2_INCLUDE_DIRS}) 0153 endif() 0154 0155 find_package(Valgrind) # for checking homemade multithreading primitives 0156 if (VALGRIND_INCLUDE_DIR) 0157 add_definitions(-DHAVE_VALGRIND) 0158 include_directories(${VALGRIND_INCLUDE_DIR}) 0159 endif() 0160 0161 # for small_vector, optional; small_vector appeared in 1.58 0162 find_package(Boost 1.58) 0163 if (BOOST_FOUND) 0164 add_definitions(-DHAVE_BOOST) 0165 endif() 0166 0167 set(DFERCLIENT_SOURCES 0168 client/introspection.h) 0169 0170 set(DFERCLIENT_HEADERS 0171 client/introspection.cpp) 0172 0173 if (DFER_BUILD_CLIENTLIB) 0174 add_library(dferclient SHARED ${DFERCLIENT_SOURCES} ${DFERCLIENT_HEADERS}) 0175 target_include_directories(dferclient INTERFACE "$<INSTALL_INTERFACE:include/dferry>") 0176 target_link_libraries(dferclient PUBLIC dfer PRIVATE ${LIBTINYXML2_LIBRARIES}) 0177 endif() 0178 0179 install(TARGETS dfer EXPORT dferryExports DESTINATION ${CMAKE_INSTALL_LIBDIR}) 0180 install(FILES ${DFER_PUBLIC_HEADERS} DESTINATION include/dferry) 0181 0182 enable_testing() # need this here to get the "test" target in the toplevel build dir 0183 add_subdirectory(tests) 0184 add_subdirectory(applications) 0185 0186 set(configModuleLocation "lib/cmake/dferry") 0187 0188 install(EXPORT dferryExports DESTINATION "${configModuleLocation}" FILE dferryTargets.cmake) 0189 0190 file(WRITE ${PROJECT_BINARY_DIR}/dferryConfig.cmake 0191 "include(\"\${CMAKE_CURRENT_LIST_DIR}/dferryTargets.cmake\")") 0192 install(FILES "${PROJECT_BINARY_DIR}/dferryConfig.cmake" 0193 DESTINATION "${configModuleLocation}")