Skip to content

Commit

Permalink
Compileble on host: Fedora 38
Browse files Browse the repository at this point in the history
Added building script for reference:
- docker-build.sh
- host-build.sh

Code ported to 2023:
- fixed opencv4
- fixed jsoncpp
- fixed typedef for pybind11 definitions
- fixed syscall issues related to SIGSTKSZ ( see more: r-lib/testthat#1373 (comment) )
  • Loading branch information
cesare-montresor committed Nov 5, 2023
1 parent 589d091 commit 2516ba9
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions docker-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cmake -DEGL_RENDERING=ON -DPYTHON_EXECUTABLE:FILEPATH=/root/mount/conda/envs/vlnce2/bin/python ..
7 changes: 7 additions & 0 deletions docker-shell.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#! /bin/bash

docker run --gpus all -it --mount type=bind,source=$MATTERPORT_DATA_DIR,target=/root/mount/Matterport3DSimulator/data/v1/scans \
--volume /home/cesare/Projects/Matterport3DSimulator/:/root/mount/Matterport3DSimulator \
--volume /home/cesare/.conda/:/root/mount/conda \
mattersim:9.2-devel-ubuntu18.04

1 change: 1 addition & 0 deletions host-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cmake -DEGL_RENDERING=ON -DPYTHON_EXECUTABLE:FILEPATH=/home/cesare/anaconda3/envs/vlnce/bin/python ..
6 changes: 3 additions & 3 deletions include/Catch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6462,7 +6462,7 @@ namespace Catch {
static bool isSet;
static struct sigaction oldSigActions[];// [sizeof(signalDefs) / sizeof(SignalDefs)];
static stack_t oldSigStack;
static char altStackMem[];
static char altStackMem[32768]; // SIGSTKSZ

static void handleSignal( int sig );

Expand Down Expand Up @@ -6597,7 +6597,7 @@ namespace Catch {
isSet = true;
stack_t sigStack;
sigStack.ss_sp = altStackMem;
sigStack.ss_size = SIGSTKSZ;
sigStack.ss_size = 32768; //quick fix for: SIGSTKSZ -> proper fix: https://github.com/r-lib/testthat/issues/1373#issuecomment-867661266
sigStack.ss_flags = 0;
sigaltstack(&sigStack, &oldSigStack);
struct sigaction sa = { };
Expand Down Expand Up @@ -6628,7 +6628,7 @@ namespace Catch {
bool FatalConditionHandler::isSet = false;
struct sigaction FatalConditionHandler::oldSigActions[sizeof(signalDefs)/sizeof(SignalDefs)] = {};
stack_t FatalConditionHandler::oldSigStack = {};
char FatalConditionHandler::altStackMem[SIGSTKSZ] = {};
char FatalConditionHandler::altStackMem[32768] = {}; //quick fix for: SIGSTKSZ

} // namespace Catch

Expand Down
3 changes: 2 additions & 1 deletion include/NavGraph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
#include <sstream>
#include <stdexcept>

#include <jsoncpp/json/json.h>
//#include <jsoncpp/json/json.h>
#include <json/json.h>
#include <opencv2/opencv.hpp>

#ifdef OSMESA_RENDERING
Expand Down
3 changes: 2 additions & 1 deletion src/lib/NavGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <fstream>
#include <iterator>
#include <opencv2/opencv.hpp>
#include <opencv2/imgcodecs.hpp>

#include <json/json.h>
#ifdef _OPENMP
Expand Down Expand Up @@ -56,7 +57,7 @@ void NavGraph::Location::loadCubemapImages() {
}
if (includeDepth) {
// 16 bit grayscale images
cv::Mat depth = cv::imread(skyboxDir + viewpointId + "_skybox_depth_small.png", CV_LOAD_IMAGE_ANYDEPTH);
cv::Mat depth = cv::imread(skyboxDir + viewpointId + "_skybox_depth_small.png", cv::IMREAD_ANYDEPTH );
w = depth.cols/6;
h = depth.rows;
xposD = depth(cv::Rect(2*w, 0, w, h));
Expand Down
1 change: 1 addition & 0 deletions src/lib_python/MatterSimPython.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <cstdint>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include "MatterSim.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/test/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ TEST_CASE( "RGB Image", "[Rendering]" ) {
auto imgfile = testcase["reference_image"].asString();
auto reference_image = cv::imread("webgl_imgs/"+imgfile);
auto state = sim.getState().at(n);
double err = cv::norm(reference_image, state->rgb, CV_L2);
double err = cv::norm(reference_image, state->rgb, cv::NORM_L2);
err /= reference_image.rows * reference_image.cols;
CHECK(err < 0.15);
// save for later comparison, these images can also be inspected by hand
Expand Down

0 comments on commit 2516ba9

Please sign in to comment.