Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/cpvrlab/SLProject4 into …
Browse files Browse the repository at this point in the history
…develop
  • Loading branch information
hsm4 committed Jan 22, 2024
2 parents 6749e93 + 8fd18c6 commit 61d15b6
Show file tree
Hide file tree
Showing 10 changed files with 182 additions and 92 deletions.
45 changes: 33 additions & 12 deletions cmake/DownloadPrebuilts.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,11 @@ function(copy_dylibs LIBS)
get_target_property(DYLIB_PATH ${LIB} LOCATION_${CMAKE_BUILD_TYPE})
get_filename_component(DYLIB_FILENAME ${DYLIB_PATH} NAME)
message(STATUS "Copying ${DYLIB_FILENAME}")
file(COPY ${DYLIB_PATH} DESTINATION ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE})
file(COPY ${DYLIB_PATH} DESTINATION ${CMAKE_BINARY_DIR})
endforeach ()
endfunction ()


#=======================================================================================================================
if ("${SYSTEM_NAME_UPPER}" STREQUAL "LINUX")

Expand All @@ -157,13 +158,19 @@ if ("${SYSTEM_NAME_UPPER}" STREQUAL "LINUX")
set(OpenCV_LIBS ${OpenCV_LINK_LIBS})
set(OpenCV_LIBS_DEBUG ${OpenCV_LIBS})

build_external_lib("build_opencv_w_contrib_for_linux.sh" "${OpenCV_VERSION}" "${OpenCV_PREBUILT_DIR}")

if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
download_lib("${OpenCV_PREBUILT_DIR}")
else ()
build_external_lib("build_opencv_w_contrib_for_linux.sh" "${OpenCV_VERSION}" "${OpenCV_PREBUILT_DIR}")
endif ()


#################
# g2o for Linux #
#################

set(g2o_PREBUILT_DIR "linux_g2o")
set(g2o_PREBUILT_DIR "linux_g2o_20170730")
set(g2o_DIR "${PREBUILT_PATH}/${g2o_PREBUILT_DIR}")
set(g2o_INCLUDE_DIR "${g2o_DIR}/include")

Expand All @@ -175,8 +182,12 @@ if ("${SYSTEM_NAME_UPPER}" STREQUAL "LINUX")
INTERFACE_INCLUDE_DIRECTORIES "${g2o_INCLUDE_DIR}")
set(g2o_LIBS ${g2o_LIBS} ${lib})
endforeach (lib)

build_external_lib("build_g2o_for_linux.sh" "" "${g2o_PREBUILT_DIR}")

if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
download_lib("${g2o_PREBUILT_DIR}")
else ()
build_external_lib("build_g2o_for_linux.sh" "" "${g2o_PREBUILT_DIR}")
endif ()

####################
# Assimp for Linux #
Expand All @@ -202,13 +213,18 @@ if ("${SYSTEM_NAME_UPPER}" STREQUAL "LINUX")

set(assimp_LIBS assimp::assimp assimp::irrxml)

build_external_lib("build_assimp_for_linux.sh" "${assimp_VERSION}" "${assimp_PREBUILT_DIR}")
if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
download_lib("${assimp_PREBUILT_DIR}")
else ()
build_external_lib("build_assimp_for_linux.sh" "${assimp_VERSION}" "${assimp_PREBUILT_DIR}")
endif ()

#####################
# OpenSSL for Linux #
#####################

set(openssl_PREBUILT_DIR "linux_openssl")
set(openssl_VERSION "1.1.1h")
set(openssl_PREBUILT_DIR "linux_openssl_${openssl_VERSION}")
set(openssl_DIR "${PREBUILT_PATH}/${openssl_PREBUILT_DIR}")
set(openssl_INCLUDE_DIR ${openssl_DIR}/include)

Expand All @@ -221,7 +237,11 @@ if ("${SYSTEM_NAME_UPPER}" STREQUAL "LINUX")
set(openssl_LIBS ${openssl_LIBS} ${lib})
endforeach (lib)

build_external_lib("build_openssl_for_linux.sh" "OpenSSL_1_1_1h" "${openssl_PREBUILT_DIR}")
if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
download_lib("${openssl_PREBUILT_DIR}")
else ()
build_external_lib("build_openssl_for_linux.sh" "" "${openssl_PREBUILT_DIR}")
endif ()

####################
# Vulkan for Linux #
Expand Down Expand Up @@ -345,7 +365,7 @@ elseif ("${SYSTEM_NAME_UPPER}" STREQUAL "WINDOWS") #----------------------------
###################

