⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dll_path.py

📁 Boost provides free peer-reviewed portable C++ source libraries. We emphasize libraries that work
💻 PY
字号:
#!/usr/bin/python# Copyright (C) Vladimir Prus 2003. Permission to copy, use, modify, sell and# distribute this software is granted provided this copyright notice appears in# all copies. This software is provided "as is" without express or implied# warranty, and with no claim as to its suitability for any purpose.# Test that the <dll-path> property is correctly set when using# <hardcode-dll-paths>true.import BoostBuildt = BoostBuild.Tester()# The point of this test is to have exe "main" which uses library "b", which# uses library "a". When "main" is built with <hardcode-dll-paths>true, paths to# both libraries should be present as values of <dll-path> feature. We create a# special target type which reports <dll-path> values on its sources and compare# the list of found values with out expectations.t.write("jamfile.jam", """exe main : main.cpp b//b ;explicit main ;path-list mp : main ;""")t.write("main.cpp", """int main() {}""")t.write("jamroot.jam", """using dll-paths ;""")t.write("dll-paths.jam", """import type ;import generators ;import feature ;import sequence ;import print ;import "class" : new ;rule init ( ){    type.register PATH_LIST : pathlist ;    class dll-paths-list-generator : generator    {        rule __init__ ( )        {            generator.__init__ dll-paths.list : EXE : PATH_LIST ;        }        rule generated-targets ( sources + : property-set : project name ? )        {            local dll-paths ;            for local s in $(sources)            {                local a = [ $(s).action ] ;                if $(a)                {                    local p = [ $(a).properties ] ;                    dll-paths += [ $(p).get <dll-path> ] ;                }            }            return [ generator.generated-targets $(sources) :                [ $(property-set).add-raw $(dll-paths:G=<dll-path>) ] :                $(project) $(name) ] ;        }    }    generators.register [ new dll-paths-list-generator ] ;}rule list ( target : sources * : properties * ){    local paths = [ feature.get-values <dll-path> : $(properties) ] ;    paths = [ sequence.insertion-sort $(paths) ] ;    print.output $(target) ;    print.text $(paths) ;}""")t.write("a/a.cpp", """void#if defined(_WIN32)__declspec(dllexport)#endiffoo() {}""")t.write("a/jamfile.jam", """lib a : a.cpp ;""")t.write("b/b.cpp", """void#if defined(_WIN32)__declspec(dllexport)#endifbar() {}""")t.write("b/jamfile.jam", """lib b : b.cpp ../a//a ;""")t.run_build_system("hardcode-dll-paths=true")t.expect_addition("bin/$toolset/debug/mp.pathlist")es1 = t.adjust_names(["a/bin/$toolset/debug"])[0]es2 = t.adjust_names(["b/bin/$toolset/debug"])[0]t.expect_content_line("bin/$toolset/debug/mp.pathlist", "*" + es1);t.expect_content_line("bin/$toolset/debug/mp.pathlist", "*" + es2);t.cleanup()

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -