Skip to content

Commit

Permalink
test: can build on win, without pnp solver and calibration
Browse files Browse the repository at this point in the history
  • Loading branch information
gaopeng1 committed Aug 25, 2023
1 parent c42047f commit d94a211
Show file tree
Hide file tree
Showing 11 changed files with 86 additions and 62 deletions.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
15 changes: 15 additions & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
@@ -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

13 changes: 7 additions & 6 deletions cmake/external/jsoncpp.cmake
Original file line number Diff line number Diff line change
@@ -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
)
78 changes: 39 additions & 39 deletions cmake/external/opencv.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions cmake/external/pnpsolver.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
7 changes: 4 additions & 3 deletions cmake/external/pybind11.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
8 changes: 4 additions & 4 deletions cpp/pybind/calibration/calibrator_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
// }
2 changes: 1 addition & 1 deletion cpp/pybind/calibration/calibrator_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

#include "pybind/xrprimer_pybind.h"

void xrprimer_pybind_calibrator(py::module &m);
// void xrprimer_pybind_calibrator(py::module &m);
8 changes: 4 additions & 4 deletions cpp/pybind/ops/pnpsolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
// }
2 changes: 1 addition & 1 deletion cpp/pybind/ops/pnpsolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

#include "pybind/xrprimer_pybind.h"

void xrprimer_pybind_pnpsolver(py::module &m);
// void xrprimer_pybind_pnpsolver(py::module &m);
4 changes: 2 additions & 2 deletions cpp/pybind/xrprimer_pybind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit d94a211

Please sign in to comment.