Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adding user template subproject #25

Merged
merged 3 commits into from
Dec 20, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
"feat: adding user template subproject"
Becheler committed Dec 20, 2023
commit 3770a4f896b9366dc3600fd4c3b944a7b016e27a
97 changes: 59 additions & 38 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -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": [],
},
]
}
18 changes: 13 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()
37 changes: 37 additions & 0 deletions template/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>)
Binary file added template/data/bio1.tif
Binary file not shown.
Binary file added template/data/bio12.tif
Binary file not shown.
Binary file added template/data/elevation.tif
Binary file not shown.
Binary file added template/data/suitability.tif
Binary file not shown.
7 changes: 7 additions & 0 deletions template/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "quetzal/quetzal.hpp"
#include <cassert>

int main()
{
std::cout << "yo" << std::endl;
}