if (SL_BUILD_WAI)
set(g2o_PREBUILT_DIR "win64_g2o")
set(g2o_PREBUILT_DIR "win64_g2o_20170730")
set(g2o_DIR "${PREBUILT_PATH}/${g2o_PREBUILT_DIR}")
set(g2o_INCLUDE_DIR "${g2o_DIR}/include")
set(g2o_LIB_DIR "${g2o_DIR}/lib")
Expand Down Expand Up @@ -557,14 +577,15 @@ elseif ("${SYSTEM_NAME_UPPER}" STREQUAL "DARWIN" AND
# g2o for MacOS-x86_64 #
########################

set(g2o_PREBUILT_DIR "mac64_g2o")
set(g2o_PREBUILT_DIR "mac64_g2o_20170730")
set(g2o_DIR "${PREBUILT_PATH}/${g2o_PREBUILT_DIR}")
set(g2o_INCLUDE_DIR "${g2o_DIR}/include")

foreach (lib ${g2o_LINK_LIBS})
add_library(${lib} SHARED IMPORTED)
set_target_properties(${lib} PROPERTIES
IMPORTED_LOCATION "${g2o_DIR}/Debug/lib${lib}.dylib"
IMPORTED_LOCATION "${g2o_DIR}/Release/lib${lib}.dylib"
IMPORTED_LOCATION_DEBUG "${g2o_DIR}/Debug/lib${lib}.dylib"
INTERFACE_INCLUDE_DIRECTORIES "${g2o_INCLUDE_DIR}")
set(g2o_LIBS ${g2o_LIBS} ${lib})
endforeach (lib)
Expand Down Expand Up @@ -761,7 +782,7 @@ elseif ("${SYSTEM_NAME_UPPER}" STREQUAL "DARWIN" AND
# g2o for MacOS-arm64 #
#######################

set(g2o_PREBUILT_DIR "macArm64_g2o")
set(g2o_PREBUILT_DIR "macArm64_g2o_20170730")
set(g2o_DIR "${PREBUILT_PATH}/${g2o_PREBUILT_DIR}")
set(g2o_INCLUDE_DIR "${g2o_DIR}/include")

Expand Down
18 changes: 16 additions & 2 deletions externals/prebuild_scripts/build_assimp_for_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,22 @@ cp LICENSE "$ZIPFOLDER"
cp Readme.md "$ZIPFOLDER"

if [ -d "../../prebuilt/$ZIPFILE" ]; then
rm -rf ../../prebuilt/$ZIPFILE
rm -rf "../../prebuilt/$ZIPFILE"
fi

mv "$ZIPFOLDER" "../../prebuilt/"
if [ ! -d "../../prebuilt/" ]; then
mkdir "../../prebuilt/"
fi

echo "ls . : $(ls .)"
echo "ls ../../ : $(ls ../../)"
echo "ls ../../prebuilt : $(ls ../../prebuilt)"

echo "cp -r $ZIPFOLDER ../../prebuilt/"
echo "PWD IS $PWD"
echo "../../prebuilt IS $PWD/../../prebuilt/"

cp -r "$ZIPFOLDER" "../../prebuilt/"

echo "prebuilt content is $(ls ../../prebuilt)"

5 changes: 4 additions & 1 deletion externals/prebuild_scripts/build_g2o_for_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ZIPFILE="$ARCH"_g2o
ZIPFOLDER="build/$ZIPFILE"
BUILD_D=build/"$ARCH"_debug
BUILD_R=build/"$ARCH"_release

VERSION="20170730_git"
clear
echo "Building g2o using the sources in the thirdparty directory"
if [ ! -d ../g2o ]
Expand All @@ -20,12 +20,15 @@ fi

cd ../g2o

git checkout $VERSION

# Make build folder for debug version
mkdir build
rm -rf $BUILD_D
mkdir "$BUILD_D"
cd "$BUILD_D"


# Run cmake to configure and generate the make files
cmake \
-DCMAKE_INSTALL_PREFIX=install \
Expand Down
68 changes: 41 additions & 27 deletions externals/prebuild_scripts/build_g2o_for_mac64.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
#!/bin/sh

# ####################################################
# Build script for g2o for mac64
# ####################################################

ARCH=mac64
ZIPFILE="$ARCH"_g2o
ZIPFOLDER=build/$ZIPFILE
VERSION="20170730_git"
ZIPFOLDER="$ARCH"_g2o_20170730
BUILD_D=build/"$ARCH"_debug
BUILD_R=build/"$ARCH"_release

clear
echo "Building g2o using the sources in the thirdparty directory"
if [ ! -d ../g2o ]
then
echo "g2o directory doesn't exists"
git clone https://github.com/RainerKuemmerle/g2o.git ../g2o
fi

echo "Building g2o using the sources in the thirdparty directory"
cd ../g2o


git checkout $VERSION

# Make build folder for debug version
mkdir build
rm -rf $BUILD_D
mkdir $BUILD_D
cd $BUILD_D

# Run cmake to configure and generate the make files
cmake \
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
Expand All @@ -30,46 +39,51 @@ cmake \
-DCMAKE_DEBUG_POSTFIX="" \
-DEIGEN3_INCLUDE_DIR=../eigen \
../..

# finally build it
make -j8

# copy all into install folder
make install
cd ../.. # back to g2o

# Make build folder for release version
rm -rf $BUILD_R
mkdir $BUILD_R
cd $BUILD_R

# Run cmake to configure and generate the make files
cmake \
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
-DCMAKE_INSTALL_PREFIX=install \
-DG2O_BUILD_APPS=off \
-DG2O_BUILD_EXAMPLES=off \
-DCMAKE_BUILD_TYPE=Release \
-DEIGEN3_INCLUDE_DIR=../eigen \
-DG2O_USE_OPENGL=off \
../..

# finally build it
make -j8

# copy all into install folder
make install
cd ../.. # back to g2o

# Create zip folder for debug and release version
rm -rf $ZIPFOLDER
mkdir $ZIPFOLDER
cp -R $BUILD_R/install/include $ZIPFOLDER/include
cp -R $BUILD_R/install/lib $ZIPFOLDER/Release
cp -R $BUILD_D/install/lib $ZIPFOLDER/Debug
cp doc/license* $ZIPFOLDER
cp README.md $ZIPFOLDER

if [ -d "../prebuilt/$ZIPFILE" ]; then
rm -rf ../prebuilt/$ZIPFILE
fi

mv $ZIPFOLDER ../prebuilt
rm -rf ../prebuilt/$ZIPFOLDER
mkdir ../prebuilt/$ZIPFOLDER
echo $BUILD_R
echo $(pwd)
echo ../prebuilt/$ZIPFOLDER
cp -R $BUILD_R/install/include ../prebuilt/$ZIPFOLDER/include
cp -R $BUILD_R/install/lib ../prebuilt/$ZIPFOLDER/Release
cp -R $BUILD_D/install/lib ../prebuilt/$ZIPFOLDER/Debug
cp doc/license* ../prebuilt/$ZIPFOLDER
cp README.md ../prebuilt/$ZIPFOLDER

#if [ -d "../prebuilt/$ZIPFILE" ]; then
# rm -rf ../prebuilt/$ZIPFILE
#fi

#mv $ZIPFOLDER ../prebuilt
66 changes: 39 additions & 27 deletions externals/prebuild_scripts/build_g2o_for_macArm64.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
#!/bin/sh

# ####################################################
# Build script for g2o for macArm64
# ####################################################

ARCH="macArm64"
ZIPFILE="$ARCH"_g2o
ZIPFOLDER=build/$ZIPFILE
VERSION="20170730_git"
ZIPFOLDER="$ARCH"_g2o_20170730
BUILD_D=build/"$ARCH"_debug
BUILD_R=build/"$ARCH"_release

clear
echo "Building g2o using the sources in the thirdparty directory"
if [ ! -d ../g2o ]
then
echo "g2o directory doesn't exists"
git clone https://github.com/RainerKuemmerle/g2o.git ../g2o
fi

echo "Building g2o using the sources in the thirdparty directory"
cd ../g2o


git checkout $VERSION

# Make build folder for debug version
mkdir build
rm -rf $BUILD_D
mkdir $BUILD_D
cd $BUILD_D

# Run cmake to configure and generate the make files
cmake \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
Expand All @@ -29,47 +37,51 @@ cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_DEBUG_POSTFIX="" \
-DEIGEN3_INCLUDE_DIR=../eigen \
-DG2O_USE_OPENGL=off \
../..

# finally build it
make -j8

# copy all into install folder
make install
cd ../.. # back to g2o

# Make build folder for release version
rm -rf $BUILD_R
mkdir $BUILD_R
cd $BUILD_R

# Run cmake to configure and generate the make files
cmake \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DCMAKE_INSTALL_PREFIX=install \
-DG2O_BUILD_APPS=off \
-DG2O_BUILD_EXAMPLES=off \
-DCMAKE_BUILD_TYPE=Release \
-DEIGEN3_INCLUDE_DIR=../eigen \
../..

# finally build it
make -j8

# copy all into install folder
make install
cd ../.. # back to g2o

# Create zip folder for debug and release version
rm -rf $ZIPFOLDER
mkdir $ZIPFOLDER
cp -R $BUILD_R/install/include $ZIPFOLDER/include
cp -R $BUILD_R/install/lib $ZIPFOLDER/Release
cp -R $BUILD_D/install/lib $ZIPFOLDER/Debug
cp doc/license* $ZIPFOLDER
cp README.md $ZIPFOLDER

if [ -d "../prebuilt/$ZIPFILE" ]; then
rm -rf ../prebuilt/$ZIPFILE
fi

mv $ZIPFOLDER ../prebuilt
rm -rf ../prebuilt/$ZIPFOLDER
mkdir ../prebuilt/$ZIPFOLDER
echo "dst is ../prebuilt/$ZIPFOLDER/"
cp -R $BUILD_R/install/include ../prebuilt/$ZIPFOLDER/include
cp -R $BUILD_R/install/lib ../prebuilt/$ZIPFOLDER/Release
cp -R $BUILD_D/install/lib ../prebuilt/$ZIPFOLDER/Debug
cp doc/license* ../prebuilt/$ZIPFOLDER
cp README.md ../prebuilt/$ZIPFOLDER

#if [ -d "../prebuilt/$ZIPFILE" ]; then
# rm -rf ../prebuilt/$ZIPFILE
#fi

#mv $ZIPFOLDER ../prebuilt

Loading

0 comments on commit 61d15b6

Please sign in to comment.