Merge branch 'master' into visibility-hidden

This commit is contained in:
tdesveauxPKFX 2018-04-10 19:48:11 +02:00 committed by GitHub
commit 56550c0dd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 536 additions and 24 deletions

View File

@ -1,9 +1,30 @@
os:
- linux
- osx
language: c++
dist: trusty
sudo: false
matrix:
include:
# Linux Debug
- os: linux
compiler: gcc
env:
- CONFIGURATION=debug
# Linux Release
- os: linux
compiler: gcc
env:
- CONFIGURATION=release
# macOS Debug x86
- os: osx
osx_image: xcode9
env:
- CONFIGURATION=debug
# macOS Release x86
- os: osx
osx_image: xcode9
env:
- CONFIGURATION=release
script:
- make -f Bootstrap.mak $TRAVIS_OS_NAME
- make -C build/bootstrap -j config=debug
- bin/release/premake5 test
- make -f Bootstrap.mak $TRAVIS_OS_NAME CONFIG=${CONFIGURATION}
- bin/${CONFIGURATION}/premake5 test

View File

@ -1,4 +1,6 @@
MSDEV = vs2012
CONFIG = release
PLATFORM = x86
LUA_DIR = contrib/lua/src
LUASHIM_DIR = contrib/luashim
@ -36,8 +38,8 @@ SRC = src/host/*.c \
$(LUA_DIR)/lvm.c \
$(LUA_DIR)/lzio.c \
PLATFORM= none
default: $(PLATFORM)
HOST_PLATFORM= none
default: $(HOST_PLATFORM)
none:
@echo "Please do"
@ -57,7 +59,7 @@ mingw: $(SRC)
$(CC) -o build/bootstrap/premake_bootstrap -DPREMAKE_NO_BUILTIN_SCRIPTS -I"$(LUA_DIR)" -I"$(LUASHIM_DIR)" $? -lole32
./build/bootstrap/premake_bootstrap embed
./build/bootstrap/premake_bootstrap --os=windows --to=build/bootstrap gmake
$(MAKE) -C build/bootstrap
$(MAKE) -C build/bootstrap config=$(CONFIG)_$(PLATFORM)
osx: $(SRC)
$(SILENT) rm -rf ./bin
@ -67,7 +69,7 @@ osx: $(SRC)
$(CC) -o build/bootstrap/premake_bootstrap -DPREMAKE_NO_BUILTIN_SCRIPTS -DLUA_USE_MACOSX -I"$(LUA_DIR)" -I"$(LUASHIM_DIR)" -framework CoreServices -framework Foundation -framework Security -lreadline $?
./build/bootstrap/premake_bootstrap embed
./build/bootstrap/premake_bootstrap --to=build/bootstrap gmake
$(MAKE) -C build/bootstrap -j`getconf _NPROCESSORS_ONLN`
$(MAKE) -C build/bootstrap -j`getconf _NPROCESSORS_ONLN` config=$(CONFIG)
linux: $(SRC)
$(SILENT) rm -rf ./bin
@ -77,7 +79,7 @@ linux: $(SRC)
$(CC) -o build/bootstrap/premake_bootstrap -DPREMAKE_NO_BUILTIN_SCRIPTS -DLUA_USE_POSIX -DLUA_USE_DLOPEN -I"$(LUA_DIR)" -I"$(LUASHIM_DIR)" $? -lm -ldl -lrt
./build/bootstrap/premake_bootstrap embed
./build/bootstrap/premake_bootstrap --to=build/bootstrap gmake
$(MAKE) -C build/bootstrap -j`getconf _NPROCESSORS_ONLN`
$(MAKE) -C build/bootstrap -j`getconf _NPROCESSORS_ONLN` config=$(CONFIG)
bsd: $(SRC)
$(SILENT) rm -rf ./bin
@ -87,7 +89,7 @@ bsd: $(SRC)
$(CC) -o build/bootstrap/premake_bootstrap -DPREMAKE_NO_BUILTIN_SCRIPTS -DLUA_USE_POSIX -DLUA_USE_DLOPEN -I"$(LUA_DIR)" -I"$(LUASHIM_DIR)" $? -lm
./build/bootstrap/premake_bootstrap embed
./build/bootstrap/premake_bootstrap --to=build/bootstrap gmake
$(MAKE) -C build/bootstrap -j`getconf _NPROCESSORS_ONLN`
$(MAKE) -C build/bootstrap -j`getconf _NPROCESSORS_ONLN` config=$(CONFIG)
windows-base: $(SRC)
$(SILENT) if exist .\bin rmdir /s /q .\bin
@ -100,7 +102,7 @@ windows-base: $(SRC)
windows: windows-base
devenv .\build\bootstrap\Premake5.sln /Upgrade
devenv .\build\bootstrap\Premake5.sln /Build Release
devenv .\build\bootstrap\Premake5.sln /Build "$(CONFIG)|$(PLATFORM:x86=win32)"
windows-msbuild: windows-base
msbuild /p:Configuration=Release /p:Platform=Win32 .\build\bootstrap\Premake5.sln
msbuild /p:Configuration=$(CONFIG) /p:Platform=$(PLATFORM:x86=win32) .\build\bootstrap\Premake5.sln

View File

@ -2,13 +2,18 @@ os: Visual Studio 2015
platform:
- Win32
- x64
configuration:
- Debug
- Release
before_build:
- cmd: git clean -ffxd
build_script:
- cmd: call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat"
- cmd: nmake -f Bootstrap.mak MSDEV=vs2015 windows
- cmd: nmake -f Bootstrap.mak MSDEV=vs2015 windows PLATFORM=%PLATFORM% CONFIG=%CONFIGURATION%
test_script:
- cmd: bin\release\premake5 test
- cmd: bin\%CONFIGURATION%\premake5 test

View File

@ -21,6 +21,102 @@
include("vs2015.lua")
include("vs2017.lua")
-- Initialize Specific API
p.api.register {
name = "shaderoptions",
scope = "config",
kind = "list:string",
tokens = true,
pathVars = true,
}
p.api.register {
name = "shaderdefines",
scope = "config",
kind = "list:string",
tokens = true,
}
p.api.register {
name = "shadertype",
scope = "config",
kind = "string",
allowed = {
"Effect",
"Vertex",
"Pixel",
"Geometry",
"Hull",
"Domain",
"Compute",
"Texture",
"RootSignature",
}
}
p.api.register {
name = "shadermodel",
scope = "config",
kind = "string",
allowed = {
"2.0",
"3.0",
"4.0_level_9_1",
"4.0_level_9_3",
"4.0",
"4.1",
"5.0",
}
}
p.api.register {
name = "shaderentry",
scope = "config",
kind = "string",
tokens = true,
}
p.api.register {
name = "shadervariablename",
scope = "config",
kind = "string",
tokens = true,
}
p.api.register {
name = "shaderheaderfileoutput",
scope = "config",
kind = "string",
tokens = true,
}
p.api.register {
name = "shaderobjectfileoutput",
scope = "config",
kind = "string",
tokens = true,
}
p.api.register {
name = "shaderassembler",
scope = "config",
kind = "string",
allowed = {
"NoListing",
"AssemblyCode",
"AssemblyCodeAndHex",
}
}
p.api.register {
name = "shaderassembleroutput",
scope = "config",
kind = "string",
tokens = true,
}
--
-- Decide when the full module should be loaded.
--

View File

@ -63,6 +63,7 @@ return {
"vc2010/test_language_settings.lua",
"vc2010/test_language_targets.lua",
"vc2010/test_floatingpoint.lua",
"vc2010/test_fxcompile_settings.lua",
"vc2010/test_globals.lua",
"vc2010/test_header.lua",
"vc2010/test_files.lua",

View File

@ -0,0 +1,229 @@
--
-- tests/actions/vstudio/vc2010/test_fxcompile_settings.lua
-- Validate FxCompile settings in Visual Studio 2010 C/C++ projects.
-- Copyright (c) 2014 Jason Perkins and the Premake project
--
local p = premake
local suite = test.declare("vstudio_vs2010_fxcompile_settings")
local vc2010 = p.vstudio.vc2010
local project = p.project
--
-- Setup
--
local wks, prj
function suite.setup()
p.action.set("vs2010")
wks, prj = test.createWorkspace()
end
local function prepare(platform)
local cfg = test.getconfig(prj, "Debug", platform)
vc2010.fxCompile(cfg)
end
---
-- Check the basic element structure with default settings.
-- Project should not generate this block if no hlsl files or no shader settings sets.
---
function suite.empty()
prepare()
test.capture [[
]]
end
function suite.defaultSettings()
files { "shader.hlsl" }
prepare()
test.capture [[
]]
end
---
-- Test FxCompilePreprocessorDefinition
---
function suite.onFxCompilePreprocessorDefinition()
files { "shader.hlsl" }
shaderdefines { "DEFINED_VALUE" }
prepare()
test.capture [[
<FxCompile>
<PreprocessorDefinitions>DEFINED_VALUE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</FxCompile>
]]
end
function suite.onFxCompilePreprocessorDefinition_multipleDefines()
files { "shader.hlsl" }
shaderdefines { "DEFINED_VALUE", "OTHER_DEFINED_VALUE" }
prepare()
test.capture [[
<FxCompile>
<PreprocessorDefinitions>DEFINED_VALUE;OTHER_DEFINED_VALUE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</FxCompile>
]]
end
---
-- Test FxCompileShaderType
---
function suite.onFxCompileShaderType()
files { "shader.hlsl" }
shadertype "Effect"
prepare()
test.capture [[
<FxCompile>
<ShaderType>Effect</ShaderType>
</FxCompile>
]]
end
---
-- Test FxCompileShaderModel
---
function suite.onFxCompileShaderModel()
files { "shader.hlsl" }
shadermodel "5.0"
prepare()
test.capture [[
<FxCompile>
<ShaderModel>5.0</ShaderModel>
</FxCompile>
]]
end
---
-- Test FxCompileShaderEntry
---
function suite.onFxCompileShaderEntry()
files { "shader.hlsl" }
shaderentry "NewEntry"
prepare()
test.capture [[
<FxCompile>
<EntryPointName>NewEntry</EntryPointName>
</FxCompile>
]]
end
---
-- Test FxCompileShaderVariableName
---
function suite.onFxCompileShaderVariableName()
files { "shader.hlsl" }
shadervariablename "ShaderVar"
prepare()
test.capture [[
<FxCompile>
<VariableName>ShaderVar</VariableName>
</FxCompile>
]]
end
---
-- Test FxCompileShaderHeaderOutput
---
function suite.onFxCompileShaderHeaderOutput()
files { "shader.hlsl" }
shaderheaderfileoutput "%%(filename).hlsl.h"
prepare()
test.capture [[
<FxCompile>
<HeaderFileOutput>%(filename).hlsl.h</HeaderFileOutput>
</FxCompile>
]]
end
---
-- Test FxCompileShaderObjectOutput
---
function suite.onFxCompileShaderObjectOutput()
files { "shader.hlsl" }
shaderobjectfileoutput "%%(filename).hlsl.o"
prepare()
test.capture [[
<FxCompile>
<ObjectFileOutput>%(filename).hlsl.o</ObjectFileOutput>
</FxCompile>
]]
end
---
-- Test FxCompileShaderAssembler
---
function suite.onFxCompileShaderAssembler()
files { "shader.hlsl" }
shaderassembler "AssemblyCode"
prepare()
test.capture [[
<FxCompile>
<AssemblerOutput>AssemblyCode</AssemblerOutput>
</FxCompile>
]]
end
---
-- Test FxCompileShaderAssemblerOutput
---
function suite.onFxCompileShaderAssemblerOutput()
files { "shader.hlsl" }
shaderassembleroutput "%%(filename).hlsl.asm.o"
prepare()
test.capture [[
<FxCompile>
<AssemblerOutputFile>%(filename).hlsl.asm.o</AssemblerOutputFile>
</FxCompile>
]]
end
---
-- Test FxCompileShaderAdditionalOptions
---
function suite.onFxCompileShaderAdditionalOptions()
files { "shader.hlsl" }
shaderoptions "-opt"
prepare()
test.capture [[
<FxCompile>
<AdditionalOptions>-opt %(AdditionalOptions)</AdditionalOptions>
</FxCompile>
]]
end

View File

@ -274,6 +274,7 @@
else
return {
m.clCompile,
m.fxCompile,
m.resourceCompile,
m.linker,
m.manifest,
@ -363,6 +364,42 @@
end
--
-- Write the <FxCompile> settings block.
--
m.elements.fxCompile = function(cfg)
return {
m.fxCompilePreprocessorDefinition,
m.fxCompileShaderType,
m.fxCompileShaderModel,
m.fxCompileShaderEntry,
m.fxCompileShaderVariableName,
m.fxCompileShaderHeaderOutput,
m.fxCompileShaderObjectOutput,
m.fxCompileShaderAssembler,
m.fxCompileShaderAssemblerOutput,
m.fxCompileShaderAdditionalOptions,
}
end
function m.fxCompile(cfg)
if p.config.hasFile(cfg, path.ishlslfile) then
local contents = p.capture(function ()
p.push()
p.callArray(m.elements.fxCompile, cfg)
p.pop()
end)
if #contents > 0 then
p.push('<FxCompile>')
p.outln(contents)
p.pop('</FxCompile>')
end
end
end
--
-- Write out the resource compiler block.
--
@ -696,13 +733,52 @@
end
}
---
-- ClCompile group
---
m.categories.FxCompile = {
name = "FxCompile",
extensions = { ".hlsl" },
priority = 3,
emitFiles = function(prj, group)
local fileCfgFunc = function(fcfg, condition)
if fcfg then
return {
m.excludedFromBuild,
m.fxCompilePreprocessorDefinition,
m.fxCompileShaderType,
m.fxCompileShaderModel,
m.fxCompileShaderEntry,
m.fxCompileShaderVariableName,
m.fxCompileShaderHeaderOutput,
m.fxCompileShaderObjectOutput,
m.fxCompileShaderAssembler,
m.fxCompileShaderAssemblerOutput,
m.fxCompileShaderAdditionalOptions,
}
else
return {
m.excludedFromBuild
}
end
end
m.emitFiles(prj, group, "FxCompile", nil, fileCfgFunc)
end,
emitFilter = function(prj, group)
m.filterGroup(prj, group, "FxCompile")
end
}
---
-- None group
---
m.categories.None = {
name = "None",
priority = 3,
priority = 4,
emitFiles = function(prj, group)
m.emitFiles(prj, group, "None", {m.generatedFile})
@ -720,7 +796,7 @@
m.categories.ResourceCompile = {
name = "ResourceCompile",
extensions = ".rc",
priority = 4,
priority = 5,
emitFiles = function(prj, group)
local fileCfgFunc = {
@ -743,7 +819,7 @@
---
m.categories.CustomBuild = {
name = "CustomBuild",
priority = 5,
priority = 6,
emitFiles = function(prj, group)
local fileFunc = {
@ -776,7 +852,7 @@
m.categories.Midl = {
name = "Midl",
extensions = ".idl",
priority = 6,
priority = 7,
emitFiles = function(prj, group)
local fileCfgFunc = {
@ -800,7 +876,7 @@
m.categories.Masm = {
name = "Masm",
extensions = ".asm",
priority = 7,
priority = 8,
emitFiles = function(prj, group)
local fileCfgFunc = function(fcfg, condition)
@ -839,7 +915,7 @@
m.categories.Image = {
name = "Image",
extensions = { ".gif", ".jpg", ".jpe", ".png", ".bmp", ".dib", "*.tif", "*.wmf", "*.ras", "*.eps", "*.pcx", "*.pcd", "*.tga", "*.dds" },
priority = 8,
priority = 9,
emitFiles = function(prj, group)
local fileCfgFunc = function(fcfg, condition)
@ -862,7 +938,7 @@
m.categories.Natvis = {
name = "Natvis",
extensions = { ".natvis" },
priority = 9,
priority = 10,
emitFiles = function(prj, group)
m.emitFiles(prj, group, "Natvis", {m.generatedFile})
@ -2488,12 +2564,85 @@
end
function m.xmlDeclaration()
p.xmlUtf8()
end
function m.fxCompilePreprocessorDefinition(cfg, condition)
if cfg.shaderdefines and #cfg.shaderdefines > 0 then
local shaderdefines = table.concat(cfg.shaderdefines, ";")
shaderdefines = shaderdefines .. ";%%(PreprocessorDefinitions)"
m.element('PreprocessorDefinitions', condition, shaderdefines)
end
end
function m.fxCompileShaderType(cfg, condition)
if cfg.shadertype then
m.element("ShaderType", condition, cfg.shadertype)
end
end
function m.fxCompileShaderModel(cfg, condition)
if cfg.shadermodel then
m.element("ShaderModel", condition, cfg.shadermodel)
end
end
function m.fxCompileShaderEntry(cfg, condition)
if cfg.shaderentry then
m.element("EntryPointName", condition, cfg.shaderentry)
end
end
function m.fxCompileShaderVariableName(cfg, condition)
if cfg.shadervariablename then
m.element("VariableName", condition, cfg.shadervariablename)
end
end
function m.fxCompileShaderHeaderOutput(cfg, condition)
if cfg.shaderheaderfileoutput then
m.element("HeaderFileOutput", condition, cfg.shaderheaderfileoutput)
end
end
function m.fxCompileShaderObjectOutput(cfg, condition)
if cfg.shaderobjectfileoutput then
m.element("ObjectFileOutput", condition, cfg.shaderobjectfileoutput)
end
end
function m.fxCompileShaderAssembler(cfg, condition)
if cfg.shaderassembler then
m.element("AssemblerOutput", condition, cfg.shaderassembler)
end
end
function m.fxCompileShaderAssemblerOutput(cfg, condition)
if cfg.shaderassembleroutput then
m.element("AssemblerOutputFile", condition, cfg.shaderassembleroutput)
end
end
function m.fxCompileShaderAdditionalOptions(cfg, condition)
local opts = cfg.shaderoptions
if #opts > 0 then
opts = table.concat(opts, " ")
m.element("AdditionalOptions", condition, '%s %%(AdditionalOptions)', opts)
end
end
---------------------------------------------------------------------------
--

View File

@ -251,6 +251,15 @@
end
--
-- Returns true if the filename represents a hlsl shader file.
--
function path.ishlslfile(fname)
return path.hasextension(fname, ".hlsl")
end
--
-- Takes a path which is relative to one location and makes it relative
-- to another location instead.