From f44a68dae848dcb9499ac88680fb9dd8b94ceebd Mon Sep 17 00:00:00 2001 From: Bassem Girgis Date: Tue, 13 Aug 2019 22:24:00 -0500 Subject: [PATCH] build google on windows --- google/benchmark/build.sh | 56 ++++++++++++++++++++++++++++++++------- google/log/build.sh | 44 +++++++++++++++++++++++++++++- google/test/build.sh | 44 +++++++++++++++++++++++++++++- 3 files changed, 132 insertions(+), 12 deletions(-) diff --git a/google/benchmark/build.sh b/google/benchmark/build.sh index d44fdf8..fd7fe5e 100755 --- a/google/benchmark/build.sh +++ b/google/benchmark/build.sh @@ -1,5 +1,15 @@ #!/bin/bash +unameOut="$(uname -s)" +case "${unameOut}" in + Linux*) machineArch=Linux;; + Darwin*) machineArch=MacOS;; + CYGWIN*) machineArch=Windows;; + MINGW*) machineArch=Windows;; + *) machineArch="UNKNOWN:${unameOut}" +esac +echo ${machineArch} + libVer=1.5.0 echo libVer=$libVer @@ -29,13 +39,39 @@ mkdir -p $libSrcPath tar zxvpf $libFilePath -C $buildPath -unameOut="$(uname -s)" -case "${unameOut}" in - Linux*) ( cd $libBuildPath && cmake -DCMAKE_BUILD_TYPE=Release -DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON -DCMAKE_INSTALL_PREFIX:PATH=$libInstallPath $libSrcPath && make install -j);; - Darwin*) ( cd $libBuildPath && cmake -DCMAKE_BUILD_TYPE=Release -DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON -DCMAKE_INSTALL_PREFIX:PATH=$libInstallPath -DLLVMAR_EXECUTABLE:PATH=/usr/bin/ar -DLLVMNM_EXECUTABLE:PATH=/usr/bin/nm -DLLVMRANLIB_EXECUTABLE:PATH=/usr/bin/ranlib $libSrcPath && make install -j);; - CYGWIN*) ;; - MINGW*) ;; - *) ;; -esac -echo ${machine} - +if [ "${machineArch}" = "Linux" ]; then + ( cd $libBuildPath && \ + cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON \ + -DCMAKE_INSTALL_PREFIX:PATH=$libInstallPath \ + $libSrcPath && \ + make install -j) +elif [ "${machineArch}" = "MacOS" ]; then + ( cd $libBuildPath && \ + cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON \ + -DCMAKE_INSTALL_PREFIX:PATH=$libInstallPath \ + -DLLVMAR_EXECUTABLE:PATH=/usr/bin/ar \ + -DLLVMNM_EXECUTABLE:PATH=/usr/bin/nm \ + -DLLVMRANLIB_EXECUTABLE:PATH=/usr/bin/ranlib \ + $libSrcPath && \ + make install -j) +elif [ "${machineArch}" = "Windows" ]; then + ( cd $libBuildPath && \ + cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON \ + -DCMAKE_INSTALL_PREFIX:PATH=$libInstallPath \ + -G "Visual Studio 16 2019" \ + -A x64 \ + $libSrcPath && \ + cmake \ + --build . \ + --config Release \ + --target INSTALL) +else + echo "unknown architecture" + exit 1 +fi diff --git a/google/log/build.sh b/google/log/build.sh index f6dc5cc..026d6f5 100755 --- a/google/log/build.sh +++ b/google/log/build.sh @@ -1,5 +1,15 @@ #!/bin/bash +unameOut="$(uname -s)" +case "${unameOut}" in + Linux*) machineArch=Linux;; + Darwin*) machineArch=MacOS;; + CYGWIN*) machineArch=Windows;; + MINGW*) machineArch=Windows;; + *) machineArch="UNKNOWN:${unameOut}" +esac +echo ${machineArch} + libVer=0.4.0 echo libVer=$libVer @@ -29,4 +39,36 @@ mkdir -p $libSrcPath tar zxvpf $libFilePath -C $buildPath -( cd $libBuildPath && cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS:BOOL=TRUE -DCMAKE_INSTALL_PREFIX:PATH=$libInstallPath $libSrcPath && make install -j) +if [ "${machineArch}" = "Linux" ]; then + ( cd $libBuildPath && \ + cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS:BOOL=TRUE \ + -DCMAKE_INSTALL_PREFIX:PATH=$libInstallPath \ + $libSrcPath && \ + make install -j) +elif [ "${machineArch}" = "MacOS" ]; then + ( cd $libBuildPath && \ + cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS:BOOL=TRUE \ + -DCMAKE_INSTALL_PREFIX:PATH=$libInstallPath \ + $libSrcPath && \ + make install -j) +elif [ "${machineArch}" = "Windows" ]; then + ( cd $libBuildPath && \ + cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS:BOOL=TRUE \ + -DCMAKE_INSTALL_PREFIX:PATH=$libInstallPath \ + -G "Visual Studio 16 2019" \ + -A x64 \ + $libSrcPath && \ + cmake \ + --build . \ + --config Release \ + --target INSTALL) +else + echo "unknown architecture" + exit 1 +fi diff --git a/google/test/build.sh b/google/test/build.sh index 7108191..1917b5a 100755 --- a/google/test/build.sh +++ b/google/test/build.sh @@ -1,5 +1,15 @@ #!/bin/bash +unameOut="$(uname -s)" +case "${unameOut}" in + Linux*) machineArch=Linux;; + Darwin*) machineArch=MacOS;; + CYGWIN*) machineArch=Windows;; + MINGW*) machineArch=Windows;; + *) machineArch="UNKNOWN:${unameOut}" +esac +echo ${machineArch} + libVer=1.8.1 echo libVer=$libVer @@ -29,4 +39,36 @@ mkdir -p $libSrcPath tar zxvpf $libFilePath -C $buildPath -( cd $libBuildPath && cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS:BOOL=TRUE -DCMAKE_INSTALL_PREFIX:PATH=$libInstallPath $libSrcPath && make install -j) +if [ "${machineArch}" = "Linux" ]; then + ( cd $libBuildPath && \ + cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS:BOOL=TRUE \ + -DCMAKE_INSTALL_PREFIX:PATH=$libInstallPath \ + $libSrcPath && \ + make install -j) +elif [ "${machineArch}" = "MacOS" ]; then + ( cd $libBuildPath && \ + cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS:BOOL=TRUE \ + -DCMAKE_INSTALL_PREFIX:PATH=$libInstallPath \ + $libSrcPath && \ + make install -j) +elif [ "${machineArch}" = "Windows" ]; then + ( cd $libBuildPath && \ + cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS:BOOL=TRUE \ + -DCMAKE_INSTALL_PREFIX:PATH=$libInstallPath \ + -G "Visual Studio 16 2019" \ + -A x64 \ + $libSrcPath && \ + cmake \ + --build . \ + --config Release \ + --target INSTALL) +else + echo "unknown architecture" + exit 1 +fi