diff --git a/CHANGES.txt b/CHANGES.txt index d4c80e20..a64cc71b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -39,6 +39,7 @@ * Added external files and virtual paths for C# projects (James Whitworth) * Added ReleaseRuntime build flag (Tarmo Pikaro) * Added Component, Form, and UserControl build actions +* Added usingdirs() to specify C++/CLI additional using directories (João Matos / triton) ------- diff --git a/src/_premake_init.lua b/src/_premake_init.lua index bc04c23c..340c0b17 100644 --- a/src/_premake_init.lua +++ b/src/_premake_init.lua @@ -609,6 +609,13 @@ }, } + api.register { + name = "usingdirs", + scope = "config", + kind = "directory-list", + tokens = true, + } + api.register { name = "uuid", scope = "project", diff --git a/src/actions/vstudio/vs2010_vcxproj.lua b/src/actions/vstudio/vs2010_vcxproj.lua index b0075ec9..ee05f6bc 100644 --- a/src/actions/vstudio/vs2010_vcxproj.lua +++ b/src/actions/vstudio/vs2010_vcxproj.lua @@ -286,6 +286,7 @@ "basicRuntimeChecks", "clCompilePreprocessorDefinitions", "clCompileAdditionalIncludeDirectories", + "clCompileAdditionalUsingDirectories", "forceIncludes", "debugInformationFormat", "programDataBaseFileName", @@ -657,6 +658,14 @@ end end + function vc2010.additionalUsingDirectories(cfg) + if #cfg.usingdirs > 0 then + local dirs = project.getrelative(cfg.project, cfg.usingdirs) + dirs = path.translate(table.concat(dirs, ";")) + _x(3,'%s;%%(AdditionalUsingDirectories)', dirs) + end + end + function vc2010.additionalCompileOptions(cfg, condition) if #cfg.buildoptions > 0 then @@ -697,6 +706,10 @@ vc2010.additionalIncludeDirectories(cfg, cfg.includedirs) end + function vc2010.clCompileAdditionalUsingDirectories(cfg) + vc2010.additionalUsingDirectories(cfg, cfg.usingdirs) + end + function vc2010.clCompilePreprocessorDefinitions(cfg) vc2010.preprocessorDefinitions(cfg, cfg.defines, false) diff --git a/tests/actions/vstudio/vc2010/test_compile_settings.lua b/tests/actions/vstudio/vc2010/test_compile_settings.lua index 75cb83c0..dfc55f76 100644 --- a/tests/actions/vstudio/vc2010/test_compile_settings.lua +++ b/tests/actions/vstudio/vc2010/test_compile_settings.lua @@ -268,6 +268,22 @@ ]] end + +-- +-- If include directories are specified, the should be added. +-- + + function suite.additionalUsingDirs_onUsingDirs() + usingdirs { "include/lua", "include/zlib" } + prepare() + test.capture [[ + + NotUsing + Level3 + include\lua;include\zlib;%(AdditionalUsingDirectories) + ]] + end + -- -- Turn off minimal rebuilds if the NoMinimalRebuild flag is set. --