CGAL笔记
2021-06-12
安装
Linux端的安装
sudo apt install libcgal-dev
|
Android端的编译
官方指南: github
指南镜像地址
直接使用Android Studio的ndk
${ANDROID_NDK}/build/tools/make_standalone_toolchain.py --arch ${ARCH} --install-dir ${TOOLCHAIN_PATH}
|
${ANDROID_NDK}
: /home/lynx/fuck_mount/AndroidSDK/ndk/21.3.6528147
${ARCH}
: arm64
${TOOLCHAIN_PATH}
: 安装位置
编译GMP
官网下载
export CC=${TOOLCHAIN_PATH}/bin/clang export PATH="${TOOLCHAIN_PATH}:${PATH}" ./configure --prefix=${GMP_PATH} --enable-shared --host=${TARGET_TRIPLET} make make install
|
${GMP_PATH}
: 安装位置
${TARGET_TRIPLET}
: aarch64-linux-android
编译MPFR
官网下载
export CC=${TOOLCHAIN_PATH}/bin/clang export PATH="${TOOLCHAIN_PATH}:${PATH}" ./configure --prefix=${MPFR_PATH} --enable-shared --host=${TARGET_TRIPLET} --with-gmp=${GMP_PATH} make make install
|
编译boost
官网下载
下载cgal源码
github镜像
选择Source code
cmake编译
先创建toolchain.cmake
set(CMAKE_SYSTEM_NAME Android) set(CMAKE_SYSTEM_VERSION 21) set(CMAKE_ANDROID_ARCH_ABI arm64-v8a) set(CMAKE_ANDROID_NDK /home/lynx/fuck_mount/AndroidSDK/ndk/21.3.6528147) set(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION clang)
set(GMP_INCLUDE_DIR /home/lynx/darkin_blade/cgal/gmp/include) set(GMP_LIBRARIES /home/lynx/darkin_blade/cgal/gmp/lib/libgmp.so)
set(MPFR_INCLUDE_DIR /home/lynx/darkin_blade/cgal/mpfr/include) set(MPFR_LIBRARIES /home/lynx/darkin_blade/cgal/mpfr/lib/libmpfr.so)
set(Boost_INCLUDE_DIR /home/lynx/darkin_blade/cgal/boost_1_76_0/boost)
|
Boost_INCLUDE_DIR
: Directory containing the boost/version.hpp
file
然后进行编译
cmake -DCMAKE_TOOLCHAIN_FILE=/home/lynx/darkin_blade/cgal/toolchain.cmake -DWITH_CGAL_Core=FALSE -DCMAKE_CXX_FLAGS=-std=c++11 -DCGAL_test_cpp_version_RUN_RES=0 -DCGAL_HEADER_ONLY=TRUE -DWITH_CGAL_Qt5=FALSE /home/lynx/darkin_blade/cgal/cgal-5.3
|
根据具体情况修改目录
${CMAKE_INSTALL_PREFIX}
: 默认/usr/local
将库导入Android
常见问题
- 编译GMP时出现:
could not find a working compiler, see config.log for details
clang
路径不对
- 安装CGAL时出现:
"/usr/local/include/CGAL/Qt": No such file or directory.
默认安装路径/usr/local
, make install
需要sudo权限