Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apple Native #1530

Merged
merged 35 commits into from
Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a568d1f
OpenSfM builds
pierotofy Jun 27, 2022
30a0ed2
Merge master
pierotofy Aug 9, 2022
0bd0434
Superbuild updates
pierotofy Aug 9, 2022
e0210af
Compiles OpenMVS
pierotofy Aug 10, 2022
281fb52
Builds on M1
pierotofy Aug 10, 2022
181652e
Builds PDAL
pierotofy Aug 17, 2022
d85805c
OpenCV misc
pierotofy Aug 27, 2022
f696c33
PoC builds opencv on mac
pierotofy Aug 30, 2022
6031131
OpenCV builds
pierotofy Aug 31, 2022
2a526f1
Fix OpenCV cmake
pierotofy Aug 31, 2022
3637cad
Builds mvstexturing
pierotofy Sep 1, 2022
847c7eb
Builds dem2points
pierotofy Sep 1, 2022
3453eda
OpenSfM builds
pierotofy Sep 1, 2022
434042e
Build opensfm with native tools
pierotofy Sep 1, 2022
78dfe26
Fix rpath
pierotofy Sep 1, 2022
a6b4958
update pyproj
pierotofy Sep 6, 2022
9549a7d
Merge onnxrm
pierotofy Sep 6, 2022
808f9e4
Update vmem
pierotofy Sep 6, 2022
2b2115c
Fix rpath for openmvs
pierotofy Sep 7, 2022
8abd163
odm_orthophoto rpath fix
pierotofy Sep 7, 2022
8884c9c
Fix entwine, obj2tiles
pierotofy Sep 7, 2022
278e85d
Change entwine branch
pierotofy Sep 7, 2022
03e2246
Use DYLD instead of fixing rpath
pierotofy Sep 10, 2022
643ea4e
Do not build openexr
pierotofy Sep 10, 2022
333eec7
Propagate DYLD_LIBRARY_PATH
pierotofy Sep 10, 2022
21895ca
Add macos build script
pierotofy Sep 15, 2022
0faa7a5
Update macos script, readme
pierotofy Sep 15, 2022
f0bdea4
Prepare for release
pierotofy Sep 15, 2022
eb5cc0e
Script fixes
pierotofy Sep 15, 2022
481ea86
Merge branch 'm1native' of https://github.com/pierotofy/ODM into m1na…
pierotofy Sep 15, 2022
9af52a2
Update readme
pierotofy Sep 15, 2022
cbf33f9
Use latest boost
pierotofy Sep 15, 2022
b645b20
Final touches
pierotofy Sep 15, 2022
3486641
Update README
pierotofy Sep 15, 2022
44914f8
Remove scripts
pierotofy Sep 15, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 31 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,20 +197,44 @@ If you have installed to a different directory by changing the `--import` comman

You can run ODM natively on Ubuntu 21.04 (although we don't recommend it):

1. Download the source from [here](https://github.com/OpenDroneMap/ODM/archive/master.zip)
2. Run `bash configure.sh install`
3. Download a sample dataset from [here](https://github.com/OpenDroneMap/odm_data_aukerman/archive/master.zip) (about 550MB) and extract it in `/datasets/aukerman`
4. Run `./run.sh --project-path /datasets odm_data_aukerman`
```bash
git clone https://github.com/OpenDroneMap/ODM
cd ODM
bash configure.sh install
```

You can then process datasets with `./run.sh /datasets/odm_data_aukerman`

## Native Install (MacOS)

You can run ODM natively on Intel/ARM MacOS.

First install:

* Xcode 13 (not 14, there's currently a bug)
* [Homebrew](https://docs.brew.sh/Installation)

Then Run:

```bash
git clone https://github.com/OpenDroneMap/ODM
cd ODM
bash configure_macos.sh install
```

You can then process datasets with `./run.sh /datasets/odm_data_aukerman`

This could be improved in the future. [Helps us create a Homebrew formula](https://github.com/OpenDroneMap/ODM/issues/1531).

### Updating a native installation

When updating to a newer version of ODM, it is recommended that you run
When updating to a newer version of native ODM, it is recommended that you run:

bash configure.sh reinstall
`bash configure.sh reinstall`

to ensure all the dependent packages and modules get updated.

### Build From Source
### Build Docker Images From Source

If you want to rebuild your own docker image (if you have changed the source code, for example), from the ODM folder you can type:

Expand Down
48 changes: 42 additions & 6 deletions SuperBuild/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,41 @@ cmake_minimum_required(VERSION 3.1)

project(ODM-SuperBuild)

# Setup SuperBuild root location
set(SB_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})

if (NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to Release")
set(CMAKE_BUILD_TYPE "Release")
endif()

# Setup SuperBuild root location
set(SB_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
if (APPLE)
find_program(HOMEBREW_EXECUTABLE brew)
mark_as_advanced(FORCE HOMEBREW_EXECUTABLE)
if (HOMEBREW_EXECUTABLE)
# Detected a Homebrew install, query for its install prefix.
execute_process(COMMAND ${HOMEBREW_EXECUTABLE} --prefix
OUTPUT_VARIABLE HOMEBREW_INSTALL_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "Detected Homebrew with install prefix: "
"${HOMEBREW_INSTALL_PREFIX}, adding to CMake search paths.")
list(APPEND CMAKE_PREFIX_PATH "${HOMEBREW_INSTALL_PREFIX}")
endif()

# Use homebrew's clang compiler since Apple
# does not allow us to link to libomp
set(CXX_PATH ${HOMEBREW_INSTALL_PREFIX}/bin/c++-12)
message("Checking for ${CXX_PATH}...")
if(EXISTS "${CXX_PATH}")
message("Found Homebrew's compiler: ${CXX_PATH}")
set(CMAKE_CXX_COMPILER ${CXX_PATH})
set(APPLE_CMAKE_ARGS "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}")
endif()

if (NOT APPLE_CMAKE_ARGS)
message(WARNING "Cannot find Homebrew's compiler, compilation might fail...")
endif()
endif()

################################
# Setup SuperBuild directories #
Expand Down Expand Up @@ -75,6 +103,9 @@ if (WIN32)
file(COPY ${CUDA_DLLS} DESTINATION "${SB_INSTALL_DIR}/bin")

set(WIN32_GDAL_ARGS -DGDAL_FOUND=TRUE -DGDAL_LIBRARY=${GDAL_LIBRARY} -DGDAL_INCLUDE_DIR=${GDAL_INCLUDE_DIR})
elseif(APPLE)
set(PYTHON_HOME "${SB_ROOT_DIR}/../venv")
set(PYTHON_EXE_PATH "${PYTHON_HOME}/bin/python")
else()
set(PYTHON_EXE_PATH "/usr/bin/python3")
endif()
Expand Down Expand Up @@ -139,10 +170,10 @@ set(custom_libs OpenSfM

externalproject_add(mve
GIT_REPOSITORY https://github.com/OpenDroneMap/mve.git
GIT_TAG 262
GIT_TAG 290
UPDATE_COMMAND ""
SOURCE_DIR ${SB_SOURCE_DIR}/mve
CMAKE_ARGS ${WIN32_CMAKE_ARGS}
CMAKE_ARGS ${WIN32_CMAKE_ARGS} ${APPLE_CMAKE_ARGS}
BUILD_IN_SOURCE 1
INSTALL_COMMAND ""
)
Expand All @@ -160,10 +191,13 @@ if (WIN32)
else()
set (POISSON_BUILD_CMD make -j${nproc} poissonrecon)
set (POISSON_BIN_PATH "Linux/PoissonRecon")
if (APPLE)
set(POISSON_BUILD_CMD COMPILER=${CMAKE_CXX_COMPILER} make -j${nproc} -f Makefile.macos poissonrecon)
endif()
endif()
externalproject_add(poissonrecon
GIT_REPOSITORY https://github.com/OpenDroneMap/PoissonRecon.git
GIT_TAG 272
GIT_TAG 290
PREFIX ${SB_BINARY_DIR}/PoissonRecon
SOURCE_DIR ${SB_SOURCE_DIR}/PoissonRecon
UPDATE_COMMAND ""
Expand All @@ -180,6 +214,7 @@ externalproject_add(dem2mesh
SOURCE_DIR ${SB_SOURCE_DIR}/dem2mesh
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${SB_INSTALL_DIR}
${WIN32_GDAL_ARGS}
${APPLE_CMAKE_ARGS}
)

externalproject_add(dem2points
Expand All @@ -189,12 +224,13 @@ externalproject_add(dem2points
SOURCE_DIR ${SB_SOURCE_DIR}/dem2points
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${SB_INSTALL_DIR}
${WIN32_GDAL_ARGS}
${APPLE_CMAKE_ARGS}
)

externalproject_add(odm_orthophoto
DEPENDS opencv
GIT_REPOSITORY https://github.com/OpenDroneMap/odm_orthophoto.git
GIT_TAG 288b
GIT_TAG 290
PREFIX ${SB_BINARY_DIR}/odm_orthophoto
SOURCE_DIR ${SB_SOURCE_DIR}/odm_orthophoto
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${SB_INSTALL_DIR}
Expand Down
4 changes: 2 additions & 2 deletions SuperBuild/cmake/External-Entwine.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ExternalProject_Add(${_proj_name}
#--Download step--------------
DOWNLOAD_DIR ${SB_DOWNLOAD_DIR}
GIT_REPOSITORY https://github.com/OpenDroneMap/entwine/
GIT_TAG 285
GIT_TAG 290
#--Update/Patch step----------
UPDATE_COMMAND ""
#--Configure step-------------
Expand All @@ -33,4 +33,4 @@ ExternalProject_Add(${_proj_name}
LOG_DOWNLOAD OFF
LOG_CONFIGURE OFF
LOG_BUILD OFF
)
)
3 changes: 2 additions & 1 deletion SuperBuild/cmake/External-MvsTexturing.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ExternalProject_Add(${_proj_name}
#--Download step--------------
DOWNLOAD_DIR ${SB_DOWNLOAD_DIR}/${_proj_name}
GIT_REPOSITORY https://github.com/OpenDroneMap/mvs-texturing
GIT_TAG 287
GIT_TAG 290
#--Update/Patch step----------
UPDATE_COMMAND ""
#--Configure step-------------
Expand All @@ -19,6 +19,7 @@ ExternalProject_Add(${_proj_name}
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX:PATH=${SB_INSTALL_DIR}
${WIN32_CMAKE_ARGS}
${APPLE_CMAKE_ARGS}
#--Build step-----------------
BINARY_DIR ${_SB_BINARY_DIR}
#--Install step---------------
Expand Down
2 changes: 2 additions & 0 deletions SuperBuild/cmake/External-Obj2Tiles.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ if (WIN32)
set(OBJ2TILES_EXT ".exe")
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
set(OBJ2TILES_ARCH "LinuxArm")
elseif(APPLE)
set(OBJ2TILES_ARCH "Osx64")
endif()


Expand Down
27 changes: 24 additions & 3 deletions SuperBuild/cmake/External-OpenCV.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,32 @@ set(_proj_name opencv)
set(_SB_BINARY_DIR "${SB_BINARY_DIR}/${_proj_name}")

if (WIN32)
set(WIN32_CMAKE_EXTRA_ARGS -DPYTHON3_NUMPY_INCLUDE_DIRS=${PYTHON_HOME}/lib/site-packages/numpy/core/include
set(OCV_CMAKE_EXTRA_ARGS -DPYTHON3_NUMPY_INCLUDE_DIRS=${PYTHON_HOME}/lib/site-packages/numpy/core/include
-DPYTHON3_PACKAGES_PATH=${PYTHON_HOME}/lib/site-packages
-DPYTHON3_EXECUTABLE=${PYTHON_EXE_PATH}
-DWITH_MSMF=OFF
-DOPENCV_LIB_INSTALL_PATH=${SB_INSTALL_DIR}/lib
-DOPENCV_BIN_INSTALL_PATH=${SB_INSTALL_DIR}/bin)
elseif(APPLE)
# macOS is unable to automatically detect our Python libs
set(OCV_CMAKE_EXTRA_ARGS -DPYTHON3_NUMPY_INCLUDE_DIRS=${PYTHON_HOME}/lib/python3.8/site-packages/numpy/core/include
-DPYTHON3_PACKAGES_PATH=${PYTHON_HOME}/lib/python3.8/site-packages
-DPYTHON3_EXECUTABLE=${PYTHON_EXE_PATH}
-DPYTHON3_LIBRARIES=${HOMEBREW_INSTALL_PREFIX}/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/lib/libpython3.8.dylib
-DPYTHON3_INCLUDE_DIR=${HOMEBREW_INSTALL_PREFIX}/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/include/python3.8/
-DPYTHON3_INCLUDE_PATH=${HOMEBREW_INSTALL_PREFIX}/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/include/python3.8/
-DPYTHON3INTERP_FOUND=ON
-DPYTHON3LIBS_FOUND=ON
-DPYTHON_DEFAULT_AVAILABLE=ON
-DPYTHON_DEFAULT_EXECUTABLE=${PYTHON_EXE_PATH}
-DPYTHON3_VERSION_MAJOR=3
-DPYTHON3_VERSION_MINOR=8
-DOPENCV_CONFIG_INSTALL_PATH=
-DOPENCV_PYTHON_INSTALL_PATH=${SB_INSTALL_DIR}/lib/python3.8/dist-packages
-DHAVE_opencv_python3=ON
-DOPENCV_PYTHON_SKIP_DETECTION=ON
-DOPENCV_LIB_INSTALL_PATH=${SB_INSTALL_DIR}/lib
-DOPENCV_BIN_INSTALL_PATH=${SB_INSTALL_DIR}/bin)
endif()

ExternalProject_Add(${_proj_name}
Expand Down Expand Up @@ -41,6 +61,7 @@ ExternalProject_Add(${_proj_name}
-DWITH_VTK=OFF
-DWITH_EIGEN=OFF
-DWITH_OPENNI=OFF
-DWITH_OPENEXR=OFF
-DBUILD_EXAMPLES=OFF
-DBUILD_TESTS=OFF
-DBUILD_PERF_TESTS=OFF
Expand All @@ -60,7 +81,7 @@ ExternalProject_Add(${_proj_name}
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX:PATH=${SB_INSTALL_DIR}
${WIN32_CMAKE_ARGS}
${WIN32_CMAKE_EXTRA_ARGS}
${OCV_CMAKE_EXTRA_ARGS}
#--Build step-----------------
BINARY_DIR ${_SB_BINARY_DIR}
#--Install step---------------
Expand All @@ -69,4 +90,4 @@ ExternalProject_Add(${_proj_name}
LOG_DOWNLOAD OFF
LOG_CONFIGURE OFF
LOG_BUILD OFF
)
)
3 changes: 2 additions & 1 deletion SuperBuild/cmake/External-OpenMVS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ externalproject_add(eigen34
)

SET(ARM64_CMAKE_ARGS "")
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64" )

if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64")
SET(ARM64_CMAKE_ARGS -DOpenMVS_USE_SSE=OFF)
endif()

Expand Down
11 changes: 9 additions & 2 deletions SuperBuild/cmake/External-OpenSfM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@ set(_SB_BINARY_DIR "${SB_BINARY_DIR}/${_proj_name}")
include(ProcessorCount)
ProcessorCount(nproc)

set(EXTRA_INCLUDE_DIRS "")
if(WIN32)
set(OpenCV_DIR "${SB_INSTALL_DIR}/x64/vc16/lib")
set(BUILD_CMD ${CMAKE_COMMAND} --build "${SB_BUILD_DIR}/opensfm" --config "${CMAKE_BUILD_TYPE}")
else()
set(OpenCV_DIR "${SB_INSTALL_DIR}/lib/cmake/opencv4")
set(BUILD_CMD make "-j${nproc}")
if (APPLE)
set(OpenCV_DIR "${SB_INSTALL_DIR}")
set(EXTRA_INCLUDE_DIRS "${HOMEBREW_INSTALL_PREFIX}/include")
else()
set(OpenCV_DIR "${SB_INSTALL_DIR}/lib/cmake/opencv4")
endif()
endif()

ExternalProject_Add(${_proj_name}
Expand All @@ -19,7 +25,7 @@ ExternalProject_Add(${_proj_name}
#--Download step--------------
DOWNLOAD_DIR ${SB_DOWNLOAD_DIR}
GIT_REPOSITORY https://github.com/OpenDroneMap/OpenSfM/
GIT_TAG 288
GIT_TAG 290
#--Update/Patch step----------
UPDATE_COMMAND git submodule update --init --recursive
#--Configure step-------------
Expand All @@ -28,6 +34,7 @@ ExternalProject_Add(${_proj_name}
-DCERES_ROOT_DIR=${SB_INSTALL_DIR}
-DOpenCV_DIR=${OpenCV_DIR}
-DADDITIONAL_INCLUDE_DIRS=${SB_INSTALL_DIR}/include
-DYET_ADDITIONAL_INCLUDE_DIRS=${EXTRA_INCLUDE_DIRS}
-DOPENSFM_BUILD_TESTS=off
-DPYTHON_EXECUTABLE=${PYTHON_EXE_PATH}
${WIN32_CMAKE_ARGS}
Expand Down
2 changes: 2 additions & 0 deletions SuperBuild/cmake/External-PDAL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ set(_SB_BINARY_DIR "${SB_BINARY_DIR}/${_proj_name}")

if (WIN32)
set(LASZIP_LIB "${SB_INSTALL_DIR}/lib/laszip.lib")
elseif(APPLE)
set(LASZIP_LIB "${SB_INSTALL_DIR}/lib/liblaszip.dylib")
else()
set(LASZIP_LIB "${SB_INSTALL_DIR}/lib/liblaszip.so")
endif()
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.8.8
2.9.0
Loading