Quantcast

Download more then one repo prior to build_command

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Download more then one repo prior to build_command

Rian Quinn
Below is my current cmake script for building libc++. There are several things about this script I would like to cleanup, but the really big one is fact that I have to download libcxx and libcxxabi twice. This is because libcxx, libcxxabi and llvm have a circular dependency (each relies on the other), so all three repos need to be downloaded before libcxxabi can be built, and then finally libcxx.

Any thoughts on ways I can remove the extra download? I tried setting DOWNLOAD_COMMAND “”, and then setting SOURCE_DIR to the previously downloaded location, but cmake complains about the fact that the directory is empty (because it has not been downloaded during the configure step).

Thanks,
- Rian

----------------------------------------------------------------------------------------------------------------------------------------------------------------


# cmake -DCMAKE_TOOLCHAIN_FILE=~/bfprefix/cmake/CMakeToolchain_VMM.txt -DDISABLE_WARNINGS=on ..

cmake_minimum_required(VERSION 3.4)
project(bfsysroot C CXX)

if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
    set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/bfprefix" CACHE PATH "default install path" FORCE)
endif()

include("${CMAKE_INSTALL_PREFIX}/cmake/CMakeGlobal_Project.txt")

# ------------------------------------------------------------------------------
# Newlib
# ------------------------------------------------------------------------------

list(APPEND NEWLIB_ARGS
    "--prefix=${CMAKE_INSTALL_PREFIX}/sysroots/"
    "--target=${BAREFLANK_TARGET}"
    "--disable-libgloss"
    "--disable-multilib"
    "--disable-newlib-supplied-syscalls"
    "--enable-newlib-multithread"
    "--enable-newlib-iconv"
    "CC_FOR_TARGET=${CMAKE_C_COMPILER}"
    "CXX_FOR_TARGET=${CMAKE_CXX_COMPILER}"
)

ExternalProject_Add(
    newlib
    PREFIX ${CMAKE_BINARY_DIR}/newlib
    GIT_REPOSITORY https://github.com/Bareflank/newlib.git
    GIT_TAG newlib-2.5.0-v1.2
    CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/newlib/configure "${NEWLIB_ARGS}" CFLAGS_FOR_TARGET=${CMAKE_C_FLAGS}
    BUILD_COMMAND make
    INSTALL_COMMAND make install
    LOG_CONFIGURE 1
    LOG_BUILD 1
    LOG_INSTALL 1
)

# ------------------------------------------------------------------------------
# Unwind
# ------------------------------------------------------------------------------

list(APPEND BFUNWIND_CMAKE_ARGS
    "-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}"
    "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}"
)

ExternalProject_Add(
    bfunwind
    PREFIX ${CMAKE_BINARY_DIR}/bfunwind
    GIT_REPOSITORY https://github.com/Bareflank/bfunwind.git
    CMAKE_ARGS ${BFUNWIND_CMAKE_ARGS}
    DEPENDS newlib
)

# ------------------------------------------------------------------------------
# Download LLVM
# ------------------------------------------------------------------------------

ExternalProject_Add(
    download_llvm
    PREFIX ${CMAKE_BINARY_DIR}/download_llvm
    DOWNLOAD_COMMAND git clone --depth 1 -b release_39 https://github.com/llvm-mirror/llvm.git download_llvm
    CONFIGURE_COMMAND ""
    BUILD_COMMAND ""
    INSTALL_COMMAND ""
)

# ------------------------------------------------------------------------------
# Download Libcxxabi
# ------------------------------------------------------------------------------

ExternalProject_Add(
    download_libcxxabi
    PREFIX ${CMAKE_BINARY_DIR}/download_libcxxabi
    DOWNLOAD_COMMAND git clone --depth 1 -b libcxxabi-39-v1 https://github.com/Bareflank/libcxxabi.git download_libcxxabi
    CONFIGURE_COMMAND ""
    BUILD_COMMAND ""
    INSTALL_COMMAND ""
)

# ------------------------------------------------------------------------------
# Download Libcxx
# ------------------------------------------------------------------------------

ExternalProject_Add(
    download_libcxx
    PREFIX ${CMAKE_BINARY_DIR}/download_libcxx
    DOWNLOAD_COMMAND git clone --depth 1 -b libcxx-39-v1 https://github.com/Bareflank/libcxx.git download_libcxx
    CONFIGURE_COMMAND ""
    BUILD_COMMAND ""
    INSTALL_COMMAND ""
)

# ------------------------------------------------------------------------------
# Libcxxabi
# ------------------------------------------------------------------------------

list(APPEND LIBCXXABI_CMAKE_ARGS
    "-DCMAKE_INSTALL_PREFIX=${BAREFLANK_SYSROOT_PATH}"
    "-DLLVM_PATH=${CMAKE_BINARY_DIR}/download_llvm/src/download_llvm"
    "-DLIBCXXABI_LIBCXX_PATH=${CMAKE_BINARY_DIR}/download_libcxx/src/download_libcxx"
    "-DLIBCXXABI_SYSROOT=${BAREFLANK_SYSROOT_PATH}"
    "-DLIBCXXABI_HAS_PTHREAD_API=ON"
    "-DLLVM_ENABLE_LIBCXX=ON"
    "-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}"
    "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}"
    "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
    "-DCMAKE_AR=${CMAKE_AR}"
    "-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}"
    "-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}"
)

ExternalProject_Add(
    libcxxabi
    PREFIX ${CMAKE_BINARY_DIR}/libcxxabi
    DOWNLOAD_COMMAND git clone --depth 1 -b libcxxabi-39-v1 https://github.com/Bareflank/libcxxabi.git
    CMAKE_ARGS ${LIBCXXABI_CMAKE_ARGS}
    DEPENDS bfunwind download_llvm download_libcxx download_libcxxabi
)

# ------------------------------------------------------------------------------
# Libcxx
# ------------------------------------------------------------------------------

list(APPEND LIBCXX_CMAKE_ARGS
    "-DCMAKE_INSTALL_PREFIX=${BAREFLANK_SYSROOT_PATH}"
    "-DLLVM_PATH=${CMAKE_BINARY_DIR}/download_llvm/src/download_llvm"
    "-DLIBCXX_CXX_ABI=libcxxabi"
    "-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${CMAKE_BINARY_DIR}/download_libcxxabi/src/download_libcxxabi/include/"
    "-DLIBCXX_SYSROOT=${BAREFLANK_SYSROOT_PATH}"
    "-DLIBCXX_HAS_PTHREAD_API=ON"
    "-DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF"
    "-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}"
    "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}"
    "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
    "-DCMAKE_AR=${CMAKE_AR}"
    "-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}"
    "-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}"
)

ExternalProject_Add(
    libcxx
    PREFIX ${CMAKE_BINARY_DIR}/libcxx
    DOWNLOAD_COMMAND git clone --depth 1 -b libcxx-39-v1 https://github.com/Bareflank/libcxx.git
    CMAKE_ARGS ${LIBCXX_CMAKE_ARGS}
    DEPENDS bfunwind download_llvm download_libcxx download_libcxxabi libcxxabi
)

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Loading...