GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — rcutils/CMakeLists.txt at master · fossabot/rcutils Expand file tree/ Copy pathCMakeLists.txtMore file actions 324 lines (280 loc) · 9.27 KB / Copy pathCMakeLists.txtFile metadata and controls324 lines (280 loc) · 9.27 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 cmake_minimum_required(VERSION 3.5) project(rcutils) # Default to C11 if(NOT CMAKE_C_STANDARD) set(CMAKE_C_STANDARD 11) endif() # Default to C++14 if(NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 14) endif() find_package(ament_cmake_python REQUIRED) find_package(ament_cmake_ros REQUIRED) ament_python_install_package(${PROJECT_NAME}) include_directories(include) if(NOT WIN32) add_compile_options(-Wall -Wextra -Wpedantic) endif() if(WIN32) set(time_impl_c src/time_win32.c) else() set(time_impl_c src/time_unix.c) endif() set(rcutils_sources src/allocator.c src/char_array.c src/cmdline_parser.c src/error_handling.c src/filesystem.c src/find.c src/format_string.c src/get_env.c src/logging.c src/repl_str.c src/snprintf.c src/split.c src/strdup.c src/string_array.c src/string_map.c src/time.c ${time_impl_c} src/uint8_array.c ) set_source_files_properties( ${rcutils_sources} PROPERTIES language "C") # "watch" template/inputs for changes configure_file( "resource/logging_macros.h.em" "logging_macros.h.em.watch" COPYONLY) configure_file( "rcutils/logging.py" "logging.py.watch" COPYONLY) # generate header with logging macros set(rcutils_module_path ${CMAKE_CURRENT_SOURCE_DIR}) set(python_code "import em" # implicitly added ; between python statements due to CMake list "\ em.invoke( \ [ \ '-o', 'include/rcutils/logging_macros.h', \ '-D', 'rcutils_module_path=\"${rcutils_module_path}\"', \ '${CMAKE_CURRENT_SOURCE_DIR}/resource/logging_macros.h.em' \ ] \ )") string(REPLACE ";" "$<SEMICOLON>" python_code "${python_code}") add_custom_command(OUTPUT include/rcutils/logging_macros.h COMMAND ${CMAKE_COMMAND} -E make_directory "include/rcutils" COMMAND ${PYTHON_EXECUTABLE} ARGS -c "${python_code}" DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/logging_macros.h.em.watch" "${CMAKE_CURRENT_BINARY_DIR}/logging.py.watch" COMMENT "Expanding logging_macros.h.em" VERBATIM ) list(APPEND rcutils_sources include/rcutils/logging_macros.h) include_directories("${CMAKE_CURRENT_BINARY_DIR}/include") add_library( ${PROJECT_NAME} ${rcutils_sources}) # Causes the visibility macros to use dllexport rather than dllimport, # which is appropriate when building the dll but not consuming it. target_compile_definitions(${PROJECT_NAME} PRIVATE "RCUTILS_BUILDING_DLL") # Needed if pthread is used for thread local storage. if(IOS AND IOS_SDK_VERSION LESS 10.0) ament_export_libraries(pthread) endif() install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin) if(BUILD_TESTING) if(NOT WIN32) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") endif() find_package(ament_cmake_gmock REQUIRED) find_package(ament_cmake_gtest REQUIRED) find_package(ament_cmake_pytest REQUIRED) find_package(ament_lint_auto REQUIRED) ament_lint_auto_find_test_dependencies() if(ament_cmake_cppcheck_FOUND) ament_cppcheck( TESTNAME "cppcheck_logging_macros" "${CMAKE_CURRENT_BINARY_DIR}/include/rcutils/logging_macros.h") endif() if(ament_cmake_cpplint_FOUND) ament_cpplint( TESTNAME "cpplint_logging_macros" # the generated code might contain longer lines for templated types MAX_LINE_LENGTH 999 ROOT "${CMAKE_CURRENT_BINARY_DIR}/include" "${CMAKE_CURRENT_BINARY_DIR}/include/rcutils/logging_macros.h") endif() if(ament_cmake_uncrustify_FOUND) ament_uncrustify( TESTNAME "uncrustify_logging_macros" # the generated code might contain longer lines for templated types MAX_LINE_LENGTH 999 "${CMAKE_CURRENT_BINARY_DIR}/include/rcutils/logging_macros.h") endif() find_package(osrf_testing_tools_cpp REQUIRED) get_target_property(memory_tools_test_env_vars osrf_testing_tools_cpp::memory_tools LIBRARY_PRELOAD_ENVIRONMENT_VARIABLE) ament_add_gtest(test_logging test/test_logging.cpp) target_link_libraries(test_logging ${PROJECT_NAME}) add_executable(test_logging_long_messages test/test_logging_long_messages.cpp) target_link_libraries(test_logging_long_messages ${PROJECT_NAME}) ament_add_pytest_test(test_logging_long_messages "test/test_logging_long_messages.py" WORKING_DIRECTORY "$<TARGET_FILE_DIR:test_logging_long_messages>" TIMEOUT 10) ament_add_pytest_test(test_logging_output_format "test/test_logging_output_format.py" WORKING_DIRECTORY "$<TARGET_FILE_DIR:test_logging_long_messages>" TIMEOUT 10) ament_add_gmock(test_logging_macros test/test_logging_macros.cpp) target_link_libraries(test_logging_macros ${PROJECT_NAME}) add_executable(test_logging_macros_c test/test_logging_macros.c) target_link_libraries(test_logging_macros_c ${PROJECT_NAME}) ament_add_test(test_logging_macros_c COMMAND "$<TARGET_FILE:test_logging_macros_c>" GENERATE_RESULT_FOR_RETURN_CODE_ZERO) set(SKIP_TEST_IF_WIN32_OR_AARCH64 "") if(WIN32) # (memory tools doesn't do anything on Windows) set(SKIP_TEST_IF_WIN32_OR_AARCH64 "SKIP_TEST") endif() # TODO(wjwwood): reenable for ARM (aarch64) when fixed in osrf_testing_tools_cpp # see: https://github.com/osrf/osrf_testing_tools_cpp/issues/3 if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") set(SKIP_TEST_IF_WIN32_OR_AARCH64 "SKIP_TEST") endif() macro(rcutils_custom_add_gtest target) ament_add_gtest(${target} ${ARGN}) endmacro() macro(rcutils_custom_add_gmock target) ament_add_gmock(${target} ${ARGN}) endmacro() # Gtests rcutils_custom_add_gtest(test_allocator test/test_allocator.cpp ENV ${memory_tools_test_env_vars} ${SKIP_TEST_IF_WIN32_OR_AARCH64} ) if(TARGET test_allocator) target_link_libraries(test_allocator ${PROJECT_NAME} osrf_testing_tools_cpp::memory_tools) endif() rcutils_custom_add_gtest(test_char_array test/test_char_array.cpp ) if(TARGET test_char_array) target_link_libraries(test_char_array ${PROJECT_NAME}) endif() rcutils_custom_add_gmock(test_error_handling test/test_error_handling.cpp # Append the directory of librcutils so it is found at test time. APPEND_LIBRARY_DIRS "$<TARGET_FILE_DIR:${PROJECT_NAME}>" ENV ${memory_tools_test_env_vars} ) if(TARGET test_error_handling) target_link_libraries(test_error_handling ${PROJECT_NAME} osrf_testing_tools_cpp::memory_tools) endif() rcutils_custom_add_gmock(test_error_handling_helpers test/test_error_handling_helpers.cpp # Append the directory of librcutils so it is found at test time. APPEND_LIBRARY_DIRS "$<TARGET_FILE_DIR:${PROJECT_NAME}>" ENV ${memory_tools_test_env_vars} ) if(TARGET test_error_handling_helpers) target_link_libraries(test_error_handling_helpers osrf_testing_tools_cpp::memory_tools) endif() rcutils_custom_add_gtest(test_split test/test_split.cpp ) if(TARGET test_split) target_link_libraries(test_split ${PROJECT_NAME}) endif() rcutils_custom_add_gtest(test_find test/test_find.cpp ) if(TARGET test_find) target_link_libraries(test_find ${PROJECT_NAME}) endif() rcutils_custom_add_gtest(test_string_array test/test_string_array.cpp ) if(TARGET test_string_array) target_link_libraries(test_string_array ${PROJECT_NAME}) endif() rcutils_custom_add_gtest(test_get_env test/test_get_env.cpp ENV EMPTY_TEST= NORMAL_TEST=foo APPEND_LIBRARY_DIRS "$<TARGET_FILE_DIR:${PROJECT_NAME}>" ) if(TARGET test_get_env) target_link_libraries(test_get_env ${PROJECT_NAME}) endif() rcutils_custom_add_gtest(test_filesystem test/test_filesystem.cpp ) if(TARGET test_filesystem) target_include_directories(test_filesystem PUBLIC ${osrf_testing_tools_cpp_INCLUDE_DIRS}) target_link_libraries(test_filesystem ${PROJECT_NAME}) endif() rcutils_custom_add_gtest(test_strdup test/test_strdup.cpp ) if(TARGET test_strdup) target_link_libraries(test_strdup ${PROJECT_NAME}) endif() rcutils_custom_add_gtest(test_format_string test/test_format_string.cpp ) if(TARGET test_format_string) target_link_libraries(test_format_string ${PROJECT_NAME}) endif() rcutils_custom_add_gtest(test_string_map test/test_string_map.cpp ) if(TARGET test_string_map) target_link_libraries(test_string_map ${PROJECT_NAME}) endif() rcutils_custom_add_gtest(test_isalnum_no_locale test/test_isalnum_no_locale.cpp ) if(TARGET test_isalnum_no_locale) target_link_libraries(test_isalnum_no_locale ${PROJECT_NAME}) endif() rcutils_custom_add_gtest(test_repl_str test/test_repl_str.cpp ) if(TARGET test_repl_str) target_link_libraries(test_repl_str ${PROJECT_NAME}) endif() rcutils_custom_add_gtest(test_time test/test_time.cpp ENV ${memory_tools_test_env_vars}) if(TARGET test_time) target_link_libraries(test_time ${PROJECT_NAME} osrf_testing_tools_cpp::memory_tools) endif() rcutils_custom_add_gtest(test_snprintf test/test_snprintf.cpp ) if(TARGET test_snprintf) target_link_libraries(test_snprintf ${PROJECT_NAME}) endif() rcutils_custom_add_gtest(test_uint8_array test/test_uint8_array.cpp ) if(TARGET test_uint8_array) target_link_libraries(test_uint8_array ${PROJECT_NAME}) endif() endif() ament_export_dependencies(ament_cmake) ament_export_include_directories(include) ament_export_libraries(${PROJECT_NAME}) ament_package() install( DIRECTORY include/ ${CMAKE_CURRENT_BINARY_DIR}/include/ DESTINATION include) |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |