diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2f6aed0..1ba4cc3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,19 +4,13 @@ on: push: pull_request: -env: - VCPKG_COMMIT: cc97b4536ae749ec0e4f643488b600b217540fb3 - VCPKG_DIR: C:/deps/vcpkg - CMAKE_PRESET: ninja-msvc-vcpkg - jobs: job_build_cpp: name: win runs-on: windows-latest steps: - # Checkout - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: true fetch-depth: 0 @@ -27,26 +21,35 @@ jobs: vsversion: 2022 toolset: 14 - # Install latest CMake - uses: lukka/get-cmake@latest - - name: Create folder - run: | - mkdir ${{ env.VCPKG_DIR }} + - name: Install Conan + id: conan + uses: turtlebrowser/get-conan@main + + - name: Print conan version + run: echo "${{ steps.conan.outputs.version }}" - # Setup vcpkg and build deps - - name: Restore artifacts, or Run vcpkg, build and cache artifacts - uses: lukka/run-vcpkg@v11 - id: runvcpkg + - name: cache ~/.conan2 + id: cache-conan + uses: actions/cache@v2 + env: + cache-name: cache-conan-modules with: - vcpkgGitCommitId: ${{ env.VCPKG_COMMIT }} - vcpkgDirectory: ${{ env.VCPKG_DIR }} + path: ~/.conan2/ + key: ${{ runner.os }}-builder-${{ env.cache-name }}-${{ hashFiles('conanfile.py') }} + restore-keys: ${{ runner.os }}-builder-${{ env.cache-name }}- + + - name: Conan install + run: conan install . -s build_type=Release --output-folder=build --build=missing -c tools.cmake.cmaketoolchain:generator=Ninja --profile:host=./ci-conan-profile --profile:build=./ci-conan-profile - - name: Run CMake consuming CMakePresets.json and vcpkg.json by mean of vcpkg. - uses: lukka/run-cmake@v10 - with: - configurePreset: ninja-release-vcpkg-win - buildPreset: ninja-msvc-vcpkg-release + - name: Create build dir + run: mkdir build/ninja-release-win + + - name: Run CMake + run: | + cmake --preset ninja-release-win + cmake --build --preset ninja-msvc-release # Build the mod - uses: gruppe-adler/action-release-with-hemtt@v3 @@ -54,7 +57,7 @@ jobs: id: build # Upload the mod - - uses: actions/upload-artifact@v1 + - uses: actions/upload-artifact@v4 with: name: ${{ steps.build.outputs.mod_name }} path: ${{ steps.build.outputs.release_path }} @@ -62,7 +65,7 @@ jobs: # zip it - uses: papeloto/action-zip@v1 with: - files: \@${{ steps.build.outputs.mod_name }}/ + files: ${{ steps.build.outputs.release_path }} dest: \@${{ steps.build.outputs.mod_name }}.zip # release it diff --git a/.gitignore b/.gitignore index f9829f4..f38f78e 100644 --- a/.gitignore +++ b/.gitignore @@ -39,6 +39,7 @@ build *.pbo CMakeSettings.json +CMakeUserPresets.json # CMake CMakeCache.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index c58aee5..85ee7de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required (VERSION 3.12) +cmake_policy(SET CMP0091 NEW) + #----Make changes here #This is your project name. And also the filename of the resulting plugin. project (grad_meh) diff --git a/CMakePresets.json b/CMakePresets.json index 8fcf657..b4508f2 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -2,28 +2,28 @@ "version": 5, "cmakeMinimumRequired": { "major": 3, - "minor": 23, + "minor": 28, "patch": 0 }, "configurePresets": [ { - "name": "ninja-debug-vcpkg-win", - "displayName": "Ninja/Windows/Debug/VCPKG Config", - "description": "Ninja/Windows/Debug/VCPKG Config", - "binaryDir": "${sourceDir}/builds/${presetName}", + "name": "ninja-debug-win", + "displayName": "Ninja/Windows/Debug/Config", + "description": "Ninja/Windows/Debug/Config", + "binaryDir": "${sourceDir}/build/${presetName}", "generator": "Ninja", "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", "CMAKE_TOOLCHAIN_FILE": { "type": "FILEPATH", - "value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" + "value": "${sourceDir}/build/conan_toolchain.cmake" }, "CMAKE_INSTALL_PREFIX": { "type": "FILEPATH", "value": "${sourceDir}/install" }, "USE_64BIT_BUILD": true, - "VCPKG_TARGET_TRIPLET": "x64-windows-static", + "USE_STATIC_LINKING": true, "CMAKE_C_COMPILER": "cl", "CMAKE_CXX_COMPILER": "cl" }, @@ -34,10 +34,10 @@ } }, { - "name": "ninja-release-vcpkg-win", - "displayName": "Ninja/Windows/Release/VCPKG Config", - "inherits": "ninja-debug-vcpkg-win", - "description": "Ninja/Windows/Release/VCPKG Config", + "name": "ninja-release-win", + "displayName": "Ninja/Windows/Release/Config", + "inherits": "ninja-debug-win", + "description": "Ninja/Windows/Release/Config", "generator": "Ninja", "cacheVariables": { "CMAKE_BUILD_TYPE": "Release" @@ -46,20 +46,20 @@ ], "buildPresets": [ { - "name": "ninja-msvc-vcpkg-debug", - "configurePreset": "ninja-debug-vcpkg-win", - "displayName": "Build ninja-msvc-vcpkg (Debug)", - "description": "Build ninja-msvc-vcpkg (Debug) Configurations", + "name": "ninja-msvc-debug", + "configurePreset": "ninja-debug-win", + "displayName": "Build ninja-msvc (Debug)", + "description": "Build ninja-msvc (Debug) Configurations", "targets": "install", "configuration": "Debug" }, { - "name": "ninja-msvc-vcpkg-release", - "configurePreset": "ninja-release-vcpkg-win", - "displayName": "Build ninja-msvc-vcpkg (Release)", - "description": "Build ninja-msvc-vcpkg Configurations", + "name": "ninja-msvc-release", + "configurePreset": "ninja-release-win", + "displayName": "Build ninja-msvc (Release)", + "description": "Build ninja-msvc Configurations", "targets": "install", "configuration": "Release" } ] -} +} \ No newline at end of file diff --git a/addons/main/script_version.hpp b/addons/main/script_version.hpp index 9ba59aa..aa31525 100644 --- a/addons/main/script_version.hpp +++ b/addons/main/script_version.hpp @@ -1,4 +1,5 @@ -#define MAJOR 0 -#define MINOR 7 -#define PATCHLVL 1 -#define BUILD 8 +#define MAJOR 1 +#define MINOR 0 +#define PATCHLVL 0 +#define BUILD beta.3 + diff --git a/ci-conan-profile b/ci-conan-profile new file mode 100644 index 0000000..fa6e904 --- /dev/null +++ b/ci-conan-profile @@ -0,0 +1,8 @@ +[settings] +arch=x86_64 +build_type=Release +compiler=msvc +compiler.cppstd=17 +compiler.runtime=dynamic +compiler.version=193 +os=Windows diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 0000000..9ce1928 --- /dev/null +++ b/conanfile.py @@ -0,0 +1,22 @@ +from conan import ConanFile +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps + +class MehRecipe(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeToolchain", "CMakeDeps" + + def requirements(self): + self.requires("fmt/10.2.1") + self.requires("nlohmann_json/3.11.3") + self.requires("pcl/1.13.1") + self.requires("clipper2/1.3.0") + self.requires("plog/1.1.10") + self.requires("gdal/3.8.3") + self.requires("openimageio/2.5.9.0") + self.requires("libpng/1.6.43", override=True) + self.requires("boost/1.84.0", override=True) + self.requires("expat/[>=2.6.2 <3]", override=True) + self.requires("openjpeg/2.5.2", override=True) + + def build_requirements(self): + self.tool_requires("cmake/3.29.0") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index eb744eb..001a425 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.15) +cmake_minimum_required (VERSION 3.28) file(GLOB_RECURSE INTERCEPT_PLUGIN_SOURCES *.h *.hpp *.c *.cpp) @@ -21,9 +21,10 @@ set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_MULTITHREADED ON) set(Boost_USE_STATIC_RUNTIME ON) -find_package(Boost 1.82.0 REQUIRED COMPONENTS system filesystem thread iostreams) +find_package(Boost 1.84.0 REQUIRED COMPONENTS system filesystem thread iostreams) # OIIO +message(STATIC ${INTERCEPT_LINK_TYPE}) if("${INTERCEPT_LINK_TYPE}" STREQUAL "static") add_definitions(-DOIIO_STATIC_DEFINE) add_definitions(-DGRAD_AFF_STATIC_DEFINE) @@ -46,7 +47,7 @@ find_package(GDAL CONFIG REQUIRED) find_package(PCL CONFIG REQUIRED) # Clipper -find_package(polyclipping CONFIG REQUIRED) +find_package(clipper2 CONFIG REQUIRED) #include the Intercept headers from the submodule @@ -82,7 +83,7 @@ include(FetchContent) FetchContent_Declare( Corrosion GIT_REPOSITORY https://github.com/corrosion-rs/corrosion.git - GIT_TAG master # Optionally specify a commit hash, version tag or branch here + GIT_TAG v0.5.0 # Optionally specify a commit hash, version tag or branch here ) # Set any global configuration variables such as `Rust_TOOLCHAIN` before this line! FetchContent_MakeAvailable(Corrosion) @@ -90,7 +91,7 @@ FetchContent_MakeAvailable(Corrosion) # Import targets defined in a package or workspace manifest `Cargo.toml` file corrosion_import_crate(MANIFEST_PATH rvff-cxx/Cargo.toml) -corrosion_add_cxxbridge(rust-lib CRATE rvff-cxx MANIFEST_PATH rvff-cxx FILES lib.rs) +corrosion_add_cxxbridge(rust-lib CRATE rvff_cxx MANIFEST_PATH rvff-cxx FILES lib.rs) include_directories(${CMAKE_CURRENT_BINARY_DIR}) add_library(${INTERCEPT_PLUGIN_NAME} SHARED ${INTERCEPT_PLUGIN_SOURCES} ${INTERCEPT_HOST_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/version.cpp) @@ -99,13 +100,13 @@ target_include_directories(${INTERCEPT_PLUGIN_NAME} PUBLIC ${OPENIMAGEIO_INCLUDE target_link_libraries(${INTERCEPT_PLUGIN_NAME} GDAL::GDAL) -target_link_libraries(${INTERCEPT_PLUGIN_NAME} OpenImageIO::OpenImageIO OpenImageIO::OpenImageIO_Util) +target_link_libraries(${INTERCEPT_PLUGIN_NAME} openimageio::openimageio) target_link_libraries(${INTERCEPT_PLUGIN_NAME} ${Boost_LIBRARIES}) -target_link_libraries(${INTERCEPT_PLUGIN_NAME} nlohmann_json nlohmann_json::nlohmann_json) -target_link_libraries(${INTERCEPT_PLUGIN_NAME} fmt::fmt-header-only) -target_link_libraries(${INTERCEPT_PLUGIN_NAME} ${PCL_LIBRARIES}) -target_link_libraries(${INTERCEPT_PLUGIN_NAME} polyclipping::polyclipping) +target_link_libraries(${INTERCEPT_PLUGIN_NAME} nlohmann_json::nlohmann_json) +target_link_libraries(${INTERCEPT_PLUGIN_NAME} fmt::fmt) +target_link_libraries(${INTERCEPT_PLUGIN_NAME} PCL::PCL) +target_link_libraries(${INTERCEPT_PLUGIN_NAME} clipper2::clipper2) target_link_libraries(${INTERCEPT_PLUGIN_NAME} plog::plog) @@ -117,11 +118,7 @@ endif() if(MSVC) # Note: This is required because we use `cxx` which uses `cc` to compile and link C++ code. - if(CMAKE_BUILD_TYPE STREQUAL "Debug") - corrosion_set_env_vars(rvff-cxx "CFLAGS=-MTd" "CXXFLAGS=-MTd") - else() - corrosion_set_env_vars(rvff-cxx "CFLAGS=-MT" "CXXFLAGS=-MT") - endif() + corrosion_set_env_vars(rvff_cxx "CFLAGS=-MD$<$:d>" "CXXFLAGS=-MD$<$:d>") endif() include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${INTERCEPT_INCLUDE_PATH}) @@ -138,7 +135,7 @@ else() set(CMAKE_CXX_FLAGS_RELEASE "/MT /Zi /O2 /Ob1 /EHsc /MP") #with debug info # /FORCE:MULTIPLE requrired to ignore second definition of tiff stuff in gdal (conflicting with oiio?) target_link_options(${INTERCEPT_PLUGIN_NAME} PUBLIC "/FORCE:MULTIPLE") - set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "/DEBUG:FULL /NODEFAULT:LIBCMTD") + set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "/DEBUG:FULL")# /NODEFAULT:LIBCMTD") set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "/OPT:REF /DEBUG:FULL /NODEFAULT:LIBCMTD") endif() @@ -149,6 +146,10 @@ if("${PLUGIN_FOLDER}" STREQUAL "") SET(PLUGIN_FOLDER "${ARMA_PATH}\\@grad_meh\\intercept") endif() +message("Build Type: " ${CMAKE_BUILD_TYPE}) +message("Use Static Linking: " ${USE_STATIC_LINKING}) +message("Cmake Install Prefix: " ${CMAKE_INSTALL_PREFIX}) + message("grad_meh plugin folder: " ${PLUGIN_FOLDER}) if(NOT "${PLUGIN_FOLDER}" STREQUAL "") add_custom_command(TARGET ${INTERCEPT_PLUGIN_NAME} POST_BUILD diff --git a/src/area.cpp b/src/area.cpp index 18a2050..bc7e1ed 100644 --- a/src/area.cpp +++ b/src/area.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include #include @@ -69,7 +69,7 @@ void writeArea(rvff::cxx::OprwCxx& wrp, fs::path& basePathGeojson, const std::ve ec.extract(cluster_indices); pcl::PCDWriter writer; - ClipperLib::Paths paths; + Clipper2Lib::Paths64 paths; paths.reserve(nPoints); for (std::vector::const_iterator it = cluster_indices.begin(); it != cluster_indices.end(); ++it) @@ -82,19 +82,20 @@ void writeArea(rvff::cxx::OprwCxx& wrp, fs::path& basePathGeojson, const std::ve cloudCluster->is_dense = true; for (auto& point : *cloudCluster) { - ClipperLib::Path polygon; - polygon.push_back(ClipperLib::IntPoint(point.x - buffer, point.y)); - polygon.push_back(ClipperLib::IntPoint(point.x, point.y - buffer)); - polygon.push_back(ClipperLib::IntPoint(point.x + buffer, point.y)); - polygon.push_back(ClipperLib::IntPoint(point.x, point.y + buffer)); + Clipper2Lib::Path64 polygon; + polygon.push_back(Clipper2Lib::Point64(point.x - buffer, point.y)); + polygon.push_back(Clipper2Lib::Point64(point.x, point.y - buffer)); + polygon.push_back(Clipper2Lib::Point64(point.x + buffer, point.y)); + polygon.push_back(Clipper2Lib::Point64(point.x, point.y + buffer)); paths.push_back(polygon); } } - ClipperLib::Paths solution; - ClipperLib::Clipper c; - c.AddPaths(paths, ClipperLib::ptSubject, true); - c.Execute(ClipperLib::ctUnion, solution, ClipperLib::pftNonZero); + //Clipper2Lib::Paths64 solution; + //Clipper2Lib::Clip c; + //c.AddPaths(paths, Clipper2Lib::ptSubject, true); + //c.Execute(Clipper2Lib::ctUnion, solution, Clipper2Lib::pftNonZero); + Clipper2Lib::Paths64 solution = Clipper2Lib::Union(paths, Clipper2Lib::FillRule::NonZero); std::vector rings; rings.reserve(solution.size()); @@ -102,7 +103,7 @@ void writeArea(rvff::cxx::OprwCxx& wrp, fs::path& basePathGeojson, const std::ve for (auto& path : solution) { auto ring = new OGRLinearRing(); for (auto& point : path) { - ring->addPoint(point.X, point.Y); + ring->addPoint(point.x, point.y); } ring->closeRings(); rings.push_back(ring); diff --git a/src/geojsons.cpp b/src/geojsons.cpp index 1358598..e27a179 100644 --- a/src/geojsons.cpp +++ b/src/geojsons.cpp @@ -970,7 +970,7 @@ void writeGeojsons(rvff::cxx::OprwCxx& wrp, std::filesystem::path& basePathGeojs for (auto& genericMapType : genericMapTypes) { if (objectMap.find(genericMapType) != objectMap.end()) { if (genericMapType == "tree") { - writeArea(wrp, basePathGeojson, objectMap["tree"], 15, 5, 10, 7, "forest"); + writeArea(wrp, basePathGeojson, objectMap["tree"], 13, 4, 10, 7, "forest"); } else if (genericMapType == "rock") { writeArea(wrp, basePathGeojson, objectMap["rock"], 10, 4, 10, 7, "rocks"); diff --git a/src/rvff-cxx b/src/rvff-cxx index ba3029d..3b8eff3 160000 --- a/src/rvff-cxx +++ b/src/rvff-cxx @@ -1 +1 @@ -Subproject commit ba3029dbf020789a305a534ee8adc9912383270b +Subproject commit 3b8eff3adb1ba70999940a01a4b263f0b24f5852 diff --git a/src/satimages.cpp b/src/satimages.cpp index 159f4f7..40730d2 100644 --- a/src/satimages.cpp +++ b/src/satimages.cpp @@ -3,7 +3,7 @@ #include #include -using namespace OpenImageIO_v2_4; +using namespace OpenImageIO_v2_5; // Range TODO: replace with C++20 Range #include diff --git a/vcpkg.json b/vcpkg.json deleted file mode 100644 index 74584b3..0000000 --- a/vcpkg.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "grad-meh", - "version-string": "0.7.1", - "dependencies": [ - "nlohmann-json", - "boost-filesystem", - "boost-iostreams", - { - "name": "openimageio", - "default-features": true, - "features": [ - "freetype" - ] - }, - "plog", - { - "name": "gdal", - "default-features": false, - "features": [ - "geos" - ] - }, - "pcl", - "polyclipping", - "fmt" - ] -} \ No newline at end of file