diff --git a/Jamfile.jam b/Jamfile.jam index 420a3e0f4460fb8ceffd4d2fa2af7101caf0a042..48dd03abebccc2167ca2faaff4f8bf51783f9949 100644 --- a/Jamfile.jam +++ b/Jamfile.jam @@ -1,17 +1,40 @@ # Latest jamplus is needed to use this + # Targets: # pugixml - build pugixml library # tests - build pugixml test suite # run_tests - run pugixml test suite # coverage - get test suite coverage -include "Jamrules.jam" ; +# Options: +# toolset=name - select toolset +# supported toolsets: mingw*, msvc* + +# default toolset/configuration +if ( ! $(toolset) ) +{ + exit You should specify a toolset ; +} + +if ( ! $(configuration) ) +{ + configuration = "debug" ; +} -BUILD = build/mingw/debug ; -CCFLAGS = -fprofile-arcs -ftest-coverage ; -LDFLAGS = -fprofile-arcs ; -GCOVFLAGS = -n ; +# options +BUILD = build/$(toolset)/$(configuration) ; + +if ( $(toolset) = "mingw" ) +{ + CCFLAGS = -fprofile-arcs -ftest-coverage ; + LDFLAGS = -fprofile-arcs ; + GCOVFLAGS = -n ; +} + +# rules +include "Jamrules.jam" ; +# targets Library pugixml : src/pugixml.cpp src/pugixpath.cpp ; Application tests : tests/main.cpp [ Glob tests : test_*.cpp ] : pugixml ; Test run_tests : tests ; diff --git a/Jamrules.jam b/Jamrules.jam index 4fda7f40cdfce5c05ce1d7c8a5b49063fb8606e9..55138f20d3718f3a98080bd0bf2e1df2d00394ca 100644 --- a/Jamrules.jam +++ b/Jamrules.jam @@ -1,23 +1,74 @@ # Rules for Jamfile.jam -actions ObjectAction +if ( $(toolset:I=^mingw) ) { - %MINGW_PATH%\bin\gcc -W -Wall -Wextra -Werror -pedantic -c $(>) -o $(<) $(CCFLAGS) -} + if ( $(configuration) = "debug" ) + { + CCFLAGS += -D_DEBUG ; + } + else + { + CCFLAGS += -DNDEBUG -O3 ; + } -actions LibraryAction -{ - %MINGW_PATH%\bin\ar rc $(<) $(>) + actions ObjectAction + { + %$(toolset)_PATH%\bin\gcc -W -Wall -Wextra -Werror -pedantic -c $(>) -o $(<) $(CCFLAGS) + } + + actions LibraryAction + { + %$(toolset)_PATH%\bin\ar rc $(<) $(>) + } + + actions LinkAction + { + %$(toolset)_PATH%\bin\g++ $(>) -o $(<) $(LDFLAGS) + } + + actions CoverageAction + { + %$(toolset)_PATH%\bin\gcov $(>:\\) $(GCOVFLAGS) | perl tests/gcov-filter.pl + } } - -actions LinkAction +else if ( $(toolset:I^=msvc) ) { - %MINGW_PATH%\bin\g++ $(>) -o $(<) $(LDFLAGS) -} + if ( $(configuration) = "debug" ) + { + CCFLAGS += /D_DEBUG /MTd ; + } + else + { + CCFLAGS += /DNDEBUG /Ox /MT ; + } -actions CoverageAction -{ - %MINGW_PATH%\bin\gcov $(>:\\) $(GCOVFLAGS) | perl tests/gcov-filter.pl + if ( $(toolset) != msvc6 ) + { + CCFLAGS += /Wp64 /W4 ; + } + else + { + CCFLAGS += /W3 ; # lots of warnings at W4 in standard library + } + + actions ObjectAction + { + %$(toolset)_PATH%\bin\cl.exe /EHsc /WX /I%$(toolset)_PATH%\include /c $(>) /Fo$(<) /nologo $(CCFLAGS) + } + + actions LibraryAction + { + %$(toolset)_PATH%\bin\lib.exe /NOLOGO /OUT:$(<) $(>) + } + + actions LinkAction + { + %$(toolset)_PATH%\bin\link.exe /SUBSYSTEM:CONSOLE /NOLOGO /OUT:$(<) $(>) /LIBPATH:%$(toolset)_PATH%\lib /LIBPATH:%$(toolset)_PATH%\PlatformSDK\lib $(LDFLAGS) + } + + actions CoverageAction + { + } } actions RunAction