diff options
| -rw-r--r-- | CMakeLists.txt | 7 | ||||
| -rw-r--r-- | GenerateProjects.bat | 32 | ||||
| -rw-r--r-- | WaveWorksDependencies.xml | 8 | ||||
| -rw-r--r-- | cmake/FindAntTweakBar.cmake | 2 | ||||
| -rw-r--r-- | cmake/FindDXUT.cmake | 2 | ||||
| -rw-r--r-- | cmake/FindDirectXTK.cmake | 2 | ||||
| -rw-r--r-- | cmake/FindFX11.cmake | 2 | ||||
| -rw-r--r-- | cmake/FindFXC.cmake | 33 | ||||
| -rw-r--r-- | compiler/cmake/ServerApp.cmake | 1 | ||||
| -rw-r--r-- | compiler/cmake/sample_d3d11.cmake | 7 | ||||
| -rw-r--r-- | compiler/cmake/sample_opengl.cmake | 1 | ||||
| -rw-r--r-- | compiler/cmake/test_d3d11.cmake | 7 | ||||
| -rw-r--r-- | packman/windows/configure/configure_s3.bat | 79 | ||||
| -rw-r--r-- | packman/windows/configure/fetch_file_from_s3.ps1 | 43 | ||||
| -rw-r--r-- | packman/windows/configure/install_package.py | 41 | ||||
| -rw-r--r-- | packman/windows/packman.cmd | 18 |
16 files changed, 249 insertions, 36 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 07a7be5..ecf6ac8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,15 +4,12 @@ project(WaveWorks CXX) CMAKE_POLICY(SET CMP0057 NEW) # Enable IN_LIST -SET(GW_DEPS_ROOT $ENV{GW_DEPS_ROOT}) +SET(GW_DEPS_ROOT $ENV{PM_PACKAGES_ROOT}) LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake) -LIST(APPEND CMAKE_MODULE_PATH ${GW_DEPS_ROOT}CMakeModules) MESSAGE(${CMAKE_MODULE_PATH}) - - # TODO: Fail if we didn't find deps IF(CMAKE_CONFIGURATION_TYPES) @@ -26,8 +23,6 @@ IF(CMAKE_CONFIGURATION_TYPES) ENDIF() -SET(GW_DEPS_ROOT $ENV{GW_DEPS_ROOT}) - # Handle different platforms. So far, Windows, PS4, XBone, Linux... More? IF(NOT DEFINED TARGET_BUILD_PLATFORM) # Not defined, default to Windows SET(TARGET_BUILD_PLATFORM "Windows") diff --git a/GenerateProjects.bat b/GenerateProjects.bat index cbc826b..1df3d8d 100644 --- a/GenerateProjects.bat +++ b/GenerateProjects.bat @@ -2,22 +2,25 @@ REM @echo off REM Make sure the various variables that we need are set -IF NOT DEFINED GW_DEPS_ROOT GOTO GW_DEPS_ROOT_UNDEFINED +call %~dp0\packman\windows\packman.cmd pull WaveWorksDependencies.xml -REM Generate projects here -rmdir /s /q compiler\vc12win64-cmake\ -mkdir compiler\vc12win64-cmake\ -pushd compiler\vc12win64-cmake\ -cmake ..\.. -G "Visual Studio 12 2013" -Ax64 -DTARGET_BUILD_PLATFORM=Windows -DWW_OUTPUT_DIR=bin\vc12win64-cmake\ -popd +IF NOT DEFINED PM_PACKAGES_ROOT GOTO PM_PACKAGES_ROOT_UNDEFINED + +REM Generate projects here -REM rmdir /s /q compiler\vc14win64-cmake\ -REM mkdir compiler\vc14win64-cmake\ -REM pushd compiler\vc14win64-cmake\ -REM cmake ..\.. -G "Visual Studio 14 2015" -Ax64 -DTARGET_BUILD_PLATFORM=Windows -DWW_OUTPUT_DIR=bin\vc14win64-cmake\ +REM rmdir /s /q compiler\vc12win64-cmake\ +REM mkdir compiler\vc12win64-cmake\ +REM pushd compiler\vc12win64-cmake\ +REM cmake ..\.. -G "Visual Studio 12 2013" -Ax64 -DTARGET_BUILD_PLATFORM=Windows -DWW_OUTPUT_DIR=bin\vc12win64-cmake\ REM popd +rmdir /s /q compiler\vc14win64-cmake\ +mkdir compiler\vc14win64-cmake\ +pushd compiler\vc14win64-cmake\ +cmake ..\.. -G "Visual Studio 14 2015" -Ax64 -DTARGET_BUILD_PLATFORM=Windows -DWW_OUTPUT_DIR=bin\vc14win64-cmake\ +popd + REM rmdir /s /q compiler\vc12-ps4-cmake\ REM mkdir compiler\vc12-ps4-cmake\ REM pushd compiler\vc12-ps4-cmake\ @@ -38,13 +41,10 @@ REM popd GOTO :End -:GW_DEPS_ROOT_UNDEFINED -ECHO GW_DEPS_ROOT has to be defined, pointing to the root of the dependency tree. +:PM_PACKAGES_ROOT_UNDEFINED +ECHO PM_PACKAGES_ROOT has to be defined, if it's not it means PackMan has not successfully bootstrapped and run as part of this batch file. PAUSE GOTO END -:CUDA_ROOT_UNDEFINED -ECHO CUDA_BIN_PATH has to be defined, pointing to the bin folder of your local CUDA install. -PAUSE :End diff --git a/WaveWorksDependencies.xml b/WaveWorksDependencies.xml new file mode 100644 index 0000000..f9249a4 --- /dev/null +++ b/WaveWorksDependencies.xml @@ -0,0 +1,8 @@ +<project toolsVersion="3.0" packageSource="s3"> + <platform name="win"> + <dependency name="DXUT" version="1.0"/> + <dependency name="FX11" version="1.0"/> + <dependency name="DirectXTK" version="1.0"/> + <dependency name="AntTweakBar" version="1.0"/> + </platform> +</project> diff --git a/cmake/FindAntTweakBar.cmake b/cmake/FindAntTweakBar.cmake index a25e9a0..149494a 100644 --- a/cmake/FindAntTweakBar.cmake +++ b/cmake/FindAntTweakBar.cmake @@ -9,7 +9,7 @@ else() endif() find_path(ATB_PATH AntTweakBar.h - HINTS ${GW_DEPS_ROOT}/AntTweakBar + HINTS ${GW_DEPS_ROOT}/AntTweakBar/${AntTweakBar_FIND_VERSION} ) MESSAGE("ATB SDK ${ATB_PATH}") diff --git a/cmake/FindDXUT.cmake b/cmake/FindDXUT.cmake index 5825c07..f9bfdca 100644 --- a/cmake/FindDXUT.cmake +++ b/cmake/FindDXUT.cmake @@ -9,7 +9,7 @@ else() endif() find_path(DXUT_SDK_PATH Core/DXUT.h - HINTS ${GW_DEPS_ROOT}/DXUT + HINTS ${GW_DEPS_ROOT}/DXUT/${DXUT_FIND_VERSION} ) # Need to be smart and get the proper VS library here diff --git a/cmake/FindDirectXTK.cmake b/cmake/FindDirectXTK.cmake index 910cc11..cbf4fba 100644 --- a/cmake/FindDirectXTK.cmake +++ b/cmake/FindDirectXTK.cmake @@ -9,7 +9,7 @@ else() endif() find_path(DXTK_SDK_PATH Inc/DirectXHelpers.h - HINTS ${GW_DEPS_ROOT}/DirectXTK/ + HINTS ${GW_DEPS_ROOT}/DirectXTK/${DirectXTK_FIND_VERSION} ) MESSAGE("DXTK SDK ${DXTK_SDK_PATH}") diff --git a/cmake/FindFX11.cmake b/cmake/FindFX11.cmake index b6e8cb0..9c3d2ba 100644 --- a/cmake/FindFX11.cmake +++ b/cmake/FindFX11.cmake @@ -9,7 +9,7 @@ else() endif() find_path(FX11_SDK_PATH Effect.h - HINTS ${GW_DEPS_ROOT}/FX11 + HINTS ${GW_DEPS_ROOT}/FX11/${FX11_FIND_VERSION} ) if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 18.0.0.0 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.0.0) diff --git a/cmake/FindFXC.cmake b/cmake/FindFXC.cmake new file mode 100644 index 0000000..27ffd07 --- /dev/null +++ b/cmake/FindFXC.cmake @@ -0,0 +1,33 @@ +include(FindPackageHandleStandardArgs) + +set(_programfiles "") +foreach(v "ProgramW6432" "ProgramFiles" "ProgramFiles(x86)") + if(DEFINED "ENV{${v}}") + file(TO_CMAKE_PATH "$ENV{${v}}" _env_programfiles) + list(APPEND _programfiles "${_env_programfiles}/Windows Kits/8.1/bin/x86") + unset(_env_programfiles) + endif() +endforeach() + +# Can't use "$ENV{ProgramFiles(x86)}" to avoid violating CMP0053. See +# http://public.kitware.com/pipermail/cmake-developers/2014-October/023190.html +set (ProgramFiles_x86 "ProgramFiles(x86)") +if ("$ENV{${ProgramFiles_x86}}") + set (ProgramFiles "$ENV{${ProgramFiles_x86}}") +else () + set (ProgramFiles "$ENV{ProgramFiles}") +endif () + +MESSAGE("Trying to find ${ProgramFiles}/Windows Kits/8.1/bin/x86 ${ProgramFiles}/Windows Kits/8.0/bin/x86") + +find_program (DirectX_FXC_EXECUTABLE fxc + HINTS ${_programfiles} + + DOC "Path to fxc.exe executable." +) + +FIND_PACKAGE_HANDLE_STANDARD_ARGS(FXC + DEFAULT_MSG + DirectX_FXC_EXECUTABLE +) + diff --git a/compiler/cmake/ServerApp.cmake b/compiler/cmake/ServerApp.cmake index 175593a..866fd0d 100644 --- a/compiler/cmake/ServerApp.cmake +++ b/compiler/cmake/ServerApp.cmake @@ -2,7 +2,6 @@ # Build serverapp # -SET(GW_DEPS_ROOT $ENV{GW_DEPS_ROOT}) SET(TEST_SOURCE_DIR ${PROJECT_SOURCE_DIR}/test/serverapp) SET(LIB_SOURCE_DIR ${PROJECT_SOURCE_DIR}/src) diff --git a/compiler/cmake/sample_d3d11.cmake b/compiler/cmake/sample_d3d11.cmake index 96ab6a4..9a0e219 100644 --- a/compiler/cmake/sample_d3d11.cmake +++ b/compiler/cmake/sample_d3d11.cmake @@ -2,11 +2,10 @@ # Build sample_d3d11 # -SET(GW_DEPS_ROOT $ENV{GW_DEPS_ROOT}) -FIND_PACKAGE(DXUT REQUIRED) -FIND_PACKAGE(FX11 REQUIRED) -FIND_PACKAGE(DirectXTK REQUIRED) +FIND_PACKAGE(DXUT 1.0 REQUIRED) +FIND_PACKAGE(FX11 1.0 REQUIRED) +FIND_PACKAGE(DirectXTK 1.0 REQUIRED) FIND_PACKAGE(FXC REQUIRED) SET(SAMP_SOURCE_DIR ${PROJECT_SOURCE_DIR}/sample/d3d11) diff --git a/compiler/cmake/sample_opengl.cmake b/compiler/cmake/sample_opengl.cmake index ce71e04..6518c90 100644 --- a/compiler/cmake/sample_opengl.cmake +++ b/compiler/cmake/sample_opengl.cmake @@ -2,7 +2,6 @@ # Build sample_opengl # -SET(GW_DEPS_ROOT $ENV{GW_DEPS_ROOT}) FIND_PACKAGE(AntTweakBar REQUIRED) diff --git a/compiler/cmake/test_d3d11.cmake b/compiler/cmake/test_d3d11.cmake index a51a126..155845d 100644 --- a/compiler/cmake/test_d3d11.cmake +++ b/compiler/cmake/test_d3d11.cmake @@ -2,11 +2,10 @@ # Build test_d3d11 # -SET(GW_DEPS_ROOT $ENV{GW_DEPS_ROOT}) -FIND_PACKAGE(DXUT REQUIRED) -FIND_PACKAGE(FX11 REQUIRED) -FIND_PACKAGE(DirectXTK REQUIRED) +FIND_PACKAGE(DXUT 1.0 REQUIRED) +FIND_PACKAGE(FX11 1.0 REQUIRED) +FIND_PACKAGE(DirectXTK 1.0 REQUIRED) FIND_PACKAGE(FXC REQUIRED) MESSAGE("FX11 ${FX11_SDK_PATH}") diff --git a/packman/windows/configure/configure_s3.bat b/packman/windows/configure/configure_s3.bat new file mode 100644 index 0000000..4beae82 --- /dev/null +++ b/packman/windows/configure/configure_s3.bat @@ -0,0 +1,79 @@ +@echo off +set PM_PACKMAN_VERSION=3.0 +:: The external root may already be configured and we should do minimal work in that case +if defined PM_PACKAGES_ROOT goto ENSURE_DIR + +:: If the folder isn't set we assume that the best place for it is on the drive that we are currently +:: running from +set PM_DRIVE=%CD:~0,2% + +set PM_PACKAGES_ROOT=%PM_DRIVE%\NVIDIA\packman-repo + +:: We use *setx* here so that the variable is persisted in the user environment +echo Setting user environment variable PM_PACKAGES_ROOT to %PM_PACKAGES_ROOT% +setx PM_PACKAGES_ROOT %PM_PACKAGES_ROOT% +if errorlevel 1 goto ERROR + +:: Check for the directory that we need. Note that mkdir will create any directories +:: that may be needed in the path +:ENSURE_DIR +if not exist %PM_PACKAGES_ROOT% ( + echo Creating directory %PM_PACKAGES_ROOT% + mkdir %PM_PACKAGES_ROOT% +) + +:: The Python interpreter may already be externally configured +if defined PM_PYTHON_EXT ( + set PM_PYTHON=%PM_PYTHON_EXT% + goto PACKMAN +) + +set PM_PYTHON_DIR=%PM_PACKAGES_ROOT%\python\2.7.6-windows-x86 +set PM_PYTHON=%PM_PYTHON_DIR%\python.exe + +if exist %PM_PYTHON% goto PACKMAN + +set [email protected] +set TARGET=%TEMP%\%PM_PYTHON_PACKAGE% +echo Fetching %PM_PYTHON_PACKAGE% from S3 ... +powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File %~dp0\fetch_file_from_s3.ps1 -sourceName %PM_PYTHON_PACKAGE% -output %TARGET% +:: A bug in powershell prevents the errorlevel code from being set when using the -File execution option +if errorlevel 1 goto ERROR + +echo Unpacking ... +%TARGET% -o%PM_PYTHON_DIR% -y +if errorlevel 1 goto ERROR + +del %TARGET% + +:PACKMAN +:: The packman module may already be externally configured +if defined PM_MODULE_EXT ( + set PM_MODULE=%PM_MODULE_EXT% + goto END +) + +set PM_MODULE_DIR=%PM_PACKAGES_ROOT%\packman\%PM_PACKMAN_VERSION%-common +set PM_MODULE=%PM_MODULE_DIR%\packman.py + +if exist %PM_MODULE% goto END + +set PM_MODULE_PACKAGE=packman@%PM_PACKMAN_VERSION%-common.zip +set TARGET=%TEMP%\%PM_MODULE_PACKAGE% +echo Fetching %PM_MODULE_PACKAGE% from S3 ... +powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File %~dp0\fetch_file_from_s3.ps1 -sourceName %PM_MODULE_PACKAGE% -output %TARGET% +:: A bug in powershell prevents the errorlevel code from being set when using the -File execution option +if errorlevel 1 goto ERROR + +echo Unpacking ... +%PM_PYTHON% %~dp0\install_package.py %TARGET% %PM_MODULE_DIR% +if errorlevel 1 goto ERROR + +del %TARGET% + +goto END + +:ERROR +echo !!! Failure while configuring local machine :( !!! + +:END diff --git a/packman/windows/configure/fetch_file_from_s3.ps1 b/packman/windows/configure/fetch_file_from_s3.ps1 new file mode 100644 index 0000000..9e1b457 --- /dev/null +++ b/packman/windows/configure/fetch_file_from_s3.ps1 @@ -0,0 +1,43 @@ +param( +[Parameter(Mandatory=$true)][string]$sourceName=$null, +[string]$output="out.exe" +) +$source = "http://packman.s3.amazonaws.com/" + $sourceName +$filename = $output +#$key64 = 'QHV0ME1AdDNHVEwkY3IxcHQk' +#$key = [System.Text.Encoding]::GetEncoding(1252).GetString([Convert]::FromBase64String($key64)) +#$key = $key | ConvertTo-SecureString -asPlainText -Force +#$credential = New-Object System.Management.Automation.PSCredential('svcgtlautomate', $key) +#$cache = New-Object System.Net.CredentialCache +#$cache.Add( "http://sso.nvidia.com", "NTLM", $credential) + +$req = [System.Net.httpwebrequest]::Create($source) +$req.cookiecontainer = New-Object System.net.CookieContainer +#$req.Credentials = $cache +Write-Host "Connecting to S3 ..." +$res = $req.GetResponse() + +if($res.StatusCode -eq "OK") { + Write-Host "Initiating download ..." + [int]$goal = $res.ContentLength + $reader = $res.GetResponseStream() + $writer = new-object System.IO.FileStream $fileName, "Create" + [byte[]]$buffer = new-object byte[] 4096 + [int]$total = [int]$count = 0 + do + { + $count = $reader.Read($buffer, 0, $buffer.Length); + $writer.Write($buffer, 0, $count); + $total += $count + if($goal -gt 0) { + Write-Progress "Downloading $url" "Saving $total of $goal" -id 0 -percentComplete (($total/$goal)*100) + } else { + Write-Progress "Downloading $url" "Saving $total bytes..." -id 0 + } + } while ($count -gt 0) + + $reader.Close() + $writer.Flush() + $writer.Close() +} + diff --git a/packman/windows/configure/install_package.py b/packman/windows/configure/install_package.py new file mode 100644 index 0000000..5e30a03 --- /dev/null +++ b/packman/windows/configure/install_package.py @@ -0,0 +1,41 @@ +import logging +import zipfile +import tempfile +import sys +import shutil + +__author__ = 'hfannar' +logging.basicConfig(level=logging.WARNING, format="%(message)s") +logger = logging.getLogger('install_package') + + +class TemporaryDirectory: + def __init__(self): + self.path = None + + def __enter__(self): + self.path = tempfile.mkdtemp() + return self.path + + def __exit__(self, type, value, traceback ): + # Remove temporary data created + shutil.rmtree(self.path) + + +def install_package(package_src_path, package_dst_path): + with zipfile.ZipFile(package_src_path, allowZip64=True) as zip_file, TemporaryDirectory() as temp_dir: + zip_file.extractall(temp_dir) + # Recursively copy (temp_dir will be automatically cleaned up on exit) + try: + # Recursive copy is needed because both package name and version folder could be missing in + # target directory: + shutil.copytree(temp_dir, package_dst_path) + except OSError, exc: + logger.warning("Directory %s already present, unpacking failed (Exception message: %s)" % + (package_dst_path, exc.strerror)) + raise + else: + logger.info("Package successfully installed to %s" % package_dst_path) + + +install_package(sys.argv[1], sys.argv[2])
\ No newline at end of file diff --git a/packman/windows/packman.cmd b/packman/windows/packman.cmd new file mode 100644 index 0000000..e768674 --- /dev/null +++ b/packman/windows/packman.cmd @@ -0,0 +1,18 @@ +@echo off +:: You can remove the call below if you do your own manual configuration of the dev machines +call %~dp0\configure\configure_s3.bat +:: Everything below is mandatory +if not defined PM_PYTHON goto :PYTHON_ENV_ERROR +if not defined PM_MODULE goto :MODULE_ENV_ERROR + +%PM_PYTHON% %PM_MODULE% %* +goto :END + +:PYTHON_ENV_ERROR +echo User environment variable PM_PYTHON is not set! Please configure machine for packman or call configure.bat. +goto :END + +:MODULE_ENV_ERROR +echo User environment variable PM_MODULE is not set! Please configure machine for packman or call configure.bat. + +:END |