CMake: distinguish between file and dir copies by presence of '.' in src path
ANGLE's build requires a file copy. Nema's build requires a dir copy. CMake uses a different command for each. gn does not distinguish which. We make a guess that happens to work for these two use cases based on the whether the base file name of the src contains a '.' Change-Id: I3503fd9d632abda3f8f952d0eef964019d932bea Reviewed-on: https://skia-review.googlesource.com/c/188626 Commit-Queue: Kevin Lubick <kjlubick@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
3ed198faf9
commit
9a2bb09202
@ -58,8 +58,8 @@ It gets manually pushed anytime there's an update to the Dockerfile or relevant
|
||||
installed libraries. To push:
|
||||
|
||||
docker build -t cmake-release ./cmake-release/
|
||||
docker tag cmake-release gcr.io/skia-public/cmake-release:3.13.1_v1
|
||||
docker push gcr.io/skia-public/cmake-release:3.13.1_v1
|
||||
docker tag cmake-release gcr.io/skia-public/cmake-release:3.13.1_v2
|
||||
docker push gcr.io/skia-public/cmake-release:3.13.1_v2
|
||||
|
||||
For testing the image locally, the following flow can be helpful:
|
||||
|
||||
|
@ -8,6 +8,7 @@ RUN apt-get update && apt-get upgrade -y && apt-get install -y \
|
||||
libfontconfig-dev \
|
||||
libgl1-mesa-dev \
|
||||
libglu1-mesa-dev \
|
||||
libxi-dev \
|
||||
&& groupadd -g 2000 skia \
|
||||
&& useradd -u 2000 -g 2000 skia
|
||||
|
||||
|
@ -372,8 +372,15 @@ def WriteCopy(out, target, project, sources, synthetic_dependencies):
|
||||
out.write('\n')
|
||||
|
||||
for src, dst in zip(inputs, outputs):
|
||||
out.write(' COMMAND ${CMAKE_COMMAND} -E copy_directory "')
|
||||
out.write(CMakeStringEscape(project.GetAbsolutePath(src)))
|
||||
abs_src_path = CMakeStringEscape(project.GetAbsolutePath(src))
|
||||
# CMake distinguishes between copying files and copying directories but
|
||||
# gn does not. We assume if the src has a period in its name then it is
|
||||
# a file and otherwise a directory.
|
||||
if "." in os.path.basename(abs_src_path):
|
||||
out.write(' COMMAND ${CMAKE_COMMAND} -E copy "')
|
||||
else:
|
||||
out.write(' COMMAND ${CMAKE_COMMAND} -E copy_directory "')
|
||||
out.write(abs_src_path)
|
||||
out.write('" "')
|
||||
out.write(CMakeStringEscape(dst))
|
||||
out.write('"\n')
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
DOCKER_IMAGE = 'gcr.io/skia-public/cmake-release:3.13.1_v1'
|
||||
DOCKER_IMAGE = 'gcr.io/skia-public/cmake-release:3.13.1_v2'
|
||||
INNER_BUILD_SCRIPT = '/SRC/skia/infra/cmake/build_skia.sh'
|
||||
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
"[START_DIR]/cache/work:/SRC",
|
||||
"--volume",
|
||||
"[START_DIR]/cache/docker/cmake:/OUT",
|
||||
"gcr.io/skia-public/cmake-release:3.13.1_v1",
|
||||
"gcr.io/skia-public/cmake-release:3.13.1_v2",
|
||||
"/SRC/skia/infra/cmake/build_skia.sh"
|
||||
],
|
||||
"env": {
|
||||
|
@ -26,8 +26,8 @@ cd $SKIA_DIR
|
||||
gn gen out/CMAKE --args='is_debug=false' --ide=json --json-ide-script=../../gn/gn_to_cmake.py
|
||||
|
||||
cd $SKIA_DIR/out/CMAKE
|
||||
cmake -G Ninja .
|
||||
cmake --build .
|
||||
cmake -G"CodeBlocks - Unix Makefiles" .
|
||||
cmake --build . --parallel 8
|
||||
|
||||
# Copy build products, ignoring the warning
|
||||
# for not copying directories.
|
||||
|
Loading…
Reference in New Issue
Block a user