diff --git a/.gitignore b/.gitignore index 3c35b94..716b193 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,4 @@ java/*.so java/*dll *.log +.vs/ diff --git a/native/src/CMakeLists.txt b/native/src/CMakeLists.txt index 114114d..6e10800 100644 --- a/native/src/CMakeLists.txt +++ b/native/src/CMakeLists.txt @@ -22,10 +22,20 @@ if (APPLE) set(CMAKE_INSTALL_RPATH "@rpath;/usr/local/lib;/opt/homebrew/lib;/opt/local/lib") endif () +if(MSVC) + add_definitions(-DWIN32_LEAN_AND_MEAN) + add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS) + add_compile_options(/EHsc /utf-8) + add_compile_definitions(_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR=1) + add_compile_options(/wd4996 /wd4530) +else() + if (NOT PDAL_BUILD) set(CMAKE_CXX_FLAGS "-std=c++14") endif() +endif() + # Setup JNI find_package(JNI REQUIRED) if (JNI_FOUND) @@ -69,4 +79,4 @@ else () add_library(${LIB_NAME} SHARED ${LIB_SRC}) install(TARGETS ${LIB_NAME} LIBRARY DESTINATION . OPTIONAL) target_link_libraries(${LIB_NAME} PRIVATE ${PDAL_LIB_NAME}) -endif () +endif () \ No newline at end of file diff --git a/native/src/include/JavaPipeline.hpp b/native/src/include/JavaPipeline.hpp index f62457e..1008670 100644 --- a/native/src/include/JavaPipeline.hpp +++ b/native/src/include/JavaPipeline.hpp @@ -45,6 +45,11 @@ #undef tolower #undef isspace +#ifndef PDAL_DLL +# define PDAL_DLL PDAL_EXPORT +#endif // !PDAL_DLL + + using pdal::point_count_t; namespace libpdaljava diff --git a/native/src/io_pdal_PointView.cpp b/native/src/io_pdal_PointView.cpp index 55f6f48..f61be77 100644 --- a/native/src/io_pdal_PointView.cpp +++ b/native/src/io_pdal_PointView.cpp @@ -307,10 +307,10 @@ JNIEXPORT jdoubleArray JNICALL Java_io_pdal_PointView_rasterizeTriangularMesh___ double determinant = (v2y - v3y) * (v1x - v3x) + (v3x - v2x) * (v1y - v3y); - double ymin = std::min(v1y, std::min(v2y, v3y)); - double ymax = std::max(v1y, std::max(v2y, v3y)); + double ymin = (std::min)(v1y, (std::min)(v2y, v3y)); + double ymax = (std::max)(v1y, (std::max)(v2y, v3y)); - double scanrow0 = std::max(std::ceil((ymin - eymin) / h - 0.5), 0.0); + double scanrow0 = (std::max)(std::ceil((ymin - eymin) / h - 0.5), 0.0); double scany = eymin + scanrow0 * h + h / 2.0; while (scany <= eymax && scany <= ymax) @@ -370,7 +370,7 @@ JNIEXPORT jdoubleArray JNICALL Java_io_pdal_PointView_rasterizeTriangularMesh___ } } - double scancol0 = std::max(std::ceil((xmin - exmin) / w - 0.5), 0.0); + double scancol0 = (std::max)(std::ceil((xmin - exmin) / w - 0.5), 0.0); double scanx = exmin + scancol0 * w + w / 2; while (scanx <= exmax && scanx <= xmax)