Skip to content

Commit

Permalink
build: install cmake from binary instead of source (#154)
Browse files Browse the repository at this point in the history
Install prebuilt cmake binaries instead of building from source
---------

Co-authored-by: Alex Liang <alex.liang@loftorbital.com>
  • Loading branch information
apaletta3 and alex-liang3 authored Jan 15, 2025
1 parent d780c04 commit f24d567
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ export docker_image_version := $(project_version)
export jupyter_image := openspacecollective/open-space-toolkit-astrodynamics-jupyter:latest
export jupyter_port := 8888


# Handle multi-platform builds locally (CI sets these env vars, but need defaults here)
TARGETPLATFORM ?= linux/amd64
$(info Target platform is $(TARGETPLATFORM))


build-image: ## Build image

docker build \
Expand Down
16 changes: 8 additions & 8 deletions docker/development/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,19 @@ RUN python3.9 -m pip install --upgrade pip ipython setuptools build wheel twine

## CMake

ARG TARGETPLATFORM
ARG CMAKE_MAJOR_VERSION="3"
ARG CMAKE_MINOR_VERSION="26"
ARG CMAKE_PATCH_VERSION="3"
ARG CMAKE_VERSION="${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}"

RUN cd /tmp \
&& wget --quiet https://cmake.org/files/v${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}/cmake-${CMAKE_VERSION}.tar.gz \
&& tar -xf cmake-${CMAKE_VERSION}.tar.gz \
&& cd cmake-${CMAKE_VERSION} \
&& ./bootstrap \
&& make -j $(nproc) \
&& make install \
&& rm -rf /tmp/cmake-${CMAKE_VERSION} /tmp/cmake-${CMAKE_VERSION}.tar.gz
RUN mkdir -p /tmp/cmake \
&& cd /tmp/cmake \
&& export PACKAGE_PLATFORM=$(if [ ${TARGETPLATFORM} = "linux/amd64" ]; then echo "x86_64"; elif [ ${TARGETPLATFORM} = "linux/arm64" ]; then echo "aarch64"; else echo "Unknown platform" && exit 1; fi;) \
&& wget --quiet https://cmake.org/files/v${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}/cmake-${CMAKE_VERSION}-linux-${PACKAGE_PLATFORM}.sh -O cmake-install.sh \
&& chmod +x /tmp/cmake/cmake-install.sh \
&& /tmp/cmake/cmake-install.sh --prefix=/usr/local --skip-license \
&& rm -rf /tmp/cmake

## GoogleTest

Expand Down

0 comments on commit f24d567

Please sign in to comment.