diff --git a/.appveyor.yml b/.appveyor.yml index 4915c710c..787b2512d 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -19,7 +19,8 @@ clone_script: && git submodule update --init --recursive environment: - APPVEYOR_SAVE_CACHE_ON_ERROR : true + APPVEYOR_SAVE_CACHE_ON_ERROR: false + APPVEYOR_CACHE_SKIP_RESTORE: true VCPKG_DEFAULT_TRIPLET: x64-windows VCPKG_ROOT: c:\tools\vcpkg diff --git a/.coderabbit.yaml b/.coderabbit.yaml new file mode 100644 index 000000000..61c75aefa --- /dev/null +++ b/.coderabbit.yaml @@ -0,0 +1,77 @@ +language: en-US +tone_instructions: 'Be constructive and professional. Focus on technical accuracy while maintaining a friendly tone.' +early_access: true +enable_free_tier: true +reviews: + profile: assertive + request_changes_workflow: false + high_level_summary: true + high_level_summary_placeholder: '@coderabbitai summary' + auto_title_placeholder: '@coderabbitai' + review_status: true + commit_status: true + poem: true + collapse_walkthrough: false + sequence_diagrams: true + changed_files_summary: true + labeling_instructions: [] + path_filters: [] + path_instructions: + - path: 'src/**/*.cpp' + instructions: 'Focus on performance, memory management, and RAII principles' + - path: 'include/**/*.hpp' + instructions: 'Focus on design patterns, interfaces, and encapsulation' + - path: 'test/**/*.cpp' + instructions: | + Review the following unit test code written using doctest. Ensure the following: + - Comprehensive test coverage and proper test organization. + - The code adheres to best practices using doctest. + - Descriptive test names are used to clearly convey the intent of each test. + abort_on_close: true + auto_review: + enabled: true + auto_incremental_review: true + ignore_title_keywords: [] + labels: [] + drafts: true + base_branches: [] + tools: + shellcheck: + enabled: true + markdownlint: + enabled: true + github-checks: + enabled: true + timeout_ms: 90000 + gitleaks: + enabled: true + cppcheck: + enabled: true + languagetool: + enabled: true + enabled_only: false + level: default + hadolint: + enabled: true + yamllint: + enabled: true + actionlint: + enabled: true + pmd: + enabled: true + semgrep: + enabled: true +chat: + auto_reply: true +knowledge_base: + opt_out: false + learnings: + scope: auto + issues: + scope: auto + jira: + project_keys: [] + linear: + team_keys: [] + pull_requests: + scope: auto diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml index 9f6c23275..300122dbe 100644 --- a/.github/workflows/clang-format-check.yml +++ b/.github/workflows/clang-format-check.yml @@ -7,6 +7,7 @@ on: pull_request: branches: - develop + workflow_dispatch: jobs: formatting-check: diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 8deafba94..8bef77775 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -18,21 +18,13 @@ jobs: - name: Setup run: | - rm /usr/local/bin/2to3 - rm /usr/local/bin/2to3-3.11 - rm /usr/local/bin/2to3-3.12 - rm /usr/local/bin/idle3 - rm /usr/local/bin/idle3.11 - rm /usr/local/bin/idle3.12 - rm /usr/local/bin/pydoc3 - rm /usr/local/bin/pydoc3.11 - rm /usr/local/bin/pydoc3.12 - rm /usr/local/bin/python3 - rm /usr/local/bin/python3.11 - rm /usr/local/bin/python3.12 - rm /usr/local/bin/python3-config - rm /usr/local/bin/python3.11-config - rm /usr/local/bin/python3.12-config + # Remove Python symlinks if they exist + echo "Checking and removing Python symlinks..." + for file in \ + /usr/local/bin/{2to3,idle3,pydoc3,python3,python3-config}{,-3.11,-3.12}; do + [ -L "$file" ] && sudo rm "$file" || true + done + echo "Python symlink cleanup completed." brew install automake autoconf autoconf-archive libtool texinfo yasm ninja python ccache pkg-config - name: Restore artifacts or setup vcpkg diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b06bf861..42d290024 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.16...3.26) +cmake_minimum_required(VERSION 3.16) # vcpkg settings must be set before project() if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE) @@ -30,7 +30,7 @@ include(cmake/PreventInSourceBuilds.cmake) # Link this 'library' to set the c++ standard / compile-time options requested add_library(project_options INTERFACE) -target_compile_features(project_options INTERFACE cxx_std_20) +target_compile_features(project_options INTERFACE cxx_std_23) if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang") option(ENABLE_BUILD_WITH_TIME_TRACE "Enable -ftime-trace to generate time tracing .json files on clang" OFF) @@ -67,21 +67,31 @@ include(CMakeDependentOption) # Set CGAL_DATA_DIR to the location of the CGAL data files set(ENV{CGAL_DATA_DIR} CMAKE_BINARY_DIR/Data) +# Minimum compiler versions required for C++23 support: +# - MSVC 19.34 (Visual Studio 2022 version 17.4) +# - GCC 12.2 +# - AppleClang 14.0 +# - Clang 16.0 +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.34") + message(FATAL_ERROR "MSVC 19.34 or higher required for C++23 support") +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "12.2") + message(FATAL_ERROR "GCC 12.2 or higher required for C++23 support") +elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "16.0") + message(FATAL_ERROR "Clang 16.0 or higher required for C++23 support") +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "14.0") + message(FATAL_ERROR "AppleClang 14.0 or higher required for C++23 support") +endif() + # Set NOMINMAX to avoid min/max macro errors on Windows in date.h #if(WIN32) # # Workaround for https://github.com/CGAL/cgal/issues/4665 and https://github.com/microsoft/vcpkg/issues/23572 # add_compile_options(/DNOMINMAX) #endif() -if (MSVC) - # Add /utf-8 flag for MSVC - add_compile_options(/utf-8) -endif() - # Project vcpkg dependencies # https://github.com/CGAL/cgal -find_package(CGAL CONFIG REQUIRED OPTIONAL_COMPONENTS Qt5) +find_package(CGAL CONFIG REQUIRED) # Don't let CGAL override flags set(CGAL_DONT_OVERRIDE_CMAKE_FLAGS TRUE diff --git a/cmake/StandardProjectSettings.cmake b/cmake/StandardProjectSettings.cmake index bdd7314b1..83923a05e 100644 --- a/cmake/StandardProjectSettings.cmake +++ b/cmake/StandardProjectSettings.cmake @@ -38,7 +38,7 @@ endif() # Set minimum Boost version set(BOOST_MIN_VERSION "1.75.0") -# Use C++20 +# Use C++23 set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) @@ -55,8 +55,9 @@ add_definitions(-DCGAL_TRIANGULATION_NO_ASSERTIONS -DCGAL_TRIANGULATION_NO_POSTC # Easier navigation in an IDE when projects are organized in folders. set_property(GLOBAL PROPERTY USE_FOLDERS ON) -# Check if the compiler is MSVC +# Deal with UTF-8 encoding if (MSVC) - # Add /utf-8 flag to MSVC add_compile_options(/utf-8) +else() + add_compile_options(-finput-charset=UTF-8) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2566b8688..22ef11b73 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,7 +10,7 @@ target_link_libraries( spdlog::spdlog_header_only TBB::tbb CGAL::CGAL) -target_compile_features(initialize PRIVATE cxx_std_20) +target_compile_features(initialize PRIVATE cxx_std_23) add_executable(cdt-opt ${PROJECT_SOURCE_DIR}/src/cdt-opt.cpp) target_link_libraries( @@ -23,7 +23,7 @@ target_link_libraries( spdlog::spdlog_header_only TBB::tbb CGAL::CGAL) -target_compile_features(cdt-opt PRIVATE cxx_std_20) +target_compile_features(cdt-opt PRIVATE cxx_std_23) add_executable(cdt ${PROJECT_SOURCE_DIR}/src/cdt.cpp) target_link_libraries( @@ -37,40 +37,40 @@ target_link_libraries( spdlog::spdlog_header_only TBB::tbb CGAL::CGAL) -target_compile_features(cdt PRIVATE cxx_std_20) +target_compile_features(cdt PRIVATE cxx_std_23) # Build cdt-viewer locally, but not in CI since QT takes more than an hour to build there -if(APPLE AND NOT ($ENV{CI})) - add_executable(cdt-viewer ${PROJECT_SOURCE_DIR}/src/cdt-viewer.cpp) - target_link_libraries( - cdt-viewer - PRIVATE project_options - project_warnings - date::date-tz - Boost::program_options - fmt::fmt-header-only - Eigen3::Eigen - spdlog::spdlog_header_only - TBB::tbb - CGAL::CGAL_Basic_viewer) - target_compile_features(cdt-viewer PRIVATE cxx_std_20) -endif() +#if(APPLE AND NOT ($ENV{CI})) +# add_executable(cdt-viewer ${PROJECT_SOURCE_DIR}/src/cdt-viewer.cpp) +# target_link_libraries( +# cdt-viewer +# PRIVATE project_options +# project_warnings +# date::date-tz +# Boost::program_options +# fmt::fmt-header-only +# Eigen3::Eigen +# spdlog::spdlog_header_only +# TBB::tbb +# CGAL::CGAL_Basic_viewer) +# target_compile_features(cdt-viewer PRIVATE cxx_std_23) +#endif() # Build bistellar-flip locally, but not in CI since QT takes more than an hour to build there -if(APPLE AND NOT ($ENV{CI})) - add_executable(bistellar-flip ${PROJECT_SOURCE_DIR}/src/bistellar-flip.cpp) - target_link_libraries( - bistellar-flip - PRIVATE project_options - project_warnings - date::date-tz - fmt::fmt-header-only - Eigen3::Eigen - spdlog::spdlog_header_only - TBB::tbb - CGAL::CGAL_Basic_viewer) - target_compile_features(bistellar-flip PRIVATE cxx_std_20) -endif() +#if(APPLE AND NOT ($ENV{CI})) +# add_executable(bistellar-flip ${PROJECT_SOURCE_DIR}/src/bistellar-flip.cpp) +# target_link_libraries( +# bistellar-flip +# PRIVATE project_options +# project_warnings +# date::date-tz +# fmt::fmt-header-only +# Eigen3::Eigen +# spdlog::spdlog_header_only +# TBB::tbb) +# CGAL::CGAL_Basic_viewer) +# target_compile_features(bistellar-flip PRIVATE cxx_std_23) +#endif() # # Tests ## @@ -105,7 +105,7 @@ set_tests_properties(initialize-toroidal PROPERTIES PASS_REGULAR_EXPRESSION add_test(NAME cdt-opt COMMAND $) set_tests_properties(cdt-opt PROPERTIES PASS_REGULAR_EXPRESSION "cdt-opt started at") -if(APPLE AND NOT ($ENV{CI})) - add_test(NAME cdt-viewer COMMAND $ --dry-run test.off) - set_tests_properties(cdt-viewer PROPERTIES PASS_REGULAR_EXPRESSION "Dry run. Exiting.") -endif() +#if(APPLE AND NOT ($ENV{CI})) +# add_test(NAME cdt-viewer COMMAND $ --dry-run test.off) +# set_tests_properties(cdt-viewer PROPERTIES PASS_REGULAR_EXPRESSION "Dry run. Exiting.") +#endif() diff --git a/src/bistellar-flip.cpp b/src/bistellar-flip.cpp index b2fc4721c..bb246094d 100644 --- a/src/bistellar-flip.cpp +++ b/src/bistellar-flip.cpp @@ -69,7 +69,9 @@ try manifolds::Manifold_3 const manifold{ foliated_triangulations::FoliatedTriangulation_3{dt, 0, 1} }; +#ifdef ENABLE_VISUALIZATION CGAL::draw(manifold.get_delaunay()); +#endif fmt::print("After bistellar flip.\n"); manifold.print_cells(); utilities::print_delaunay(dt); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 67590809d..d5f9f79c5 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -17,8 +17,8 @@ add_executable( Torus_test.cpp Utilities_test.cpp Vertex_test.cpp) -# Activate C++20 features -target_compile_features(CDT_unit_tests PRIVATE cxx_std_20) +# Activate C++23 features +target_compile_features(CDT_unit_tests PRIVATE cxx_std_23) target_link_libraries( CDT_unit_tests PRIVATE project_options diff --git a/vcpkg.json b/vcpkg.json index 215b18ed7..90b087939 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -16,14 +16,6 @@ "name": "yasm-tool", "platform": "windows" }, - { - "name": "cgal", - "features": ["qt"], - "platform": "osx" - }, - { - "name": "cgal", - "platform": "!osx" - } + "cgal" ] } \ No newline at end of file