diff --git a/CMakeLists.txt b/CMakeLists.txt index 52e1eae..4567a09 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,13 @@ include(cmake/version.cmake) project(${META_PROJECT_NAME} VERSION ${META_VERSION} LANGUAGES C CXX) +if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(CMAKE_C_FLAGS "-static-libgcc") + set(CMAKE_CXX_FLAGS "-static-libgcc -static-libstdc++") + endif() +endif() + if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(_DEFAULT_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/install) set(CMAKE_INSTALL_PREFIX ${_DEFAULT_INSTALL_PREFIX} diff --git a/README_CN.md b/README_CN.md index e69de29..54d297f 100644 --- a/README_CN.md +++ b/README_CN.md @@ -0,0 +1,15 @@ +build ON windows + +# build on windows + +1. donwload toolchain +https://github.com/brechtsanders/winlibs_mingw/releases/download/12.3.0-16.0.4-11.0.0-msvcrt-r1/winlibs-x86_64-posix-seh-gcc-12.3.0-llvm-16.0.4-mingw-w64msvcrt-11.0.0-r1.zip + +2. set system path + +3. build deps + +4. build xrprimer + +5. run test + diff --git a/cmake/external/jsoncpp.cmake b/cmake/external/jsoncpp.cmake index 55d57cc..6487f63 100644 --- a/cmake/external/jsoncpp.cmake +++ b/cmake/external/jsoncpp.cmake @@ -1,14 +1,15 @@ include(ExternalProject) + externalproject_add( ext_jsoncpp PREFIX jsoncpp GIT_REPOSITORY https://github.com/open-source-parsers/jsoncpp.git GIT_TAG 5defb4ed1a4293b8e2bf641e16b156fb9de498cc # 1.9.5 CMAKE_ARGS ${ExternalProject_CMAKE_ARGS_hidden} - -DJSONCPP_WITH_TESTS=OFF - -DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF - -DJSONCPP_WITH_PKGCONFIG_SUPPORT=OFF - -DBUILD_OBJECT_LIBS=OFF - -DCMAKE_CXX_FLAGS="-fPIC" - -DCMAKE_INSTALL_PREFIX=${STAGED_INSTALL_PREFIX}/jsoncpp + -DJSONCPP_WITH_TESTS=OFF + -DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF + -DJSONCPP_WITH_PKGCONFIG_SUPPORT=OFF + -DBUILD_OBJECT_LIBS=OFF + -DCMAKE_CXX_FLAGS="-fPIC" + -DCMAKE_INSTALL_PREFIX=${STAGED_INSTALL_PREFIX}/jsoncpp ) diff --git a/cmake/external/opencv.cmake b/cmake/external/opencv.cmake index 478a4cf..9c93a7f 100644 --- a/cmake/external/opencv.cmake +++ b/cmake/external/opencv.cmake @@ -8,46 +8,46 @@ if(NOT IOS) PREFIX opencv URL ${OPENCV_URL} URL_HASH - SHA256=158db5813a891c7eda8644259fc1dbd76b21bd1ffb9854a8b4b8115a4ceec359 + SHA256=158db5813a891c7eda8644259fc1dbd76b21bd1ffb9854a8b4b8115a4ceec359 CMAKE_ARGS - ${ExternalProject_CMAKE_ARGS_hidden} - -DBUILD_ZLIB=ON - -DWITH_1394=OFF - -DWITH_ADE=OFF - -DWITH_ARAVIS=OFF - -DWITH_CLP=OFF - -DWITH_CUDA=OFF - -DWITH_CUFFT=OFF - -DWITH_NVCUVID=OFF - -DWITH_CUBLAS=OFF - -DWITH_FFMPEG=OFF - -DWITH_FREETYPE=OFF - -DWITH_GDAL=OFF - -DWITH_GDCM=OFF - -DWITH_GPHOTO2=OFF - -DWITH_GSTREAMER=OFF - -DWITH_GTK=OFF - -DWITH_GTK_2_X=OFF - -DWITH_HALIDE=OFF - -DWITH_HPX=OFF - -DWITH_INF_ENGINE=OFF - -DWITH_IPP=OFF - -DWITH_ITT=OFF - -DWITH_QUIRC=OFF - -DWITH_EIGEN=ON - -DWITH_IMGCODEC_HDR=ON - -DWITH_IMGCODEC_PFM=ON - -DWITH_IMGCODEC_PXM=ON - -DWITH_IMGCODEC_SUNRASTER=ON - -DWITH_JASPER=ON - -DWITH_JPEG=ON - -DBUILD_PROTOBUF=OFF - -DBUILD_opencv_apps=OFF - -DBULID_PNG=ON - -DOPENCV_SKIP_PYTHON_WARNING=ON - -DCMAKE_INSTALL_PREFIX=${STAGED_INSTALL_PREFIX}/opencv - -DBUILD_LIST="core,calib3d,features2d,flann,highgui,imgcodecs,imgproc,video,videoio" - -DCMAKE_PREFIX_PATH=${STAGED_INSTALL_PREFIX}/eigen3 + ${ExternalProject_CMAKE_ARGS_hidden} + -DBUILD_ZLIB=ON + -DWITH_1394=OFF + -DWITH_ADE=OFF + -DWITH_ARAVIS=OFF + -DWITH_CLP=OFF + -DWITH_CUDA=OFF + -DWITH_CUFFT=OFF + -DWITH_NVCUVID=OFF + -DWITH_CUBLAS=OFF + -DWITH_FFMPEG=OFF + -DWITH_FREETYPE=OFF + -DWITH_GDAL=OFF + -DWITH_GDCM=OFF + -DWITH_GPHOTO2=OFF + -DWITH_GSTREAMER=OFF + -DWITH_GTK=OFF + -DWITH_GTK_2_X=OFF + -DWITH_HALIDE=OFF + -DWITH_HPX=OFF + -DWITH_INF_ENGINE=OFF + -DWITH_IPP=OFF + -DWITH_ITT=OFF + -DWITH_QUIRC=OFF + -DWITH_EIGEN=ON + -DWITH_IMGCODEC_HDR=ON + -DWITH_IMGCODEC_PFM=ON + -DWITH_IMGCODEC_PXM=ON + -DWITH_IMGCODEC_SUNRASTER=ON + -DWITH_JASPER=ON + -DWITH_JPEG=ON + -DBUILD_PROTOBUF=OFF + -DBUILD_opencv_apps=OFF + -DBULID_PNG=ON + -DOPENCV_SKIP_PYTHON_WARNING=ON + -DCMAKE_INSTALL_PREFIX=${STAGED_INSTALL_PREFIX}/opencv + -DBUILD_LIST="core,calib3d,features2d,flann,highgui,imgcodecs,imgproc,video,videoio" + -DCMAKE_PREFIX_PATH=${STAGED_INSTALL_PREFIX}/eigen3 ) add_dependencies(ext_opencv ext_eigen) diff --git a/cmake/external/pnpsolver.cmake b/cmake/external/pnpsolver.cmake index 4bb9031..b26d1bd 100644 --- a/cmake/external/pnpsolver.cmake +++ b/cmake/external/pnpsolver.cmake @@ -7,8 +7,8 @@ if(NOT IOS) GIT_REPOSITORY https://github.com/GACLove/pnpsolver.git GIT_TAG 08182c16424d8730b36fce50168f820fc0733a74 CMAKE_ARGS ${ExternalProject_CMAKE_ARGS_hidden} -DBUILD_SHARED_LIBS=OFF - -DCMAKE_INSTALL_PREFIX=${STAGED_INSTALL_PREFIX}/pnpsolver - -DCMAKE_PREFIX_PATH=${STAGED_INSTALL_PREFIX} + -DCMAKE_INSTALL_PREFIX=${STAGED_INSTALL_PREFIX}/pnpsolver + -DCMAKE_PREFIX_PATH=${STAGED_INSTALL_PREFIX} ) add_dependencies(ext_pnpsolver ext_ceres) else() diff --git a/cmake/external/pybind11.cmake b/cmake/external/pybind11.cmake index f3dff7c..8ae7cc0 100644 --- a/cmake/external/pybind11.cmake +++ b/cmake/external/pybind11.cmake @@ -6,10 +6,11 @@ if(NOT IOS) PREFIX pybind11 URL https://github.com/pybind/pybind11/archive/refs/tags/v2.6.2.tar.gz URL_HASH - SHA256=8ff2fff22df038f5cd02cea8af56622bc67f5b64534f1b83b9f133b8366acff2 + SHA256=8ff2fff22df038f5cd02cea8af56622bc67f5b64534f1b83b9f133b8366acff2 CMAKE_ARGS ${ExternalProject_CMAKE_ARGS_hidden} - -DCMAKE_INSTALL_PREFIX=${STAGED_INSTALL_PREFIX}/pybind11 - -DBUILD_TESTING=OFF + -DCMAKE_INSTALL_PREFIX=${STAGED_INSTALL_PREFIX}/pybind11 + -DBUILD_TESTING=OFF + -DPYBIND11_USE_STATIC_PYTHON=ON ) else() message(STATUS "[XRPrimer] Disable pybind11 on IOS") diff --git a/cpp/pybind/calibration/calibrator_api.cpp b/cpp/pybind/calibration/calibrator_api.cpp index 6049fc5..771582b 100644 --- a/cpp/pybind/calibration/calibrator_api.cpp +++ b/cpp/pybind/calibration/calibrator_api.cpp @@ -6,7 +6,7 @@ void pybind_camera_calibrator(py::module &m) { m.def("CalibrateMultiPinholeCamera", &CalibrateMultiPinholeCamera); } -void xrprimer_pybind_calibrator(py::module &m) { - py::module m_submodule = m.def_submodule("calibrator"); - pybind_camera_calibrator(m_submodule); -} +// void xrprimer_pybind_calibrator(py::module &m) { +// py::module m_submodule = m.def_submodule("calibrator"); +// pybind_camera_calibrator(m_submodule); +// } diff --git a/cpp/pybind/calibration/calibrator_api.h b/cpp/pybind/calibration/calibrator_api.h index c19b047..62f4951 100644 --- a/cpp/pybind/calibration/calibrator_api.h +++ b/cpp/pybind/calibration/calibrator_api.h @@ -2,4 +2,4 @@ #include "pybind/xrprimer_pybind.h" -void xrprimer_pybind_calibrator(py::module &m); +// void xrprimer_pybind_calibrator(py::module &m); diff --git a/cpp/pybind/ops/pnpsolver.cpp b/cpp/pybind/ops/pnpsolver.cpp index 8bd22e1..abe9ff9 100644 --- a/cpp/pybind/ops/pnpsolver.cpp +++ b/cpp/pybind/ops/pnpsolver.cpp @@ -67,7 +67,7 @@ void pybind_pnpsolver(py::module &m) { m.def("prior_guided_pnp", &prior_guided_pnp, py::return_value_policy::copy); } -void xrprimer_pybind_pnpsolver(py::module &m) { - py::module m_submodule = m.def_submodule("ops"); - pybind_pnpsolver(m_submodule); -} +// void xrprimer_pybind_pnpsolver(py::module &m) { +// py::module m_submodule = m.def_submodule("ops"); +// pybind_pnpsolver(m_submodule); +// } diff --git a/cpp/pybind/ops/pnpsolver.h b/cpp/pybind/ops/pnpsolver.h index c23940a..577059e 100644 --- a/cpp/pybind/ops/pnpsolver.h +++ b/cpp/pybind/ops/pnpsolver.h @@ -2,4 +2,4 @@ #include "pybind/xrprimer_pybind.h" -void xrprimer_pybind_pnpsolver(py::module &m); +// void xrprimer_pybind_pnpsolver(py::module &m); diff --git a/cpp/pybind/xrprimer_pybind.cpp b/cpp/pybind/xrprimer_pybind.cpp index daac458..bf658a6 100644 --- a/cpp/pybind/xrprimer_pybind.cpp +++ b/cpp/pybind/xrprimer_pybind.cpp @@ -190,8 +190,8 @@ PYBIND11_MODULE(xrprimer_cpp, m) { pybind_eigen_classes(m); xrprimer_pybind_camera(m); - xrprimer_pybind_calibrator(m); + // xrprimer_pybind_calibrator(m); xrprimer_pybind_version(m); xrprimer_pybind_pose(m); - xrprimer_pybind_pnpsolver(m); + // xrprimer_pybind_pnpsolver(m); }