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