From 3770a4f896b9366dc3600fd4c3b944a7b016e27a Mon Sep 17 00:00:00 2001 From: Arnaud Becheler <8360330+Becheler@users.noreply.github.com> Date: Wed, 20 Dec 2023 06:34:40 +0000 Subject: [PATCH] "feat: adding user template subproject" --- .vscode/tasks.json | 97 +++++++++++++++++++++------------- CMakeLists.txt | 18 +++++-- template/CMakeLists.txt | 37 +++++++++++++ template/data/bio1.tif | Bin 0 -> 3948 bytes template/data/bio12.tif | Bin 0 -> 3965 bytes template/data/elevation.tif | Bin 0 -> 3965 bytes template/data/suitability.tif | Bin 0 -> 3950 bytes template/main.cpp | 7 +++ 8 files changed, 116 insertions(+), 43 deletions(-) create mode 100644 template/CMakeLists.txt create mode 100644 template/data/bio1.tif create mode 100644 template/data/bio12.tif create mode 100644 template/data/elevation.tif create mode 100644 template/data/suitability.tif create mode 100644 template/main.cpp diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 83124e92..c7489553 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -3,115 +3,136 @@ { "version": "2.0.0", "tasks": [ - // Release mode { - "label": "Configure Conan Release", + "label": "Clean Build Folder", + "type": "shell", + "command": "rm -r ${workspaceFolder}/build", + "problemMatcher": [], + }, + // TEST RELEASE + { + "label": "Configure Conan (Release)", "type": "shell", "command": "conan install conanfile.py --profile:build=conan/profiles/linux-armv8-gcc12-release --profile:host=conan/profiles/linux-armv8-gcc12-release --build=missing --output-folder=build", "group": "test", "presentation": { "reveal": "always", - "panel": "new" + "panel": "shared" }, "dependsOn": [], }, { - "label": "Configure CMake Release", + "label": "Configure CMake (Release)", "type": "shell", "command": "cmake -B ${workspaceFolder}/build -S . -DCMAKE_BUILD_TYPE=Release --toolchain ${workspaceFolder}/build/conan_toolchain.cmake", "group": "test", "presentation": { "reveal": "always", - "panel": "new" + "panel": "shared" }, - "dependsOn": ["Configure Conan Release"], + "dependsOn": ["Configure Conan (Release)"], }, { - "label": "Unit Tests Build Release", + "label": "Build Unit Tests (Release)", "type": "shell", "command": "cmake --build ${workspaceFolder}/build --config Release", "group": "test", "presentation": { "reveal": "always", - "panel": "new" + "panel": "shared" }, - "dependsOn": ["Configure CMake Release"], + "dependsOn": ["Configure CMake (Release)"], }, { - "label": "Unit Tests Run Release", + "label": "Run Unit Tests (Release)", "type": "shell", "command": "cd ${workspaceFolder}/build && ctest -C Release --rerun-failed --output-on-failure", "group": "test", "presentation": { "reveal": "always", - "panel": "new" + "panel": "shared" }, - "dependsOn": ["Unit Tests Build Release"], + "problemMatcher": [], + "dependsOn": ["Build Unit Tests (Release)"], }, - // Debug mode + // TEST DEBUG { - "label": "Configure Conan Debug", + "label": "Configure Conan (Debug)", "type": "shell", "command": "conan install conanfile.py --profile:build=conan/profiles/linux-armv8-gcc12-debug --profile:host=conan/profiles/linux-armv8-gcc12-debug --build=missing --output-folder=build", "group": "test", "presentation": { "reveal": "always", - "panel": "new" + "panel": "shared" }, "dependsOn": [], }, { - "label": "Configure CMake Debug", + "label": "Configure CMake (Debug)", "type": "shell", - "command": "cmake -B ${workspaceFolder}/build -S . -DCMAKE_BUILD_TYPE=Debug --toolchain ${workspaceFolder}/build/conan_toolchain.cmake", + "command": "cmake -B ${workspaceFolder}/build -S . -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON --toolchain ${workspaceFolder}/build/conan_toolchain.cmake", "group": "test", "presentation": { "reveal": "always", - "panel": "new" + "panel": "shared" }, - "dependsOn": ["Configure Conan Debug"], + "dependsOn": ["Configure Conan (Debug)"], }, { - "label": "Unit Tests Build Debug", + "label": "Build Unit Tests (Debug)", "type": "shell", "command": "cmake --build ${workspaceFolder}/build --config Debug", "group": "test", "presentation": { "reveal": "always", - "panel": "new" + "panel": "shared" }, - "dependsOn": ["Configure CMake Debug"], + "dependsOn": ["Configure CMake (Debug)"], }, { - "label": "Unit Tests Run Debug", + "label": "Run Unit Tests (Debug)", "type": "shell", "command": "cd ${workspaceFolder}/build && ctest -C Debug --rerun-failed --output-on-failure", "group": "test", "presentation": { "reveal": "always", - "panel": "new" + "panel": "shared" }, - "dependsOn": ["Unit Tests Build Debug"], + "problemMatcher": [], + "dependsOn": ["Build Unit Tests (Debug)"], }, + // TEMPLATE PROJECT { - "label": "Build Main", + "label": "Configure CMake Template (Debug)", "type": "shell", - "command": "g++ -g main.cpp -o main.out", - "group": { - "kind": "build", - "isDefault": true + "command": "cmake -B ${workspaceFolder}/build -S . -DCMAKE_BUILD_TYPE=Debug --toolchain ${workspaceFolder}/build/conan_toolchain.cmake", + "group": "test", + "presentation": { + "reveal": "always", + "panel": "shared" }, - //"dependsOn": ["Configure CMake"], + "dependsOn": ["Configure Conan (Debug)"], }, { - "label": "Clean Build Folder", + "label": "Build Template Project (Debug)", "type": "shell", - "command": "rm -r ${workspaceFolder}/build", - "group": { - "kind": "build", - "isDefault": true + "command": "cd ${workspaceFolder}/build && cmake --build . ", + "presentation": { + "reveal": "always", + "panel": "shared" + }, + "dependsOn": ["Configure CMake Template (Debug)"], + }, + { + "label": "Run Template Project (Debug)", + "type": "shell", + "command": "cd ${workspaceFolder}/build/template && ./main ", + "presentation": { + "reveal": "always", + "panel": "shared" }, - //"dependsOn": ["Configure CMake"], - } + "dependsOn": ["Build Template Project (Debug)"], + "problemMatcher": [], + }, ] } \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 29e00dd7..3b28d880 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,8 +17,16 @@ add_subdirectory(src) # generate project documentation add_subdirectory(docs) -enable_testing() -# add unit tests -add_subdirectory(test) -# add usage example -add_subdirectory(example) +# add template project +add_subdirectory(template) + +# We default to build tests if option -D CMAKE_BUILD_TESTS=ON not provided (no FORCE, so the previous value, if set, stays) +set(BUILD_TESTS OFF CACHE STRING "Build module test") + +if(BUILD_TESTS) + enable_testing() + # add unit tests + add_subdirectory(test) + # add usage example + add_subdirectory(example) +endif() \ No newline at end of file diff --git a/template/CMakeLists.txt b/template/CMakeLists.txt new file mode 100644 index 00000000..5df10d19 --- /dev/null +++ b/template/CMakeLists.txt @@ -0,0 +1,37 @@ +# requires cxx_std_20 new in CMake 3.12 +cmake_minimum_required(VERSION 3.12) + +# Tell find_package() to first search using Config mode before falling back to Module mode (for conan) +set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE) + +# Global approach Gdal +find_package(GDAL REQUIRED) + +# range-v3 +find_package(range-v3) + +# Include Boost as an imported target: 1.73 important for compilation with gcc 10 and C++20 +find_package(Boost 1.79 REQUIRED COMPONENTS unit_test_framework filesystem serialization) +if(Boost_FOUND) + include_directories(${Boost_INCLUDE_DIRS}) # Find Boost headers only +ENDIF() + +# Copy the data required by I/O examples +file(COPY data DESTINATION ${CMAKE_BINARY_DIR}/template) + +# Create director to store the examples output (for future doc) +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/template/output) + +# Add compile target +add_executable(main main.cpp) +# Require the standard +target_compile_features(main PUBLIC cxx_std_20) +# Ignore warnings about subtle ABI change +target_compile_options(main PUBLIC "-Wno-psabi") +# Link to Boost libraries AND other targets and dependencies +target_link_libraries(main quetzal::quetzal boost::boost GDAL::GDAL range-v3::range-v3) +# Specifies include directories to use when compiling a given target +target_include_directories( + main PRIVATE + $ + $) diff --git a/template/data/bio1.tif b/template/data/bio1.tif new file mode 100644 index 0000000000000000000000000000000000000000..2b09500677bc9b5bb57f2784b0f6ecb97dc03a7a GIT binary patch literal 3948 zcmbW4e@q<5702iJaU5`_fWZ)q$r)2(Kwj_6?9R@}nB0{ME;itc!45_#zDqF0rnq*D zTS6=4dl%4rCmplT&+AGe zLV*rDvcmakuzwkhMh>u(;l2|=JBk9^1NLMvYCbA2*#0w7=m-dL&^Zcr7F_cS@YO%g zulX*FEd3u1_cnfux42yum3v!#4Zc=iNrJ;sT;963#c{ybvUhWCb&ad0yt<~mw0cja ztG2vyXJxMAu&?Fd_h3xUEx`(xNbyG9;eUBP=Bf&J!$gubEGW}7RTbs}u=0hLHdU0xFg;Q_OwC80d~zktn7V0AP&G z{f!7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Q7MfUY4>$N^QP>e$oT;^1I4c1{U=UmP?<%`q#p@KOL;LZrizC zvc5TY^!oeNnNQ#Cyke<7_QIAY-~Q+3k*#yTj7{ygCv>fC+VFYh>Zb39lAZV7SJILA zMbnS+iGh)xmS^z?AFs5Fxb*K+F8|wkpzxK<+;Z$m&q>K_Y0qum((##PU~lsE?1`%v z8;fc#)$JTb^OrrkyZxxUp>4sTfz-akZ~kTT(wv<5x^177x78btY?lb>CQOPcfyz4cYNozIUf$5$~fq_ z`g(rHrOrt@*zY`(Z-2Qr=@GjuKUZ__y4?4YBu`$$wxpZ`t~v9ACpQ%~4|;kF=Gd;E z_h-fAj*EM;(o0*DrB1uca^!ip=e3p{BkM!;HZSPu-6GCu}ZT z=nt!kEOp8G{>~q+rmi@2!7t0=$1bel-GS3zWXL5Q!L)rP zd9KF2=d?j@`-h%~s?U!0x#Q>djj!;vS|(ftzwLM2UFJG1O{T|<{gSUr?W^xy5TDb( zy5y-{p5Eft*kc_Jy2nUEW|};H{+a#XTnpOL7s_94w$|JTI%2ZqE3WSCTh4CXAGpwy z=Cnvd8C}cr$~|8n8E@Tjj~sYsQ~SWR%ME+wfW>X?{Xs2oj4b*tA;BtJEN_fBgN611 z=W$oeNP3WUp1E`|tuy_JgT={BH`Z*3++1HHdtkKw^mjhINsZllls>1QCmS%RnnTfyhD>GV!o~V^!|jp=3z2# NdEn6cy}$c~<-d5VKmh;% literal 0 HcmV?d00001 diff --git a/template/data/elevation.tif b/template/data/elevation.tif new file mode 100644 index 0000000000000000000000000000000000000000..0b4c9a82f1029d214880e74147708319d6e14c15 GIT binary patch literal 3965 zcmbVPeNa@_6@PCRmR%rZSrLe0SP%^#$>Y8I?x#U!HxkU6ERz63H+)j3Z38oH`WXj&$(Z50bcS6HwgaAZ0cZu-21X9pNiQc(t?OKZBsK3! zlx#5m53qk9vPy2SGvK{Lp+w07_A0R74Oyn5+5mR&utjPDAPzW9V9$eRPJyp+d4A?| zb7tm$E43$^-9^5}+Kui_fs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Z~kTT(wv<5x^177x78btY?lb>CQOPcfyz4cYNozIUf$5$~fq_ z`g(rHrOrt@*zY`(Z-2Qr=@GjuKUZ__y4?4YBu`$$wxpZ`t~v9ACpQ%~4|;kF=Gd;E z_h-fAj*EM;(o0*DrB1uca^!ip=e3p{BkM!;HZSPu-6GCu}ZT z=nt!kEOp8G{>~q+rmi@2!7t0=$1bel-GS3zWXL5Q!L)rP zd9KF2=d?j@`-h%~s?U!0x#Q>djj!;vS|(ftzwLM2UFJG1O{T|<{gSUr?W^xy5TDb( zy5y-{p5Eft*kc_Jy2nUEW|};H{+a#XTnpOL7s_94w$|JTI%2ZqE3WSCTh4CXAGpwy z=Cnvd8C}cr$~|8n8E@Tjj~sYsQ~SWR%ME+wfW>X?{Xs2oj4b*tA;BtJEN_fBgN611 z=W$oeNP3WUp1E`|tuy_JgT={BH`Z*3++1HHdtkKw^mjhINsZllls>1QCmS%RnnTfyhD>GV!o~V^!|jp=3z2# NdEn6cy}$c~<-d5VKmh;% literal 0 HcmV?d00001 diff --git a/template/data/suitability.tif b/template/data/suitability.tif new file mode 100644 index 0000000000000000000000000000000000000000..3d16cd004e8110cbafa78ed345a594421c793a8a GIT binary patch literal 3950 zcmbW4O=uHA6vrn?t!<4}Y5h1T#CRx3yWN@Dot=d=ZD>l_Vq0lat*07o#G*+{o1=(U zAq7D^3EmW{0V&#o2f>RV73@vWlY+M%MGD1}#W!gKZL+)Boh)zXWoG`fZ-4uCnP*w& zQ4>O_4WU2?1;7h|1@`zs@LQm7Q;hBQi+PQE{9}QJvbM1mq2s&#LUUr*7i*r}opTe! zr}t>bz;7%rHWou+Dw(8(>a8lZP_`ZS7GW*mnxSwX2WVU@~!GI9td}WeS;iOC%Dr z3fWvFpUGu=qN#KuZKcvye`<0#F<}jl4@V>OncVDc7*nHh9P1X7-BbgKk$sXb6Mpq& z)=168bOoD4C92L1O7(0P*6S{lN+**8m%Ls-Igsifvo5Bs(S0FD=4Qn0PG#q>&rQ!3 zrf2fe__gU7Jn7-?tC?Z{%s?W^Oel$BGLx8uYgFY_3YvQWw$O0Y5gMuc&}tHm_=g4( zNob(d6;24&h+#6S8%zqCdjPi3h%+?m9~$)!4J4A#gpw%+F$mKcXH3Ufikf=_w$!LI zHO)UY%|A7eNKz9@s+gvMxuIgNnnaG8djz)BG-qn{zp6DasP3N{NF=EVrLJh4QL1rM zr8+UBa?L#gTWY#9HReCpn15;@k)$S+MByB324^bAsw($gbC1B58gr&*_@`$0rv?&9 zYC=gB6;q0V8B;MPQn}_Hfh{$|nHu*`jr*qt5=m-8Nfp?37@TlbXUq`P>c1h?yEXR+ zY^iZ)Y92P7)w?y*KQ)j@QWHw5a7Z>&gJd(fW=iFndjz)BOlN9Xtt4Bldw-!&DJ33?|KkkeS^;KpB%2n1uBnp}UR6bBrK?_9=lyCvGaWv4hT7*&5SpNU`TyxV( zQH&odw+Jof3Qx~0&58B;UZp1zmj_c3uH8X@mF2h>>wfnv?!}sie)f2=_v~NXiv^#r z$GzB}BOf}xY>k)JKYi_JySiC=6nauxc)eEIcrjY~eD+G|$FFZMm$w#6o!__PUTp2a NtzIt%6=$y(`w#i8P#XXM literal 0 HcmV?d00001 diff --git a/template/main.cpp b/template/main.cpp new file mode 100644 index 00000000..4dfdb153 --- /dev/null +++ b/template/main.cpp @@ -0,0 +1,7 @@ +#include "quetzal/quetzal.hpp" +#include + +int main() +{ + std::cout << "yo" << std::endl; +} \ No newline at end of file