From f55ba7852c35e8720c3a26e1fb9933d2f2305ba8 Mon Sep 17 00:00:00 2001 From: Jim Date: Sun, 24 May 2020 14:51:25 +1000 Subject: [PATCH 1/3] Adding vscode remote-container development + added devcontainer stuff + .vscode folder, including settings for build args + required Dockers + launch.json for running + moved main dockers to ./Docker folder + added vscode base build --- .devcontainer/Dockerfile | 6 + .devcontainer/devcontainer.json | 30 +++ .../.vscode => .vscode}/c_cpp_properties.json | 8 +- {Source/.vscode => .vscode}/launch.json | 14 +- .vscode/settings.json | 11 + .../Dockerfile.base.ubuntu.18.04 | 34 ++- .../Dockerfile.flint.ubuntu.18.04 | 7 +- Docker/Dockerfile.vscode-base.ubuntu.18.04 | 203 ++++++++++++++++++ Source/.devcontainer/devcontainer.json | 36 ---- Source/.gitignore | 1 + Source/.vscode/settings.json | 3 - Source/.vscode/tasks.json | 19 -- Source/docker/Dockerfile.base.ubuntu.18.04 | 150 ------------- Source/docker/Dockerfile.flint.ubuntu.18.04 | 59 ----- 14 files changed, 280 insertions(+), 301 deletions(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json rename {Source/.vscode => .vscode}/c_cpp_properties.json (68%) rename {Source/.vscode => .vscode}/launch.json (71%) create mode 100644 .vscode/settings.json rename {Examples/docker => Docker}/Dockerfile.base.ubuntu.18.04 (87%) rename {Examples/docker => Docker}/Dockerfile.flint.ubuntu.18.04 (95%) create mode 100644 Docker/Dockerfile.vscode-base.ubuntu.18.04 delete mode 100644 Source/.devcontainer/devcontainer.json delete mode 100644 Source/.vscode/settings.json delete mode 100644 Source/.vscode/tasks.json delete mode 100644 Source/docker/Dockerfile.base.ubuntu.18.04 delete mode 100644 Source/docker/Dockerfile.flint.ubuntu.18.04 diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..bb02d19 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,6 @@ +FROM mojaglobal/vscode-baseimage:bionic + +ENV DEBIAN_FRONTEND=noninteractive + +# Switch back to dialog for any ad-hoc use of apt-get +ENV DEBIAN_FRONTEND=dialog diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..331d76b --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,30 @@ +// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.117.1/containers/cpp +{ + "name": "C++", + "dockerFile": "Dockerfile", + "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"], + + // Set *default* container specific settings.json values on container create. + "settings": { + "terminal.integrated.shell.linux": "/bin/bash" + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-vscode.cpptools", + "austin.code-gnu-global", + "twxs.cmake", + "ms-vscode.cmake-tools" + ] + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "gcc -v", + + // Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root. + // "remoteUser": "vscode" + +} \ No newline at end of file diff --git a/Source/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json similarity index 68% rename from Source/.vscode/c_cpp_properties.json rename to .vscode/c_cpp_properties.json index aa8ca86..c71784c 100644 --- a/Source/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -7,11 +7,11 @@ ], "defines": [], "compilerPath": "/usr/bin/gcc", - "cStandard": "c11", - "cppStandard": "c++17", + "cStandard": "gnu11", + "cppStandard": "gnu++14", "intelliSenseMode": "clang-x64", - "configurationProvider": "vector-of-bool.cmake-tools", - "compileCommands": "${workspaceFolder}/build/compile_commands.json" + "compileCommands": "${workspaceFolder}/Source/vscodebuild/compile_commands.json", + "configurationProvider": "vector-of-bool.cmake-tools" } ], "version": 4 diff --git a/Source/.vscode/launch.json b/.vscode/launch.json similarity index 71% rename from Source/.vscode/launch.json rename to .vscode/launch.json index ceba5b7..5bd3b73 100644 --- a/Source/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,13 +5,15 @@ "version": "0.2.0", "configurations": [ { - "name": "g++-7 build and debug active file", + "name": "(gdb) Launch", "type": "cppdbg", "request": "launch", - "program": "${fileDirname}/${fileBasenameNoExtension}", - "args": [], + "program": "${workspaceFolder}/Source/vscodebuild/bin/moja.cli", + "args": [ + "--help", + ], "stopAtEntry": false, - "cwd": "${workspaceFolder}", + "cwd": "${workspaceFolder}/Examples", "environment": [], "externalConsole": false, "MIMode": "gdb", @@ -21,9 +23,7 @@ "text": "-enable-pretty-printing", "ignoreFailures": true } - ], - "preLaunchTask": "g++-7 build active file", - "miDebuggerPath": "/usr/bin/gdb" + ] } ] } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..3e3cbd7 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,11 @@ +{ + "cmake.configureArgs": [ + "-DCMAKE_BUILD_TYPE=DEBUG", + "-DCMAKE_INSTALL_PREFIX=/usr/local", + "-DENABLE_TESTS:BOOL=OFF", + "-DENABLE_MOJA.MODULES.GDAL=ON", + "-DENABLE_MOJA.MODULES.LIBPQ=ON", + "-DBoost_USE_STATIC_LIBS=OFF", + "-DBUILD_SHARED_LIBS=ON" + ] +} \ No newline at end of file diff --git a/Examples/docker/Dockerfile.base.ubuntu.18.04 b/Docker/Dockerfile.base.ubuntu.18.04 similarity index 87% rename from Examples/docker/Dockerfile.base.ubuntu.18.04 rename to Docker/Dockerfile.base.ubuntu.18.04 index 4a7ddc2..fb74bc4 100644 --- a/Examples/docker/Dockerfile.base.ubuntu.18.04 +++ b/Docker/Dockerfile.base.ubuntu.18.04 @@ -28,7 +28,7 @@ WORKDIR $ROOTDIR/ # Install basic dependencies RUN apt-get update -y && apt-get install -y --fix-missing --no-install-recommends \ software-properties-common build-essential ca-certificates \ - libtool automake zlib1g-dev libspatialite-dev pkg-config sqlite3 \ + libtool automake zlib1g-dev libspatialite-dev pkg-config libsqlite3-dev sqlite3 \ python3-dev python3-numpy python3-pip openssl libssl-dev libpq-dev \ libcurl4-gnutls-dev libproj-dev libxml2-dev libexpat-dev libxerces-c-dev \ libgeos-dev libpoppler-dev \ @@ -50,23 +50,23 @@ RUN wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cm && tar xzf cmake-${CMAKE_VERSION}.tar.gz \ && cd cmake-${CMAKE_VERSION} \ && ./bootstrap --system-curl --parallel=$NUM_CPU \ - && make --quiet -j $NUM_CPU \ + && .$NUM_CPU \ && make --quiet install \ && make clean \ && cd .. -RUN wget https://github.com/azadkuh/sqlite-amalgamation/archive/${SQLITE_VERSION}.tar.gz \ - && tar -xzf ${SQLITE_VERSION}.tar.gz && mkdir -p sqlite-amalgamation-${SQLITE_VERSION}/build && cd sqlite-amalgamation-${SQLITE_VERSION}/build \ - && cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=RELEASE \ - -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON \ - -DBUILD_SHARED_LIBS=ON \ - -DCMAKE_INSTALL_PREFIX=$ROOTDIR .. \ - && make --quiet -j $NUM_CPU install/strip \ - && make clean \ - && cd $ROOTDIR/src +# RUN wget https://github.com/azadkuh/sqlite-amalgamation/archive/${SQLITE_VERSION}.tar.gz \ +# && tar -xzf ${SQLITE_VERSION}.tar.gz && mkdir -p sqlite-amalgamation-${SQLITE_VERSION}/build && cd sqlite-amalgamation-${SQLITE_VERSION}/build \ +# && cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=RELEASE \ +# -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON \ +# -DBUILD_SHARED_LIBS=ON \ +# -DCMAKE_INSTALL_PREFIX=$ROOTDIR .. \ +# && make --quiet -j $NUM_CPU install/strip \ +# && make clean \ +# && cd $ROOTDIR/src -# fix sqlite include location -RUN mv $ROOTDIR/include/sqlite3/sqlite3.h $ROOTDIR/include +# # fix sqlite include location +# RUN mv $ROOTDIR/include/sqlite3/sqlite3.h $ROOTDIR/include RUN wget https://pocoproject.org/releases/poco-${POCO_VERSION}/poco-${POCO_VERSION}-all.tar.gz \ && tar -xzf poco-${POCO_VERSION}-all.tar.gz && mkdir poco-${POCO_VERSION}-all/cmake-build && cd poco-${POCO_VERSION}-all/cmake-build \ @@ -101,7 +101,7 @@ RUN wget https://pocoproject.org/releases/poco-${POCO_VERSION}/poco-${POCO_VERSI # build user-config.jam files RUN echo "using python : 3.6 : /usr ;" > ~/user-config.jam - RUN wget https://dl.bintray.com/boostorg/release/${BOOST_VERSION_DOT}/source/boost_${BOOST_VERSION}.tar.bz2 \ +RUN wget https://dl.bintray.com/boostorg/release/${BOOST_VERSION_DOT}/source/boost_${BOOST_VERSION}.tar.bz2 \ && tar --bzip2 -xf boost_${BOOST_VERSION}.tar.bz2 && cd boost_${BOOST_VERSION} \ && ./bootstrap.sh --prefix=$ROOTDIR \ && ./b2 -d0 -j $NUM_CPU cxxstd=14 install variant=release link=shared \ @@ -152,9 +152,3 @@ RUN apt-get update -y \ RUN ldconfig RUN rm -r $ROOTDIR/src/* - - - - - - diff --git a/Examples/docker/Dockerfile.flint.ubuntu.18.04 b/Docker/Dockerfile.flint.ubuntu.18.04 similarity index 95% rename from Examples/docker/Dockerfile.flint.ubuntu.18.04 rename to Docker/Dockerfile.flint.ubuntu.18.04 index ba246c9..9d1c720 100644 --- a/Examples/docker/Dockerfile.flint.ubuntu.18.04 +++ b/Docker/Dockerfile.flint.ubuntu.18.04 @@ -7,7 +7,8 @@ # # ================================================================================================================== -FROM moja/baseimage:ubuntu-18.04 +#FROM moja/baseimage:ubuntu-18.04 +FROM moja/baseimage:mg LABEL maintainer="info@moja.global" @@ -46,7 +47,7 @@ RUN git clone --recursive https://github.com/sebastiandev/zipper.git \ # GET moja.global RUN git clone --recursive --depth 1 -b ${FLINT_BRANCH} https://github.com/moja-global/FLINT.git flint \ && mkdir -p flint/Source/build && cd flint/Source/build \ - && cmake -DCMAKE_BUILD_TYPE=RELEASE \ + && cmake -DCMAKE_BUILD_TYPE=DEBUG \ -DCMAKE_INSTALL_PREFIX=$ROOTDIR \ -DENABLE_TESTS:BOOL=OFF \ -DENABLE_MOJA.MODULES.GDAL=ON \ @@ -55,7 +56,7 @@ RUN git clone --recursive --depth 1 -b ${FLINT_BRANCH} https://github.com/moja-g -DBUILD_SHARED_LIBS=ON .. \ && make --quiet -j $NUM_CPU \ && make --quiet install \ - && make clean \ +# && make clean \ && cd $ROOTDIR/src RUN ln -s $ROOTDIR/lib/libmoja.modules.* $ROOTDIR/bin diff --git a/Docker/Dockerfile.vscode-base.ubuntu.18.04 b/Docker/Dockerfile.vscode-base.ubuntu.18.04 new file mode 100644 index 0000000..9ff8382 --- /dev/null +++ b/Docker/Dockerfile.vscode-base.ubuntu.18.04 @@ -0,0 +1,203 @@ +#------------------------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. +#------------------------------------------------------------------------------------------------------------- + +# https://hub.docker.com/_/microsoft-vscode-devcontainers +# docker build --build-arg NUM_CPU=8 -t moja/baseimage_vscode:ubuntu-18.04 . + +FROM mcr.microsoft.com/vscode/devcontainers/base:ubuntu-18.04 +#FROM moja/baseimage:mg + +# Avoid warnings by switching to noninteractive +ENV DEBIAN_FRONTEND=noninteractive + +# This Dockerfile's base image has a non-root user with sudo access. Use the "remoteUser" +# property in devcontainer.json to use it. On Linux, the container user's GID/UIDs +# will be updated to match your local UID/GID (when using the dockerFile property). +# See https://aka.ms/vscode-remote/containers/non-root-user for details. +ARG USERNAME=vscode +ARG USER_UID=1000 +ARG USER_GID=$USER_UID +ARG NUM_CPU=1 + +# Configure apt and install packages +RUN apt-get update \ + # + # Install C++ tools + && apt-get -y install --fix-missing \ + #--no-install-recommends \ + automake \ + bash-completion \ + build-essential \ + ca-certificates \ + cmake \ + cppcheck \ + doxygen \ + doxygen-latex \ + git \ + graphviz \ + libcurl4-gnutls-dev \ + libexpat-dev \ + libgeos-dev \ + libpoppler-dev \ + libpq-dev \ + libproj-dev \ + libspatialite-dev \ + libsqlite3-dev \ + libssl-dev \ + libtool \ + libxerces-c-dev \ + libxml2-dev \ + nasm \ + openssl \ + pkg-config \ + postgis \ + postgresql-client-10 \ + postgresql-server-dev-10 \ + python-dev \ + python-numpy \ + python-pip \ + python3-dev \ + python3-numpy \ + python3-pip \ + software-properties-common \ + sqlite3 \ + valgrind \ + wget \ + zlib1g-dev \ + # [Optional] Update UID/GID if needed + && if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then \ + groupmod --gid $USER_GID $USERNAME \ + && usermod --uid $USER_UID --gid $USER_GID $USERNAME \ + && chown -R $USER_UID:$USER_GID /home/$USERNAME; \ + fi \ + # + # Clean up + && apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* + +ENV ROOTDIR /usr/local +ENV GDAL_VERSION 2.4.1 +ENV CMAKE_VERSION 3.15.4 +ENV POCO_VERSION 1.9.2 +ENV BOOST_VERSION 1_72_0 +ENV BOOST_VERSION_DOT 1.72.0 +ENV FMT_VERSION 6.1.2 +ENV SQLITE_VERSION 3.31.1 + +WORKDIR $ROOTDIR/ + +# set environment variables +ENV PATH $ROOTDIR/bin:$PATH +ENV LD_LIBRARY_PATH $ROOTDIR/lib:$LD_LIBRARY_PATH +ENV PYTHONPATH $ROOTDIR/lib:$PYTHONPATH + +WORKDIR $ROOTDIR/src + +RUN wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}.tar.gz \ + && tar xzf cmake-${CMAKE_VERSION}.tar.gz \ + && cd cmake-${CMAKE_VERSION} \ + && ./bootstrap --system-curl --parallel=$NUM_CPU \ + && make --quiet install \ + && make clean \ + && cd .. + +RUN wget https://pocoproject.org/releases/poco-${POCO_VERSION}/poco-${POCO_VERSION}-all.tar.gz \ + && tar -xzf poco-${POCO_VERSION}-all.tar.gz && mkdir poco-${POCO_VERSION}-all/cmake-build && cd poco-${POCO_VERSION}-all/cmake-build \ + && cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=$ROOTDIR \ + -DPOCO_UNBUNDLED=ON \ + -DPOCO_STATIC=OFF \ + -DENABLE_ENCODINGS=OFF \ + -DENABLE_ENCODINGS_COMPILER=OFF \ + -DENABLE_XML=OFF \ + -DENABLE_JSON=ON \ + -DENABLE_MONGODB=OFF \ + -DENABLE_REDIS=OFF \ + -DENABLE_PDF=OFF \ + -DENABLE_UTIL=OFF \ + -DENABLE_NET=OFF \ + -DENABLE_NETSSL=OFF \ + -DENABLE_CRYPTO=OFF \ + -DENABLE_DATA=ON \ + -DENABLE_DATA_SQLITE=ON \ + -DENABLE_DATA_MYSQL=OFF \ + -DENABLE_DATA_ODBC=OFF \ + -DENABLE_SEVENZIP=OFF \ + -DENABLE_ZIP=OFF \ + -DENABLE_PAGECOMPILER=OFF \ + -DENABLE_PAGECOMPILER_FILE2PAGE=OFF \ + -DENABLE_TESTS:BOOL=OFF .. \ + && make --quiet -j $NUM_CPU \ + && make --quiet install/strip \ + # && make clean \ + && cd $ROOTDIR/src + +# build user-config.jam files +RUN echo "using python : 3.6 : /usr ;" > ~/user-config.jam + +RUN wget https://dl.bintray.com/boostorg/release/${BOOST_VERSION_DOT}/source/boost_${BOOST_VERSION}.tar.bz2 \ + && tar --bzip2 -xf boost_${BOOST_VERSION}.tar.bz2 && cd boost_${BOOST_VERSION} \ + && ./bootstrap.sh --prefix=$ROOTDIR \ + && ./b2 -d0 -j $NUM_CPU cxxstd=14 install variant=release link=shared \ + # && ./b2 clean \ + && cd $ROOTDIR/src + +RUN wget https://github.com/fmtlib/fmt/archive/${FMT_VERSION}.tar.gz \ + && mkdir libfmt-${FMT_VERSION} && tar -xzf ${FMT_VERSION}.tar.gz -C libfmt-${FMT_VERSION} --strip-components=1 && cd libfmt-${FMT_VERSION} \ + && cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=$ROOTDIR \ + -DFMT_DOC=OFF \ + -DFMT_TEST=OFF . \ + && make --quiet -j $NUM_CPU install/strip \ + # && make clean \ + && cd $ROOTDIR/src + +RUN git clone --recursive https://github.com/sebastiandev/zipper.git \ + && cd zipper && git checkout e9f150516cb55d194b5e01d21a9527783e98311d && mkdir build && cd build \ + && cmake .. \ + && make --quiet -j $NUM_CPU \ + && make --quiet install \ + && make clean \ + && cd $ROOTDIR/src + +RUN wget http://download.osgeo.org/gdal/${GDAL_VERSION}/gdal-${GDAL_VERSION}.tar.gz \ + && tar -xvf gdal-${GDAL_VERSION}.tar.gz && cd gdal-${GDAL_VERSION} \ + && ./configure --without-libtool --with-hide-internal-symbols \ + --with-python --with-spatialite --with-pg --with-curl --prefix=$ROOTDIR \ + --with-libtiff=internal --with-rename-internal-libtiff-symbols \ + --with-geotiff=internal --with-rename-internal-libgeotiff-symbols \ + && make --quiet -j $NUM_CPU \ + && make install \ + # && make clean \ + && cd $ROOTDIR/src +RUN strip -s $ROOTDIR/lib/libgdal.so +RUN for i in $ROOTDIR/lib/python3/dist-packages/osgeo/*.so; do strip -s $i 2>/dev/null || /bin/true; done +RUN strip -s $ROOTDIR/bin/gdal_contour && strip -s $ROOTDIR/bin/gdal_grid \ + && strip -s $ROOTDIR/bin/gdal_rasterize && strip -s $ROOTDIR/bin/gdal_translate && strip -s $ROOTDIR/bin/gdaladdo \ + && strip -s $ROOTDIR/bin/gdalbuildvrt && strip -s $ROOTDIR/bin/gdaldem && strip -s $ROOTDIR/bin/gdalenhance \ + && strip -s $ROOTDIR/bin/gdalinfo && strip -s $ROOTDIR/bin/gdallocationinfo && strip -s $ROOTDIR/bin/gdalmanage \ + && strip -s $ROOTDIR/bin/gdalserver && strip -s $ROOTDIR/bin/gdalsrsinfo && strip -s $ROOTDIR/bin/gdaltindex \ + && strip -s $ROOTDIR/bin/gdaltransform && strip -s $ROOTDIR/bin/gdalwarp && strip -s $ROOTDIR/bin/gnmanalyse \ + && strip -s $ROOTDIR/bin/gnmmanage && strip -s $ROOTDIR/bin/nearblack && strip -s $ROOTDIR/bin/ogr2ogr \ + && strip -s $ROOTDIR/bin/ogrinfo && strip -s $ROOTDIR/bin/ogrlineref && strip -s $ROOTDIR/bin/ogrtindex \ + && strip -s $ROOTDIR/bin/testepsg + +ENV CURL_CA_BUNDLE /etc/ssl/certs/ca-certificates.crt +ENV GDAL_DATA=/usr/local/share/gdal +ENV GDAL_HTTP_VERSION 2 + +RUN apt-get update -y \ + && apt-get remove -y --purge build-essential \ + && cd $ROOTDIR/src/gdal-${GDAL_VERSION}/swig/python \ + && python3 setup.py build \ + && python3 setup.py install + +RUN cd $ROOTDIR/src/gdal-${GDAL_VERSION}/swig/python \ + && python3 setup.py build \ + && python3 setup.py install + +RUN ldconfig + +# Switch back to dialog for any ad-hoc use of apt-get +ENV DEBIAN_FRONTEND=dialog diff --git a/Source/.devcontainer/devcontainer.json b/Source/.devcontainer/devcontainer.json deleted file mode 100644 index 9af078b..0000000 --- a/Source/.devcontainer/devcontainer.json +++ /dev/null @@ -1,36 +0,0 @@ -// See https://aka.ms/vscode-remote/devcontainer.json for format details. -{ - // See https://aka.ms/vscode-remote/devcontainer.json for format details. - "name": "Existing Dockerfile", - - // Sets the run context to one level up instead of the .devcontainer folder. - "context": "..", - - // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename. - "dockerFile": "../docker/Dockerfile.base.ubuntu.18.04", - - // The optional 'runArgs' property can be used to specify additional runtime arguments. - "runArgs": [ - // Uncomment the next line if you want to use Docker from the container. See the docker-in-docker definition for details. - // "-v","/var/run/docker.sock:/var/run/docker.sock", - - // Uncomment the next line if you will be using a ptrace-based debugger like C++, Go, and Rust. - "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" - ], - - // Uncomment the next line if you want to publish any ports. - // "appPort": [], - - // Uncomment the next line if you want to add in default container specific settings.json values - // "settings": { "workbench.colorTheme": "Quiet Light" }, - - // Uncomment the next line to run commands after the container is created. - // "postCreateCommand": "uname -a", - - // Add the IDs of any extensions you want installed in the array below. - "extensions": [ - "vector-of-bool.cmake-tools", - "ms-vscode.cpptools", - "austin.code-gnu-global" - ] -} \ No newline at end of file diff --git a/Source/.gitignore b/Source/.gitignore index ac37f90..7d9bc1e 100644 --- a/Source/.gitignore +++ b/Source/.gitignore @@ -58,6 +58,7 @@ build_lin/ build_win/ build2017/ build2017_dc/ +vscodebuild/ bld/ [Bb]in/ [Oo]bj/ diff --git a/Source/.vscode/settings.json b/Source/.vscode/settings.json deleted file mode 100644 index 0db5873..0000000 --- a/Source/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "cmake.configureOnOpen": true -} \ No newline at end of file diff --git a/Source/.vscode/tasks.json b/Source/.vscode/tasks.json deleted file mode 100644 index 0be46f7..0000000 --- a/Source/.vscode/tasks.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "tasks": [ - { - "type": "shell", - "label": "g++-7 build active file", - "command": "/usr/bin/g++-7", - "args": [ - "-g", - "${file}", - "-o", - "${fileDirname}/${fileBasenameNoExtension}" - ], - "options": { - "cwd": "/usr/bin" - } - } - ], - "version": "2.0.0" -} \ No newline at end of file diff --git a/Source/docker/Dockerfile.base.ubuntu.18.04 b/Source/docker/Dockerfile.base.ubuntu.18.04 deleted file mode 100644 index 2a66d7a..0000000 --- a/Source/docker/Dockerfile.base.ubuntu.18.04 +++ /dev/null @@ -1,150 +0,0 @@ -# ================================================================================================================== -# -# Docker to ubuntu 18.04 base image (for required libraries) used by flint docker -# -# Building this Docker: -# docker build -f Dockerfile.base.ubuntu.18.04 --build-arg NUM_CPU=4 -t moja/baseimage:ubuntu-18.04 . -# -# ================================================================================================================== - -# Ubuntu 18.04 Bionic Beaver -FROM ubuntu:bionic - -LABEL maintainer="info@moja.global" - -ARG DEBIAN_FRONTEND=noninteractive - -WORKDIR $ROOTDIR/ - -# Install basic dependencies -RUN apt-get update -y && apt-get install -y \ - software-properties-common \ - build-essential \ - python3-dev \ - python3-numpy \ - python3-pip \ - libspatialite-dev \ - libeigen3-dev \ - sqlite3 \ - openssl \ - libssl-dev \ - libpq-dev \ - libcurl4-gnutls-dev \ - libproj-dev \ - libxml2-dev \ - libgeos-dev \ - libnetcdf-dev \ - libpoppler-dev \ - libhdf4-alt-dev \ - libhdf5-serial-dev \ - wget \ - bash-completion \ - nasm \ - postgresql-client-10 \ - git \ - gdb \ - && apt-get -y autoremove \ - && apt-get clean \ - && ln -sf /usr/include/eigen3 /usr/local/include/eigen - -# set versions of libraries used and some paths -ENV ROOTDIR /usr/local/ -ENV GDAL_VERSION 2.4.0 -ENV CMAKE_VERSION 3.14.3 -ENV POCO_VERSION 1.9.0 -ENV BOOST_VERSION 1_69_0 -ENV BOOST_VERSION_DOT 1.69.0 -ENV FMT_VERSION 5.3.0 -ENV SQLITE_VERSION 3270200 - -# set environment variables -ENV PATH /usr/local/bin:$PATH -ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH -ENV PYTHONPATH /usr/local/lib:$PYTHONPATH - -ARG NUM_CPU=1 -WORKDIR $ROOTDIR - -## CMake -ADD https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}.tar.gz $ROOTDIR/src/ -RUN cd src && tar -xzf cmake-${CMAKE_VERSION}.tar.gz && cd cmake-${CMAKE_VERSION} \ - && ./bootstrap \ - && make -s -j $NUM_CPU \ - && make install \ - && make clean \ - && cd $ROOTDIR - -# build user-config.jam files -RUN echo "using python : 3.6 : /usr ;" > ~/user-config.jam - -## Poco -WORKDIR $ROOTDIR -#ADD https://pocoproject.org/releases/poco-${POCO_VERSION}/poco-${POCO_VERSION}-all.tar.gz $ROOTDIR/src/ -#RUN cd src && tar -xzf poco-${POCO_VERSION}-all.tar.gz && cd poco-${POCO_VERSION}-all \ -ADD https://pocoproject.org/releases/poco-${POCO_VERSION}/poco-${POCO_VERSION}.tar.gz $ROOTDIR/src/ -RUN cd src && tar -xzf poco-${POCO_VERSION}.tar.gz && cd poco-${POCO_VERSION} \ - && ./configure --omit=Data/ODBC,Data/MySQL,FSM,Redis --no-samples --no-tests \ - && make -s -j $NUM_CPU DEFAULT_TARGET=shared_release \ - && make install \ - && make clean \ - && cd $ROOTDIR - -## Boost -ADD https://dl.bintray.com/boostorg/release/${BOOST_VERSION_DOT}/source/boost_${BOOST_VERSION}.tar.bz2 $ROOTDIR/src/ -RUN cd src && tar --bzip2 -xf boost_${BOOST_VERSION}.tar.bz2 && cd boost_${BOOST_VERSION} \ - && ./bootstrap.sh --prefix=/usr/local \ - && ./b2 -j $NUM_CPU cxxstd=14 install \ - && ./b2 clean \ - && cd $ROOTDIR - -## FMT -ADD https://github.com/fmtlib/fmt/archive/${FMT_VERSION}.tar.gz $ROOTDIR/src/ -RUN cd src && mkdir libfmt-${FMT_VERSION} && tar -xzf ${FMT_VERSION}.tar.gz -C libfmt-${FMT_VERSION} --strip-components=1 && cd libfmt-${FMT_VERSION} \ - && cmake -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr/local . \ - && make -j $NUM_CPU install \ - && make clean \ - && cd $ROOTDIR && rm -Rf src/libfmt* - -## SQLite -#ADD https://www.sqlite.org/2019/sqlite-autoconf-${SQLITE_VERSION}.tar.gz $ROOTDIR/src/ -#RUN cd src && tar -xzf sqlite-autoconf-${SQLITE_VERSION}.tar.gz -C /usr/include/ \ -# && cd $ROOTDIR && rm -Rf src/sqlite* - -ADD https://www.sqlite.org/2019/sqlite-autoconf-${SQLITE_VERSION}.tar.gz $ROOTDIR/src/ -RUN cd src && tar -xzf sqlite-autoconf-${SQLITE_VERSION}.tar.gz -C /usr/local/ \ - && cp /usr/local/sqlite-autoconf-${SQLITE_VERSION}/sqlite3.c /usr/include/ \ - && cd $ROOTDIR && rm -Rf src/sqlite* - -## gdal -ADD http://download.osgeo.org/gdal/${GDAL_VERSION}/gdal-${GDAL_VERSION}.tar.gz $ROOTDIR/src/ -RUN cd src && tar -xvf gdal-${GDAL_VERSION}.tar.gz && cd gdal-${GDAL_VERSION} \ - && ./configure \ - --with-python --with-spatialite --with-pg --with-curl \ - --with-netcdf --with-hdf5=/usr/lib/x86_64-linux-gnu/hdf5/serial \ - --with-curl \ - && make -j $NUM_CPU && make install && ldconfig \ - && apt-get update -y \ - && apt-get remove -y --purge build-essential \ - && cd $ROOTDIR && cd src/gdal-${GDAL_VERSION}/swig/python \ - && python3 setup.py build \ - && python3 setup.py install \ - && cd $ROOTDIR && rm -Rf src/gdal* - -## Zipper -RUN cd src && git clone --recursive https://github.com/sebastiandev/zipper.git -WORKDIR $ROOTDIR/src/zipper/build -RUN cmake .. \ - && make -s -j $NUM_CPU \ - && make install \ - && make clean \ - && cd $ROOTDIR - -## Turtle -WORKDIR $ROOTDIR/src/ -RUN wget https://sourceforge.net/projects/turtle/files/turtle/1.3.1/turtle-1.3.1.tar.gz \ - && tar xzf turtle-1.3.1.tar.gz -C /usr/local/ \ - && cd $ROOTDIR && rm -Rf src/turtle* - -#ADD http://downloads.sourceforge.net/project/turtle/turtle/1.3.1/turtle-1.3.1.tar.bz2 $ROOTDIR/src/ -#RUN tar xvf turtle-1.3.0.tar.bz2 -C /usr/local/ -WORKDIR $ROOTDIR/src diff --git a/Source/docker/Dockerfile.flint.ubuntu.18.04 b/Source/docker/Dockerfile.flint.ubuntu.18.04 deleted file mode 100644 index fd13c2e..0000000 --- a/Source/docker/Dockerfile.flint.ubuntu.18.04 +++ /dev/null @@ -1,59 +0,0 @@ -# ================================================================================================================== -# -# Docker to ubuntu 16.04 image for Moja flint libraries and executables -# -# Building this Docker: -# docker build -f Dockerfile.flint.ubuntu.18.04 --build-arg NUM_CPU=4 --build-arg GITHUB_AT=[TOKEN] --build-arg FLINT_BRANCH=[BRANCH] -t moja/flint:ubuntu-18.04 . -# -# ================================================================================================================== - -FROM moja/baseimage:ubuntu-18.04 - -LABEL maintainer="info@moja.global" - -ARG GITHUB_AT -ARG FLINT_BRANCH -ARG NUM_CPU=1 -ARG DEBIAN_FRONTEND=noninteractive - -ENV SQLITE_VERSION 3270200 -ENV ROOTDIR /usr/local/ - -WORKDIR $ROOTDIR/ - -# set environment variables -ENV PATH /usr/local/bin:$PATH -ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH -ENV PYTHONPATH /usr/local/lib:$PYTHONPATH -ENV CURL_CA_BUNDLE /etc/ssl/certs/ca-certificates.crt -ENV GDAL_DATA=/usr/share/gdal -ENV GDAL_HTTP_VERSION 2 - -ADD https://www.sqlite.org/2019/sqlite-autoconf-${SQLITE_VERSION}.tar.gz $ROOTDIR/src/ -RUN cd src && tar -xzf sqlite-autoconf-${SQLITE_VERSION}.tar.gz -C /usr/local/ \ - && cp /usr/local/sqlite-autoconf-${SQLITE_VERSION}/sqlite3.c /usr/include/ \ - && cd $ROOTDIR && rm -Rf src/sqlite* - - -# GET FLINT -WORKDIR $ROOTDIR/ -RUN cd src && git clone -b ${FLINT_BRANCH} https://${GITHUB_AT}@github.com/moja-global/flint.git flint - -WORKDIR $ROOTDIR/src/flint/Source/build -RUN cmake -DCMAKE_BUILD_TYPE=RELEASE \ - -DCMAKE_INSTALL_PREFIX=/usr/local \ - -DENABLE_MOJA.MODULES.ZIPPER=ON \ - -DENABLE_MOJA.MODULES.POCO=OFF \ - -DENABLE_MOJA.MODULES.LIBPQ=ON \ - -DENABLE_MOJA.MODULES.GDAL=ON \ - -DENABLE_MOJA.CLI=ON \ - -DENABLE_TESTS:BOOL=OFF .. \ - && make -s -j $NUM_CPU \ - && make install \ - && make clean - -WORKDIR $ROOTDIR/src - -RUN ln -s /usr/local/lib/libmoja.modules.* /usr/local/bin -RUN rm -Rf /usr/local/src/* -WORKDIR /tmp/flint_runenv \ No newline at end of file From 95d5b2272beb493dddef9f38fa6cafc8bda9fb33 Mon Sep 17 00:00:00 2001 From: Jim Date: Sun, 24 May 2020 14:56:02 +1000 Subject: [PATCH 2/3] Add option to make gdal meta data optiinal + added single flag in settings 'metadata_required'. Default is True --- .../include/moja/modules/gdal/rasterreadergdal.h | 1 + Source/moja.modules.gdal/src/rasterreadergdal.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Source/moja.modules.gdal/include/moja/modules/gdal/rasterreadergdal.h b/Source/moja.modules.gdal/include/moja/modules/gdal/rasterreadergdal.h index 31b5e61..726b948 100644 --- a/Source/moja.modules.gdal/include/moja/modules/gdal/rasterreadergdal.h +++ b/Source/moja.modules.gdal/include/moja/modules/gdal/rasterreadergdal.h @@ -22,6 +22,7 @@ class GDAL_API MetaDataRasterReaderGDAL : public datarepository::MetaDataRasterR private: std::string _path; std::string _prefix; + bool _metaDataRequired; }; class GDAL_API TileRasterReaderGDAL : public datarepository::TileRasterReaderInterface { diff --git a/Source/moja.modules.gdal/src/rasterreadergdal.cpp b/Source/moja.modules.gdal/src/rasterreadergdal.cpp index 0a8602b..82985a3 100644 --- a/Source/moja.modules.gdal/src/rasterreadergdal.cpp +++ b/Source/moja.modules.gdal/src/rasterreadergdal.cpp @@ -46,6 +46,10 @@ MetaDataRasterReaderGDAL::MetaDataRasterReaderGDAL(const std::string& path, cons auto parent = filePath.parent().toString(); auto abs = filePath.parent().absolute().toString(); _path = (boost::format("%1%%2%.json") % filePath.parent().absolute().toString() % filePath.getBaseName()).str(); + _metaDataRequired = true; + if (settings.contains("metadata_required")) { + _metaDataRequired = settings["metadata_required"].extract(); + } } catch (...) { BOOST_THROW_EXCEPTION(flint::LocalDomainError() << flint::Details("GDAL Error in constructor") << flint::LibraryName("moja.modules.gdal") @@ -64,7 +68,9 @@ DynamicObject MetaDataRasterReaderGDAL::readMetaData() const { auto layerMetadata = parsePocoJSONToDynamic(metadata).extract(); return layerMetadata; } else { - BOOST_THROW_EXCEPTION(datarepository::FileNotFoundException() << datarepository::FileName(_path)); + if (_metaDataRequired) { + BOOST_THROW_EXCEPTION(datarepository::FileNotFoundException() << datarepository::FileName(_path)); + } } } From 85dcb566fd9042f3e4ff568a850957ea2128c2b0 Mon Sep 17 00:00:00 2001 From: Jim Date: Sun, 24 May 2020 15:27:22 +1000 Subject: [PATCH 3/3] Missed a return --- Source/moja.modules.gdal/src/rasterreadergdal.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/moja.modules.gdal/src/rasterreadergdal.cpp b/Source/moja.modules.gdal/src/rasterreadergdal.cpp index 82985a3..f64ba63 100644 --- a/Source/moja.modules.gdal/src/rasterreadergdal.cpp +++ b/Source/moja.modules.gdal/src/rasterreadergdal.cpp @@ -70,6 +70,8 @@ DynamicObject MetaDataRasterReaderGDAL::readMetaData() const { } else { if (_metaDataRequired) { BOOST_THROW_EXCEPTION(datarepository::FileNotFoundException() << datarepository::FileName(_path)); + } else { + return DynamicObject(); } } }