diff --git a/plotjuggler_plugins/ParserLineInflux/line_parser.cpp b/plotjuggler_plugins/ParserLineInflux/line_parser.cpp index 4673789a2..652dd12ee 100644 --- a/plotjuggler_plugins/ParserLineInflux/line_parser.cpp +++ b/plotjuggler_plugins/ParserLineInflux/line_parser.cpp @@ -67,7 +67,8 @@ class MsgParserImpl : public MessageParser if (value.startsWith('"') && value.endsWith('"')) { auto& data = _plot_data.getOrCreateStringSeries(key); - data.pushBack({ ts_sec, StringRef(value.data() + 1, value.size() - 2) }); + data.pushBack(PJ::StringSeries::Point( + ts_sec, StringRef(value.data() + 1, value.size() - 2))); } else if (value == "t" || value == "T" || value == "true" || value == "True" || value == "TRUE") diff --git a/plotjuggler_plugins/ParserROS/CMakeLists.txt b/plotjuggler_plugins/ParserROS/CMakeLists.txt index 382634b6c..3b0da41fe 100644 --- a/plotjuggler_plugins/ParserROS/CMakeLists.txt +++ b/plotjuggler_plugins/ParserROS/CMakeLists.txt @@ -9,13 +9,15 @@ find_package(fastcdr QUIET) add_subdirectory(rosx_introspection) -include_directories( rosx_introspection/include ) - add_library(ParserROS1 SHARED special_messages.cpp ros_parser.cpp ros1_parser.h ) +target_include_directories(rosx_introspection PRIVATE + $ + ) + target_link_libraries(ParserROS1 ${Qt5Widgets_LIBRARIES} rosx_introspection diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/CMakeLists.txt b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/CMakeLists.txt index aa7036fb6..948da0f3c 100644 --- a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/CMakeLists.txt +++ b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/CMakeLists.txt @@ -15,12 +15,7 @@ ############################################################################### # CMake build rules for FastCDR # ############################################################################### -cmake_minimum_required(VERSION 3.10) - -set(IS_TOP_LEVEL TRUE) -if(PROJECT_SOURCE_DIR) - set(IS_TOP_LEVEL FALSE) -endif() +cmake_minimum_required(VERSION 3.16) # Set CMAKE_BUILD_TYPE to Release by default. if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) @@ -31,58 +26,16 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") endif() -############################################################################### -# Version information # -############################################################################### - -#If not set, copy over product version from configure.ac -file(STRINGS - configure.ac - LIB_MAJOR_VERSION_TMP - REGEX "^m4_define\\(\\[?version_major\\]?, *\\[?[0-9]+\\]?\\)" - ) -file(STRINGS - configure.ac - LIB_MINOR_VERSION_TMP - REGEX "^m4_define\\(\\[?version_minor\\]?, *\\[?[0-9]+\\]?\\)" - ) -file(STRINGS - configure.ac - LIB_PATCH_VERSION_TMP - REGEX "^m4_define\\(\\[?version_micro\\]?, *\\[?[0-9]+\\]?\\)" - ) - -string(REGEX REPLACE "m4_define\\(\\[?version_major\\]?, *\\[?([0-9]+)\\]?\\)" - "\\1" - LIB_MAJOR_VERSION - ${LIB_MAJOR_VERSION_TMP} - ) -string(REGEX REPLACE "m4_define\\(\\[?version_minor\\]?, *\\[?([0-9]+)\\]?\\)" - "\\1" - LIB_MINOR_VERSION - ${LIB_MINOR_VERSION_TMP} - ) -string(REGEX REPLACE "m4_define\\(\\[?version_micro\\]?, *\\[?([0-9]+)\\]?\\)" - "\\1" - LIB_PATCH_VERSION - ${LIB_PATCH_VERSION_TMP} - ) - -set(LIB_VERSION_STR "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_PATCH_VERSION}") +# Set BUILD_TESTING to OFF by default. +if(NOT BUILD_TESTING) + message(STATUS "Tests not compiled by default") + set(BUILD_TESTING OFF CACHE BOOL "Enable testing" FORCE) +endif() ############################################################################### # Project # ############################################################################### -if(CMAKE_VERSION VERSION_LESS 3.0) - project(fastcdr C CXX) - set(PROJECT_VERSION_MAJOR "${LIB_MAJOR_VERSION}") - set(PROJECT_VERSION_MINOR "${LIB_MINOR_VERSION}") - set(PROJECT_VERSION_PATCH "${LIB_PATCH_VERSION}") - set(PROJECT_VERSION "${LIB_VERSION_STR}") -else() - cmake_policy(SET CMP0048 NEW) - project(fastcdr VERSION "${LIB_VERSION_STR}" LANGUAGES C CXX) -endif() +project(fastcdr VERSION 2.2.1 LANGUAGES CXX) set(PROJECT_NAME_STYLED "FastCDR") set(PROJECT_NAME_LARGE "Fast CDR") @@ -92,12 +45,19 @@ set(${PROJECT_NAME}_DESCRIPTION "eProsima ${PROJECT_NAME_LARGE} library provides message(STATUS "Configuring ${PROJECT_NAME_LARGE}") message(STATUS "Version: ${PROJECT_VERSION}") -message(STATUS "To change the version modify the file configure.ac") ############################################################################### -# Generation of windows installers. +# CCache on Windows on CI ############################################################################### -option(EPROSIMA_INSTALLER "Activate the creation of a build to create windows installers" OFF) +if (MSVC AND CMAKE_CXX_COMPILER_LAUNCHER STREQUAL "ccache") + foreach(config DEBUG RELWITHDEBINFO) + foreach(lang C CXX) + set(flags_var "CMAKE_${lang}_FLAGS_${config}") + string(REPLACE "/Zi" "/Z7" ${flags_var} "${${flags_var}}") + set(${flags_var} "${${flags_var}}") + endforeach() + endforeach() +endif() ############################################################################### # GCC colors if using CCache @@ -116,22 +76,14 @@ endif() # unless the library was explicitly added as a static library. option(BUILD_SHARED_LIBS "Create shared libraries by default" ON) -############################################################################### -# Load external eProsima projects. -############################################################################### - -option(EPROSIMA_BUILD "Activate internal building" OFF) - -if(EPROSIMA_INSTALLER) - set(EPROSIMA_BUILD ON) -endif() - ############################################################################### # Test system configuration ############################################################################### include(${PROJECT_SOURCE_DIR}/cmake/common/check_configuration.cmake) -check_stdcxx() -check_compile_feature() + +set(FORCE_CXX "11" CACHE STRING "C++ standard fulfillment selection") +check_stdcxx(${FORCE_CXX}) + check_endianness() check_type_sizes() @@ -166,34 +118,25 @@ else() set(DOC_DIR "${DATA_INSTALL_DIR}/doc") endif() set(DOC_INSTALL_DIR ${DOC_DIR} CACHE PATH "Installation directory for documentation") -if(WIN32 AND EPROSIMA_INSTALLER AND IS_TOP_LEVEL) - set(LICENSE_INSTALL_DIR . CACHE PATH "Installation directory for licenses") -else() - set(LICENSE_INSTALL_DIR ${DATA_INSTALL_DIR}/${PROJECT_NAME} CACHE PATH "Installation directory for licenses") -endif() +set(LICENSE_INSTALL_DIR ${DATA_INSTALL_DIR}/${PROJECT_NAME} CACHE PATH "Installation directory for licenses") ############################################################################### # Compile library. ############################################################################### add_subdirectory(src/cpp) -############################################################################### -# Testing options -############################################################################### -option(EPROSIMA_BUILD_TESTS "Activate the building and execution unit tests and integral tests" OFF) - -if(EPROSIMA_BUILD AND NOT EPROSIMA_INSTALLER AND NOT EPROSIMA_INSTALLER_MINION) - set(EPROSIMA_BUILD_TESTS ON) -endif() - ############################################################################### # Testing ############################################################################### -if(EPROSIMA_BUILD_TESTS AND IS_TOP_LEVEL AND NOT EPROSIMA_INSTALLER) - enable_testing() - include(CTest) +enable_testing() +include(CTest) - add_subdirectory(test) +if (BUILD_TESTING) + if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.22) + add_subdirectory(test) + else() + message(INFO "Tests are disabled because the version of CMake is less than 3.22") + endif() endif() ############################################################################### @@ -202,11 +145,7 @@ endif() # Add an option to toggle the generation of the API documentation. option(BUILD_DOCUMENTATION "Use doxygen to create product documentation" OFF) option(CHECK_DOCUMENTATION "Use doxygen to check code documentation" OFF) - -if(EPROSIMA_INSTALLER) - set(BUILD_DOCUMENTATION ON) - set(DOXYGEN_SHOULD_SKIP_THIS_PUBLIC "DOXYGEN_SHOULD_SKIP_THIS_PUBLIC") -endif() +option(GENERATE_PDF_DOC "Use doxygen to generate API Reference PDF" OFF) if(CHECK_DOCUMENTATION) set(BUILD_DOCUMENTATION ON) @@ -254,6 +193,11 @@ if(BUILD_DOCUMENTATION) else() set(USE_DOT YES) endif() + if(GENERATE_PDF_DOC) + set(GENERATE_LATEX YES) + else() + set(GENERATE_LATEX NO) + endif() # Configure the template doxyfile for or specific project configure_file(doxyfile.in ${PROJECT_BINARY_DIR}/doxyfile @ONLY IMMEDIATE) # Add custom target to run doxygen when ever the project is build @@ -264,6 +208,15 @@ if(BUILD_DOCUMENTATION) add_dependencies(doxygen docdirs) + if(GENERATE_PDF_DOC) + add_custom_target(make_pdf ALL + COMMAND "make" "pdf" + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/doxygen/latex + COMMENT "Generating API reference PDF" VERBATIM) + + add_dependencies(make_pdf doxygen) + endif() + ### README html ######################## if(WIN32) @@ -277,26 +230,10 @@ if(BUILD_DOCUMENTATION) configure_file(doc/README.html.in ${README_LOCATION}/README.html @ONLY IMMEDIATE) - ### ReadTheDocs ######################## -# if(NOT CHECK_DOCUMENTATION) -# add_custom_target(readthedocs -# COMMAND "${WGET_EXE}" "https://media.readthedocs.org/htmlzip/eprosima-fast-cdr/v${PROJECT_VERSION}/eprosima-fast-cdr.zip" -# COMMAND "${UNZIP_EXE}" "eprosima-fast-cdr.zip" -d "${PROJECT_BINARY_DIR}/doc/" -# COMMAND ${CMAKE_COMMAND} -E remove_directory "${PROJECT_BINARY_DIR}/doc/manual" -# COMMAND ${CMAKE_COMMAND} -E rename "${PROJECT_BINARY_DIR}/doc/eprosima-fast-cdr-v${PROJECT_VERSION}" "${PROJECT_BINARY_DIR}/doc/manual" -# COMMAND ${CMAKE_COMMAND} -E remove "eprosima-fast-cdr.zip" -# ) -# -# add_dependencies(readthedocs docdirs) -# endif() - add_custom_target(doc ALL COMMENT "Generated project documentation" VERBATIM) add_dependencies(doc doxygen) -# if(NOT CHECK_DOCUMENTATION) -# add_dependencies(doc readthedocs) -# endif() endif() @@ -308,9 +245,6 @@ install(FILES ${PROJECT_SOURCE_DIR}/LICENSE DESTINATION ${LICENSE_INSTALL_DIR} COMPONENT licenses ) -set(CPACK_COMPONENT_LICENSES_HIDDEN 1) - -set(CPACK_COMPONENTS_ALL headers licenses) if(BUILD_DOCUMENTATION) @@ -325,35 +259,10 @@ if(BUILD_DOCUMENTATION) COMPONENT documentation ) -# if(NOT CHECK_DOCUMENTATION) -# install(DIRECTORY ${PROJECT_BINARY_DIR}/doc/manual -# DESTINATION ${DOC_INSTALL_DIR} -# COMPONENT documentation -# ) -# endif() - - ### Documentation component - set(CPACK_COMPONENT_DOCUMENTATION_DISPLAY_NAME "Documentation") - set(CPACK_COMPONENT_DOCUMENTATION_DESCRIPTION "eProsima ${PROJECT_NAME_LARGE} documentation") - - set(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} documentation) -endif() - -if(MSVC OR MSVC_IDE) - if(EPROSIMA_INSTALLER) - set(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} - libraries_i86Win32VS2010 - libraries_x64Win64VS2010 - libraries_i86Win32VS2013 - libraries_x64Win64VS2013 - libraries_i86Win32VS2015 - libraries_x64Win64VS2015 - ) - else() - set(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} libraries_${MSVC_ARCH}) + if(GENERATE_PDF_DOC) + install(FILES "${PROJECT_BINARY_DIR}/doxygen/latex/refman.pdf" + DESTINATION ${DOC_INSTALL_DIR} + RENAME fastcdr-${PROJECT_VERSION}-api-reference.pdf + COMPONENT documentation) endif() -else() - set(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} libraries) endif() - -include(${PROJECT_SOURCE_DIR}/cmake/packaging/eProsimaPackaging.cmake) diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/common/check_configuration.cmake b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/common/check_configuration.cmake index 25c80552c..ac60c5aa1 100644 --- a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/common/check_configuration.cmake +++ b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/common/check_configuration.cmake @@ -12,71 +12,125 @@ # See the License for the specific language governing permissions and # limitations under the License. -macro(check_stdcxx) - # Check C++11 - include(CheckCXXCompilerFlag) - if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG OR - CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR - CMAKE_CXX_COMPILER_ID MATCHES "QCC") - check_cxx_compiler_flag(-std=c++14 SUPPORTS_CXX14) - set(HAVE_CXX14 0) - set(HAVE_CXX1Y 0) - set(HAVE_CXX11 0) - set(HAVE_CXX0X 0) - if(SUPPORTS_CXX14) - add_compile_options($<$:-std=c++14>) - set(HAVE_CXX14 1) - set(HAVE_CXX1Y 1) - set(HAVE_CXX11 1) - set(HAVE_CXX0X 1) - else() - check_cxx_compiler_flag(-std=c++1y SUPPORTS_CXX1Y) - if(SUPPORTS_CXX1Y) - add_compile_options($<$:-std=c++1y>) - set(HAVE_CXX1Y 1) - set(HAVE_CXX11 1) - set(HAVE_CXX0X 1) - else() - check_cxx_compiler_flag(-std=c++11 SUPPORTS_CXX11) - if(SUPPORTS_CXX11) - add_compile_options($<$:-std=c++11>) - set(HAVE_CXX11 1) - set(HAVE_CXX0X 1) - else() - check_cxx_compiler_flag(-std=c++0x SUPPORTS_CXX0X) - if(SUPPORTS_CXX0X) - add_compile_options($<$:-std=c++0x>) - set(HAVE_CXX0X 1) - else() - set(HAVE_CXX0X 0) - endif() - endif() - endif() +# get_set_stdcxx() checks and sets the compiler standard level +# stdversion: the level of standard fullfilment +# stdfeature: the feature name associated with that level +# gcc_flag: the gcc/clang flag for fallback +# cl_flag: the cl flag for fallback +# force: if the user should enforced this standard level or not (FORCE_CXX) +# result: a return variable to check if this level is available + +function(get_set_stdcxx stdversion stdfeature gcc_flag cl_flag force result) + + set(${result} 0 PARENT_SCOPE) + + # check if CMake feature management is available + get_property(CXX_KNOWN_FEATURES GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES) + if((stdfeature IN_LIST CXX_KNOWN_FEATURES) AND NOT ("run_fallback_test" IN_LIST ARGV)) + # CMake is aware let's check if is available + if(force AND (stdfeature IN_LIST CMAKE_CXX_COMPILE_FEATURES)) + # is available report and enforce as commanded + # avoid using CACHE variables to avoid polute projects that use this repo as subdir + set(CMAKE_CXX_STANDARD ${stdversion} PARENT_SCOPE) + set(${result} 1 PARENT_SCOPE) + message(STATUS "Enforced ${stdfeature} CMake feature") + elseif(force) + message(FATAL_ERROR "The specified C++ ${stdfeature} feature is not supported using default compiler.") endif() - elseif(MSVC OR MSVC_IDE) - set(HAVE_CXX11 1) - set(HAVE_CXX0X 1) else() - set(HAVE_CXX11 0) - set(HAVE_CXX0X 0) - endif() -endmacro() + # fallback to the old behaviour + include(CheckCXXCompilerFlag) + + if(gcc_flag AND ( + CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG OR + CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR + CMAKE_CXX_COMPILER_ID MATCHES "QCC")) + # check using gcc/clang flags + check_cxx_compiler_flag(${gcc_flag} SUPPORTS_${stdfeature}) + if(SUPPORTS_${stdfeature} AND force) + add_compile_options($<$:${gcc_flag}>) + set(${result} 1 PARENT_SCOPE) + message(STATUS "Enforced ${gcc_flag} CMake feature") + elseif((NOT SUPPORTS_${stdfeature}) AND force) + message(FATAL_ERROR "Force to support ${stdfeature} but not supported by gnu compiler") + endif() + elseif(cl_flag AND (MSVC OR MSVC_IDE)) + # check using cl flags + check_cxx_compiler_flag(${cl_flag} SUPPORTS_${stdfeature}) + if(SUPPORTS_${stdfeature} AND force) + add_compile_options($<$:${cl_flag}>) + set(${result} 1 PARENT_SCOPE) + message(STATUS "Enforced ${cl_flag} CMake feature") + elseif((NOT SUPPORTS_${stdfeature}) AND force) + message(FATAL_ERROR "Force to support ${stdfeature} but not supported by MSVC") + endif() + elseif(force) + message(WARNING "The specified C++ ${stdfeature} feature is not supported using default compiler.") + endif() -macro(check_compile_feature) - # Check constexpr - list(FIND CMAKE_CXX_COMPILE_FEATURES "cxx_constexpr" CXX_CONSTEXPR_SUPPORTED) - if(${CXX_CONSTEXPR_SUPPORTED} GREATER -1) - set(HAVE_CXX_CONSTEXPR 1) - else() - set(HAVE_CXX_CONSTEXPR 0) endif() -endmacro() + +endfunction() + +function(check_stdcxx enforced_level) + + # Map force values to cmake features + set(cxx_levels 23 20 17 14 1Y 11) + set(cxx_features cxx_std_23 cxx_std_20 cxx_std_17 cxx_std_14 NOTFOUND cxx_std_11) + set(gcc_flags -std=c++23 -std=c++20 -std=c++17 -std=c++14 -std=c++1y -std=c++11) + set(cl_flags /std:c++23 /std:c++20 /std:c++17 /std:c++14 NOTFOUND NOTFOUND) + set(HAVE_CXX HAVE_CXX23 HAVE_CXX20 HAVE_CXX17 HAVE_CXX14 HAVE_CXX1Y HAVE_CXX11) + + # Traverse the collection + while(cxx_levels) + + # pop current values + list(POP_FRONT cxx_levels level) + list(POP_FRONT cxx_features feature) + list(POP_FRONT gcc_flags gcc_flag) + list(POP_FRONT cl_flags cl_flag) + list(POP_FRONT HAVE_CXX preprocessor_flag) + + # check if we must enforce this one + if(enforced_level STREQUAL level) + set(force TRUE) + else() + set(force FALSE) + endif() + + # testing framework awareness + set(test) + if("run_fallback_test" IN_LIST ARGV) + set(test "run_fallback_test") + endif() + + # check + get_set_stdcxx(${level} ${feature} ${gcc_flag} ${cl_flag} ${force} result ${test}) + + if(result) + # we are done, mark all levels below as available + set(${preprocessor_flag} 1 PARENT_SCOPE) + # upload local variable fixed by get_set_stdcxx + set(CMAKE_CXX_STANDARD ${CMAKE_CXX_STANDARD} PARENT_SCOPE) + while(HAVE_CXX) + list(POP_FRONT HAVE_CXX preprocessor_flag) + set(${preprocessor_flag} 1 PARENT_SCOPE) + endwhile() + break() + else() + # If the user doesn't enforce this level the macros are not trustworthy + set(${preprocessor_flag} 0 PARENT_SCOPE) + endif() + + endwhile() + +endfunction() macro(check_type_sizes) include(CheckTypeSize) - check_type_size("long double" TYPE_LONG_DOUBLE) + check_type_size("long double" TYPE_LONG_DOUBLE LANGUAGE CXX) set(FASTCDR_SIZEOF_LONG_DOUBLE ${TYPE_LONG_DOUBLE}) - check_type_size("__float128" TYPE_FLOAT128) + check_type_size("__float128" TYPE_FLOAT128 LANGUAGE CXX) if(HAVE_TYPE_FLOAT128) set(FASTCDR_HAVE_FLOAT128 1) else() @@ -85,10 +139,18 @@ macro(check_type_sizes) endmacro() macro(check_endianness) - # Test endianness - include(TestBigEndian) - test_big_endian(BIG_ENDIAN) - set(FASTCDR_IS_BIG_ENDIAN_TARGET ${BIG_ENDIAN}) + if(CMAKE_CXX_BYTE_ORDER) + if(CMAKE_CXX_BYTE_ORDER STREQUAL "BIG_ENDIAN") + set(FASTCDR_IS_BIG_ENDIAN_TARGET 1) + else() + set(FASTCDR_IS_BIG_ENDIAN_TARGET 0) + endif() + else() + # Test endianness + include(TestBigEndian) + test_big_endian(BIG_ENDIAN) + set(FASTCDR_IS_BIG_ENDIAN_TARGET ${BIG_ENDIAN}) + endif() endmacro() macro(check_msvc_arch) diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/common/eprosima_libraries.cmake b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/common/eprosima_libraries.cmake deleted file mode 100644 index d326e81b4..000000000 --- a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/common/eprosima_libraries.cmake +++ /dev/null @@ -1,99 +0,0 @@ -# Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -# -# 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. - -macro(eprosima_find_package package) - - if(NOT ${package}_FOUND) - - # Parse arguments. - set(options REQUIRED) - set(multiValueArgs OPTIONS) - cmake_parse_arguments(FIND "${options}" "" "${multiValueArgs}" ${ARGN}) - - option(THIRDPARTY "Activate the use of internal thirdparties" OFF) - option(THIRDPARTY_UPDATE "Activate the auto update of internal thirdparties" ON) - - if(EPROSIMA_BUILD) - set(THIRDPARTY ON) - endif() - - option(THIRDPARTY_${package} "Activate the use of internal thirdparty ${package}" OFF) - - if(NOT EPROSIMA_INSTALLER) - find_package(${package} QUIET) - endif() - - if(NOT ${package}_FOUND AND (THIRDPARTY OR THIRDPARTY_${package})) - set(SUBDIRECTORY_EXIST TRUE) - if(THIRDPARTY_UPDATE OR NOT EXISTS "${PROJECT_SOURCE_DIR}/thirdparty/${package}/CMakeLists.txt") - message(STATUS "${package} thirdparty is being updated...") - execute_process( - COMMAND git submodule update --recursive --init "thirdparty/${package}" - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - RESULT_VARIABLE EXECUTE_RESULT - ) - if(NOT EXECUTE_RESULT EQUAL 0) - message(WARNING "Cannot configure Git submodule ${package}") - if(NOT EXISTS "${PROJECT_SOURCE_DIR}/thirdparty/${package}/CMakeLists.txt") - set(SUBDIRECTORY_EXIST FALSE) - endif() - endif() - endif() - - if(SUBDIRECTORY_EXIST) - foreach(opt_ ${FIND_OPTIONS}) - set(${opt_} ON) - endforeach() - add_subdirectory(${PROJECT_SOURCE_DIR}/thirdparty/${package}) - set(${package}_FOUND TRUE) - if(NOT IS_TOP_LEVEL) - set(${package}_FOUND TRUE PARENT_SCOPE) - endif() - endif() - endif() - - if(${package}_FOUND) - message(STATUS "${package} library found...") - elseif(${FIND_REQUIRED}) - message(FATAL_ERROR "${package} library not found...") - else() - message(STATUS "${package} library not found...") - endif() - endif() -endmacro() - -macro(eprosima_find_thirdparty package thirdparty_name) - if(NOT (EPROSIMA_INSTALLER AND (MSVC OR MSVC_IDE))) - - option(THIRDPARTY_${package} "Activate the use of internal thirdparty ${package}" OFF) - - if(THIRDPARTY OR THIRDPARTY_${package}) - execute_process( - COMMAND git submodule update --recursive --init "thirdparty/${thirdparty_name}" - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - RESULT_VARIABLE EXECUTE_RESULT - ) - - if(EXECUTE_RESULT EQUAL 0) - else() - message(FATAL_ERROR "Cannot configure Git submodule ${package}") - endif() - set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${PROJECT_SOURCE_DIR}/thirdparty/${thirdparty_name}) - set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${PROJECT_SOURCE_DIR}/thirdparty/${thirdparty_name}/${thirdparty_name}) - endif() - - find_package(${package} REQUIRED QUIET) - - endif() -endmacro() diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/common/find_or_add_gtest.cmake b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/common/find_or_add_gtest.cmake new file mode 100644 index 000000000..f466bc85a --- /dev/null +++ b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/common/find_or_add_gtest.cmake @@ -0,0 +1,40 @@ +# Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). +# +# 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. + +macro(find_or_add_gtest) + # Check if building on an ament context, i.e. ROS 2 + # Thanks to https://github.com/facontidavide/PlotJuggler/blob/main/CMakeLists.txt#L66 + find_package(ament_cmake QUIET) + + # This is a ROS 2 build + if(ament_cmake_FOUND) + # Find all GTest vendor required packages + find_package(ament_cmake REQUIRED) + find_package(gtest_vendor REQUIRED) + find_package(ament_cmake_gtest REQUIRED) + + # Find GTest + ament_find_gtest() + + # Add aliases for GTest libraries so we can use them as targets independently of the context + add_library(GTest::gtest ALIAS gtest) + add_library(GTest::gtest_main ALIAS gtest_main) + target_link_libraries(gtest_main gtest) + + # This is a non-ROS 2 build + else() + # Find GTest normally + find_package(GTest CONFIG REQUIRED) + endif() +endmacro() diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/common/gtest.cmake b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/common/gtest.cmake deleted file mode 100644 index eabccb6c4..000000000 --- a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/common/gtest.cmake +++ /dev/null @@ -1,84 +0,0 @@ -# Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -# -# 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. - -option(GTEST_INDIVIDUAL "Activate the execution of GTest tests" OFF) - -macro(add_gtest test) - # Parse arguments - set(multiValueArgs SOURCES ENVIRONMENTS DEPENDENCIES) - cmake_parse_arguments(GTEST "" "" "${multiValueArgs}" ${ARGN}) - - if(GTEST_INDIVIDUAL) - if(WIN32) - set(WIN_PATH "$ENV{PATH}") - get_target_property(LINK_LIBRARIES_ ${test} LINK_LIBRARIES) - if(NOT "${LINK_LIBRARIES_}" STREQUAL "LINK_LIBRARIES_-NOTFOUND") - foreach(LIBRARY_LINKED ${LINK_LIBRARIES_}) - if(TARGET ${LIBRARY_LINKED}) - set(WIN_PATH "$;${WIN_PATH}") - endif() - endforeach() - endif() - foreach(DEP ${GTEST_DEPENDENCIES}) - set(WIN_PATH "$;${WIN_PATH}") - endforeach() - string(REPLACE ";" "\\;" WIN_PATH "${WIN_PATH}") - endif() - - foreach(GTEST_SOURCE_FILE ${GTEST_SOURCES}) - file(STRINGS ${GTEST_SOURCE_FILE} GTEST_NAMES REGEX ^TEST) - foreach(GTEST_NAME ${GTEST_NAMES}) - string(REGEX REPLACE ["\) \(,"] ";" GTEST_NAME ${GTEST_NAME}) - list(GET GTEST_NAME 1 GTEST_GROUP_NAME) - list(GET GTEST_NAME 3 GTEST_NAME) - add_test(NAME ${GTEST_GROUP_NAME}.${GTEST_NAME} - COMMAND ${test} - --gtest_filter=${GTEST_GROUP_NAME}.${GTEST_NAME}) - - # Add environment - if(WIN32) - set_property(TEST ${GTEST_GROUP_NAME}.${GTEST_NAME} APPEND PROPERTY ENVIRONMENT "PATH=${WIN_PATH}") - endif() - - foreach(property ${GTEST_ENVIRONMENTS}) - set_property(TEST ${GTEST_GROUP_NAME}.${GTEST_NAME} APPEND PROPERTY ENVIRONMENT "${property}") - endforeach() - endforeach() - endforeach() - else() - add_test(NAME ${test} COMMAND ${test}) - - # Add environment - if(WIN32) - set(WIN_PATH "$ENV{PATH}") - get_target_property(LINK_LIBRARIES_ ${test} LINK_LIBRARIES) - if(NOT "${LINK_LIBRARIES_}" STREQUAL "LINK_LIBRARIES_-NOTFOUND") - foreach(LIBRARY_LINKED ${LINK_LIBRARIES_}) - if(TARGET ${LIBRARY_LINKED}) - set(WIN_PATH "$;${WIN_PATH}") - endif() - endforeach() - endif() - foreach(DEP ${GTEST_DEPENDENCIES}) - set(WIN_PATH "$;${WIN_PATH}") - endforeach() - string(REPLACE ";" "\\;" WIN_PATH "${WIN_PATH}") - set_property(TEST ${test} APPEND PROPERTY ENVIRONMENT "PATH=${WIN_PATH}") - endif() - - foreach(property ${GTEST_ENVIRONMENTS}) - set_property(TEST ${test} APPEND PROPERTY ENVIRONMENT "${property}") - endforeach() - endif() -endmacro() diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/dev/generate_msvc_libraries.cmake b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/dev/generate_msvc_libraries.cmake deleted file mode 100644 index c0d7eb484..000000000 --- a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/dev/generate_msvc_libraries.cmake +++ /dev/null @@ -1,83 +0,0 @@ -# Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -# -# 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. - -macro(generate_msvc_libraries platform) - string(SUBSTRING "${platform}" 0 8 arch_) - string(SUBSTRING "${platform}" 8 -1 vstool_) - string(COMPARE EQUAL "${arch_}" "x64Win64" IS_X64) - string(COMPARE EQUAL "${vstool_}" "VS2013" IS_VS2013) - string(COMPARE EQUAL "${vstool_}" "VS2015" IS_VS2015) - string(COMPARE EQUAL "${vstool_}" "VS2017" IS_VS2017) - string(SUBSTRING "${CMAKE_GENERATOR}" 0 21 generator_) - - if(IS_X64) - set(generator_ "${generator_} Win64") - endif() - - if(IS_VS2013) - set(toolset_ "v120") - elseif(IS_VS2015) - set(toolset_ "v140") - elseif(IS_VS2017) - set(toolset_ "v141") - else() - message(FATAL_ERROR "Lexical error defining platform. Trying to use platform \"${platform}\"") - endif() - - add_custom_target(${PROJECT_NAME}_${platform}_dir - COMMAND ${CMAKE_COMMAND} -E make_directory "${PROJECT_BINARY_DIR}/eprosima_installer/${platform}" - ) - - add_custom_target(${PROJECT_NAME}_${platform}_dir_static - COMMAND ${CMAKE_COMMAND} -E make_directory "${PROJECT_BINARY_DIR}/eprosima_installer/${platform}_static") - - add_custom_target(${PROJECT_NAME}_${platform} ALL - COMMAND ${CMAKE_COMMAND} -G "${generator_}" -T "${toolset_}" -DEPROSIMA_BUILD=ON -DEPROSIMA_INSTALLER_MINION=ON -DCMAKE_INSTALL_PREFIX:PATH=${PROJECT_BINARY_DIR}/eprosima_installer/${platform}/install ${PROJECT_SOURCE_DIR} - COMMAND ${CMAKE_COMMAND} --build . --target install --config Release - COMMAND ${CMAKE_COMMAND} --build . --target install --config Debug - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/eprosima_installer/${platform} - ) - - add_custom_target(${PROJECT_NAME}_${platform}_static ALL - COMMAND ${CMAKE_COMMAND} -G "${generator_}" -T "${toolset_}" -DBUILD_SHARED_LIBS=OFF -DEPROSIMA_BUILD=ON -DEPROSIMA_INSTALLER_MINION=ON -DCMAKE_INSTALL_PREFIX:PATH=${PROJECT_BINARY_DIR}/eprosima_installer/${platform}/install ${PROJECT_SOURCE_DIR} - COMMAND ${CMAKE_COMMAND} --build . --target install --config Release - COMMAND ${CMAKE_COMMAND} --build . --target install --config Debug - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/eprosima_installer/${platform}_static - ) - - add_dependencies(${PROJECT_NAME}_${platform} ${PROJECT_NAME}_${platform}_dir) - add_dependencies(${PROJECT_NAME}_${platform}_static ${PROJECT_NAME}_${platform}_dir_static) -endmacro() - -macro(install_msvc_libraries platform) - install(DIRECTORY ${PROJECT_BINARY_DIR}/eprosima_installer/${platform}/install/${BIN_INSTALL_DIR}/ - DESTINATION ${BIN_INSTALL_DIR} - COMPONENT libraries_${platform} - ) - - install(DIRECTORY ${PROJECT_BINARY_DIR}/eprosima_installer/${platform}/install/${LIB_INSTALL_DIR}/ - DESTINATION ${LIB_INSTALL_DIR} - COMPONENT libraries_${platform} - ) - - install(DIRECTORY ${PROJECT_BINARY_DIR}/eprosima_installer/${platform}/install/${DATA_INSTALL_DIR}/ - DESTINATION ${DATA_INSTALL_DIR} - COMPONENT cmake - ) - - string(TOUPPER "${platform}" ${platform}_UPPER) - set(CPACK_COMPONENT_LIBRARIES_${${platform}_UPPER}_DISPLAY_NAME "${platform}" PARENT_SCOPE) - set(CPACK_COMPONENT_LIBRARIES_${${platform}_UPPER}_DESCRIPTION "eProsima ${PROJECT_NAME_LARGE} libraries for platform ${platform}" PARENT_SCOPE) - set(CPACK_COMPONENT_LIBRARIES_${${platform}_UPPER}_GROUP "Libraries" PARENT_SCOPE) -endmacro() diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/dev/set_sources.cmake b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/dev/set_sources.cmake deleted file mode 100644 index 5702aa5cc..000000000 --- a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/dev/set_sources.cmake +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -# -# 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. - -macro(set_sources) - set(${PROJECT_NAME}_SOURCES - ${ARGN} - ) - - set_property(GLOBAL PROPERTY ${PROJECT_NAME}_SOURCES_PROPERTY ${${PROJECT_NAME}_SOURCES}) -endmacro() - -macro(set_public_headers_directory abs_directory rel_directory) - - install(DIRECTORY ${abs_directory}/${rel_directory} - ${ARGN} - FILES_MATCHING - PATTERN "*.h" - PATTERN "*.hpp" - ) - - get_property(${PROJECT_NAME}_PUBLIC_HEADERS_DIRECTORIES GLOBAL PROPERTY ${PROJECT_NAME}_PUBLIC_HEADERS_DIRECTORIES_PROPERTY) - set(${PROJECT_NAME}_PUBLIC_HEADERS_DIRECTORIES ${${PROJECT_NAME}_PUBLIC_HEADERS_DIRECTORIES} ${abs_directory}) - set_property(GLOBAL PROPERTY ${PROJECT_NAME}_PUBLIC_HEADERS_DIRECTORIES_PROPERTY ${${PROJECT_NAME}_PUBLIC_HEADERS_DIRECTORIES}) - -endmacro() - -macro(set_public_header abs_directory rel_directory file) - install(FILES ${abs_directory}/${rel_directory}/${file} - ${ARGN} - ) - - get_property(${PROJECT_NAME}_PUBLIC_HEADERS_FILES GLOBAL PROPERTY ${PROJECT_NAME}_PUBLIC_HEADERS_FILES_PROPERTY) - set(${PROJECT_NAME}_PUBLIC_HEADERS_FILES ${${PROJECT_NAME}_PUBLIC_HEADERS_FILES} ${rel_directory}/${file}) - set_property(GLOBAL PROPERTY ${PROJECT_NAME}_PUBLIC_HEADERS_FILES_PROPERTY ${${PROJECT_NAME}_PUBLIC_HEADERS_FILES}) -endmacro() diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/Config.cmake.in b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/Config.cmake.in index f5ff8b058..510075a5d 100644 --- a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/Config.cmake.in +++ b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/Config.cmake.in @@ -22,12 +22,58 @@ endif() set_and_check(@PROJECT_NAME@_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") set_and_check(@PROJECT_NAME@_LIB_DIR "@PACKAGE_LIB_INSTALL_DIR@") -if(FASTDDS_STATIC) - include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-static-targets.cmake) -else() - include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-dynamic-targets.cmake OPTIONAL RESULT_VARIABLE DYNAMIC_TARGET_FILE) - # fallback to static linking if dynamic target is missing - if( NOT DYNAMIC_TARGET_FILE ) - include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-static-targets.cmake) - endif() -endif() +set(fastcdr_known_comps static shared) +set(fastcdr_comp_static NO) +set(fastcdr_comp_shared NO) +foreach (fastcdr_comp IN LISTS ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS) + if (fastcdr_comp IN_LIST fastcdr_known_comps) + set(fastcdr_comp_${fastcdr_comp} YES) + else () + set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE + "fastcdr does not recognize component `${fastcdr_comp}`.") + set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE) + return() + endif () +endforeach () + +if (fastcdr_comp_static AND fastcdr_comp_shared) + set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE + "fastcdr `static` and `shared` components are mutually exclusive.") + set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE) + return() +endif () + +set(fastcdr_static_targets "${CMAKE_CURRENT_LIST_DIR}/fastcdr-static-targets.cmake") +set(fastcdr_shared_targets "${CMAKE_CURRENT_LIST_DIR}/fastcdr-shared-targets.cmake") + +macro(fastcdr_load_targets type) + if (NOT EXISTS "${fastcdr_${type}_targets}") + set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE + "fastcdr `${type}` libraries were requested but not found.") + set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE) + return() + endif () + include("${fastcdr_${type}_targets}") +endmacro() + +if (fastcdr_comp_static) + fastcdr_load_targets(static) +elseif (fastcdr_comp_shared) + fastcdr_load_targets(shared) +elseif (DEFINED fastcdr_SHARED_LIBS AND fastcdr_SHARED_LIBS) + fastcdr_load_targets(shared) +elseif (DEFINED fastcdr_SHARED_LIBS AND NOT fastcdr_SHARED_LIBS) + fastcdr_load_targets(static) +elseif (BUILD_SHARED_LIBS) + if (EXISTS "${fastcdr_shared_targets}") + fastcdr_load_targets(shared) + else () + fastcdr_load_targets(static) + endif () +else () + if (EXISTS "${fastcdr_static_targets}") + fastcdr_load_targets(static) + else () + fastcdr_load_targets(shared) + endif () +endif () diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/eProsimaPackaging.cmake b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/eProsimaPackaging.cmake deleted file mode 100644 index 39880bcdc..000000000 --- a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/eProsimaPackaging.cmake +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -# -# 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. - -############################################################################### -# Set common CPACK variables. -############################################################################### - -set(CPACK_PACKAGE_NAME ${PROJECT_NAME}) - -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${CPACK_PACKAGE_NAME} - ${${PROJECT_NAME}_DESCRIPTION_SUMMARY}") - -set(CPACK_PACKAGE_DESCRIPTION "${${PROJECT_NAME}_DESCRIPTION}") - -set(CPACK_PACKAGE_VENDOR "eProsima") -set(CPACK_PACKAGE_CONTACT "eProsima Support ") - -set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) -set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) -set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) -set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) - -set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") - -set(CPACK_COMPONENT_CMAKE_HIDDEN 1) -set(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} cmake) - -############################################################################### -# Platform and architecture dependant -############################################################################### -if(WIN32) - set(CPACK_GENERATOR NSIS) - - configure_file(${PROJECT_SOURCE_DIR}/cmake/packaging/windows/WindowsPackaging.cmake.in ${PROJECT_BINARY_DIR}/cmake/packaging/windows/WindowsPackaging.cmake @ONLY) - configure_file(${PROJECT_SOURCE_DIR}/cmake/packaging/windows/NSISPackaging.cmake.in ${PROJECT_BINARY_DIR}/cmake/packaging/windows/NSISPackaging.cmake @ONLY) - - # Update CMAKE_MODULE_PATH to find NSIS.template.in - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/packaging/windows") - - # Set cpack project config file. - set(CPACK_PROJECT_CONFIG_FILE ${PROJECT_BINARY_DIR}/cmake/packaging/windows/WindowsPackaging.cmake) -elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - set(CPACK_GENERATOR TGZ) - set(CPACK_SOURCE_GENERATOR TGZ) - - # Prepare specific cmake scripts - configure_file(${PROJECT_SOURCE_DIR}/cmake/packaging/linux/LinuxPackaging.cmake.in ${PROJECT_BINARY_DIR}/cmake/packaging/linux/LinuxPackaging.cmake @ONLY) - configure_file(${PROJECT_SOURCE_DIR}/cmake/packaging/linux/AutotoolsPackaging.cmake.in ${PROJECT_BINARY_DIR}/cmake/packaging/linux/AutotoolsPackaging.cmake @ONLY) - - # Prepare scripts for autotools - include(${PROJECT_SOURCE_DIR}/cmake/packaging/linux/autotools_generator_utility.cmake) - generate_autotools_generator_script() - - # Set cpack project config file. - set(CPACK_PROJECT_CONFIG_FILE ${PROJECT_BINARY_DIR}/cmake/packaging/linux/LinuxPackaging.cmake) -endif() - -include(CPack) \ No newline at end of file diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/linux/AutotoolsPackaging.cmake.in b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/linux/AutotoolsPackaging.cmake.in deleted file mode 100644 index a4b23c5e5..000000000 --- a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/linux/AutotoolsPackaging.cmake.in +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -# -# 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. - -# Copy configure.ac -file(INSTALL @PROJECT_SOURCE_DIR@/configure.ac - DESTINATION @PROJECT_BINARY_DIR@/autotools - ) - -# Copy m4 diretory -file(INSTALL @PROJECT_SOURCE_DIR@/m4 - DESTINATION @PROJECT_BINARY_DIR@/autotools - ) - -# Create include/@PROJECT_NAME@ -file(MAKE_DIRECTORY @PROJECT_BINARY_DIR@/autotools/include/@PROJECT_NAME@) - -# Run autoreconf -execute_process(COMMAND autoreconf -fi @PROJECT_BINARY_DIR@/autotools - RESULT_VARIABLE EXECUTE_RESULT) - -if(NOT EXECUTE_RESULT EQUAL 0) - message(FATAL_ERROR "Failed the execution of autoreconf") -endif() - -# Copy include/@PROJECT_NAME@/config.h.in -file(INSTALL @PROJECT_SOURCE_DIR@/include/@PROJECT_NAME@/config.h.in - DESTINATION @PROJECT_BINARY_DIR@/autotools/include/@PROJECT_NAME@ - ) - -# Copy licenses -file(INSTALL @PROJECT_SOURCE_DIR@/LICENSE - DESTINATION @PROJECT_BINARY_DIR@/autotools - ) diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/linux/LinuxPackaging.cmake.in b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/linux/LinuxPackaging.cmake.in deleted file mode 100644 index 514b5d1c7..000000000 --- a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/linux/LinuxPackaging.cmake.in +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -# -# 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. - -set(PROJECT_NAME @PROJECT_NAME@) -set(PROJECT_NAME_STYLED @PROJECT_NAME_STYLED@) -set(PROJECT_NAME_UPPER @PROJECT_NAME_UPPER@) -set(PROJECT_VERSION_AUTOTOOLS @PROJECT_VERSION_MAJOR@:@PROJECT_VERSION_MINOR@:@PROJECT_VERSION_PATCH@) - -if(${CPACK_GENERATOR} STREQUAL "TGZ" ) - if(${CPACK_TOPLEVEL_TAG} STREQUAL "Linux") - # Define name of the TGZ file - set(CPACK_PACKAGE_FILE_NAME eProsima_${PROJECT_NAME_STYLED}-@PROJECT_VERSION@-Linux) - set(CPACK_COMPONENTS_ALL headers sources) - set(CPACK_ARCHIVE_COMPONENT_INSTALL ON) - set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON) - - # Include to prepare Makefiles - include(@PROJECT_BINARY_DIR@/cmake/packaging/linux/autotools_generator.cmake) - - # Prepare Makefile.am for autotools - configure_file(@PROJECT_SOURCE_DIR@/Makefile.am.in @PROJECT_BINARY_DIR@/autotools/Makefile.am) - - # Prepare src/cpp/Makefile.am for autotools - generate_sources_for_autotools() - configure_file(@PROJECT_SOURCE_DIR@/src/cpp/Makefile.am.in @PROJECT_BINARY_DIR@/autotools/src/cpp/Makefile.am) - - # Prepare include/Makefile.am for autotools - generate_public_headers_for_autotools() - configure_file(@PROJECT_SOURCE_DIR@/include/Makefile.am.in @PROJECT_BINARY_DIR@/autotools/include/Makefile.am) - - # Define cmake script to copy autotools files. - set(CPACK_INSTALL_SCRIPT "@PROJECT_BINARY_DIR@/cmake/packaging/linux/AutotoolsPackaging.cmake") - endif() -endif() diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/linux/autotools_generator.cmake.in b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/linux/autotools_generator.cmake.in deleted file mode 100644 index 938d08195..000000000 --- a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/linux/autotools_generator.cmake.in +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -# -# 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. - -macro(generate_sources_for_autotools) - set(@PROJECT_NAME@_SOURCES_TMP @@PROJECT_NAME@_SOURCES@) - set(@PROJECT_NAME@_SOURCES_AUTOTOOLS "") - foreach(@PROJECT_NAME@_SOURCE ${@PROJECT_NAME@_SOURCES_TMP}) - set(@PROJECT_NAME@_SOURCES_AUTOTOOLS "${@PROJECT_NAME@_SOURCES_AUTOTOOLS} ${@PROJECT_NAME@_SOURCE}") - endforeach() -endmacro() - -macro(generate_public_headers_for_autotools) - set(@PROJECT_NAME@_PUBLIC_HEADERS_DIRECTORIES_TMP @@PROJECT_NAME@_PUBLIC_HEADERS_DIRECTORIES@) - set(@PROJECT_NAME@_PUBLIC_HEADERS_AUTOTOOLS "") - foreach(directory ${@PROJECT_NAME@_PUBLIC_HEADERS_DIRECTORIES_TMP}) - file(GLOB_RECURSE @PROJECT_NAME@_PUBLIC_HEADERS_TMP RELATIVE ${directory} ${directory}/*.h) - foreach(@PROJECT_NAME@_PUBLIC_HEADER ${@PROJECT_NAME@_PUBLIC_HEADERS_TMP}) - set(@PROJECT_NAME@_PUBLIC_HEADERS_AUTOTOOLS "${@PROJECT_NAME@_PUBLIC_HEADERS_AUTOTOOLS} ${@PROJECT_NAME@_PUBLIC_HEADER}") - endforeach() - endforeach() - - set(@PROJECT_NAME@_PUBLIC_HEADERS_FILES_TMP @@PROJECT_NAME@_PUBLIC_HEADERS_FILES@) - foreach(file ${@PROJECT_NAME@_PUBLIC_HEADERS_FILES_TMP}) - set(@PROJECT_NAME@_PUBLIC_HEADERS_AUTOTOOLS "${@PROJECT_NAME@_PUBLIC_HEADERS_AUTOTOOLS} ${file}") - endforeach() -endmacro() - diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/linux/autotools_generator_utility.cmake b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/linux/autotools_generator_utility.cmake deleted file mode 100644 index ddfd30f8c..000000000 --- a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/linux/autotools_generator_utility.cmake +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -# -# 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. - -macro(generate_autotools_generator_script) - get_property(${PROJECT_NAME}_SOURCES GLOBAL PROPERTY ${PROJECT_NAME}_SOURCES_PROPERTY) - get_property(${PROJECT_NAME}_PUBLIC_HEADERS_DIRECTORIES GLOBAL PROPERTY ${PROJECT_NAME}_PUBLIC_HEADERS_DIRECTORIES_PROPERTY) - get_property(${PROJECT_NAME}_PUBLIC_HEADERS_FILES GLOBAL PROPERTY ${PROJECT_NAME}_PUBLIC_HEADERS_FILES_PROPERTY) - configure_file(${PROJECT_SOURCE_DIR}/cmake/packaging/linux/autotools_generator.cmake.in ${PROJECT_BINARY_DIR}/cmake/packaging/linux/autotools_generator.cmake.in @ONLY) - configure_file(${PROJECT_BINARY_DIR}/cmake/packaging/linux/autotools_generator.cmake.in ${PROJECT_BINARY_DIR}/cmake/packaging/linux/autotools_generator.cmake @ONLY) -endmacro() diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/windows/EnvVarPage.nsh.in b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/windows/EnvVarPage.nsh.in deleted file mode 100644 index b9411f245..000000000 --- a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/windows/EnvVarPage.nsh.in +++ /dev/null @@ -1,427 +0,0 @@ -# Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -# -# 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 nsDialogs.nsh -!include LogicLib.nsh -!include EnvVarUpdate.nsh - -Var Dialog -Var FirstTime - -Var Label - -Var CheckboxHOME -Var CheckboxHOME_State - -Var CheckboxRadioButtons -Var CheckboxRadioButtons_State - -Var GroupBoxRadioButton - -Var RadioButtonX64_VS2010 -Var RadioButtonX64_VS2010_State - -Var RadioButtonI86_VS2010 -Var RadioButtonI86_VS2010_State - -Var RadioButtonX64_VS2013 -Var RadioButtonX64_VS2013_State - -Var RadioButtonI86_VS2013 -Var RadioButtonI86_VS2013_State - -Var RadioButtonX64_VS2015 -Var RadioButtonX64_VS2015_State - -Var RadioButtonI86_VS2015 -Var RadioButtonI86_VS2015_State - -LangString PAGE_TITLE ${LANG_ENGLISH} "Environment variables setting" -LangString PAGE_SUBTITLE ${LANG_ENGLISH} "Choose which environment variables you want to set." - -Function VariablesEntornoPage - - !insertmacro MUI_HEADER_TEXT $(PAGE_TITLE) $(PAGE_SUBTITLE) - - nsDialogs::Create 1018 - Pop $Dialog - - ${If} $Dialog == error - Abort - ${EndIf} - - ### Creaci�n de los elementos gr�ficos - ${NSD_CreateLabel} 0 0 100% 20u "Check the environment variables you want to set and uncheck the environment variables you don't want to set. Click Next to continue." - Pop $Label - - ${NSD_CreateCheckbox} 10 20u 100% 12u "Set the @PROJECT_NAME_UPPER@HOME environment variable." - Pop $CheckboxHOME - ${If} $CheckboxHOME_State == ${BST_CHECKED} - ${NSD_Check} $CheckboxHOME - ${EndIf} - - ${NSD_CreateCheckbox} 10 32u 100% 12u "&Add to the PATH the location of eProsima @PROJECT_NAME_LARGE@ libraries." - Pop $CheckboxRadioButtons - - ### La primera vez que lanzamos el instalador, el checkbox de HOME - ### y el de SCRIPTS deben estar marcados. - StrCmp $FirstTime "FirstTime" jumpfirsttime 0 ### Si son iguales las cadenas, GOTO +5, si no, GOTO 0 - ${NSD_Check} $CheckboxHOME - ${NSD_Check} $CheckboxRadioButtons - ${NSD_GetState} $CheckboxHOME $CheckboxHOME_State - ${NSD_GetState} $CheckboxRadioButtons $CheckboxRadioButtons_State - StrCpy $FirstTime "FirstTime" - - jumpfirsttime: - - Call CheckRadioButtons - - !define lib_radio_x 30 - !define lib_radio_height 15u - !define lib_radio_y_0 52u - !define lib_radio_y_1 67u - !define lib_radio_y_2 82u - !define lib_radio_y_3 97u - !define lib_radio_y_4 112u - !define lib_radio_y_5 127u - - ; GroupBox 1 - ${NSD_CreateGroupBox} 20 44u 90% 97u "Select the configuration:" - Pop $GroupBoxRadioButton - #Pop $GB_Ar1 - - ${If} ${RunningX64} - ${NSD_CreateRadioButton} ${lib_radio_x} ${lib_radio_y_0} 50% ${lib_radio_height} "&x64 VS2015 platforms." - Pop $RadioButtonX64_VS2015 - ### Fijamos los callbacks para cuando se haga click en los RadioButtones - ${NSD_OnClick} $RadioButtonX64_VS2015 ClickX64_VS2015 - - ${NSD_CreateRadioButton} ${lib_radio_x} ${lib_radio_y_1} 50% ${lib_radio_height} "&x64 VS2013 platforms." - Pop $RadioButtonX64_VS2013 - ### Fijamos los callbacks para cuando se haga click en los RadioButtones - ${NSD_OnClick} $RadioButtonX64_VS2013 ClickX64_VS2013 - - ${NSD_CreateRadioButton} ${lib_radio_x} ${lib_radio_y_2} 50% ${lib_radio_height} "&x64 VS2010 platforms." - Pop $RadioButtonX64_VS2010 - ### Fijamos los callbacks para cuando se haga click en los RadioButtones - ${NSD_OnClick} $RadioButtonX64_VS2010 ClickX64_VS2010 - - ${NSD_CreateRadioButton} ${lib_radio_x} ${lib_radio_y_3} 50% ${lib_radio_height} "&i86 VS2015 platforms." - Pop $RadioButtonI86_VS2015 - ${NSD_CreateRadioButton} ${lib_radio_x} ${lib_radio_y_4} 50% ${lib_radio_height} "&i86 VS2013 platforms." - Pop $RadioButtonI86_VS2013 - ${NSD_CreateRadioButton} ${lib_radio_x} ${lib_radio_y_5} 50% ${lib_radio_height} "&i86 VS2010 platforms." - Pop $RadioButtonI86_VS2010 - - Call EnableRadioX64 - Call EnableRadioI86 - ${Else} - ${NSD_CreateRadioButton} ${lib_radio_x} ${lib_radio_y_0} 50% ${lib_radio_height} "&i86 VS2015 platforms." - Pop $RadioButtonI86_VS2015 - ${NSD_CreateRadioButton} ${lib_radio_x} ${lib_radio_y_1} 50% ${lib_radio_height} "&i86 VS2013 platforms." - Pop $RadioButtonI86_VS2013 - ${NSD_CreateRadioButton} ${lib_radio_x} ${lib_radio_y_2} 50% ${lib_radio_height} "&i86 VS2010 platforms." - Pop $RadioButtonI86_VS2010 - - Call EnableRadioI86 - ${EndIf} - - ### Fijamos los callbacks para cuando se haga click en los CheckBoxes - ${NSD_OnClick} $CheckboxHOME ClickHOME - ${NSD_OnClick} $CheckboxRadioButtons ClickCheckboxRadioButtons - ${NSD_OnClick} $RadioButtonI86_VS2015 ClickI86_VS2015 - ${NSD_OnClick} $RadioButtonI86_VS2013 ClickI86_VS2013 - ${NSD_OnClick} $RadioButtonI86_VS2010 ClickI86_VS2010 - - Call SelectDefaultBestConfiguration - - nsDialogs::Show -FunctionEnd - -### Callback invocado cuando se pulsa el CheckBox HOME -### Guardamos el estado en la variable _state -Function ClickHOME - ${NSD_GetState} $CheckboxHOME $CheckboxHOME_State -FunctionEnd - -Function ClickCheckboxRadioButtons - ${NSD_GetState} $CheckboxRadioButtons $CheckboxRadioButtons_State - ${If} $CheckboxRadioButtons_State == 0 - EnableWindow $RadioButtonX64_VS2010 0 - EnableWindow $RadioButtonI86_VS2010 0 - EnableWindow $RadioButtonX64_VS2013 0 - EnableWindow $RadioButtonI86_VS2013 0 - EnableWindow $RadioButtonX64_VS2015 0 - EnableWindow $RadioButtonI86_VS2015 0 - - ${NSD_SetState} $RadioButtonX64_VS2010 0 - ${NSD_SetState} $RadioButtonI86_VS2010 0 - ${NSD_SetState} $RadioButtonX64_VS2013 0 - ${NSD_SetState} $RadioButtonI86_VS2013 0 - ${NSD_SetState} $RadioButtonX64_VS2015 0 - ${NSD_SetState} $RadioButtonI86_VS2015 0 - - ${NSD_GetState} $RadioButtonI86_VS2010 $RadioButtonI86_VS2010_State - ${NSD_GetState} $RadioButtonX64_VS2010 $RadioButtonX64_VS2010_State - ${NSD_GetState} $RadioButtonX64_VS2013 $RadioButtonX64_VS2013_State - ${NSD_GetState} $RadioButtonI86_VS2013 $RadioButtonI86_VS2013_State - ${NSD_GetState} $RadioButtonI86_VS2015 $RadioButtonI86_VS2015_State - ${NSD_GetState} $RadioButtonX64_VS2015 $RadioButtonX64_VS2015_State - ${ElseIf} $CheckboxRadioButtons_State == 1 - Call EnableRadioX64 - Call EnableRadioI86 - Call SelectDefaultBestConfiguration - ${EndIf} -FunctionEnd - -### Callback invocado cuando se pulsa el CheckBox x64 -### Sirve para deshabilitar el i86, pues no pueden aparecer a la vez -### Tambien guardamos el estado en la variable _state -Function ClickX64_VS2010 - Call ResetStates - Pop $RadioButtonX64_VS2010 - ${NSD_GetState} $RadioButtonX64_VS2010 $RadioButtonX64_VS2010_State -FunctionEnd - -### Callback invocado cuando se pulsa el CheckBox i86 -### Sirve para deshabilitar el x64, pues no pueden aparecer a la vez -### Tambien guardamos el estado en la variable _state -Function ClickI86_VS2010 - Call ResetStates - Pop $RadioButtonI86_VS2010 - ${NSD_GetState} $RadioButtonI86_VS2010 $RadioButtonI86_VS2010_State -FunctionEnd - -### Callback invocado cuando se pulsa el CheckBox x64 VS2013 -### Sirve para deshabilitar el i86 2013, pues no pueden aparecer a la vez -### Tambien guardamos el estado en la variable _state -Function ClickX64_VS2013 - Call ResetStates - Pop $RadioButtonX64_VS2013 - ${NSD_GetState} $RadioButtonX64_VS2013 $RadioButtonX64_VS2013_State -FunctionEnd - -### Callback invocado cuando se pulsa el CheckBox i86 -### Sirve para deshabilitar el x64, pues no pueden aparecer a la vez -### Tambien guardamos el estado en la variable _state -Function ClickI86_VS2013 - Call ResetStates - Pop $RadioButtonI86_VS2013 - ${NSD_GetState} $RadioButtonI86_VS2013 $RadioButtonI86_VS2013_State -FunctionEnd - -### Callback invocado cuando se pulsa el CheckBox x64 -### Sirve para deshabilitar el i86, pues no pueden aparecer a la vez -### Tambien guardamos el estado en la variable _state -Function ClickX64_VS2015 - Call ResetStates - Pop $RadioButtonX64_VS2015 - ${NSD_GetState} $RadioButtonX64_VS2015 $RadioButtonX64_VS2015_State -FunctionEnd - -### Callback invocado cuando se pulsa el CheckBox i86 -### Sirve para deshabilitar el x64, pues no pueden aparecer a la vez -### Tambien guardamos el estado en la variable _state -Function ClickI86_VS2015 - Call ResetStates - Pop $RadioButtonI86_VS2015 - ${NSD_GetState} $RadioButtonI86_VS2015 $RadioButtonI86_VS2015_State -FunctionEnd - -Function ResetStates - Push 0 - Pop $RadioButtonX64_VS2010_State - Push 0 - Pop $RadioButtonI86_VS2010_State - Push 0 - Pop $RadioButtonX64_VS2013_State - Push 0 - Pop $RadioButtonI86_VS2013_State - Push 0 - Pop $RadioButtonX64_VS2015_State - Push 0 - Pop $RadioButtonI86_VS2015_State -FunctionEnd - -Function SelectDefaultBestConfiguration - ${If} $CheckboxRadioButtons_State == 1 - ${If} ${SectionIsSelected} ${libraries_x64Win64VS2015} - ${NSD_SetState} $RadioButtonX64_VS2015 1 - ${NSD_GetState} $RadioButtonX64_VS2015 $RadioButtonX64_VS2015_State - ${ElseIf} ${SectionIsSelected} ${libraries_x64Win64VS2013} - ${NSD_SetState} $RadioButtonX64_VS2013 1 - ${NSD_GetState} $RadioButtonX64_VS2013 $RadioButtonX64_VS2013_State - ${ElseIf} ${SectionIsSelected} ${libraries_x64Win64VS2010} - ${NSD_SetState} $RadioButtonX64_VS2010 1 - ${NSD_GetState} $RadioButtonX64_VS2010 $RadioButtonX64_VS2010_State - ${ElseIf} ${SectionIsSelected} ${libraries_i86Win32VS2015} - ${NSD_SetState} $RadioButtonI86_VS2015 1 - ${NSD_GetState} $RadioButtonI86_VS2015 $RadioButtonI86_VS2015_State - ${ElseIf} ${SectionIsSelected} ${libraries_i86Win32VS2013} - ${NSD_SetState} $RadioButtonI86_VS2013 1 - ${NSD_GetState} $RadioButtonI86_VS2013 $RadioButtonI86_VS2013_State - ${ElseIf} ${SectionIsSelected} ${libraries_i86Win32VS2010} - ${NSD_SetState} $RadioButtonI86_VS2010 1 - ${NSD_GetState} $RadioButtonI86_VS2010 $RadioButtonI86_VS2010_State - ${EndIf} - ${EndIf} -FunctionEnd - -Function CheckRadioButtons - ${If} ${SectionIsSelected} ${libraries} - ${OrIf} ${SectionIsPartiallySelected} ${libraries} - EnableWindow $CheckboxRadioButtons 1 - ${If} $CheckboxRadioButtons_State == 1 - ${NSD_Check} $CheckboxRadioButtons - ${EndIf} - ${Else} - EnableWindow $CheckboxRadioButtons 0 - ${NSD_SetState} $CheckboxRadioButtons 0 - ${EndIf} - -FunctionEnd - -Function EnableRadioX64 - ${If} ${RunningX64} - ${If} $CheckboxRadioButtons_State == 1 - ${If} ${SectionIsSelected} ${libraries_x64Win64VS2015} - EnableWindow $RadioButtonX64_VS2015 1 - ${Else} - EnableWindow $RadioButtonX64_VS2015 0 - ${EndIf} - ${If} ${SectionIsSelected} ${libraries_x64Win64VS2013} - EnableWindow $RadioButtonX64_VS2013 1 - ${Else} - EnableWindow $RadioButtonX64_VS2013 0 - ${EndIf} - ${If} ${SectionIsSelected} ${libraries_x64Win64VS2010} - EnableWindow $RadioButtonX64_VS2010 1 - ${Else} - EnableWindow $RadioButtonX64_VS2010 0 - ${EndIf} - ${Else} - EnableWindow $RadioButtonX64_VS2015 0 - EnableWindow $RadioButtonX64_VS2013 0 - EnableWindow $RadioButtonX64_VS2010 0 - ${EndIf} - ${EndIf} -FunctionEnd - -Function EnableRadioI86 - ${If} $CheckboxRadioButtons_State == 1 - ${If} ${SectionIsSelected} ${libraries_i86Win32VS2015} - EnableWindow $RadioButtonI86_VS2015 1 - ${Else} - EnableWindow $RadioButtonI86_VS2015 0 - ${EndIf} - ${If} ${SectionIsSelected} ${libraries_i86Win32VS2013} - EnableWindow $RadioButtonI86_VS2013 1 - ${Else} - EnableWindow $RadioButtonI86_VS2013 0 - ${EndIf} - ${If} ${SectionIsSelected} ${libraries_i86Win32VS2010} - EnableWindow $RadioButtonI86_VS2010 1 - ${Else} - EnableWindow $RadioButtonI86_VS2010 0 - ${EndIf} - ${Else} - EnableWindow $RadioButtonI86_VS2015 0 - EnableWindow $RadioButtonI86_VS2013 0 - EnableWindow $RadioButtonI86_VS2010 0 - ${EndIf} -FunctionEnd - -Function InstallVarEnvs - ### Actualizamos las variables de entorno que se hayan marcado - ${If} $CheckboxHOME_State == ${BST_CHECKED} - ${EnvVarUpdate} $0 "@PROJECT_NAME_UPPER@HOME" "P" "HKLM" "$INSTDIR" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "@PROJECT_NAME_UPPER@HOME" 1 - ${EndIf} - ${If} ${SectionIsSelected} ${libraries_x64Win64VS2010} - ${If} $RadioButtonX64_VS2010_State == ${BST_CHECKED} - ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\bin\x64Win64VS2010" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "x64Win64VS2010 libraries location" 1 - ${EndIf} - ${EndIf} - ${If} ${SectionIsSelected} ${libraries_i86Win32VS2010} - ${If} $RadioButtonI86_VS2010_State == ${BST_CHECKED} - ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\bin\i86Win32VS2010" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "i86Win32VS2010 libraries location" 1 - ${EndIf} - ${EndIf} - ${If} ${SectionIsSelected} ${libraries_x64Win64VS2013} - ${If} $RadioButtonX64_VS2013_State == ${BST_CHECKED} - ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\bin\x64Win64VS2013" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "x64Win64VS2013 libraries location" 1 - ${EndIf} - ${EndIf} - ${If} ${SectionIsSelected} ${libraries_i86Win32VS2013} - ${If} $RadioButtonI86_VS2013_State == ${BST_CHECKED} - ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\bin\i86Win32VS2013" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "i86Win32VS2013 libraries location" 1 - ${EndIf} - ${EndIf} - ${If} ${SectionIsSelected} ${libraries_x64Win64VS2015} - ${If} $RadioButtonX64_VS2015_State == ${BST_CHECKED} - ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\bin\x64Win64VS2015" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "x64Win64VS2015 libraries location" 1 - ${EndIf} - ${EndIf} - ${If} ${SectionIsSelected} ${libraries_i86Win32VS2015} - ${If} $RadioButtonI86_VS2015_State == ${BST_CHECKED} - ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\bin\i86Win32VS2015" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "i86Win32VS2015 libraries location" 1 - ${EndIf} - ${EndIf} -FunctionEnd - -Var RegKeyCheck - -!macro UninstallVarEnvs - ReadRegStr $RegKeyCheck HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "@PROJECT_NAME_UPPER@HOME" - ${If} $RegKeyCheck == 1 - DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "@PROJECT_NAME_UPPER@HOME" - ${un.EnvVarUpdate} $0 "@PROJECT_NAME_UPPER@HOME" "R" "HKLM" "$INSTDIR" - ${EndIf} - ReadRegStr $RegKeyCheck HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "x64Win64VS2010 libraries location" - ${If} $RegKeyCheck == 1 - DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "x64Win64VS2010 libraries location" - ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR\bin\x64Win64VS2010" - ${EndIf} - ReadRegStr $RegKeyCheck HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "i86Win32VS2010 libraries location" - ${If} $RegKeyCheck == 1 - DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "i86Win32VS2010 libraries location" - ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR\bin\i86Win32VS2010" - ${EndIf} - ReadRegStr $RegKeyCheck HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "x64Win64VS2013 libraries location" - ${If} $RegKeyCheck == 1 - DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "x64Win64VS2013 libraries location" - ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR\bin\x64Win64VS2013" - ${EndIf} - ReadRegStr $RegKeyCheck HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "i86Win32VS2013 libraries location" - ${If} $RegKeyCheck == 1 - DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "i86Win32VS2013 libraries location" - ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR\bin\i86Win32VS2013" - ${EndIf} - ReadRegStr $RegKeyCheck HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "x64Win64VS2015 libraries location" - ${If} $RegKeyCheck == 1 - DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "x64Win64VS2015 libraries location" - ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR\bin\x64Win64VS2015" - ${EndIf} - ReadRegStr $RegKeyCheck HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "i86Win32VS2015 libraries location" - ${If} $RegKeyCheck == 1 - DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "i86Win32VS2015 libraries location" - ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR\bin\i86Win32VS2015" - ${EndIf} -!macroend diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/windows/EnvVarPage_one_arch.nsh.in b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/windows/EnvVarPage_one_arch.nsh.in deleted file mode 100644 index 3620a37e3..000000000 --- a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/windows/EnvVarPage_one_arch.nsh.in +++ /dev/null @@ -1,123 +0,0 @@ -# Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -# -# 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 nsDialogs.nsh -!include LogicLib.nsh -!include EnvVarUpdate.nsh - -Var Dialog -Var FirstTime - -Var Label - -Var CheckboxHOME -Var CheckboxHOME_State - -Var CheckboxRadioButtons -Var CheckboxRadioButtons_State - -LangString PAGE_TITLE ${LANG_ENGLISH} "Environment variables setting" -LangString PAGE_SUBTITLE ${LANG_ENGLISH} "Choose which environment variables you want to set." - -Function VariablesEntornoPage - - !insertmacro MUI_HEADER_TEXT $(PAGE_TITLE) $(PAGE_SUBTITLE) - - nsDialogs::Create 1018 - - Pop $Dialog - - ${If} $Dialog == error - Abort - ${EndIf} - - ### Creación de los elementos gráficos - ${NSD_CreateLabel} 0 0 100% 20u "Check the environment variables you want to set and uncheck the environment variables you don't want to set. Click Next to continue." - Pop $Label - - ${NSD_CreateCheckbox} 10 20u 100% 12u "Set the @PROJECT_NAME_UPPER@HOME environment variable." - Pop $CheckboxHOME - ${If} $CheckboxHOME_State == ${BST_CHECKED} - ${NSD_Check} $CheckboxHOME - ${EndIf} - - ${NSD_CreateCheckbox} 10 40u 100% 15u "&Add to the PATH the location of eProsima @PROJECT_NAME_LARGE@ libraries for platform @MSVC_ARCH@." - Pop $CheckboxRadioButtons - ${If} $CheckboxRadioButtons_State == ${BST_CHECKED} - ${NSD_Check} $CheckboxRadioButtons - ${EndIf} - - ### La primera vez que lanzamos el instalador, el checkbox de HOME - ### y el de SCRIPTS deben estar marcados. - StrCmp $FirstTime "FirstTime" jumpfirsttime 0 ### Si son iguales las cadenas, GOTO +5, si no, GOTO 0 - ${NSD_Check} $CheckboxHOME - ${NSD_Check} $CheckboxRadioButtons - ${NSD_GetState} $CheckboxHOME $CheckboxHOME_State - ${NSD_GetState} $CheckboxRadioButtons $CheckboxRadioButtons_State - StrCpy $FirstTime "FirstTime" - - jumpfirsttime: - - ${If} ${SectionIsSelected} ${libraries_@MSVC_ARCH@} - EnableWindow $CheckboxRadioButtons 1 - ${Else} - EnableWindow $CheckboxRadioButtons 0 - ${EndIf} - - ### Fijamos los callbacks para cuando se haga click en los CheckBoxes - ${NSD_OnClick} $CheckboxHOME ClickHOME - ${NSD_OnClick} $CheckboxRadioButtons ClickCheckboxRadioButtons - - nsDialogs::Show -FunctionEnd - -### Callback invocado cuando se pulsa el CheckBox HOME -### Guardamos el estado en la variable _state -Function ClickHOME - ${NSD_GetState} $CheckboxHOME $CheckboxHOME_State -FunctionEnd - -Function ClickCheckboxRadioButtons - ${NSD_GetState} $CheckboxRadioButtons $CheckboxRadioButtons_State -FunctionEnd - -Function InstallVarEnvs - ### Actualizamos las variables de entorno que se hayan marcado - ${If} $CheckboxHOME_State == ${BST_CHECKED} - ${EnvVarUpdate} $0 "@PROJECT_NAME_UPPER@HOME" "P" "HKLM" "$INSTDIR" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "@PROJECT_NAME_UPPER@HOME" 1 - ${EndIf} - ${If} ${SectionIsSelected} ${libraries_@MSVC_ARCH@} - ${If} $CheckboxRadioButtons_State == ${BST_CHECKED} - ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\lib@MSVC_ARCH_DIR@" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "@MSVC_ARCH@ libraries location" 1 - ${EndIf} - ${EndIf} -FunctionEnd - -Var RegKeyCheck - -!macro UninstallVarEnvs - ReadRegStr $RegKeyCheck HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "@PROJECT_NAME_UPPER@HOME" - ${If} $RegKeyCheck == 1 - DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "@PROJECT_NAME_UPPER@HOME" - ${un.EnvVarUpdate} $0 "@PROJECT_NAME_UPPER@HOME" "R" "HKLM" "$INSTDIR" - ${EndIf} - ReadRegStr $RegKeyCheck HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "@MSVC_ARCH@ libraries location" - ${If} $RegKeyCheck == 1 - DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "@MSVC_ARCH@ libraries location" - ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR\lib@MSVC_ARCH_DIR@" - ${EndIf} -!macroend - diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/windows/EnvVarUpdate.nsh b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/windows/EnvVarUpdate.nsh deleted file mode 100644 index 39682000c..000000000 --- a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/windows/EnvVarUpdate.nsh +++ /dev/null @@ -1,327 +0,0 @@ -/** - * EnvVarUpdate.nsh - * : Environmental Variables: append, prepend, and remove entries - * - * WARNING: If you use StrFunc.nsh header then include it before this file - * with all required definitions. This is to avoid conflicts - * - * Usage: - * ${EnvVarUpdate} "ResultVar" "EnvVarName" "Action" "RegLoc" "PathString" - * - * Credits: - * Version 1.0 - * * Cal Turney (turnec2) - * * Amir Szekely (KiCHiK) and e-circ for developing the forerunners of this - * function: AddToPath, un.RemoveFromPath, AddToEnvVar, un.RemoveFromEnvVar, - * WriteEnvStr, and un.DeleteEnvStr - * * Diego Pedroso (deguix) for StrTok - * * Kevin English (kenglish_hi) for StrContains - * * Hendri Adriaens (Smile2Me), Diego Pedroso (deguix), and Dan Fuhry - * (dandaman32) for StrReplace - * - * Version 1.1 (compatibility with StrFunc.nsh) - * * techtonik - * - * http://nsis.sourceforge.net/Environmental_Variables:_append%2C_prepend%2C_and_remove_entries - * - */ - - -!ifndef ENVVARUPDATE_FUNCTION -!define ENVVARUPDATE_FUNCTION -!verbose push -!verbose 3 -!include "LogicLib.nsh" -!include "WinMessages.NSH" -!include "StrFunc.nsh" - -; ---- Fix for conflict if StrFunc.nsh is already includes in main file ----------------------- -!macro _IncludeStrFunction StrFuncName - !ifndef ${StrFuncName}_INCLUDED - ${${StrFuncName}} - !endif - !ifndef Un${StrFuncName}_INCLUDED - ${Un${StrFuncName}} - !endif - !define un.${StrFuncName} "${Un${StrFuncName}}" -!macroend - -!insertmacro _IncludeStrFunction StrTok -!insertmacro _IncludeStrFunction StrStr -!insertmacro _IncludeStrFunction StrRep - -; ---------------------------------- Macro Definitions ---------------------------------------- -!macro _EnvVarUpdateConstructor ResultVar EnvVarName Action Regloc PathString - Push "${EnvVarName}" - Push "${Action}" - Push "${RegLoc}" - Push "${PathString}" - Call EnvVarUpdate - Pop "${ResultVar}" -!macroend -!define EnvVarUpdate '!insertmacro "_EnvVarUpdateConstructor"' - -!macro _unEnvVarUpdateConstructor ResultVar EnvVarName Action Regloc PathString - Push "${EnvVarName}" - Push "${Action}" - Push "${RegLoc}" - Push "${PathString}" - Call un.EnvVarUpdate - Pop "${ResultVar}" -!macroend -!define un.EnvVarUpdate '!insertmacro "_unEnvVarUpdateConstructor"' -; ---------------------------------- Macro Definitions end------------------------------------- - -;----------------------------------- EnvVarUpdate start---------------------------------------- -!define hklm_all_users 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' -!define hkcu_current_user 'HKCU "Environment"' - -!macro EnvVarUpdate UN - -Function ${UN}EnvVarUpdate - - Push $0 - Exch 4 - Exch $1 - Exch 3 - Exch $2 - Exch 2 - Exch $3 - Exch - Exch $4 - Push $5 - Push $6 - Push $7 - Push $8 - Push $9 - Push $R0 - - /* After this point: - ------------------------- - $0 = ResultVar (returned) - $1 = EnvVarName (input) - $2 = Action (input) - $3 = RegLoc (input) - $4 = PathString (input) - $5 = Orig EnvVar (read from registry) - $6 = Len of $0 (temp) - $7 = tempstr1 (temp) - $8 = Entry counter (temp) - $9 = tempstr2 (temp) - $R0 = tempChar (temp) */ - - ; Step 1: Read contents of EnvVarName from RegLoc - ; - ; Check for empty EnvVarName - ${If} $1 == "" - SetErrors - DetailPrint "ERROR: EnvVarName is blank" - Goto EnvVarUpdate_Restore_Vars - ${EndIf} - - ; Check for valid Action - ${If} $2 != "A" - ${AndIf} $2 != "P" - ${AndIf} $2 != "R" - SetErrors - DetailPrint "ERROR: Invalid Action - must be A, P, or R" - Goto EnvVarUpdate_Restore_Vars - ${EndIf} - - ${If} $3 == HKLM - ReadRegStr $5 ${hklm_all_users} $1 ; Get EnvVarName from all users into $5 - ${ElseIf} $3 == HKCU - ReadRegStr $5 ${hkcu_current_user} $1 ; Read EnvVarName from current user into $5 - ${Else} - SetErrors - DetailPrint 'ERROR: Action is [$3] but must be "HKLM" or HKCU"' - Goto EnvVarUpdate_Restore_Vars - ${EndIf} - - ; Check for empty PathString - ${If} $4 == "" - SetErrors - DetailPrint "ERROR: PathString is blank" - Goto EnvVarUpdate_Restore_Vars - ${EndIf} - - ; Make sure we've got some work to do - ${If} $5 == "" - ${AndIf} $2 == "R" - SetErrors - DetailPrint "$1 is empty - Nothing to remove" - Goto EnvVarUpdate_Restore_Vars - ${EndIf} - - ; Step 2: Scrub EnvVar - ; - StrCpy $0 $5 ; Copy the contents to $0 - ; Remove spaces around semicolons (NOTE: spaces before the 1st entry or - ; after the last one are not removed here but instead in Step 3) - ${If} $0 != "" ; If EnvVar is not empty ... - ${Do} - ${${UN}StrStr} $7 $0 " ;" - ${If} $7 == "" - ${ExitDo} - ${EndIf} - ${${UN}StrRep} $0 $0 " ;" ";" ; Remove ';' - ${Loop} - ${Do} - ${${UN}StrStr} $7 $0 "; " - ${If} $7 == "" - ${ExitDo} - ${EndIf} - ${${UN}StrRep} $0 $0 "; " ";" ; Remove ';' - ${Loop} - ${Do} - ${${UN}StrStr} $7 $0 ";;" - ${If} $7 == "" - ${ExitDo} - ${EndIf} - ${${UN}StrRep} $0 $0 ";;" ";" - ${Loop} - - ; Remove a leading or trailing semicolon from EnvVar - StrCpy $7 $0 1 0 - ${If} $7 == ";" - StrCpy $0 $0 "" 1 ; Change ';' to '' - ${EndIf} - StrLen $6 $0 - IntOp $6 $6 - 1 - StrCpy $7 $0 1 $6 - ${If} $7 == ";" - StrCpy $0 $0 $6 ; Change ';' to '' - ${EndIf} - ; DetailPrint "Scrubbed $1: [$0]" ; Uncomment to debug - ${EndIf} - - /* Step 3. Remove all instances of the target path/string (even if "A" or "P") - $6 = bool flag (1 = found and removed PathString) - $7 = a string (e.g. path) delimited by semicolon(s) - $8 = entry counter starting at 0 - $9 = copy of $0 - $R0 = tempChar */ - - ${If} $5 != "" ; If EnvVar is not empty ... - StrCpy $9 $0 - StrCpy $0 "" - StrCpy $8 0 - StrCpy $6 0 - - ${Do} - ${${UN}StrTok} $7 $9 ";" $8 "0" ; $7 = next entry, $8 = entry counter - - ${If} $7 == "" ; If we've run out of entries, - ${ExitDo} ; were done - ${EndIf} ; - - ; Remove leading and trailing spaces from this entry (critical step for Action=Remove) - ${Do} - StrCpy $R0 $7 1 - ${If} $R0 != " " - ${ExitDo} - ${EndIf} - StrCpy $7 $7 "" 1 ; Remove leading space - ${Loop} - ${Do} - StrCpy $R0 $7 1 -1 - ${If} $R0 != " " - ${ExitDo} - ${EndIf} - StrCpy $7 $7 -1 ; Remove trailing space - ${Loop} - ${If} $7 == $4 ; If string matches, remove it by not appending it - StrCpy $6 1 ; Set 'found' flag - ${ElseIf} $7 != $4 ; If string does NOT match - ${AndIf} $0 == "" ; and the 1st string being added to $0, - StrCpy $0 $7 ; copy it to $0 without a prepended semicolon - ${ElseIf} $7 != $4 ; If string does NOT match - ${AndIf} $0 != "" ; and this is NOT the 1st string to be added to $0, - StrCpy $0 $0;$7 ; append path to $0 with a prepended semicolon - ${EndIf} ; - - IntOp $8 $8 + 1 ; Bump counter - ${Loop} ; Check for duplicates until we run out of paths - ${EndIf} - - ; Step 4: Perform the requested Action - ; - ${If} $2 != "R" ; If Append or Prepend - ${If} $6 == 1 ; And if we found the target - DetailPrint "Target is already present in $1. It will be removed and" - ${EndIf} - ${If} $0 == "" ; If EnvVar is (now) empty - StrCpy $0 $4 ; just copy PathString to EnvVar - ${If} $6 == 0 ; If found flag is either 0 - ${OrIf} $6 == "" ; or blank (if EnvVarName is empty) - DetailPrint "$1 was empty and has been updated with the target" - ${EndIf} - ${ElseIf} $2 == "A" ; If Append (and EnvVar is not empty), - StrCpy $0 $0;$4 ; append PathString - ${If} $6 == 1 - DetailPrint "appended to $1" - ${Else} - DetailPrint "Target was appended to $1" - ${EndIf} - ${Else} ; If Prepend (and EnvVar is not empty), - StrCpy $0 $4;$0 ; prepend PathString - ${If} $6 == 1 - DetailPrint "prepended to $1" - ${Else} - DetailPrint "Target was prepended to $1" - ${EndIf} - ${EndIf} - ${Else} ; If Action = Remove - ${If} $6 == 1 ; and we found the target - DetailPrint "Target was found and removed from $1" - ${Else} - DetailPrint "Target was NOT found in $1 (nothing to remove)" - ${EndIf} - ${If} $0 == "" - DetailPrint "$1 is now empty" - ${EndIf} - ${EndIf} - - ; Step 5: Update the registry at RegLoc with the updated EnvVar and announce the change - ; - ClearErrors - ${If} $3 == HKLM - WriteRegExpandStr ${hklm_all_users} $1 $0 ; Write it in all users section - ${ElseIf} $3 == HKCU - WriteRegExpandStr ${hkcu_current_user} $1 $0 ; Write it to current user section - ${EndIf} - - IfErrors 0 +4 - MessageBox MB_OK|MB_ICONEXCLAMATION "Could not write updated $1 to $3" - DetailPrint "Could not write updated $1 to $3" - Goto EnvVarUpdate_Restore_Vars - - ; "Export" our change - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 - - EnvVarUpdate_Restore_Vars: - ; - ; Restore the user's variables and return ResultVar - Pop $R0 - Pop $9 - Pop $8 - Pop $7 - Pop $6 - Pop $5 - Pop $4 - Pop $3 - Pop $2 - Pop $1 - Push $0 ; Push my $0 (ResultVar) - Exch - Pop $0 ; Restore his $0 - -FunctionEnd - -!macroend ; EnvVarUpdate UN -!insertmacro EnvVarUpdate "" -!insertmacro EnvVarUpdate "un." -;----------------------------------- EnvVarUpdate end---------------------------------------- - -!verbose pop -!endif diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/windows/InstallRedistributables.nsh b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/windows/InstallRedistributables.nsh deleted file mode 100644 index d8c876dd9..000000000 --- a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/windows/InstallRedistributables.nsh +++ /dev/null @@ -1,180 +0,0 @@ -# Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -# -# 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 x64.nsh - -Var X64VS2010Needed -Var I86VS2010Needed -Var X64VS2013Needed -Var I86VS2013Needed -Var X64VS2015Needed -Var I86VS2015Needed - -Function InstallRedistributables - - StrCpy $X64VS2010Needed "1" - StrCpy $I86VS2010Needed "1" - StrCpy $X64VS2013Needed "1" - StrCpy $I86VS2013Needed "1" - StrCpy $X64VS2015Needed "1" - StrCpy $I86VS2015Needed "1" - - # Check if it is necessary to install to x64VS2010 - ${If} ${RunningX64} - ${If} ${SectionIsSelected} ${libraries_x64Win64VS2010} - ${OrIf} ${SectionIsSelected} ${libraries_i86Win32VS2010} - ClearErrors - SetRegView 64 - ReadRegDword $0 HKLM "SOFTWARE\Classes\Installer\Products\1926E8D15D0BCE53481466615F760A7F" "Version" - IfErrors 0 VC2010RedistInstalled - StrCpy $X64VS2010Needed "0" - ${EndIf} - ${Else} - # Check if it is necessary to install to i86VS2010 - ${If} ${SectionIsSelected} ${libraries_i86Win32VS2010} - ClearErrors - ReadRegDword $0 HKLM "SOFTWARE\Classes\Installer\Products\1D5E3C0FEDA1E123187686FED06E995A" "Version" - IfErrors 0 VC2010RedistInstalled - StrCpy $I86VS2010Needed "0" - ${EndIf} - ${EndIf} - - VC2010RedistInstalled: - - # Check if it is necessary to install to x64VS2013 - ${If} ${RunningX64} - ${If} ${SectionIsSelected} ${libraries_x64Win64VS2013} - ${OrIf} ${SectionIsSelected} ${libraries_i86Win32VS2013} - ClearErrors - SetRegView 64 - ReadRegStr $0 HKLM "SOFTWARE\Classes\Installer\Dependencies\{050d4fc8-5d48-4b8f-8972-47c82c46020f}" "Version" - IfErrors 0 VC2013RedistInstalled - StrCpy $X64VS2013Needed "0" - ${EndIf} - ${Else} - # Check if it is necessary to install to i86VS2013 - ${If} ${SectionIsSelected} ${libraries_i86Win32VS2013} - ClearErrors - ReadRegStr $0 HKLM "SOFTWARE\Classes\Installer\Dependencies\{f65db027-aff3-4070-886a-0d87064aabb1}" "Version" - IfErrors 0 VC2013RedistInstalled - StrCpy $I86VS2013Needed "0" - ${EndIf} - ${EndIf} - - VC2013RedistInstalled: - - # Check if it is necessary to install to x64VS2015 - ${If} ${RunningX64} - ${If} ${SectionIsSelected} ${libraries_x64Win64VS2015} - ${OrIf} ${SectionIsSelected} ${libraries_i86Win32VS2015} - ClearErrors - SetRegView 64 - ReadRegStr $0 HKLM "SOFTWARE\Classes\Installer\Dependencies\{3ee5e5bb-b7cc-4556-8861-a00a82977d6c}" "Version" - IfErrors 0 VC2015RedistInstalled - StrCpy $X64VS2015Needed "0" - ${EndIf} - ${Else} - # Check if it is necessary to install to i86VS2015 - ${If} ${SectionIsSelected} ${libraries_i86Win32VS2015} - ClearErrors - ReadRegStr $0 HKLM "SOFTWARE\Classes\Installer\Dependencies\{23daf363-3020-4059-b3ae-dc4ad39fed19}" "Version" - IfErrors 0 VC2015RedistInstalled - StrCpy $I86VS2015Needed "0" - ${EndIf} - ${EndIf} - - VC2015RedistInstalled: - - ${If} ${RunningX64} - StrCmp $X64VS2010Needed "1" notinstall2010 install2010 - ${Else} - StrCmp $I86VS2010Needed "1" notinstall2010 install2010 - ${EndIf} - - install2010: - messageBox MB_YESNO|MB_ICONQUESTION "$(^Name) needs Visual Studio 2010 Redistributable packages.$\nDo you want to download and install them?" IDNO notinstall2010 - - ${If} ${RunningX64} - NSISdl::download https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x64.exe $TEMP\vcredist_x64.exe - Pop $R0 ; Get the return value - StrCmp $R0 "success" 0 +3 - ExecWait "$TEMP\vcredist_x64.exe" - Goto +2 - MessageBox MB_OK "vcredist_x64.exe download failed: $R0" - ${Else} - NSISdl::download https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x86.exe $TEMP\vcredist_x86.exe - Pop $R0 ; Get the return value - StrCmp $R0 "success" 0 +3 - ExecWait "$TEMP\vcredist_x86.exe" - Goto +2 - MessageBox MB_OK "vcredist_x86.exe download failed: $R0" - ${EndIf} - - notinstall2010: - - ${If} ${RunningX64} - StrCmp $X64VS2013Needed "1" notinstall2013 install2013 - ${Else} - StrCmp $I86VS2013Needed "1" notinstall2013 install2013 - ${EndIf} - - install2013: - messageBox MB_YESNO|MB_ICONQUESTION "$(^Name) needs Visual Studio 2013 Redistributable packages.$\nDo you want to download and install them?" IDNO notinstall2013 - - ${If} ${RunningX64} - NSISdl::download http://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x64.exe $TEMP\vcredist_x64.exe - Pop $R0 ; Get the return value - StrCmp $R0 "success" 0 +3 - ExecWait "$TEMP\vcredist_x64.exe" - Goto +2 - MessageBox MB_OK "vcredist_x64.exe download failed: $R0" - ${Else} - NSISdl::download http://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x86.exe $TEMP\vcredist_x86.exe - Pop $R0 ; Get the return value - StrCmp $R0 "success" 0 +3 - ExecWait "$TEMP\vcredist_x86.exe" - Goto +2 - MessageBox MB_OK "vcredist_x86.exe download failed: $R0" - ${EndIf} - - notinstall2013: - - ${If} ${RunningX64} - StrCmp $X64VS2015Needed "1" notinstall2015 install2015 - ${Else} - StrCmp $I86VS2015Needed "1" notinstall2015 install2015 - ${EndIf} - - install2015: - messageBox MB_YESNO|MB_ICONQUESTION "$(^Name) needs Visual Studio 2015 Redistributable packages.$\nDo you want to download and install them?" IDNO notinstall2015 - - ${If} ${RunningX64} - NSISdl::download http://download.microsoft.com/download/C/E/5/CE514EAE-78A8-4381-86E8-29108D78DBD4/VC_redist.x64.exe $TEMP\vcredist_x64.exe - Pop $R0 ; Get the return value - StrCmp $R0 "success" 0 +3 - ExecWait "$TEMP\vcredist_x64.exe" - Goto +2 - MessageBox MB_OK "vcredist_x64.exe download failed: $R0" - ${Else} - NSISdl::download http://download.microsoft.com/download/C/E/5/CE514EAE-78A8-4381-86E8-29108D78DBD4/VC_redist.x86.exe $TEMP\vcredist_x86.exe - Pop $R0 ; Get the return value - StrCmp $R0 "success" 0 +3 - ExecWait "$TEMP\vcredist_x86.exe" - Goto +2 - MessageBox MB_OK "vcredist_x86.exe download failed: $R0" - ${EndIf} - - notinstall2015: - -FunctionEnd diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/windows/NSIS.template.in b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/windows/NSIS.template.in deleted file mode 100644 index 6212cf5a5..000000000 --- a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/windows/NSIS.template.in +++ /dev/null @@ -1,1029 +0,0 @@ -# Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -# -# 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. - -; CPack install script designed for a nmake build - -;-------------------------------- -; You must define these values - - !define VERSION "@CPACK_PACKAGE_VERSION@" - !define PATCH "@CPACK_PACKAGE_VERSION_PATCH@" - !define INST_DIR "@CPACK_TEMPORARY_DIRECTORY@" - -;-------------------------------- -;Variables - - Var MUI_TEMP - Var STARTMENU_FOLDER - Var SV_ALLUSERS - Var START_MENU - Var DO_NOT_ADD_TO_PATH - Var ADD_TO_PATH_ALL_USERS - Var ADD_TO_PATH_CURRENT_USER - Var INSTALL_DESKTOP - Var IS_DEFAULT_INSTALLDIR - Var VARPROGRAMFILES -;-------------------------------- -;Include Modern UI - - !define MUI_STARTMENUPAGE_DEFAULTFOLDER "eProsima\@CPACK_NSIS_DISPLAY_NAME@" - - !include "MUI2.nsh" - -;-------------------------------- -;General - - ;Name and file - Name "@CPACK_NSIS_PACKAGE_NAME@" - OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@" - VIProductVersion @CPACK_PACKAGE_VERSION@.0 - VIAddVersionKey ProductName "@CPACK_PACKAGE_NAME@" - VIAddVersionKey ProductVersion "@CPACK_PACKAGE_VERSION@" - VIAddVersionKey CompanyName "@CPACK_PACKAGE_VENDOR@" - VIAddVersionKey CompanyWebsite "@CPACK_PACKAGE_CONTACT@" - VIAddVersionKey FileVersion "@CPACK_PACKAGE_VERSION@" - VIAddVersionKey FileDescription "" - VIAddVersionKey LegalCopyright "" - - ;Set compression - SetCompressor @CPACK_NSIS_COMPRESSOR@ - - ;Require administrator access - RequestExecutionLevel admin - -@CPACK_NSIS_DEFINES@ - - !include Sections.nsh - -;Include detenction of architecture - !include "x64.nsh" - -;--- Component support macros: --- -; The code for the add/remove functionality is from: -; http://nsis.sourceforge.net/Add/Remove_Functionality -; It has been modified slightly and extended to provide -; inter-component dependencies. -Var AR_SecFlags -Var AR_RegFlags -@CPACK_NSIS_SECTION_SELECTED_VARS@ - -; Loads the "selected" flag for the section named SecName into the -; variable VarName. -!macro LoadSectionSelectedIntoVar SecName VarName - SectionGetFlags ${${SecName}} $${VarName} - IntOp $${VarName} $${VarName} & ${SF_SELECTED} ;Turn off all other bits -!macroend - -; Loads the value of a variable... can we get around this? -!macro LoadVar VarName - IntOp $R0 0 + $${VarName} -!macroend - -; Sets the value of a variable -!macro StoreVar VarName IntValue - IntOp $${VarName} 0 + ${IntValue} -!macroend - -!macro InitSection SecName - ; This macro reads component installed flag from the registry and - ;changes checked state of the section on the components page. - ;Input: section index constant name specified in Section command. - - ClearErrors - ;Reading component status from registry - ReadRegDWORD $AR_RegFlags HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" "Installed" - IfErrors "default_${SecName}" - ;Status will stay default if registry value not found - ;(component was never installed) - IntOp $AR_RegFlags $AR_RegFlags & ${SF_SELECTED} ;Turn off all other bits - SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading default section flags - IntOp $AR_SecFlags $AR_SecFlags & 0xFFFE ;Turn lowest (enabled) bit off - IntOp $AR_SecFlags $AR_RegFlags | $AR_SecFlags ;Change lowest bit - - ; Note whether this component was installed before - !insertmacro StoreVar ${SecName}_was_installed $AR_RegFlags - IntOp $R0 $AR_RegFlags & $AR_RegFlags - - ;Writing modified flags - SectionSetFlags ${${SecName}} $AR_SecFlags - - "default_${SecName}:" - !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected -!macroend - -!macro FinishSection SecName - ; This macro reads section flag set by user and removes the section - ;if it is not selected. - ;Then it writes component installed flag to registry - ;Input: section index constant name specified in Section command. - - SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading section flags - ;Checking lowest bit: - IntOp $AR_SecFlags $AR_SecFlags & ${SF_SELECTED} - IntCmp $AR_SecFlags 1 "leave_${SecName}" - ;Section is not selected: - ;Calling Section uninstall macro and writing zero installed flag - !insertmacro "Remove_${${SecName}}" - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" \ - "Installed" 0 - Goto "exit_${SecName}" - - "leave_${SecName}:" - ;Section is selected: - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" \ - "Installed" 1 - - "exit_${SecName}:" -!macroend - -!macro RemoveSection_CPack SecName - ; This macro is used to call section's Remove_... macro - ;from the uninstaller. - ;Input: section index constant name specified in Section command. - - !insertmacro "Remove_${${SecName}}" -!macroend - -; Determine whether the selection of SecName changed -!macro MaybeSelectionChanged SecName - !insertmacro LoadVar ${SecName}_selected - SectionGetFlags ${${SecName}} $R1 - IntOp $R1 $R1 & ${SF_SELECTED} ;Turn off all other bits - - ; See if the status has changed: - IntCmp $R0 $R1 "${SecName}_unchanged" - !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected - - IntCmp $R1 ${SF_SELECTED} "${SecName}_was_selected" - !insertmacro "Deselect_required_by_${SecName}" - goto "${SecName}_unchanged" - - "${SecName}_was_selected:" - !insertmacro "Select_${SecName}_depends" - - "${SecName}_unchanged:" -!macroend -;--- End of Add/Remove macros --- - -;-------------------------------- -;Interface Settings - - !define MUI_HEADERIMAGE - !define MUI_HEADERIMAGE_RIGHT - !define MUI_ABORTWARNING - -;-------------------------------- -; path functions - -!verbose 3 -!include "WinMessages.NSH" -!verbose 4 - -;---------------------------------------- -; based upon a script of "Written by KiCHiK 2003-01-18 05:57:02" -;---------------------------------------- -!verbose 3 -!include "WinMessages.NSH" -!verbose 4 -;==================================================== -; get_NT_environment -; Returns: the selected environment -; Output : head of the stack -;==================================================== -!macro select_NT_profile UN -Function ${UN}select_NT_profile - StrCmp $ADD_TO_PATH_ALL_USERS "1" 0 environment_single - DetailPrint "Selected environment for all users" - Push "all" - Return - environment_single: - DetailPrint "Selected environment for current user only." - Push "current" - Return -FunctionEnd -!macroend -!insertmacro select_NT_profile "" -!insertmacro select_NT_profile "un." -;---------------------------------------------------- -!define NT_current_env 'HKCU "Environment"' -!define NT_all_env 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' - -!ifndef WriteEnvStr_RegKey - !ifdef ALL_USERS - !define WriteEnvStr_RegKey \ - 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' - !else - !define WriteEnvStr_RegKey 'HKCU "Environment"' - !endif -!endif - -; AddToPath - Adds the given dir to the search path. -; Input - head of the stack -; Note - Win9x systems requires reboot - -Function AddToPath - Exch $0 - Push $1 - Push $2 - Push $3 - - # don't add if the path doesn't exist - IfFileExists "$0\*.*" "" AddToPath_done - - ReadEnvStr $1 PATH - ; if the path is too long for a NSIS variable NSIS will return a 0 - ; length string. If we find that, then warn and skip any path - ; modification as it will trash the existing path. - StrLen $2 $1 - IntCmp $2 0 CheckPathLength_ShowPathWarning CheckPathLength_Done CheckPathLength_Done - CheckPathLength_ShowPathWarning: - Messagebox MB_OK|MB_ICONEXCLAMATION "Warning! PATH too long installer unable to modify PATH!" - Goto AddToPath_done - CheckPathLength_Done: - Push "$1;" - Push "$0;" - Call CmakeStrStr - Pop $2 - StrCmp $2 "" "" AddToPath_done - Push "$1;" - Push "$0\;" - Call CmakeStrStr - Pop $2 - StrCmp $2 "" "" AddToPath_done - GetFullPathName /SHORT $3 $0 - Push "$1;" - Push "$3;" - Call CmakeStrStr - Pop $2 - StrCmp $2 "" "" AddToPath_done - Push "$1;" - Push "$3\;" - Call CmakeStrStr - Pop $2 - StrCmp $2 "" "" AddToPath_done - - Call IsNT - Pop $1 - StrCmp $1 1 AddToPath_NT - ; Not on NT - StrCpy $1 $WINDIR 2 - FileOpen $1 "$1\autoexec.bat" a - FileSeek $1 -1 END - FileReadByte $1 $2 - IntCmp $2 26 0 +2 +2 # DOS EOF - FileSeek $1 -1 END # write over EOF - FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n" - FileClose $1 - SetRebootFlag true - Goto AddToPath_done - - AddToPath_NT: - StrCmp $ADD_TO_PATH_ALL_USERS "1" ReadAllKey - ReadRegStr $1 ${NT_current_env} "PATH" - Goto DoTrim - ReadAllKey: - ReadRegStr $1 ${NT_all_env} "PATH" - DoTrim: - StrCmp $1 "" AddToPath_NTdoIt - Push $1 - Call Trim - Pop $1 - StrCpy $0 "$1;$0" - AddToPath_NTdoIt: - StrCmp $ADD_TO_PATH_ALL_USERS "1" WriteAllKey - WriteRegExpandStr ${NT_current_env} "PATH" $0 - Goto DoSend - WriteAllKey: - WriteRegExpandStr ${NT_all_env} "PATH" $0 - DoSend: - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 - - AddToPath_done: - Pop $3 - Pop $2 - Pop $1 - Pop $0 -FunctionEnd - - -; RemoveFromPath - Remove a given dir from the path -; Input: head of the stack - -Function un.RemoveFromPath - Exch $0 - Push $1 - Push $2 - Push $3 - Push $4 - Push $5 - Push $6 - - IntFmt $6 "%c" 26 # DOS EOF - - Call un.IsNT - Pop $1 - StrCmp $1 1 unRemoveFromPath_NT - ; Not on NT - StrCpy $1 $WINDIR 2 - FileOpen $1 "$1\autoexec.bat" r - GetTempFileName $4 - FileOpen $2 $4 w - GetFullPathName /SHORT $0 $0 - StrCpy $0 "SET PATH=%PATH%;$0" - Goto unRemoveFromPath_dosLoop - - unRemoveFromPath_dosLoop: - FileRead $1 $3 - StrCpy $5 $3 1 -1 # read last char - StrCmp $5 $6 0 +2 # if DOS EOF - StrCpy $3 $3 -1 # remove DOS EOF so we can compare - StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine - StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine - StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine - StrCmp $3 "" unRemoveFromPath_dosLoopEnd - FileWrite $2 $3 - Goto unRemoveFromPath_dosLoop - unRemoveFromPath_dosLoopRemoveLine: - SetRebootFlag true - Goto unRemoveFromPath_dosLoop - - unRemoveFromPath_dosLoopEnd: - FileClose $2 - FileClose $1 - StrCpy $1 $WINDIR 2 - Delete "$1\autoexec.bat" - CopyFiles /SILENT $4 "$1\autoexec.bat" - Delete $4 - Goto unRemoveFromPath_done - - unRemoveFromPath_NT: - StrCmp $ADD_TO_PATH_ALL_USERS "1" unReadAllKey - ReadRegStr $1 ${NT_current_env} "PATH" - Goto unDoTrim - unReadAllKey: - ReadRegStr $1 ${NT_all_env} "PATH" - unDoTrim: - StrCpy $5 $1 1 -1 # copy last char - StrCmp $5 ";" +2 # if last char != ; - StrCpy $1 "$1;" # append ; - Push $1 - Push "$0;" - Call un.CmakeStrStr ; Find `$0;` in $1 - Pop $2 ; pos of our dir - StrCmp $2 "" unRemoveFromPath_done - ; else, it is in path - # $0 - path to add - # $1 - path var - StrLen $3 "$0;" - StrLen $4 $2 - StrCpy $5 $1 -$4 # $5 is now the part before the path to remove - StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove - StrCpy $3 $5$6 - - StrCpy $5 $3 1 -1 # copy last char - StrCmp $5 ";" 0 +2 # if last char == ; - StrCpy $3 $3 -1 # remove last char - - StrCmp $ADD_TO_PATH_ALL_USERS "1" unWriteAllKey - WriteRegExpandStr ${NT_current_env} "PATH" $3 - Goto unDoSend - unWriteAllKey: - WriteRegExpandStr ${NT_all_env} "PATH" $3 - unDoSend: - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 - - unRemoveFromPath_done: - Pop $6 - Pop $5 - Pop $4 - Pop $3 - Pop $2 - Pop $1 - Pop $0 -FunctionEnd - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Uninstall sutff -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -########################################### -# Utility Functions # -########################################### - -;==================================================== -; IsNT - Returns 1 if the current system is NT, 0 -; otherwise. -; Output: head of the stack -;==================================================== -; IsNT -; no input -; output, top of the stack = 1 if NT or 0 if not -; -; Usage: -; Call IsNT -; Pop $R0 -; ($R0 at this point is 1 or 0) - -!macro IsNT un -Function ${un}IsNT - Push $0 - ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion - StrCmp $0 "" 0 IsNT_yes - ; we are not NT. - Pop $0 - Push 0 - Return - - IsNT_yes: - ; NT!!! - Pop $0 - Push 1 -FunctionEnd -!macroend -!insertmacro IsNT "" -!insertmacro IsNT "un." - -; CmakeStrStr -; input, top of stack = string to search for -; top of stack-1 = string to search in -; output, top of stack (replaces with the portion of the string remaining) -; modifies no other variables. -; -; Usage: -; Push "this is a long ass string" -; Push "ass" -; Call CmakeStrStr -; Pop $R0 -; ($R0 at this point is "ass string") - -!macro CmakeStrStr un -Function ${un}CmakeStrStr -Exch $R1 ; st=haystack,old$R1, $R1=needle - Exch ; st=old$R1,haystack - Exch $R2 ; st=old$R1,old$R2, $R2=haystack - Push $R3 - Push $R4 - Push $R5 - StrLen $R3 $R1 - StrCpy $R4 0 - ; $R1=needle - ; $R2=haystack - ; $R3=len(needle) - ; $R4=cnt - ; $R5=tmp - loop: - StrCpy $R5 $R2 $R3 $R4 - StrCmp $R5 $R1 done - StrCmp $R5 "" done - IntOp $R4 $R4 + 1 - Goto loop -done: - StrCpy $R1 $R2 "" $R4 - Pop $R5 - Pop $R4 - Pop $R3 - Pop $R2 - Exch $R1 -FunctionEnd -!macroend -!insertmacro CmakeStrStr "" -!insertmacro CmakeStrStr "un." - -Function Trim ; Added by Pelaca - Exch $R1 - Push $R2 -Loop: - StrCpy $R2 "$R1" 1 -1 - StrCmp "$R2" " " RTrim - StrCmp "$R2" "$\n" RTrim - StrCmp "$R2" "$\r" RTrim - StrCmp "$R2" ";" RTrim - GoTo Done -RTrim: - StrCpy $R1 "$R1" -1 - Goto Loop -Done: - Pop $R2 - Exch $R1 -FunctionEnd - -Function ConditionalAddToRegisty - Pop $0 - Pop $1 - StrCmp "$0" "" ConditionalAddToRegisty_EmptyString - WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" \ - "$1" "$0" - ;MessageBox MB_OK "Set Registry: '$1' to '$0'" - DetailPrint "Set install registry entry: '$1' to '$0'" - ConditionalAddToRegisty_EmptyString: -FunctionEnd - -;-------------------------------- - -!ifdef CPACK_USES_DOWNLOAD -Function DownloadFile - IfFileExists $INSTDIR\* +2 - CreateDirectory $INSTDIR - Pop $0 - - ; Skip if already downloaded - IfFileExists $INSTDIR\$0 0 +2 - Return - - StrCpy $1 "@CPACK_DOWNLOAD_SITE@" - - try_again: - NSISdl::download "$1/$0" "$INSTDIR\$0" - - Pop $1 - StrCmp $1 "success" success - StrCmp $1 "Cancelled" cancel - MessageBox MB_OK "Download failed: $1" - cancel: - Return - success: -FunctionEnd -!endif - -;-------------------------------- -; Installation types -@CPACK_NSIS_INSTALLATION_TYPES@ - -;-------------------------------- -; Component sections -@CPACK_NSIS_COMPONENT_SECTIONS@ - -;Include page for set environment variables - !include "EnvVarPage.nsh" - -;Include installation of redistributable files. - !include InstallRedistributables.nsh - -;-------------------------------- -; Define some macro setting for the gui -@CPACK_NSIS_INSTALLER_MUI_ICON_CODE@ -@CPACK_NSIS_INSTALLER_ICON_CODE@ -@CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC@ -@CPACK_NSIS_INSTALLER_MUI_FINISHPAGE_RUN_CODE@ - -;-------------------------------- -;Pages - !insertmacro MUI_PAGE_WELCOME - - !insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@" - Page custom InstallOptionsPage - !insertmacro MUI_PAGE_DIRECTORY - - ;Start Menu Folder Page Configuration - !define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX" - !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" - !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" - !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER - - @CPACK_NSIS_PAGE_COMPONENTS@ - - Page custom VariablesEntornoPage - !insertmacro MUI_PAGE_INSTFILES - !insertmacro MUI_PAGE_FINISH - - !insertmacro MUI_UNPAGE_CONFIRM - !insertmacro MUI_UNPAGE_INSTFILES - -;-------------------------------- -;Languages - - !insertmacro MUI_LANGUAGE "English" ;first language is the default language - !insertmacro MUI_LANGUAGE "Albanian" - !insertmacro MUI_LANGUAGE "Arabic" - !insertmacro MUI_LANGUAGE "Basque" - !insertmacro MUI_LANGUAGE "Belarusian" - !insertmacro MUI_LANGUAGE "Bosnian" - !insertmacro MUI_LANGUAGE "Breton" - !insertmacro MUI_LANGUAGE "Bulgarian" - !insertmacro MUI_LANGUAGE "Croatian" - !insertmacro MUI_LANGUAGE "Czech" - !insertmacro MUI_LANGUAGE "Danish" - !insertmacro MUI_LANGUAGE "Dutch" - !insertmacro MUI_LANGUAGE "Estonian" - !insertmacro MUI_LANGUAGE "Farsi" - !insertmacro MUI_LANGUAGE "Finnish" - !insertmacro MUI_LANGUAGE "French" - !insertmacro MUI_LANGUAGE "German" - !insertmacro MUI_LANGUAGE "Greek" - !insertmacro MUI_LANGUAGE "Hebrew" - !insertmacro MUI_LANGUAGE "Hungarian" - !insertmacro MUI_LANGUAGE "Icelandic" - !insertmacro MUI_LANGUAGE "Indonesian" - !insertmacro MUI_LANGUAGE "Irish" - !insertmacro MUI_LANGUAGE "Italian" - !insertmacro MUI_LANGUAGE "Japanese" - !insertmacro MUI_LANGUAGE "Korean" - !insertmacro MUI_LANGUAGE "Kurdish" - !insertmacro MUI_LANGUAGE "Latvian" - !insertmacro MUI_LANGUAGE "Lithuanian" - !insertmacro MUI_LANGUAGE "Luxembourgish" - !insertmacro MUI_LANGUAGE "Macedonian" - !insertmacro MUI_LANGUAGE "Malay" - !insertmacro MUI_LANGUAGE "Mongolian" - !insertmacro MUI_LANGUAGE "Norwegian" - !insertmacro MUI_LANGUAGE "Polish" - !insertmacro MUI_LANGUAGE "Portuguese" - !insertmacro MUI_LANGUAGE "PortugueseBR" - !insertmacro MUI_LANGUAGE "Romanian" - !insertmacro MUI_LANGUAGE "Russian" - !insertmacro MUI_LANGUAGE "Serbian" - !insertmacro MUI_LANGUAGE "SerbianLatin" - !insertmacro MUI_LANGUAGE "SimpChinese" - !insertmacro MUI_LANGUAGE "Slovak" - !insertmacro MUI_LANGUAGE "Slovenian" - !insertmacro MUI_LANGUAGE "Spanish" - !insertmacro MUI_LANGUAGE "Swedish" - !insertmacro MUI_LANGUAGE "Thai" - !insertmacro MUI_LANGUAGE "TradChinese" - !insertmacro MUI_LANGUAGE "Turkish" - !insertmacro MUI_LANGUAGE "Ukrainian" - !insertmacro MUI_LANGUAGE "Welsh" - - -;-------------------------------- -;Reserve Files - - ;These files should be inserted before other files in the data block - ;Keep these lines before any File command - ;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA) - - !include "InstallOptions.nsh" - -;-------------------------------- -;Installer Sections - -Section "-Core installation" - ;Use the entire tree produced by the INSTALL target. Keep the - ;list of directories here in sync with the RMDir commands below. - SetOutPath "$INSTDIR" - @CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS@ - @CPACK_NSIS_FULL_INSTALL@ - - ;Store installation folder - WriteRegStr SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "" $INSTDIR - - ;Create uninstaller - WriteUninstaller "$INSTDIR\Uninstall.exe" - Push "DisplayName" - Push "@CPACK_NSIS_DISPLAY_NAME@" - Call ConditionalAddToRegisty - Push "DisplayVersion" - Push "@CPACK_PACKAGE_VERSION@" - Call ConditionalAddToRegisty - Push "Publisher" - Push "@CPACK_PACKAGE_VENDOR@" - Call ConditionalAddToRegisty - Push "UninstallString" - Push "$INSTDIR\Uninstall.exe" - Call ConditionalAddToRegisty - Push "NoRepair" - Push "1" - Call ConditionalAddToRegisty - - !ifdef CPACK_NSIS_ADD_REMOVE - ;Create add/remove functionality - Push "ModifyPath" - Push "$INSTDIR\AddRemove.exe" - Call ConditionalAddToRegisty - !else - Push "NoModify" - Push "1" - Call ConditionalAddToRegisty - !endif - - ; Optional registration - Push "DisplayIcon" - Push "$INSTDIR\@CPACK_NSIS_INSTALLED_ICON_NAME@" - Call ConditionalAddToRegisty - Push "HelpLink" - Push "@CPACK_NSIS_HELP_LINK@" - Call ConditionalAddToRegisty - Push "URLInfoAbout" - Push "@CPACK_NSIS_URL_INFO_ABOUT@" - Call ConditionalAddToRegisty - Push "Contact" - Push "@CPACK_NSIS_CONTACT@" - Call ConditionalAddToRegisty - !insertmacro INSTALLOPTIONS_READ $INSTALL_DESKTOP "NSIS.InstallOptions.ini" "Field 5" "State" - !insertmacro MUI_STARTMENU_WRITE_BEGIN Application - - ;Create shortcuts - CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER" -@CPACK_NSIS_CREATE_ICONS@ -@CPACK_NSIS_CREATE_ICONS_EXTRA@ - CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe" - - ;Read a value from an InstallOptions INI file - !insertmacro INSTALLOPTIONS_READ $DO_NOT_ADD_TO_PATH "NSIS.InstallOptions.ini" "Field 2" "State" - !insertmacro INSTALLOPTIONS_READ $ADD_TO_PATH_ALL_USERS "NSIS.InstallOptions.ini" "Field 3" "State" - !insertmacro INSTALLOPTIONS_READ $ADD_TO_PATH_CURRENT_USER "NSIS.InstallOptions.ini" "Field 4" "State" - - ; Write special uninstall registry entries - Push "StartMenu" - Push "$STARTMENU_FOLDER" - Call ConditionalAddToRegisty - Push "DoNotAddToPath" - Push "$DO_NOT_ADD_TO_PATH" - Call ConditionalAddToRegisty - Push "AddToPathAllUsers" - Push "$ADD_TO_PATH_ALL_USERS" - Call ConditionalAddToRegisty - Push "AddToPathCurrentUser" - Push "$ADD_TO_PATH_CURRENT_USER" - Call ConditionalAddToRegisty - Push "InstallToDesktop" - Push "$INSTALL_DESKTOP" - Call ConditionalAddToRegisty - - !insertmacro MUI_STARTMENU_WRITE_END - -@CPACK_NSIS_EXTRA_INSTALL_COMMANDS@ - - call InstallVarEnvs - - call InstallRedistributables - -SectionEnd - -Section "-Add to path" - Push $INSTDIR\bin - StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 doNotAddToPath - StrCmp $DO_NOT_ADD_TO_PATH "1" doNotAddToPath 0 - Call AddToPath - doNotAddToPath: -SectionEnd - -;-------------------------------- -; Create custom pages -Function InstallOptionsPage - !insertmacro MUI_HEADER_TEXT "Install Options" "Choose options for installing @CPACK_NSIS_PACKAGE_NAME@" - !insertmacro INSTALLOPTIONS_DISPLAY "NSIS.InstallOptions.ini" - -FunctionEnd - -;-------------------------------- -; determine admin versus local install -Function un.onInit - - ClearErrors - UserInfo::GetName - IfErrors noLM - Pop $0 - UserInfo::GetAccountType - Pop $1 - StrCmp $1 "Admin" 0 +3 - SetShellVarContext all - ;MessageBox MB_OK 'User "$0" is in the Admin group' - Goto done - StrCmp $1 "Power" 0 +3 - SetShellVarContext all - ;MessageBox MB_OK 'User "$0" is in the Power Users group' - Goto done - - noLM: - ;Get installation folder from registry if available - - done: - -FunctionEnd - -;--- Add/Remove callback functions: --- -!macro SectionList MacroName - ;This macro used to perform operation on multiple sections. - ;List all of your components in following manner here. -@CPACK_NSIS_COMPONENT_SECTION_LIST@ -!macroend - -Section -FinishComponents - ;Removes unselected components and writes component status to registry - !insertmacro SectionList "FinishSection" - -!ifdef CPACK_NSIS_ADD_REMOVE - ; Get the name of the installer executable - System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1' - StrCpy $R3 $R0 - - ; Strip off the last 13 characters, to see if we have AddRemove.exe - StrLen $R1 $R0 - IntOp $R1 $R0 - 13 - StrCpy $R2 $R0 13 $R1 - StrCmp $R2 "AddRemove.exe" addremove_installed - - ; We're not running AddRemove.exe, so install it - CopyFiles $R3 $INSTDIR\AddRemove.exe - - addremove_installed: -!endif -SectionEnd -;--- End of Add/Remove callback functions --- - -;-------------------------------- -; Component dependencies -Function .onSelChange - !insertmacro SectionList MaybeSelectionChanged -FunctionEnd - -;-------------------------------- -;Uninstaller Section - -Section "Uninstall" - ReadRegStr $START_MENU SHCTX \ - "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "StartMenu" - ;MessageBox MB_OK "Start menu is in: $START_MENU" - ReadRegStr $DO_NOT_ADD_TO_PATH SHCTX \ - "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "DoNotAddToPath" - ReadRegStr $ADD_TO_PATH_ALL_USERS SHCTX \ - "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "AddToPathAllUsers" - ReadRegStr $ADD_TO_PATH_CURRENT_USER SHCTX \ - "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "AddToPathCurrentUser" - ;MessageBox MB_OK "Add to path: $DO_NOT_ADD_TO_PATH all users: $ADD_TO_PATH_ALL_USERS" - ReadRegStr $INSTALL_DESKTOP SHCTX \ - "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "InstallToDesktop" - ;MessageBox MB_OK "Install to desktop: $INSTALL_DESKTOP " - -@CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS@ - - !insertmacro UninstallVarEnvs - - ;Remove files we installed. - ;Keep the list of directories here in sync with the File commands above. -@CPACK_NSIS_DELETE_FILES@ -@CPACK_NSIS_DELETE_DIRECTORIES@ - -!ifdef CPACK_NSIS_ADD_REMOVE - ;Remove the add/remove program - Delete "$INSTDIR\AddRemove.exe" -!endif - - ;Remove the uninstaller itself. - Delete "$INSTDIR\Uninstall.exe" - DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" - - ;Remove the installation directory if it is empty. - RMDir "$INSTDIR" - - ; Remove the registry entries. - DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" - - ; Removes all optional components - !insertmacro SectionList "RemoveSection_CPack" - - !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP - - Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk" -@CPACK_NSIS_DELETE_ICONS@ -@CPACK_NSIS_DELETE_ICONS_EXTRA@ - - ;Delete empty start menu parent diretories - StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" - - startMenuDeleteLoop: - ClearErrors - RMDir $MUI_TEMP - GetFullPathName $MUI_TEMP "$MUI_TEMP\.." - - IfErrors startMenuDeleteLoopDone - - StrCmp "$MUI_TEMP" "$SMPROGRAMS" startMenuDeleteLoopDone startMenuDeleteLoop - startMenuDeleteLoopDone: - - ; If the user changed the shortcut, then untinstall may not work. This should - ; try to fix it. - StrCpy $MUI_TEMP "$START_MENU" - Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk" -@CPACK_NSIS_DELETE_ICONS_EXTRA@ - - ;Delete empty start menu parent diretories - StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" - - secondStartMenuDeleteLoop: - ClearErrors - RMDir $MUI_TEMP - GetFullPathName $MUI_TEMP "$MUI_TEMP\.." - - IfErrors secondStartMenuDeleteLoopDone - - StrCmp "$MUI_TEMP" "$SMPROGRAMS" secondStartMenuDeleteLoopDone secondStartMenuDeleteLoop - secondStartMenuDeleteLoopDone: - - DeleteRegKey /ifempty SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" - - Push $INSTDIR\bin - StrCmp $DO_NOT_ADD_TO_PATH_ "1" doNotRemoveFromPath 0 - Call un.RemoveFromPath - doNotRemoveFromPath: -SectionEnd - -;-------------------------------- -; determine admin versus local install -; Is install for "AllUsers" or "JustMe"? -; Default to "JustMe" - set to "AllUsers" if admin or on Win9x -; This function is used for the very first "custom page" of the installer. -; This custom page does not show up visibly, but it executes prior to the -; first visible page and sets up $INSTDIR properly... -; Choose different default installation folder based on SV_ALLUSERS... -; "Program Files" for AllUsers, "My Documents" for JustMe... - -Function .onInit - StrCmp "@CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL@" "ON" 0 inst - - ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "UninstallString" - StrCmp $0 "" inst - - MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION \ - "@CPACK_NSIS_PACKAGE_NAME@ is already installed. $\n$\nDo you want to uninstall the old version before installing the new one?" \ - IDYES uninst IDNO inst - Abort - -;Run the uninstaller -uninst: - ClearErrors - StrLen $2 "\Uninstall.exe" - StrCpy $3 $0 -$2 # remove "\Uninstall.exe" from UninstallString to get path - ExecWait '$0 _?=$3' ;Do not copy the uninstaller to a temp file - - IfErrors uninst_failed inst -uninst_failed: - MessageBox MB_OK|MB_ICONSTOP "Uninstall failed." - Abort - - -inst: - ; Reads components status for registry - !insertmacro SectionList "InitSection" - - ${If} ${RunningX64} - StrCpy $VARPROGRAMFILES "$PROGRAMFILES64" - ${else} - StrCpy $VARPROGRAMFILES "$PROGRAMFILES" - ${EndIf} - - StrCmp "$INSTDIR" "" 0 +2 - StrCpy $INSTDIR "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@" - - ; check to see if /D has been used to change - ; the install directory by comparing it to the - ; install directory that is expected to be the - ; default - StrCpy $IS_DEFAULT_INSTALLDIR 0 - StrCmp "$INSTDIR" "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@" 0 +2 - StrCpy $IS_DEFAULT_INSTALLDIR 1 - - StrCpy $SV_ALLUSERS "JustMe" - ; if default install dir then change the default - ; if it is installed for JustMe - StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2 - StrCpy $INSTDIR "$DOCUMENTS\@CPACK_PACKAGE_INSTALL_DIRECTORY@" - - ClearErrors - UserInfo::GetName - IfErrors noLM - Pop $0 - UserInfo::GetAccountType - Pop $1 - StrCmp $1 "Admin" 0 +4 - SetShellVarContext all - ;MessageBox MB_OK 'User "$0" is in the Admin group' - StrCpy $SV_ALLUSERS "AllUsers" - Goto done - StrCmp $1 "Power" 0 +4 - SetShellVarContext all - ;MessageBox MB_OK 'User "$0" is in the Power Users group' - StrCpy $SV_ALLUSERS "AllUsers" - Goto done - - noLM: - StrCpy $SV_ALLUSERS "AllUsers" - ;Get installation folder from registry if available - - done: - StrCmp $SV_ALLUSERS "AllUsers" 0 +3 - StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2 - StrCpy $INSTDIR "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@" - - StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage - !insertmacro INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini" - - noOptionsPage: - - File /oname=$PLUGINSDIR\spltmp.jpg "@CPACK_TOPLEVEL_DIRECTORY@\eProsimaLogo.jpg" - newadvsplash::show 1000 600 400 -1 "$PLUGINSDIR\spltmp.jpg" - Pop $0 - -FunctionEnd diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/windows/NSISPackaging.cmake.in b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/windows/NSISPackaging.cmake.in deleted file mode 100644 index 424385f6e..000000000 --- a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/windows/NSISPackaging.cmake.in +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -# -# 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. - -# Prepare auxiliary NSIS scripts -string(TOUPPER "@PROJECT_NAME@" PROJECT_NAME_UPPER) - -set(MSVC_ARCH_DIR "") -if(@EPROSIMA_BUILD@) - set(MSVC_ARCH_DIR "\\@MSVC_ARCH@") -endif() - -if(@EPROSIMA_INSTALLER@) -configure_file(@PROJECT_SOURCE_DIR@/cmake/packaging/windows/EnvVarPage.nsh.in ${CPACK_TOPLEVEL_DIRECTORY}/EnvVarPage.nsh @ONLY) -else() -configure_file(@PROJECT_SOURCE_DIR@/cmake/packaging/windows/EnvVarPage_one_arch.nsh.in ${CPACK_TOPLEVEL_DIRECTORY}/EnvVarPage.nsh @ONLY) -endif() - -file(COPY @PROJECT_SOURCE_DIR@/cmake/packaging/windows/EnvVarUpdate.nsh - DESTINATION ${CPACK_TOPLEVEL_DIRECTORY}) - -file(COPY @PROJECT_SOURCE_DIR@/cmake/packaging/windows/InstallRedistributables.nsh - DESTINATION ${CPACK_TOPLEVEL_DIRECTORY}) - -# Copy images -file(COPY @PROJECT_SOURCE_DIR@/utils/images/logo/eProsimaLogo.jpg - DESTINATION ${CPACK_TOPLEVEL_DIRECTORY}) diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/windows/WindowsPackaging.cmake.in b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/windows/WindowsPackaging.cmake.in deleted file mode 100644 index cdd0680f9..000000000 --- a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/packaging/windows/WindowsPackaging.cmake.in +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -# -# 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. - -set(PROJECT_NAME_LARGE "@PROJECT_NAME_LARGE@") -set(MSVC_ARCH @MSVC_ARCH@) - -if(${CPACK_GENERATOR} STREQUAL "NSIS" ) - cmake_policy(SET CMP0012 NEW) - - if(@EPROSIMA_INSTALLER@) - # Define name of the NSIS file - set(CPACK_PACKAGE_FILE_NAME eProsima_@PROJECT_NAME_STYLED@-@PROJECT_VERSION@-Windows) - else() - # Define name of the NSIS file - set(CPACK_PACKAGE_FILE_NAME eProsima_@PROJECT_NAME_STYLED@-@PROJECT_VERSION@-${MSVC_ARCH}) - endif() - - set(CPACK_NSIS_DISPLAY_NAME "@PROJECT_NAME_LARGE@ @PROJECT_VERSION@") - set(CPACK_NSIS_PACKAGE_NAME "eProsima @PROJECT_NAME_LARGE@ @PROJECT_VERSION@") - set(CPACK_NSIS_URL_INFO_ABOUT "www.eprosima.com") - set(CPACK_NSIS_CONTACT "support@eprosima.com") - set(CPACK_NSIS_MUI_ICON "@PROJECT_SOURCE_DIR@\\utils\\images\\icon\\eprosima_icon.ico") - set(CPACK_PACKAGE_ICON "@PROJECT_SOURCE_DIR@\\utils\\images\\icon\\eprosima_icon.bmp") - set(CPACK_NSIS_INSTALL_ROOT "$VARPROGRAMFILES\\eProsima") - - # Define cmake script to copy images files and prepare auxiliary NSIS scripts. - set(CPACK_INSTALL_SCRIPT "@PROJECT_BINARY_DIR@/cmake/packaging/windows/NSISPackaging.cmake") -endif() - diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/testing/GoogleTest.cmake b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/testing/GoogleTest.cmake new file mode 100644 index 000000000..c10612a51 --- /dev/null +++ b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/testing/GoogleTest.cmake @@ -0,0 +1,30 @@ +# Copyright 2023 Proyectos y Sistemas de Mantenimiento SL (eProsima). +# +# 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(GoogleTest) + +function(gtest_discover_tests TARGET) + cmake_minimum_required(VERSION 3.22) + if (WIN32) + add_custom_command( + TARGET ${TARGET} POST_BUILD + COMMAND ${CMAKE_COMMAND} -DTARGET=${TARGET} -DCONFIG=$ -DRUNTIME_LIST=$ -P ${CMAKE_SOURCE_DIR}/cmake/testing/generate_google_test_win_wrapper.cmake + COMMAND_EXPAND_LISTS + VERBATIM + ) + + set(CMAKE_COMMAND "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_win_wrapper_$.bat") + endif() + _gtest_discover_tests(${TARGET} ${ARGN}) +endfunction() diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/testing/generate_google_test_win_wrapper.cmake b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/testing/generate_google_test_win_wrapper.cmake new file mode 100644 index 000000000..1a6f62335 --- /dev/null +++ b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/cmake/testing/generate_google_test_win_wrapper.cmake @@ -0,0 +1,40 @@ +# Copyright 2023 Proyectos y Sistemas de Mantenimiento SL (eProsima). +# +# 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. + +if (NOT DEFINED TARGET) + message(FATAL_ERROR "This scrips needs TARGET variable set") +endif() +if (NOT DEFINED CONFIG) + message(FATAL_ERROR "This scrips needs CONFIG variable set") +endif() +if (NOT DEFINED RUNTIME_LIST) + message(FATAL_ERROR "This scrips needs RUNTIME_LIST variable set") +endif() + +set(_path "") + +foreach(_runtime_dll IN LISTS RUNTIME_LIST) + cmake_path(GET _runtime_dll PARENT_PATH _runtime_dll_path) + cmake_path(NATIVE_PATH _runtime_dll_path _runtime_dll_path_native) + list(APPEND _path "${_runtime_dll_path_native}") +endforeach() + +list(REMOVE_DUPLICATES _path) + +cmake_path(NATIVE_PATH CMAKE_COMMAND _cmake_command) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_win_wrapper_${CONFIG}.bat" " +@ECHO OFF +set \"PATH=${_path};%PATH%\" +\"${_cmake_command}\" %* +") diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/include/Makefile.am.in b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/include/Makefile.am.in deleted file mode 100644 index 39cbc5cea..000000000 --- a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/include/Makefile.am.in +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -# -# 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. - -library_includedir = $(includedir) -nobase_library_include_HEADERS = ${${PROJECT_NAME}_PUBLIC_HEADERS_AUTOTOOLS} diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/include/fastcdr/Cdr.h b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/include/fastcdr/Cdr.h index 5748cd489..ba51fa2b8 100644 --- a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/include/fastcdr/Cdr.h +++ b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/include/fastcdr/Cdr.h @@ -266,7 +266,7 @@ class Cdr Cdr_DllAPI size_t get_serialized_data_length() const; /*! - * @brief Get the number of bytes needed to align a position to certain data size. + * @brief Returns the number of bytes needed to align a position to certain data size. * @param current_alignment Position to be aligned. * @param data_size Size of next data to process (should be power of two). * @return Number of required alignment bytes. @@ -748,26 +748,17 @@ class Cdr Cdr& serialize( const std::array<_T, _Size>& array_t) { - Cdr::state dheader_state(*this); - - if (CdrVersion::XCDRv2 == cdr_version_ && !is_multi_array_primitive(&array_t)) + if (!is_multi_array_primitive(&array_t)) { - // Serialize DHEADER - uint32_t dheader {0}; - serialize(dheader); - } + Cdr::state dheader_state {allocate_xcdrv2_dheader()}; - serialize_array(array_t.data(), array_t.size()); + serialize_array(array_t.data(), array_t.size()); - if (CdrVersion::XCDRv2 == cdr_version_ && !is_multi_array_primitive(&array_t)) + set_xcdrv2_dheader(dheader_state); + } + else { - auto offset = offset_; - Cdr::state state_after(*this); - set_state(dheader_state); - size_t dheader = offset - offset_ - (4 + alignment(sizeof(uint32_t)));/* DHEADER */ - serialize(static_cast(dheader)); - set_state(state_after); - serialized_member_size_ = SERIALIZED_MEMBER_SIZE; + serialize_array(array_t.data(), array_t.size()); } return *this; @@ -784,14 +775,7 @@ class Cdr Cdr& serialize( const std::vector<_T>& vector_t) { - Cdr::state dheader_state(*this); - - if (CdrVersion::XCDRv2 == cdr_version_) - { - // Serialize DHEADER - uint32_t dheader {0}; - serialize(dheader); - } + Cdr::state dheader_state {allocate_xcdrv2_dheader()}; serialize(static_cast(vector_t.size())); @@ -805,16 +789,7 @@ class Cdr ex.raise(); } - if (CdrVersion::XCDRv2 == cdr_version_) - { - auto offset = offset_; - Cdr::state state_after(*this); - set_state(dheader_state); - size_t dheader = offset - offset_ - (4 + alignment(sizeof(uint32_t)));/* DHEADER */ - serialize(static_cast(dheader)); - set_state(state_after); - serialized_member_size_ = SERIALIZED_MEMBER_SIZE; - } + set_xcdrv2_dheader(dheader_state); return *this; } @@ -876,14 +851,7 @@ class Cdr Cdr& serialize( const std::map<_K, _T>& map_t) { - Cdr::state dheader_state(*this); - - if (CdrVersion::XCDRv2 == cdr_version_) - { - // Serialize DHEADER - uint32_t dheader {0}; - serialize(dheader); - } + Cdr::state dheader_state {allocate_xcdrv2_dheader()}; serialize(static_cast(map_t.size())); @@ -901,16 +869,7 @@ class Cdr ex.raise(); } - if (CdrVersion::XCDRv2 == cdr_version_) - { - auto offset = offset_; - Cdr::state state_after(*this); - set_state(dheader_state); - size_t dheader = offset - offset_ - (4 + alignment(sizeof(uint32_t)));/* DHEADER */ - serialize(static_cast(dheader)); - set_state(state_after); - serialized_member_size_ = SERIALIZED_MEMBER_SIZE; - } + set_xcdrv2_dheader(dheader_state); return *this; } @@ -1271,6 +1230,91 @@ class Cdr return *this; } + /*! + * @brief Encodes an std::vector of primitives as an array. + * @param[in] value Reference to a std::vector. + * @return Reference to the eprosima::fastcdr::Cdr object. + * @exception exception::NotEnoughMemoryException This exception is thrown when trying to encode into a buffer + * position that exceeds the internal memory size. + */ + template::value || + std::is_arithmetic<_T>::value>::type* = nullptr> + Cdr& serialize_array( + const std::vector<_T>& value) + { + serialize_array(value.data(), value.size()); + + return *this; + } + + /*! + * @brief Encodes an std::vector of non-primitives as an array. + * @param[in] value Reference to a std::vector. + * @return Reference to the eprosima::fastcdr::Cdr object. + * @exception exception::NotEnoughMemoryException This exception is thrown when trying to encode into a buffer + * position that exceeds the internal memory size. + */ + template::value && + !std::is_arithmetic<_T>::value>::type* = nullptr> + Cdr& serialize_array( + const std::vector<_T>& value) + { + Cdr::state dheader_state {allocate_xcdrv2_dheader()}; + + serialize_array(value.data(), value.size()); + + set_xcdrv2_dheader(dheader_state); + + return *this; + } + + /*! + * @brief Encodes an std::vector as an array with a different endianness. + * @param[in] value Reference to a std::vector. + * @param[in] endianness Endianness that will be used in the serialization of this value. + * @return Reference to the eprosima::fastcdr::Cdr object. + * @exception exception::NotEnoughMemoryException This exception is thrown when trying to encode into a buffer + * position that exceeds the internal memory size. + */ + template + Cdr& serialize_array( + const std::vector<_T>& value, + Endianness endianness) + { + bool aux_swap = swap_bytes_; + swap_bytes_ = (swap_bytes_ && (static_cast(endianness_) == endianness)) || + (!swap_bytes_ && (static_cast(endianness_) != endianness)); + + try + { + serialize_array(value); + swap_bytes_ = aux_swap; + } + catch (exception::Exception& ex) + { + swap_bytes_ = aux_swap; + ex.raise(); + } + + return *this; + } + + /*! + * @brief Encodes an std::vector of booleans as an array. + * @param[in] value Reference to a std::vector. + * @return Reference to the eprosima::fastcdr::Cdr object. + * @exception exception::NotEnoughMemoryException This exception is thrown when trying to encode into a buffer + * position that exceeds the internal memory size. + */ + TEMPLATE_SPEC + Cdr& serialize_array( + const std::vector& value) + { + serialize_bool_array(value); + + return *this; + } + /*! * @brief This function template serializes a raw sequence of non-primitives * @param sequence_t Pointer to the sequence that will be serialized in the buffer. @@ -1284,14 +1328,7 @@ class Cdr const _T* sequence_t, size_t num_elements) { - Cdr::state dheader_state(*this); - - if (CdrVersion::XCDRv2 == cdr_version_) - { - // Serialize DHEADER - uint32_t dheader {0}; - serialize(dheader); - } + Cdr::state dheader_state {allocate_xcdrv2_dheader()}; serialize(static_cast(num_elements)); @@ -1305,16 +1342,7 @@ class Cdr ex.raise(); } - if (CdrVersion::XCDRv2 == cdr_version_) - { - auto offset = offset_; - Cdr::state state_after(*this); - set_state(dheader_state); - size_t dheader = offset - offset_ - (4 + alignment(sizeof(uint32_t)));/* DHEADER */ - serialize(static_cast(dheader)); - set_state(state_after); - serialized_member_size_ = SERIALIZED_MEMBER_SIZE; - } + set_xcdrv2_dheader(dheader_state); return *this; } @@ -2330,6 +2358,120 @@ class Cdr bool* bool_t, size_t num_elements); + /*! + * @brief Decodes an array of primitives on a std::vector. + * + * std::vector must have allocated the number of element of the array. + * + * @param[out] value Reference to the std::vector where the array will be stored after decoding from the buffer. + * @return Reference to the eprosima::fastcdr::Cdr object. + * @exception exception::NotEnoughMemoryException This exception is thrown when trying to decode from a buffer + * position that exceeds the internal memory size. + */ + template::value || + std::is_arithmetic<_T>::value>::type* = nullptr> + Cdr& deserialize_array( + std::vector<_T>& value) + { + deserialize_array(value.data(), value.size()); + + return *this; + } + + /*! + * @brief Decodes an array of non-primitives on a std::vector. + * + * std::vector must have allocated the number of element of the array. + * + * @param[out] value Reference to the std::vector where the array will be stored after decoding from the buffer. + * @return Reference to the eprosima::fastcdr::Cdr object. + * @exception exception::NotEnoughMemoryException This exception is thrown when trying to decode from a buffer + * position that exceeds the internal memory size. + */ + template::value && + !std::is_arithmetic<_T>::value>::type* = nullptr> + Cdr& deserialize_array( + std::vector<_T>& value) + { + if (CdrVersion::XCDRv2 == cdr_version_) + { + uint32_t dheader {0}; + deserialize(dheader); + + uint32_t count {0}; + auto offset = offset_; + while (offset_ - offset < dheader && count < value.size()) + { + deserialize_array(&value.data()[count], 1); + ++count; + } + + if (offset_ - offset != dheader) + { + throw exception::BadParamException("Member size greater than size specified by DHEADER"); + } + } + else + { + return deserialize_array(value.data(), value.size()); + } + + return *this; + } + + /*! + * @brief Decodes an array of non-primitives on a std::vector with a different endianness. + * + * std::vector must have allocated the number of element of the array. + * + * @param[out] value Reference to the std::vector where the array will be stored after decoding from the buffer. + * @param[in] endianness Endianness that will be used in the serialization of this value. + * @return Reference to the eprosima::fastcdr::Cdr object. + * @exception exception::NotEnoughMemoryException This exception is thrown when trying to decode from a buffer + * position that exceeds the internal memory size. + */ + template + Cdr& deserialize_array( + std::vector<_T>& value, + Endianness endianness) + { + bool aux_swap = swap_bytes_; + swap_bytes_ = (swap_bytes_ && (static_cast(endianness_) == endianness)) || + (!swap_bytes_ && (static_cast(endianness_) != endianness)); + + try + { + deserialize_array(value); + swap_bytes_ = aux_swap; + } + catch (exception::Exception& ex) + { + swap_bytes_ = aux_swap; + ex.raise(); + } + + return *this; + } + + /*! + * @brief Decodes an array of booleans on a std::vector. + * + * std::vector must have allocated the number of element of the array. + * + * @param[out] value Reference to the std::vector where the array will be stored after decoding from the buffer. + * @return Reference to the eprosima::fastcdr::Cdr object. + * @exception exception::NotEnoughMemoryException This exception is thrown when trying to encode into a buffer + * position that exceeds the internal memory size. + */ + TEMPLATE_SPEC + Cdr& deserialize_array( + std::vector& value) + { + deserialize_bool_array(value); + + return *this; + } + /*! * @brief This function template deserializes a raw sequence of non-primitives. * This function allocates memory to store the sequence. The user pointer will be set to point this allocated memory. @@ -2760,13 +2902,7 @@ class Cdr if (!value) { - value = external<_T>{new -#if !defined(_MSC_VER) || _MSC_VER >= 1920 - _T() -#else - external<_T>::type() -#endif // if _MSC_VER >= 1920 - }; + value = external<_T>{new typename external<_T>::type()}; } deserialize(*value); @@ -2803,6 +2939,22 @@ class Cdr return *this; } + /*! + * @brief Encodes an empty DHEADER if the encoding version is XCDRv2. + * After serializing the members's type, @ref set_xcdrv2_dheader must be called to set the correct DHEADER value + * using the @ref state returned by this function. + */ + Cdr_DllAPI state allocate_xcdrv2_dheader(); + + /*! + * @brief Uses the @ref state to calculate the member's type size and serialize the value in the previous allocated + * DHEADER. + * + * @param[in] state @ref state used to calculate the member's type size. + */ + Cdr_DllAPI void set_xcdrv2_dheader( + const state& state); + private: Cdr( @@ -2811,9 +2963,15 @@ class Cdr Cdr& operator =( const Cdr&) = delete; + Cdr_DllAPI Cdr& serialize_bool_array( + const std::vector& vector_t); + Cdr_DllAPI Cdr& serialize_bool_sequence( const std::vector& vector_t); + Cdr_DllAPI Cdr& deserialize_bool_array( + std::vector& vector_t); + Cdr_DllAPI Cdr& deserialize_bool_sequence( std::vector& vector_t); @@ -2873,7 +3031,8 @@ class Cdr } /*! - * @brief This function returns the extra bytes regarding the allignment. + * @brief Returns the number of bytes needed to align the current position (having as reference the origin) to + * certain data size. * @param data_size The size of the data that will be serialized. * @return The size needed for the alignment. */ @@ -3373,13 +3532,16 @@ class Cdr //! Align for types equal or greater than 64bits. size_t align64_ {4}; - + /*! + * When serializing a member's type using XCDRv2, this enumerator is used to inform the type was serialized with a + * DHEADER and the algorithm could optimize the XCDRv2 member header. + */ enum SerializedMemberSizeForNextInt { - NO_SERIALIZED_MEMBER_SIZE, - SERIALIZED_MEMBER_SIZE, - SERIALIZED_MEMBER_SIZE_4, - SERIALIZED_MEMBER_SIZE_8 + NO_SERIALIZED_MEMBER_SIZE, //! Default. No serialized member size in a DHEADER. + SERIALIZED_MEMBER_SIZE, //! Serialized member size in a DHEADER. + SERIALIZED_MEMBER_SIZE_4, //! Serialized member size (which is a multiple of 4) in a DHEADER. + SERIALIZED_MEMBER_SIZE_8 //! Serialized member size (which is a multiple of 8) in a DHEADER. } //! Specifies if a DHEADER was serialized. Used to optimize XCDRv2 member headers. serialized_member_size_ {NO_SERIALIZED_MEMBER_SIZE}; diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/include/fastcdr/CdrSizeCalculator.hpp b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/include/fastcdr/CdrSizeCalculator.hpp index 423b32333..67860e2a9 100644 --- a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/include/fastcdr/CdrSizeCalculator.hpp +++ b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/include/fastcdr/CdrSizeCalculator.hpp @@ -60,6 +60,16 @@ class CdrSizeCalculator Cdr_DllAPI CdrSizeCalculator( CdrVersion cdr_version); + /*! + * @brief Constructor. + * @param[in] cdr_version Represents the version of the encoding algorithm that will be used for the encoding. + * The default value is CdrVersion::XCDRv2. + * @param[in] encoding Represents the initial encoding. + */ + Cdr_DllAPI CdrSizeCalculator( + CdrVersion cdr_version, + EncodingAlgorithmFlag encoding); + /*! * @brief Retrieves the version of the encoding algorithm used by the instance. * @return Configured CdrVersion. @@ -1057,6 +1067,68 @@ class CdrSizeCalculator return calculate_array_serialized_size(data->data(), num_elements * data->size(), current_alignment); } + /*! + * @brief Specific template which calculates the encoded size of an std::vector of primitives as an array. + * @param[in] data Reference to the instance. + * @param[inout] current_alignment Current alignment in the encoding. + * @return Encoded size of the instance. + */ + template::value || + std::is_arithmetic<_T>::value>::type* = nullptr> + size_t calculate_array_serialized_size( + const std::vector<_T>& data, + size_t& current_alignment) + { + return calculate_array_serialized_size(data.data(), data.size(), current_alignment); + } + + /*! + * @brief Specific template which calculates the encoded size of an std::vector of non-primitives as an array. + * @param[in] data Reference to the instance. + * @param[inout] current_alignment Current alignment in the encoding. + * @return Encoded size of the instance. + */ + template::value && + !std::is_arithmetic<_T>::value>::type* = nullptr> + size_t calculate_array_serialized_size( + const std::vector<_T>& data, + size_t& current_alignment) + { + size_t initial_alignment {current_alignment}; + + if (CdrVersion::XCDRv2 == cdr_version_) + { + // DHEADER + current_alignment += 4 + alignment(current_alignment, 4); + } + + size_t calculated_size {current_alignment - initial_alignment}; + calculated_size += calculate_array_serialized_size(data.data(), data.size(), current_alignment); + + if (CdrVersion::XCDRv2 == cdr_version_) + { + // Inform DHEADER can be joined with NEXTINT + serialized_member_size_ = SERIALIZED_MEMBER_SIZE; + } + + return calculated_size; + } + + /*! + * @brief Specific template which calculates the encoded size of an std::vector of bool as an array. + * @param[in] data Reference to the instance. + * @param[inout] current_alignment Current alignment in the encoding. + * @return Encoded size of the instance. + */ + TEMPLATE_SPEC + size_t calculate_array_serialized_size( + const std::vector& data, + size_t& current_alignment) + { + current_alignment += data.size(); + return data.size(); + } + /*! * @brief Generic template which calculates the encoded size of the constructed type's member of a unknown type. * @tparam _T Member's type. diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/include/fastcdr/config/doxygen_modules.h b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/include/fastcdr/config/doxygen_modules.h new file mode 100644 index 000000000..521200293 --- /dev/null +++ b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/include/fastcdr/config/doxygen_modules.h @@ -0,0 +1,34 @@ +// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// 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. + +/** + * @file doxygen_modules.h + */ + +#ifndef FASTCDR_DOXYGEN_MODULES_H_ +#define FASTCDR_DOXYGEN_MODULES_H_ + +/*! + * @defgroup FASTCDRAPIREFERENCE FastCDR Serializer API Reference + * @brief FastCDR Serializer internal API groped in modules. + */ + +/*! + * @defgroup EXCEPTIONMODULE Exceptions + * @ingroup FASTCDRAPIREFERENCE + * @brief Exceptions used by the FastCDR API. + * All exceptions defined in this module are thrown by the FastCDR library. + */ + +#endif /* FASTCDR_DOXYGEN_MODULES_H_ */ diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/src/cpp/Cdr.cpp b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/src/cpp/Cdr.cpp index 34e2ebe8b..189ee21d0 100644 --- a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/src/cpp/Cdr.cpp +++ b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/src/cpp/Cdr.cpp @@ -1643,13 +1643,8 @@ Cdr& Cdr::deserialize( // Allocate memory. string_t = reinterpret_cast(calloc(length + 1, sizeof(wchar_t))); // WStrings never serialize terminating zero - for (size_t idx = 0; idx < length; ++idx) - { - uint16_t temp; - offset_ >> temp; - string_t[idx] = static_cast(temp); - offset_ += sizeof(uint16_t); - } + deserialize_array(string_t, length); + return *this; } @@ -2156,6 +2151,44 @@ Cdr& Cdr::deserialize_array( throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); } +Cdr& Cdr::serialize_bool_array( + const std::vector& vector_t) +{ + state state_before_error(*this); + + size_t total_size = vector_t.size() * sizeof(bool); + + if (((end_ - offset_) >= total_size) || resize(total_size)) + { + // Save last datasize. + last_data_size_ = sizeof(bool); + + for (size_t count = 0; count < vector_t.size(); ++count) + { + uint8_t value = 0; + std::vector::const_reference ref = vector_t[count]; + + if (ref) + { + value = 1; + } + offset_++ << value; + } + } + else + { + set_state(state_before_error); + throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); + } + + if (CdrVersion::XCDRv2 == cdr_version_) + { + serialized_member_size_ = SERIALIZED_MEMBER_SIZE; + } + + return *this; +} + Cdr& Cdr::serialize_bool_sequence( const std::vector& vector_t) { @@ -2196,6 +2229,46 @@ Cdr& Cdr::serialize_bool_sequence( return *this; } +Cdr& Cdr::deserialize_bool_array( + std::vector& vector_t) +{ + state state_before_error(*this); + + size_t total_size = vector_t.size() * sizeof(bool); + + if ((end_ - offset_) >= total_size) + { + // Save last datasize. + last_data_size_ = sizeof(bool); + + for (uint32_t count = 0; count < vector_t.size(); ++count) + { + uint8_t value = 0; + offset_++ >> value; + + if (value == 1) + { + vector_t[count] = true; + } + else if (value == 0) + { + vector_t[count] = false; + } + else + { + throw BadParamException("Unexpected byte value in Cdr::deserialize_bool_sequence, expected 0 or 1"); + } + } + } + else + { + set_state(state_before_error); + throw NotEnoughMemoryException(NotEnoughMemoryException::NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT); + } + + return *this; +} + Cdr& Cdr::deserialize_bool_sequence( std::vector& vector_t) { @@ -3304,5 +3377,34 @@ Cdr& Cdr::cdr_deserialize_type( return *this; } +Cdr::state Cdr::allocate_xcdrv2_dheader() +{ + Cdr::state dheader_state(*this); + + if (CdrVersion::XCDRv2 == cdr_version_) + { + // Serialize DHEADER + uint32_t dheader {0}; + serialize(dheader); + } + + return dheader_state; +} + +void Cdr::set_xcdrv2_dheader( + const Cdr::state& dheader_state) +{ + if (CdrVersion::XCDRv2 == cdr_version_) + { + auto offset = offset_; + Cdr::state state_after(*this); + set_state(dheader_state); + size_t dheader = offset - offset_ - (4 + alignment(sizeof(uint32_t))); /* DHEADER */ + serialize(static_cast(dheader)); + set_state(state_after); + serialized_member_size_ = SERIALIZED_MEMBER_SIZE; + } +} + } // namespace fastcdr } // namespace eprosima diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/src/cpp/CdrSizeCalculator.cpp b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/src/cpp/CdrSizeCalculator.cpp index c642de473..6462422b2 100644 --- a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/src/cpp/CdrSizeCalculator.cpp +++ b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/src/cpp/CdrSizeCalculator.cpp @@ -32,6 +32,14 @@ CdrSizeCalculator::CdrSizeCalculator( } } +CdrSizeCalculator::CdrSizeCalculator( + CdrVersion cdr_version, + EncodingAlgorithmFlag encoding) + : cdr_version_(cdr_version) + , current_encoding_(encoding) +{ +} + CdrVersion CdrSizeCalculator::get_cdr_version() const { return cdr_version_; diff --git a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/src/cpp/Makefile.am.in b/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/src/cpp/Makefile.am.in deleted file mode 100644 index d5b7cd8b1..000000000 --- a/plotjuggler_plugins/ParserROS/rosx_introspection/3rdparty/Fast-CDR/src/cpp/Makefile.am.in +++ /dev/null @@ -1,7 +0,0 @@ -ACLOCAL_AMFLAGS = -I m4 --install - -lib_LTLIBRARIES = lib${PROJECT_NAME}.la -lib${PROJECT_NAME}_la_SOURCES = ${${PROJECT_NAME}_SOURCES_AUTOTOOLS} -lib${PROJECT_NAME}_la_LDFLAGS = -version-number ${PROJECT_VERSION_AUTOTOOLS} - -AM_CPPFLAGS = -DFASTCDR_SOURCE -I../../include