From 1ed35486551c89f605be71f0873ce174ca2f8180 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Mon, 18 Jul 2016 23:27:51 -0400 Subject: [PATCH] base: Add cmake wrapper scripts for CMAKE_TOOLCHAIN_FILE All images should define this variables. Disable build tests on the base image because it is not configured for cross compiling. --- Dockerfile | 3 +++ Makefile | 17 ++++++++--------- imagefiles/ccmake.sh | 6 ++++++ imagefiles/cmake.sh | 6 ++++++ test/run.py | 4 ---- 5 files changed, 23 insertions(+), 13 deletions(-) create mode 100755 imagefiles/ccmake.sh create mode 100755 imagefiles/cmake.sh diff --git a/Dockerfile b/Dockerfile index 2fff1c8..bc024fa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -58,6 +58,7 @@ RUN git clone git://cmake.org/cmake.git CMake && \ make install && \ cd .. && \ rm -rf CMake* +# Wrappers that point to CMAKE_TOOLCHAIN_FILE # Build and install Ninja from source RUN git clone https://github.com/martine/ninja.git && \ @@ -67,6 +68,8 @@ RUN git clone https://github.com/martine/ninja.git && \ ./ninja && \ cp ./ninja /usr/bin/ && \ cd .. && rm -rf ninja +COPY imagefiles/cmake.sh /usr/local/bin/cmake +COPY imagefiles/ccmake.sh /usr/local/bin/ccmake RUN echo "root:root" | chpasswd WORKDIR /work diff --git a/Makefile b/Makefile index 38cd69f..2be523c 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ browser-asmjs: base browser-asmjs/Dockerfile browser-asmjs.test: browser-asmjs test/run.py $(DOCKER) run --rm dockcross/browser-asmjs > $(BIN)/dockcross-browser-asmjs && chmod +x $(BIN)/dockcross-browser-asmjs - $(BIN)/dockcross-browser-asmjs python test/run.py --emulator /usr/bin/node --exe-suffix ".js" + $(BIN)/dockcross-browser-asmjs python test/run.py --exe-suffix ".js" linux-x86: base linux-x86/Dockerfile linux-x86/Toolchain.cmake $(DOCKER) build -t $(ORG)/linux-x86 linux-x86 @@ -41,49 +41,49 @@ linux-arm64: base linux-arm64/Dockerfile linux-arm64/Toolchain.cmake linux-arm64.test: linux-arm64 test/run.py $(DOCKER) run --rm dockcross/linux-arm64 > $(BIN)/dockcross-linux-arm64 && chmod +x $(BIN)/dockcross-linux-arm64 - $(BIN)/dockcross-linux-arm64 python test/run.py --emulator /usr/bin/qemu-aarch64 + $(BIN)/dockcross-linux-arm64 python test/run.py linux-armv5: base linux-armv5/Dockerfile linux-armv5/Toolchain.cmake $(DOCKER) build -t $(ORG)/linux-armv5 linux-armv5 linux-armv5.test: linux-armv5 test/run.py $(DOCKER) run --rm dockcross/linux-armv5 > $(BIN)/dockcross-linux-armv5 && chmod +x $(BIN)/dockcross-linux-armv5 - $(BIN)/dockcross-linux-armv5 python test/run.py --emulator /usr/bin/qemu-arm + $(BIN)/dockcross-linux-armv5 python test/run.py linux-armv6: base linux-armv6/Dockerfile linux-armv6/Toolchain.cmake $(DOCKER) build -t $(ORG)/linux-armv6 linux-armv6 linux-armv6.test: linux-armv6 test/run.py $(DOCKER) run --rm dockcross/linux-armv6 > $(BIN)/dockcross-linux-armv6 && chmod +x $(BIN)/dockcross-linux-armv6 - $(BIN)/dockcross-linux-armv6 python test/run.py --emulator /usr/bin/qemu-arm + $(BIN)/dockcross-linux-armv6 python test/run.py linux-armv7: base linux-armv7/Dockerfile linux-armv7/Toolchain.cmake $(DOCKER) build -t $(ORG)/linux-armv7 linux-armv7 linux-armv7.test: linux-armv7 test/run.py $(DOCKER) run --rm dockcross/linux-armv7 > $(BIN)/dockcross-linux-armv7 && chmod +x $(BIN)/dockcross-linux-armv7 - $(BIN)/dockcross-linux-armv7 python test/run.py --emulator /usr/bin/qemu-arm + $(BIN)/dockcross-linux-armv7 python test/run.py linux-ppc64le: base linux-ppc64le/Dockerfile linux-ppc64le/Toolchain.cmake $(DOCKER) build -t $(ORG)/linux-ppc64le linux-ppc64le linux-ppc64le.test: linux-ppc64le test/run.py $(DOCKER) run --rm dockcross/linux-ppc64le > $(BIN)/dockcross-linux-ppc64le && chmod +x $(BIN)/dockcross-linux-ppc64le - $(BIN)/dockcross-linux-ppc64le python test/run.py --emulator /usr/bin/qemu-ppc64le --languages C + $(BIN)/dockcross-linux-ppc64le python test/run.py --languages C windows-x86: base windows-x86/Dockerfile windows-x86/settings.mk $(DOCKER) build -t $(ORG)/windows-x86 windows-x86 windows-x86.test: windows-x86 test/run.py $(DOCKER) run --rm dockcross/windows-x86 > $(BIN)/dockcross-windows-x86 && chmod +x $(BIN)/dockcross-windows-x86 - $(BIN)/dockcross-windows-x86 python test/run.py --emulator /usr/bin/wine --exe-suffix ".exe" + $(BIN)/dockcross-windows-x86 python test/run.py --exe-suffix ".exe" windows-x64: base windows-x64/Dockerfile windows-x64/settings.mk $(DOCKER) build -t $(ORG)/windows-x64 windows-x64 windows-x64.test: windows-x64 test/run.py $(DOCKER) run --rm dockcross/windows-x64 > $(BIN)/dockcross-windows-x64 && chmod +x $(BIN)/dockcross-windows-x64 - $(BIN)/dockcross-windows-x64 python test/run.py --emulator /usr/bin/wine --exe-suffix ".exe" + $(BIN)/dockcross-windows-x64 python test/run.py --exe-suffix ".exe" base: Dockerfile $(DOCKER) build -t $(ORG)/base . @@ -91,6 +91,5 @@ base: Dockerfile base.test: base test/run.py mkdir -p $(BIN) $(DOCKER) run --rm dockcross/base > $(BIN)/dockcross-base && chmod +x $(BIN)/dockcross-base - $(BIN)/dockcross-base python test/run.py --emulator 'sh -c' .PHONY: images base android-arm linux-x86 linux-x64 linux-arm64 linux-armv5 linux-armv6 linux-armv7 windows-x86 windows-x64 tests %.test diff --git a/imagefiles/ccmake.sh b/imagefiles/ccmake.sh new file mode 100755 index 0000000..75ca42a --- /dev/null +++ b/imagefiles/ccmake.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +# Always pass the CMAKE_TOOLCHAIN_FILE variable to CMake when inside a +# dockcross environment -- the CMAKE_TOOLCHAIN_FILE environmental variable is +# always set in this context +exec /usr/bin/ccmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=${CMAKE_TOOLCHAIN_FILE} "$@" diff --git a/imagefiles/cmake.sh b/imagefiles/cmake.sh new file mode 100755 index 0000000..c69a095 --- /dev/null +++ b/imagefiles/cmake.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +# Always pass the CMAKE_TOOLCHAIN_FILE variable to CMake when inside a +# dockcross environment -- the CMAKE_TOOLCHAIN_FILE environmental variable is +# always set in this context +exec /usr/bin/cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=${CMAKE_TOOLCHAIN_FILE} "$@" diff --git a/test/run.py b/test/run.py index ec5940f..fb61fc7 100755 --- a/test/run.py +++ b/test/run.py @@ -58,10 +58,6 @@ def test_cmake_build_system(build_dir, language, source, emulator, linker_flags, if linker_flags: cmake_configuration_cmd.insert(1, '-DCMAKE_EXE_LINKER_FLAGS="{0}"'.format(' '.join(linker_flags))) - toolchain_file = os.getenv('CMAKE_TOOLCHAIN_FILE') - if toolchain_file: - cmake_configuration_cmd.insert(1, - '-DCMAKE_TOOLCHAIN_FILE={0}'.format(toolchain_file)) print(' '.join(cmake_configuration_cmd)) sys.stdout.flush() if subprocess.call(cmake_configuration_cmd):