Skip to content

Commit

Permalink
Merge pull request #4561 from matkatz/offline-build
Browse files Browse the repository at this point in the history
fix offline build errors
  • Loading branch information
dorodnic authored Aug 4, 2019
2 parents d982a68 + 42f47a5 commit 8e0c499
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 27 deletions.
1 change: 0 additions & 1 deletion CMake/global_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ include(GNUInstallDirs)
# include librealsense helper macros
include(CMake/lrs_macros.cmake)
include(CMake/version_config.cmake)
include(CMake/lrs_options.cmake)

if(ENABLE_CCACHE)
find_program(CCACHE_FOUND ccache)
Expand Down
30 changes: 16 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,21 @@
cmake_minimum_required(VERSION 3.1.0)
project(librealsense2 LANGUAGES CXX C)

include(CMake/lrs_options.cmake)
include(CMake/connectivity_check.cmake)

# Checking Internet connection, as TM2 needs to download the FW from amazon cloud
if(BUILD_WITH_TM2 AND NOT INTERNET_CONNECTION)
message(WARNING "No internet connection, disabling BUILD_WITH_TM2")
set(BUILD_WITH_TM2 OFF)
endif()

# Checking Internet connection, as TM2 needs to download the FW from amazon cloud
if(IMPORT_DEPTH_CAM_FW AND NOT INTERNET_CONNECTION)
message(WARNING "No internet connection, disabling IMPORT_DEPTH_CAM_FW")
set(IMPORT_DEPTH_CAM_FW OFF)
endif()

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/CMake)

# include librealsense general configuration
Expand Down Expand Up @@ -33,12 +46,6 @@ endif()
# set library version
set_target_properties(${LRS_TARGET} PROPERTIES VERSION ${REALSENSE_VERSION_STRING} SOVERSION "${REALSENSE_VERSION_MAJOR}.${REALSENSE_VERSION_MINOR}")

# Checking Internet connection, as TM2 needs to download the FW from amazon cloud
if(BUILD_WITH_TM2 AND NOT INTERNET_CONNECTION)
message(STATUS "No internet connection, disabling BUILD_WITH_TM2")
set(BUILD_WITH_TM2 OFF)
endif()

include(include/CMakeLists.txt)
include(src/CMakeLists.txt)
include(third-party/CMakeLists.txt)
Expand Down Expand Up @@ -75,17 +82,12 @@ if(BUILD_UNIT_TESTS)
add_subdirectory(unit-tests)
endif()

if (BUILD_WITH_TM2)
if(BUILD_WITH_TM2)
add_tm2()
endif()

if (IMPORT_DEPTH_CAM_FW)
if(INTERNET_CONNECTION)
add_subdirectory(common/fw)
else()
message(STATUS "No internet connection, disabling IMPORT_UVC_FW")
set(IMPORT_DEPTH_CAM_FW OFF)
endif()
if(IMPORT_DEPTH_CAM_FW)
add_subdirectory(common/fw)
endif()

include(CMake/embedd_udev_rules.cmake)
7 changes: 7 additions & 0 deletions common/fw-update-helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,17 @@
#else
#define FW_D4XX_FW_IMAGE_VERSION ""
#define FW_SR3XX_FW_IMAGE_VERSION ""
const char* fw_get_D4XX_FW_Image(int) { return NULL; }
const char* fw_get_SR3XX_FW_Image(int) { return NULL; }
#endif // INTERNAL_FW

namespace rs2
{
bool is_recommended_fw_available()
{
return !(strcmp("", FW_D4XX_FW_IMAGE_VERSION) == 0);
}

static std::map<int, std::string> product_line_to_fw =
{
{RS2_PRODUCT_LINE_D400, FW_D4XX_FW_IMAGE_VERSION},
Expand Down
1 change: 1 addition & 0 deletions common/fw-update-helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace rs2
std::map<int, std::vector<uint8_t>> create_default_fw_table();
std::vector<int> parse_fw_version(const std::string& fw);
bool is_upgradeable(const std::string& curr, const std::string& available);
bool is_recommended_fw_available();

class firmware_update_manager : public std::enable_shared_from_this<firmware_update_manager>
{
Expand Down
28 changes: 16 additions & 12 deletions common/model-views.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4076,22 +4076,26 @@ namespace rs2
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Install official signed firmware from file to the device");

if ((dev.supports(RS2_CAMERA_INFO_PRODUCT_LINE)) ||
(dev.query_sensors().size() && dev.query_sensors().front().supports(RS2_CAMERA_INFO_PRODUCT_LINE)))
if (ImGui::Selectable("Install Recommended Firmware "))
if (is_recommended_fw_available() &&
((dev.supports(RS2_CAMERA_INFO_PRODUCT_LINE)) ||
(dev.query_sensors().size() && dev.query_sensors().front().supports(RS2_CAMERA_INFO_PRODUCT_LINE))))
{
auto sensors = dev.query_sensors();
auto product_line_str = "";
if (dev.supports(RS2_CAMERA_INFO_PRODUCT_LINE))
product_line_str = dev.get_info(RS2_CAMERA_INFO_PRODUCT_LINE);
if (sensors.size() && sensors.front().supports(RS2_CAMERA_INFO_PRODUCT_LINE))
product_line_str = sensors.front().get_info(RS2_CAMERA_INFO_PRODUCT_LINE);
int product_line = parse_product_line(product_line_str);
if (ImGui::Selectable("Install Recommended Firmware "))
{
auto sensors = dev.query_sensors();
auto product_line_str = "";
if (dev.supports(RS2_CAMERA_INFO_PRODUCT_LINE))
product_line_str = dev.get_info(RS2_CAMERA_INFO_PRODUCT_LINE);
if (sensors.size() && sensors.front().supports(RS2_CAMERA_INFO_PRODUCT_LINE))
product_line_str = sensors.front().get_info(RS2_CAMERA_INFO_PRODUCT_LINE);
int product_line = parse_product_line(product_line_str);

static auto table = create_default_fw_table();
static auto table = create_default_fw_table();

begin_update(table[product_line], viewer, error_message);
begin_update(table[product_line], viewer, error_message);
}
}

if (ImGui::IsItemHovered())
ImGui::SetTooltip("Install default recommended firmware for this device");
}
Expand Down

0 comments on commit 8e0c499

Please sign in to comment.