Commit 9168f373 authored by Aaron Bray's avatar Aaron Bray
Browse files

Various odds and ends

Update docker with latest debian and build with clang
Update readme with flags used for magic leap
Fix EngineState.json
Eigen should have been privately installing
Handle an error if pulse given an invalid state path
parent 2f38af9c
ARG BASE=debian:buster
ARG BASE=debian:bullseye
FROM $BASE
ARG BASE
ARG JUPYTER=OFF
RUN echo $BASE
RUN echo $JUPYTER
ENV TERM linux
RUN if [ "$BASE" = "debian:buster" ]; then \
RUN if [ "$BASE" = "debian:bullseye" ]; then \
apt-get update && \
apt-get -y install git wget build-essential cmake java-common python3-pip && \
apt-get -y install clang-format clang-tidy clang-tools clang clangd libc++-dev libc++1 libc++abi-dev libc++abi1 libclang-dev && \
apt-get -y install libclang1 liblldb-dev libllvm-ocaml-dev libomp-dev libomp5 lld lldb llvm-dev llvm-runtime llvm python-clang &&\
wget https://d3pxv6yz143wms.cloudfront.net/8.232.09.1/java-1.8.0-amazon-corretto-jdk_8.232.09-1_amd64.deb && \
dpkg --install java-1.8.0-amazon-corretto-jdk_8.232.09-1_amd64.deb && \
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto \
dpkg --install java-1.8.0-amazon-corretto-jdk_8.232.09-1_amd64.deb \
;fi
RUN if [ "$BASE" = "fedora:32" ]; then \
dnf check-update && \
dnf -y install git make gcc gcc-c++ cmake python3-devel python3-pip && \
rpm --import https://yum.corretto.aws/corretto.key && \
curl -L -o /etc/yum.repos.d/corretto.repo https://yum.corretto.aws/corretto.repo && \
yum install -y java-1.8.0-amazon-corretto-devel && \
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto \
yum install -y java-1.8.0-amazon-corretto-devel \
;fi
# Replace with pip install -r requirements.txt
# Or a setup.py
RUN pip3 install six \
RUN if [ "$JUPYTER" = "ON" ]; then \
pip3 install six \
&& pip3 install numpy \
&& pip3 install pandas \
&& pip3 install matplotlib \
&& pip3 install bqplot \
&& pip3 install jupyter \
&& pip3 install ipywidgets
RUN jupyter nbextension enable --py bqplot
&& pip3 install ipywidgets \
&& jupyter nbextension enable --py bqplot \
;fi
# Pull in local source and build
COPY . /source
RUN mkdir build && \
RUN export JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto && \
mkdir build && \
mkdir pulse && \
cd /build && \
cmake -DPulse_PYTHON_API=ON -DCMAKE_INSTALL_PREFIX=/pulse /source && \
cmake -DPulse_PYTHON_API=ON \
-DCMAKE_INSTALL_PREFIX=/pulse \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_CXX_FLAGS=-stdlib=libc++ \
/source && \
cd /build && \
make -j4 && \
cd / && \
rm -rf /build
RUN if [ "$BASE" = "debian:buster" ]; then \
RUN if [ "$BASE" = "debian:bullseye" ]; then \
rm java-1.8.0-amazon-corretto-jdk_8.232.09-1_amd64.deb ;fi
ENV PYTHONPATH /source/src/python:/pulse/bin
......
......@@ -215,6 +215,10 @@ In this example we are building on a windows machine, using the Lumin SDK v0.24.
Please follow the [Lumin instructions on generating a cmake toolchain file](https://developer.magicleap.com/en-us/learn/guides/sdk-mabu-ref-build-and-link-libraries#build-libraries-with-cmake) needed for cross compiling.
I had to modify the toolchain file, adding '-llog' for protobuf's use of the android log methods, as well as '-g -std=c++11 -Wall -pedantic' to add C++11 support.
`set(CMAKE_CXX_FLAGS "-g -std=c++1z -Wall -pedantic ` <br>
`set(CMAKE_EXE_LINKER_FLAGS "-llog ` <br>
`set(CMAKE_SHARED_LINKER_FLAGS "-llog ` <br>
Here is a copy of the [modified toolchain file](https://data.kitware.com/api/v1/file/5f29b9489014a6d84e57067a/download)
To generate a Makefile and build, run :
......@@ -222,6 +226,7 @@ To generate a Makefile and build, run :
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~bash
# Where -H specifies the Pulse source, and -B is the build directory
cmake -DPulse_JAVA_API:BOOL=OFF -DCMAKE_TOOLCHAIN_FILE:FILEPATH=C:/Programming/magicleap.0.24.1.toolchain.cmake -BC:/Programming/Builds/pulse-engine-lumin -HC:/Programming/Pulse/engine -G "Unix Makefiles"
# Run make from within your build directory
N:/Tools/MagicLeap/dev/mlsdk/v0.24.1/tools/mabu/tools/MinGW/bin/mingw32-make.exe
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
{
"Configuration": {
"TimeStep" : { "ScalarTime": { "Value": 0.02, "Unit": "s" } }
},{"Scenario": {
},"Scenario": {
"Name":"BasicStandard",
"Description":"Basic scenario measuring patient vitals with no insults or interventions",
"EngineStateFile":"./states/StandardMale@0s.pbb",
......@@ -97,20 +97,5 @@
]},
"AnyAction":[{"AdvanceTime":{"Time":{"ScalarTime":{"Value":2.0,"Unit":"min"}}}}]},
"Configuration": {
"AutoSerialization": {
"Directory": "./states/testing/",
"Filename": "patient/HemorrhageVaryingSeverity",
"AfterActions": "On",
"Period": {
"ScalarTime": {
"Value": 5.0,
"Unit": "s"
}
},
"PeriodTimeStamps": "On",
"ReloadState": "On"
}
}
}}
}
......@@ -8,6 +8,7 @@ add_external_project_ex( Eigen3
URL_HASH MD5=609286804b0f79be622ccf7f9ff2b660
CMAKE_CACHE_ARGS
-DBUILD_TESTING:BOOL=OFF
-DCMAKE_INSTALL_PREFIX:PATH=${Eigen3_PREFIX}/install
RELATIVE_INCLUDE_PATH ""
DEPENDENCIES ""
#VERBOSE
......
......@@ -80,7 +80,11 @@ bool SEScenarioExec::Execute(PhysiologyEngine& pe, SEScenario& sce)
// Initialize the engine with a state or initial parameters
if (sce.HasEngineStateFile())
{
pe.SerializeFromFile(sce.GetEngineStateFile());
if (!pe.SerializeFromFile(sce.GetEngineStateFile()))
{
pe.GetLogger()->Error("Unable to load state file: "+ sce.GetEngineStateFile());
return false;
}
// WE ARE OVERWRITING ANY DATA REQUESTS IN THE STATE WITH WHATS IN THE SCENARIO!!!
// Make a copy of the data requests, note this clears out data requests from the engine
pe.GetEngineTracker()->GetDataRequestManager().Copy(sce.GetDataRequestManager(), pe.GetSubstanceManager());
......
......@@ -33,7 +33,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Google.Protobuf">
<HintPath>..\..\..\..\..\builds\pulse-engine\External\protobuf\src\csharp\src\Google.Protobuf\bin\Release\net45\Google.Protobuf.dll</HintPath>
<HintPath>..\..\..\..\..\Builds\pulse-engine\External\protobuf\src\csharp\src\Google.Protobuf\bin\Release\net45\Google.Protobuf.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment