Skip to content

Commit

Permalink
Use system eigen3 by default (#1158)
Browse files Browse the repository at this point in the history
Remove the bundled eigen3 and use the system's eigen3 by default. It is no longer
necessary to specify -DUSE_SYSTEM_EIGEN3=ON.

Also, add running of unit tests to the Windows and Mac builds as this exercises the
eigen code.
  • Loading branch information
agalasso authored Dec 31, 2023
1 parent ad6dae4 commit 4030ca7
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 28 deletions.
3 changes: 3 additions & 0 deletions build/build-mac
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,8 @@ make -j$cores

check_library_dependencies

# make sure tests all pass
ctest

zip -r "$ZIPFILE" PHD2.app
chmod 644 "$ZIPFILE"
24 changes: 11 additions & 13 deletions build/build-win
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ fi

CMD="/c/Windows/System32/cmd.exe"
CMAKE='/c/Program Files/CMake/bin/cmake.exe'
CTEST='/c/Program Files/CMake/bin/ctest.exe'
ISCC="/c/Program Files (x86)/Inno Setup 5/ISCC.exe"

CMAKE_W=$(cygpath -w "$CMAKE")
Expand All @@ -80,24 +81,21 @@ vcpkg_args=()
if [[ $VCPKG_ROOT ]]; then
vcpkg_args+=(-DVCPKG_ROOT=$VCPKG_ROOT)
fi

mkdir -p tmp
(
cd tmp
cd tmp

cat >run_cmake.bat <<EOF
cat >run_cmake.bat <<EOF
"$CMAKE_W" -Wno-dev -G "Visual Studio 17" -A Win32 ${vcpkg_args[@]} "-DwxWidgets_PREFIX_DIRECTORY=%WXWIN%" ..
EOF

"$CMD" /c run_cmake.bat
)
"$CMD" /c run_cmake.bat

# generate phd2.iss and README.txt in tmp, one level up from Release/
sed -e "s/@VERSION@/$V/g" phd2.iss.in >tmp/phd2.iss
sed -e "s/@VERSION@/$V/g" README-PHD2.txt.in >tmp/README-PHD2.txt
sed -e "s/@VERSION@/$V/g" ../phd2.iss.in >phd2.iss
sed -e "s/@VERSION@/$V/g" ../README-PHD2.txt.in >README-PHD2.txt

"$CMAKE" --build . --config Release

(
cd tmp
"$CMAKE" --build . --target phd2 --config Release
"$CTEST" --build-config Release

"$ISCC" phd2.iss /F"${INSTALLER}"
)
"$ISCC" phd2.iss /F"${INSTALLER}"
2 changes: 0 additions & 2 deletions cmake_modules/compiler_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ if(WIN32)
endif()

# these options allow to use system libraries
option(USE_SYSTEM_CFITSIO "Enable this option here or in cmake call if you want to use system's cfitsio." OFF)
option(USE_SYSTEM_LIBUSB "Enable this option here or in cmake call if you want to use system's libUSB." OFF)
option(USE_SYSTEM_EIGEN3 "Enable this option here or in cmake call if you want to use system's Eigen3." OFF)
option(USE_SYSTEM_GTEST "Enable this option here or in cmake call if you want to use system's Gtest." OFF)
option(USE_SYSTEM_LIBINDI "Enable this option here or in cmake call if you want to use system's libindi." OFF)

Expand Down
2 changes: 1 addition & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ include /usr/share/dpkg/default.mk
# -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)

override_dh_auto_configure:
dh_auto_configure -- -DUSE_SYSTEM_LIBINDI=1 -DUSE_SYSTEM_EIGEN3=1 -DUSE_SYSTEM_GTEST=1 -DUSE_SYSTEM_LIBUSB=1
dh_auto_configure -- -DUSE_SYSTEM_LIBINDI=1 -DUSE_SYSTEM_GTEST=1 -DUSE_SYSTEM_LIBUSB=1

Binary file removed thirdparty/eigen-eigen-67e894c6cd8f.tar.bz2
Binary file not shown.
13 changes: 1 addition & 12 deletions thirdparty/thirdparty.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -495,21 +495,10 @@ endif()

if(WIN32)
set(EIGEN_SRC ${VCPKG_INCLUDE}/eigen3)
elseif(USE_SYSTEM_EIGEN3)
else()
find_package(Eigen3 REQUIRED)
set(EIGEN_SRC ${EIGEN3_INCLUDE_DIR})
message(STATUS "Using system's Eigen3.")
else(USE_SYSTEM_EIGEN3)
set(EIGEN eigen-eigen-67e894c6cd8f)
set(eigen_root ${thirdparties_deflate_directory}/${EIGEN})
if(NOT EXISTS ${eigen_root})
# untar the dependency
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar xjf ${thirdparty_dir}/${EIGEN}.tar.bz2
WORKING_DIRECTORY ${thirdparties_deflate_directory})
endif()

set(EIGEN_SRC ${eigen_root})
endif()


Expand Down

0 comments on commit 4030ca7

Please sign in to comment.