diff --git a/.github/workflows/build-ubuntu.yml b/.github/workflows/build-ubuntu.yml new file mode 100644 index 0000000..5c67453 --- /dev/null +++ b/.github/workflows/build-ubuntu.yml @@ -0,0 +1,33 @@ +name: build-ubuntu + +on: + workflow_dispatch: + workflow_call: + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + configuration: [Debug, Release] + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: setup + run: | + sudo apt update + sudo apt -y install libopencv-dev libglfw3 libglfw3-dev libxkbcommon-dev libxinerama-dev libxcursor-dev libxi-dev doxygen graphviz + + - name: Configure Ubuntu + run: cmake -B ${{github.workspace}}/build/gcc-${{ matrix.configuration }} -S . -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} + + - name: Build Ubuntu + run: cmake --build ${{github.workspace}}/build/gcc-${{ matrix.configuration }} --config ${{ matrix.configuration }} -- -j 10 + + - name: Test Ubuntu + run: | + cd ${{github.workspace}}/build/gcc-${{ matrix.configuration }} + ctest -C ${{ matrix.configuration }} + diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml new file mode 100644 index 0000000..73738b8 --- /dev/null +++ b/.github/workflows/build-windows.yml @@ -0,0 +1,43 @@ +name: build-windows + +on: + workflow_dispatch: + workflow_call: + +jobs: + build: + runs-on: windows-latest + strategy: + matrix: + configuration: [Debug] + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Cacke vcpkg + uses: actions/cache@v3 + with: + path: 'C:/vcpkg/installed' + key: vcpkg-x64-windows-${{ matrix.configuration }} + restore-keys: | + vcpkg-x64-windows-${{ matrix.configuration }} + + - name: Install OpenCV vcpkg + run: | + vcpkg install opencv[core]:x64-windows-static + + - name: Set PATH for vcpkg + run: echo "PATH=C:/vcpkg/installed/x64-windows/bin:${{ env.PATH }}" >> $GITHUB_ENV + + - name: Configure Windows + run: cmake -B ${{github.workspace}}/build/msvc-${{ matrix.configuration }} -S . -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static + + - name: Build Windows + run: cmake --build ${{github.workspace}}/build/msvc-${{ matrix.configuration }} --config ${{ matrix.configuration }} -j 10 + + - name: Test Windows + run: | + cd ${{github.workspace}}/build/msvc-${{ matrix.configuration }} + ctest -C ${{ matrix.configuration }} diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml new file mode 100644 index 0000000..e185eb2 --- /dev/null +++ b/.github/workflows/ci-workflow.yml @@ -0,0 +1,25 @@ +name: CI Workflow + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + workflow_dispatch: + +jobs: + build-ubuntu: + uses: ./.github/workflows/build-ubuntu.yml + + build-windows: + uses: ./.github/workflows/build-windows.yml + + generate-docs: + permissions: + id-token: write + pages: write + uses: ./.github/workflows/generate-docs.yml + if: github.ref == 'refs/heads/main' + needs: + - build-ubuntu + - build-windows diff --git a/.github/workflows/cmake.yml b/.github/workflows/generate-docs.yml similarity index 52% rename from .github/workflows/cmake.yml rename to .github/workflows/generate-docs.yml index 697c57c..5ae2601 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/generate-docs.yml @@ -1,40 +1,33 @@ -name: C/C++ CI +name: generate-docs on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] workflow_dispatch: + workflow_call: jobs: build: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 with: submodules: recursive + - name: setup run: | sudo apt update - sudo apt -y install libopencv-dev libglfw3 libglfw3-dev libxkbcommon-dev libxinerama-dev libxcursor-dev libxi-dev doxygen graphviz - - name: configure - run: cmake --preset gcc-debug - - name: build - run: cmake --build build --preset gcc-debug - - name: test - run: | - cd ${{github.workspace}}/build/gcc-debug - ctest -C Debug + sudo apt -y install doxygen graphviz - - name: Upload static files as artifact + - name: Generate Documentation + run: | + cmake -S . -B build -DPIXELARIUM_BUILD_DOCS_ONLY=ON + cmake --build build + + - name: Upload Documentation Files as Artifacts id: deployment uses: actions/upload-pages-artifact@v3 with: - path: ${{github.workspace}}/build/gcc-debug/doc/html + path: ${{github.workspace}}/build/doc/html - # Deployment job deploy: environment: name: github-pages diff --git a/CMakeLists.txt b/CMakeLists.txt index 32e49ee..0f69878 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,10 @@ cmake_minimum_required(VERSION 3.23) -project(pixelarium VERSION 0.0.5) +project(pixelarium VERSION 0.0.6) set(CMAKE_VERBOSE_MAKEFILE ON) -set(CXX_STANDARD 23) -set(CXX_STANDARD_REQUIRED true) +set(CMAKE_CXX_STANDARD 23) +set(CMAKE_CXX_STANDARD_REQUIRED true) # setting global module directories set(glfw3_module_DIR ${PROJECT_SOURCE_DIR}/modules/glfw) @@ -13,28 +13,61 @@ set(imgui_DIR ${PROJECT_SOURCE_DIR}/modules/imgui) set(pfd_DIR ${PROJECT_SOURCE_DIR}/modules/portable-file-dialogs) set(spdlog_DIR ${PROJECT_SOURCE_DIR}/modules/spdlog) -find_package(OpenGL REQUIRED) - message(STATUS "GLFW:\t" ${glfw3_module_DIR}) message(STATUS "PFD:\t\t" ${pfd_DIR}) message(STATUS "SPDLOG:\t" ${spdlog_DIR}) #==================== # Options -option(PIXELARIUM_BUILD_UNITTESTS "Generate Unittests" ON) -option(PIXELARIUM_BUILD_DOCS "Generate Documentation" ON) +option(PIXELARIUM_BUILD_UNITTESTS "Generate Unittests" ON) +option(PIXELARIUM_BUILD_DOCS "Generate Documentation" ON) +option(PIXELARIUM_BUILD_DOCS_ONLY "Build only Documentation (no compilatoin)" OFF) #==================== +if(PIXELARIUM_BUILD_DOCS OR PIXELARIUM_BUILD_DOCS_ONLY) + include(${PROJECT_SOURCE_DIR}/cmake/awesomeDoxygen.cmake) + set(MAINPAGE_FILE "doc/index.md") + find_package(Doxygen) + if (DOXYGEN_FOUND) + + set(DOXYGEN_IN ${PROJECT_SOURCE_DIR}/doc/Doxyfile.in) + set(DOXYGEN_OUT ${CMAKE_BINARY_DIR}/Doxyfile) + + configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY) + message(STATUS "Building Docs") + + add_custom_target(doxygen ALL + COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMENT "Generating Docs") + + else (DOXYGEN_FOUND) + message(FATAL_ERROR "Doxygen need to be installed to generate the doxygen documentation") + endif (DOXYGEN_FOUND) + + if(PIXELARIUM_BUILD_DOCS_ONLY) + message(STATUS "Documentation Generated successful") + list(APPEND CMAKE_MESSAGE_INDENT " ") + message(STATUS "PIXELARIUM_BUILD_DOCS_ONLY was set to ON. Thus, no compilation will follow.") + message(STATUS "If compilation shall occur, set '-DPIXELARIUM_BUILD_DOCS_ONLY=OFF'.") + list(POP_BACK CMAKE_MESSAGE_INDENT) + + return() + endif() +endif() + +find_package(OpenGL REQUIRED) + if(WIN32) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - set(CMAKE_CXX_FLAGS "/std:c++23 /Zi /EHsc") + set(CMAKE_CXX_FLAGS "/Zi /EHsc") else() - set(CMAKE_CXX_FLAGS "-Wall -Wextra -g --std=c++23") + set(CMAKE_CXX_FLAGS "-Wall -Wextra -g") endif() endif() if(UNIX) - set(CMAKE_CXX_FLAGS "-Wall -Wextra -g --std=c++23") + set(CMAKE_CXX_FLAGS "-Wall -Wextra -g") endif() string(TOUPPER "${CMAKE_PROJECT_NAME}" PIXELARIUM_TITLE) @@ -78,25 +111,3 @@ if(PIXELARIUM_BUILD_UNITTESTS) enable_testing() add_subdirectory(tests) endif() - -if(PIXELARIUM_BUILD_DOCS) - include(${PROJECT_SOURCE_DIR}/cmake/awesomeDoxygen.cmake) - set(MAINPAGE_FILE "doc/index.md") - find_package(Doxygen) - if (DOXYGEN_FOUND) - - set(DOXYGEN_IN ${PROJECT_SOURCE_DIR}/doc/Doxyfile.in) - set(DOXYGEN_OUT ${CMAKE_BINARY_DIR}/Doxyfile) - - configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY) - message(STATUS "Building Docs") - - add_custom_target(doxygen ALL - COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT} - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - COMMENT "Generating Docs") - - else (DOXYGEN_FOUND) - message(FATAL_ERROR "Doxygen need to be installed to generate the doxygen documentation") - endif (DOXYGEN_FOUND) -endif() diff --git a/CMakePresets.json b/CMakePresets.json index 6d9e3f7..853eaca 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -16,7 +16,8 @@ "FETCHCONTENT_FULLY_DISCONNECTED": "OFF", "CMAKE_VERBOSE_MAKEFILE": "ON", "PIXELARIUM_BUILD_UNITTESTS": "ON", - "PIXELARIUM_BUILD_DOCS": "OFF" + "PIXELARIUM_BUILD_DOCS": "OFF", + "PIXELARIUM_BUILD_DOCS_ONLY": "OFF" } }, { @@ -52,8 +53,7 @@ "cacheVariables": { "CMAKE_C_COMPILER": "gcc", "CMAKE_CXX_COMPILER": "g++", - "CMAKE_BUILD_TYPE": "Debug", - "PIXELARIUM_BUILD_DOCS": "ON" + "CMAKE_BUILD_TYPE": "Debug" } } ], diff --git a/cmake/libCZI.cmake b/cmake/libCZI.cmake index 66233d9..a593fa3 100644 --- a/cmake/libCZI.cmake +++ b/cmake/libCZI.cmake @@ -3,7 +3,7 @@ include(FetchContent) FetchContent_Declare( libCZI GIT_REPOSITORY https://github.com/ZEISS/libczi.git - GIT_TAG 593ee17587214358c535bd036473b1b62945e637 + GIT_TAG main ) if(NOT libCZI_POPULATED) @@ -13,6 +13,7 @@ if(NOT libCZI_POPULATED) set(LIBCZI_BUILD_CZICMD OFF CACHE BOOL "" FORCE) set(LIBCZI_BUILD_DYNLIB OFF CACHE BOOL "" FORCE) set(LIBCZI_BUILD_UNITTESTS OFF CACHE BOOL "" FORCE) + set(LIBCZI_BUILD_PREFER_EXTERNALPACKAGE_RAPIDJSON OFF CACHE BOOL "" FORCE) set(LIBCZI_DO_NOT_SET_MSVC_RUNTIME_LIBRARY ON CACHE BOOL "" FORCE) endif() diff --git a/doc/versions.md b/doc/versions.md index 92e482c..e14cc75 100644 --- a/doc/versions.md +++ b/doc/versions.md @@ -1,11 +1,12 @@ # Version History -| Version | Description | -|:-------:|:------------------------------------------------------------------------| -| 0.0.5 | Compile for C++23 and code style adaptions | -| 0.0.4 | Fix MSVC build, some cosmetics, explicit initial window size for images | -| 0.0.3 | Fetch subblocks based on the dimension selection sliders | -| 0.0.2 | Add Dimension selector sliders to CZI image view | -| 0.0.1 | Initiate CZI image view | -| 0.0.0 | Initial version | +| Version | Description | +|:-------:|:------------------------------------------------------------------------------------------------------------| +| 0.0.6 | Added documentation-only option `PIXELARIUM_BUILD_DOCS_ONLY`, libCZI upgrade to main branch CI improvements | +| 0.0.5 | Compile for C++23 and code style adaptions | +| 0.0.4 | Fix MSVC build, some cosmetics, explicit initial window size for images | +| 0.0.3 | Fetch subblocks based on the dimension selection sliders | +| 0.0.2 | Add Dimension selector sliders to CZI image view | +| 0.0.1 | Initiate CZI image view | +| 0.0.0 | Initial version | diff --git a/lib/utilities/ILog.hpp b/lib/utilities/ILog.hpp index 274e28f..b06e74c 100644 --- a/lib/utilities/ILog.hpp +++ b/lib/utilities/ILog.hpp @@ -1,11 +1,10 @@ #pragma once #include -#ifdef WIN32 +#ifdef _WIN32 #define __PRETTY_FUNCTION__ __FUNCTION__ #endif - namespace pixelarium::utils::log { enum class LogLevel