Nicolas Capens | 4c9f04b | 2019-01-31 22:09:03 -0500 | [diff] [blame] | 1 | #!/bin/bash
|
| 2 |
|
| 3 | # This shell script is for (re)generating Visual Studio project files from CMake
|
| 4 | # files, making them path relative so they can be checked into the repository.
|
| 5 |
|
| 6 | # exit when any command fails
|
| 7 | set -e
|
| 8 |
|
| 9 | if [[ "$OSTYPE" != "msys" ]]; then
|
| 10 | echo This script is meant for generation of path relative Visual Studio project
|
| 11 | echo files from CMake. It should be run from an MSYS/MinGW bash shell, such as
|
| 12 | echo the one that comes with Git for Windows.
|
| 13 | exit 1
|
| 14 | fi
|
| 15 |
|
| 16 | CMAKE_GENERATOR="Visual Studio 15 2017 Win64"
|
| 17 |
|
| 18 | CMAKE_BUILD_PATH="build/$CMAKE_GENERATOR"
|
| 19 |
|
| 20 | if [ ! -d "$CMAKE_BUILD_PATH" ]; then
|
| 21 | mkdir -p "$CMAKE_BUILD_PATH"
|
| 22 | fi
|
| 23 | cd "$CMAKE_BUILD_PATH"
|
| 24 |
|
| 25 | cmake -G"$CMAKE_GENERATOR" \
|
| 26 | -Thost=x64 \
|
| 27 | -DSPIRV-Headers_SOURCE_DIR="${CMAKE_HOME_DIRECTORY}/third_party/SPIRV-Headers" \
|
| 28 | -DCMAKE_CONFIGURATION_TYPES="Debug;Release" \
|
| 29 | -DSKIP_SPIRV_TOOLS_INSTALL=true \
|
| 30 | -DSPIRV_SKIP_EXECUTABLES=true \
|
| 31 | -DSPIRV_SKIP_TESTS=true \
|
| 32 | ../..
|
| 33 |
|
| 34 | cd ../..
|
| 35 |
|
| 36 | echo Making project files path relative. This might take a minute.
|
| 37 |
|
| 38 | # Current directory with forward slashes
|
| 39 | CD=$(pwd -W)/
|
| 40 | # Current directory with (escaped) backslashes
|
| 41 | CD2=$(echo $(pwd -W) | sed 's?/?\\\\?g')\\\\
|
| 42 | # Phython executable path
|
| 43 | PYTHON=$(where python | head --lines=1 | sed 's?\\?\\\\?g')
|
| 44 | # CMake executable path
|
| 45 | CMAKE=$(where cmake | head --lines=1 | sed 's?\\?\\\\?g')
|
| 46 |
|
| 47 | find . -type f \( -name \*.vcxproj -o -name \*.vcxproj.filters -o -name \*.sln \) \
|
| 48 | -execdir sed --in-place --binary --expression="s?$CD?\$(SolutionDir)?g" {} \
|
| 49 | --expression="s?$CD2?\$(SolutionDir)?g" {} \
|
| 50 | --expression="s?$PYTHON?python?g" {} \
|
Nicolas Capens | 73c3124 | 2019-02-12 00:09:23 -0500 | [diff] [blame] | 51 | --expression="s?$CMAKE?cmake?g" {} \
|
| 52 | --expression="s?MultiThreadedDebugDLL?MultiThreadedDebug?g" {} \
|
| 53 | --expression="s?MultiThreadedDLL?MultiThreaded?g" {} \; |