From fd79a004e36075aec362c2e7e5438e157b68cd60 Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Tue, 20 Feb 2018 12:45:22 -0600 Subject: [PATCH] Generate version.cpp if it doesn't already exist. This is necessary when bootstrapping a new RID, and we can't run MSBuild to generate the version.cpp file. Commit migrated from https://github.com/dotnet/core-setup/commit/83f55767876e52aba1372b94fee5f0faf9308aca --- src/installer/corehost/CMakeLists.txt | 2 -- src/installer/corehost/build.sh | 15 +++++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/installer/corehost/CMakeLists.txt b/src/installer/corehost/CMakeLists.txt index fadadad..fd2dd12 100644 --- a/src/installer/corehost/CMakeLists.txt +++ b/src/installer/corehost/CMakeLists.txt @@ -1,6 +1,4 @@ cmake_minimum_required (VERSION 2.6) -set(VERSION_FILE_PATH "${CMAKE_BINARY_DIR}/../../../version.cpp") - include(../settings.cmake) add_subdirectory(cli) diff --git a/src/installer/corehost/build.sh b/src/installer/corehost/build.sh index 300a07b..cdd3895 100755 --- a/src/installer/corehost/build.sh +++ b/src/installer/corehost/build.sh @@ -1,9 +1,5 @@ #!/usr/bin/env bash -# Why is this a separate script? Why not just invoke 'cmake' and 'make' in the C# build scripts themselves? -# I really don't know, but it doesn't work when I do that. Something about SIGCHLD not getting from clang to cmake or something. -# -anurse - init_rid_plat() { # Detect Distro @@ -98,6 +94,8 @@ __portableBuildArgs= __configuration=Debug __linkPortable=0 __cmake_defines="-DCMAKE_BUILD_TYPE=${__configuration} ${__portableBuildArgs}" +__baseIntermediateOutputPath="$RootRepo/Bin/obj" +__versionSourceFile="$__baseIntermediateOutputPath/version.cpp" while [ "$1" != "" ]; do lowerI="$(echo $1 | awk '{print tolower($0)}')" @@ -150,6 +148,8 @@ while [ "$1" != "" ]; do shift done +mkdir -p "$__baseIntermediateOutputPath" + case $__build_arch in amd64|x64) __arch_define=-DCLI_CMAKE_PLATFORM_ARCH_AMD64=1 @@ -214,6 +214,13 @@ else exit 1 fi +if [ ! -f $__versionSourceFile ]; then + __versionSourceLine="static char sccsid[] __attribute__((used)) = \"@(#)No version information produced\";" + echo $__versionSourceLine > $__versionSourceFile +fi + +__cmake_defines="${__cmake_defines} -DVERSION_FILE_PATH:STRING=${__versionSourceFile}" + echo "Building Corehost from $DIR to $(pwd)" set -x # turn on trace if [ $__CrossBuild == 1 ]; then -- 2.7.4