Ticket #3729: 3729.diff
File 3729.diff, 49.7 KB (added by , 8 years ago) |
---|
-
build/premake/cxxtest/cxxtest.lua
1 local m = {} 2 m._VERSION = "0.0.0-dev" 3 4 m.path = nil 5 6 function m.configure_project(rootfile, hdrfiles, rootoptions, testoptions) 7 if rootoptions == nil then 8 rootoptions = '' 9 end 10 if testoptions == nil then 11 testoptions = '' 12 end 13 local cmds = {} 14 local abspath = path.getabsolute(m.path) 15 16 for _,hdrfile in ipairs(hdrfiles) do 17 hdrfile = path.getabsolute(hdrfile) 18 local srcfile = string.sub(hdrfile, 1, -3) .. ".cpp" 19 files { hdrfile, srcfile } 20 table.insert(cmds, abspath .. " --part " .. testoptions .. " -o " .. srcfile .. " " .. hdrfile) 21 end 22 rootfile = path.getabsolute(rootfile) 23 files { rootfile } 24 table.insert(cmds, abspath .. " --root " .. rootoptions .. " -o " .. rootfile) 25 prebuildcommands {cmds} 26 end 27 28 cxxtest = m 29 return m -
build/premake/extern_libs.lua
77 77 result_libs = string.gsub(result_libs, ",", " ") 78 78 result_libs = string.gsub(result_libs, "\n", "") 79 79 linkoptions { result_libs } 80 elseif _ACTION == "gmake" then 80 elseif _ACTION == "gmake" then 81 81 gnuexternals { "`"..cmd_libs.."`" } 82 82 else 83 83 linkoptions { "`"..cmd_libs.."`" } … … 109 109 local dbg_cmd = "/DELAYLOAD:" .. name .. suffix .. ".dll" 110 110 local cmd = "/DELAYLOAD:" .. name .. ".dll" 111 111 112 configuration"Debug"112 filter "Debug" 113 113 linkoptions { dbg_cmd } 114 configuration"Release"114 filter "Release" 115 115 linkoptions { cmd } 116 configuration{ }116 filter { } 117 117 end 118 118 119 119 end … … 158 158 end 159 159 else 160 160 for i,name in pairs(names) do 161 configuration"Debug"161 filter "Debug" 162 162 links { name .. suffix } 163 configuration"Release"163 filter "Release" 164 164 links { name } 165 configuration{ }165 filter { } 166 166 167 167 add_delayload(name, suffix, def) 168 168 end … … 290 290 link_settings = function() 291 291 add_source_lib_paths("fcollada") 292 292 if os.is("windows") then 293 configuration"Debug"293 filter "Debug" 294 294 links { "FColladaD" } 295 configuration"Release"295 filter "Release" 296 296 links { "FCollada" } 297 configuration{ }297 filter { } 298 298 else 299 configuration"Debug"299 filter "Debug" 300 300 links { "FColladaSD" } 301 configuration"Release"301 filter "Release" 302 302 links { "FColladaSR" } 303 configuration{ }303 filter { } 304 304 end 305 305 end, 306 306 }, … … 483 483 link_settings = function() 484 484 if os.is("windows") then 485 485 add_default_lib_paths("libxml2") 486 configuration"Debug"486 filter "Debug" 487 487 links { "libxml2" } 488 configuration"Release"488 filter "Release" 489 489 links { "libxml2" } 490 configuration{ }490 filter { } 491 491 elseif os.is("macosx") then 492 492 xml2_config_path = os.getenv("XML2_CONFIG") 493 493 if not xml2_config_path then … … 618 618 else 619 619 include_dir = "include-unix" 620 620 end 621 configuration"Debug"621 filter "Debug" 622 622 includedirs { libraries_source_dir.."spidermonkey/"..include_dir.."-debug" } 623 623 defines { "DEBUG" } 624 configuration"Release"624 filter "Release" 625 625 includedirs { libraries_source_dir.."spidermonkey/"..include_dir.."-release" } 626 configuration{ }626 filter { } 627 627 end 628 628 end, 629 629 link_settings = function() … … 639 639 add_default_lib_paths("nspr") 640 640 links { "nspr4", "plc4", "plds4" } 641 641 end 642 configuration"Debug"642 filter "Debug" 643 643 links { "mozjs31-ps-debug" } 644 configuration"Release"644 filter "Release" 645 645 links { "mozjs31-ps-release" } 646 configuration{ }646 filter { } 647 647 add_source_lib_paths("spidermonkey") 648 648 end 649 649 end, -
build/premake/premake5.lua
33 33 -- Root directory of project checkout relative to this .lua file 34 34 rootdir = "../.." 35 35 36 dofile("extern_libs 4.lua")36 dofile("extern_libs5.lua") 37 37 38 38 -- detect compiler for non-Windows 39 39 if os.is("macosx") then … … 93 93 end 94 94 end 95 95 96 -- Set up the Solution97 solution"pyrogenesis"96 -- Set up the Workspace 97 workspace "pyrogenesis" 98 98 targetdir(rootdir.."/binaries/system") 99 99 libdirs(rootdir.."/binaries/system") 100 100 if not _OPTIONS["outpath"] then … … 105 105 106 106 -- Get some environement specific information used later. 107 107 if os.is("windows") then 108 nasmpath(rootdir.."/build/bin/nasm.exe")109 108 lcxxtestpath = rootdir.."/build/bin/cxxtestgen.exe" 110 109 else 111 110 … … 142 141 143 142 local obj_dir_prefix = _OPTIONS["outpath"].."/obj/"..project_name.."_" 144 143 145 configuration"Debug"144 filter "Debug" 146 145 objdir(obj_dir_prefix.."Debug") 147 146 targetsuffix("_dbg") 148 147 149 configuration"Release"148 filter "Release" 150 149 objdir(obj_dir_prefix.."Release") 151 150 152 configuration{ }151 filter { } 153 152 154 153 end 155 154 … … 156 155 157 156 function project_set_build_flags() 158 157 159 flags { "NoEditAndContinue" }158 editandcontinue "Off" 160 159 161 160 if not _OPTIONS["minimal-flags"] then 162 161 flags { "Symbols" } … … 164 163 165 164 if cc ~= "icc" and (os.is("windows") or not _OPTIONS["minimal-flags"]) then 166 165 -- adds the -Wall compiler flag 167 flags { "ExtraWarnings" }-- this causes far too many warnings/remarks on ICC166 warnings "Extra" -- this causes far too many warnings/remarks on ICC 168 167 end 169 168 170 169 -- disable Windows debug heap, since it makes malloc/free hugely slower when 171 170 -- running inside a debugger 172 if os.is("windows") then173 flags { "NoDebugHeap" }174 end171 -- if os.is("windows") then 172 -- flags { "NoDebugHeap" } 173 -- end 175 174 176 configuration"Debug"175 filter "Debug" 177 176 defines { "DEBUG" } 178 177 179 configuration"Release"178 filter "Release" 180 179 if os.is("windows") or not _OPTIONS["minimal-flags"] then 181 flags { "OptimizeSpeed" }180 optimize "Speed" 182 181 end 183 182 defines { "NDEBUG", "CONFIG_FINAL=1" } 184 183 185 configuration{ }184 filter { } 186 185 187 186 if _OPTIONS["gles"] then 188 187 defines { "CONFIG2_GLES=1" } … … 212 211 if os.is("windows") then 213 212 214 213 -- use native wchar_t type (not typedef to unsigned short) 215 flags { "NativeWChar" }214 nativewchar "on" 216 215 217 216 else -- *nix 218 217 219 -- TODO, FIXME: This check is incorrect because it means that some additional flags will be added inside the "else" branch if the 218 -- TODO, FIXME: This check is incorrect because it means that some additional flags will be added inside the "else" branch if the 220 219 -- compiler is ICC and minimal-flags is specified (ticket: #2994) 221 220 if cc == "icc" and not _OPTIONS["minimal-flags"] then 222 221 buildoptions { … … 231 230 "-Wunused-function", 232 231 "-wd1292" -- avoid lots of 'attribute "__nonnull__" ignored' 233 232 } 234 configuration"Debug"233 filter "Debug" 235 234 buildoptions { "-O0" } -- ICC defaults to -O2 236 configuration{ }235 filter { } 237 236 if os.is("macosx") then 238 237 linkoptions { "-multiply_defined","suppress" } 239 238 end … … 296 295 } 297 296 end 298 297 end 299 298 300 299 buildoptions { 301 300 -- Enable C++11 standard. 302 301 "-std=c++0x" … … 379 378 380 379 -- Adding the executable path and taking care of correct escaping 381 380 if _ACTION == "gmake" then 382 linkoptions { "-Wl,-rpath,'$$ORIGIN'" } 381 linkoptions { "-Wl,-rpath,'$$ORIGIN'" } 383 382 elseif _ACTION == "codeblocks" then 384 383 linkoptions { "-Wl,-R\\\\$$$ORIGIN" } 385 384 end … … 474 473 -- * precompiled.cpp (needed to "Create" the PCH) also goes in 475 474 -- the abovementioned dir. 476 475 if (not _OPTIONS["without-pch"] and not extra_params["no_pch"]) then 477 pchheader( pch_dir.."precompiled.h")476 pchheader("precompiled.h") -- this has to match the #include line for VS 478 477 pchsource(pch_dir.."precompiled.cpp") 479 478 defines { "USING_PCH" } 480 479 files { pch_dir.."precompiled.h", pch_dir.."precompiled.cpp" } … … 545 544 end 546 545 547 546 if os.is("windows") then 548 flags { "NoRTTI" }547 rtti "off" 549 548 end 550 549 end 551 550 … … 568 567 end 569 568 570 569 if os.is("windows") then 571 flags { "NoRTTI" }570 rtti "off" 572 571 links { "delayimp" } 573 572 end 574 573 end … … 607 606 "boost", 608 607 } 609 608 setup_third_party_static_lib_project("tinygettext", source_dirs, extern_libs, { } ) 610 609 611 610 -- it's an external library and we don't want to modify its source to fix warnings, so we just disable them to avoid noise in the compile output 612 611 if _ACTION == "vs2013" then 613 buildoptions { 612 buildoptions { 614 613 "/wd4127", 615 614 "/wd4309", 616 615 "/wd4800", … … 730 729 "icu", 731 730 "iconv", 732 731 } 733 732 734 733 if not _OPTIONS["without-audio"] then 735 734 table.insert(extern_libs, "openal") 736 735 table.insert(extern_libs, "vorbis") 737 736 end 738 737 739 738 setup_static_lib_project("engine", source_dirs, extern_libs, {}) 740 739 741 740 … … 844 843 for i,v in pairs(sysdep_dirs[os.get()]) do 845 844 table.insert(source_dirs, v); 846 845 end 847 846 848 847 if os.is("linux") then 849 848 if _OPTIONS["android"] then 850 849 table.insert(source_dirs, "lib/sysdep/os/android") … … 963 962 -- from "lowlevel" static lib; must be added here to be linked in 964 963 files { source_root.."lib/sysdep/os/win/error_dialog.rc" } 965 964 966 flags { "NoRTTI" }965 rtti "off" 967 966 968 967 linkoptions { 969 968 -- wraps main thread in a __try block(see wseh.cpp). replace with mainCRTStartup if that's undesired. … … 1011 1010 end 1012 1011 1013 1012 -- For debug_resolve_symbol 1014 configuration"Debug"1013 filter "Debug" 1015 1014 linkoptions { "-rdynamic" } 1016 configuration{ }1015 filter { } 1017 1016 1018 1017 elseif os.is("macosx") then 1019 1018 … … 1065 1064 if target_type == "SharedLib" then 1066 1065 if _OPTIONS["macosx-bundle"] then 1067 1066 -- If we're building a bundle, it will be in ../Frameworks 1068 configuration"Debug"1067 filter "Debug" 1069 1068 linkoptions { "-install_name @executable_path/../Frameworks/lib"..project_name.."_dbg.dylib" } 1070 configuration"Release"1069 filter "Release" 1071 1070 linkoptions { "-install_name @executable_path/../Frameworks/lib"..project_name..".dylib" } 1072 configuration{ }1071 filter { } 1073 1072 else 1074 configuration"Debug"1073 filter "Debug" 1075 1074 linkoptions { "-install_name @executable_path/lib"..project_name.."_dbg.dylib" } 1076 configuration"Release"1075 filter "Release" 1077 1076 linkoptions { "-install_name @executable_path/lib"..project_name..".dylib" } 1078 configuration{ }1077 filter { } 1079 1078 end 1080 1079 end 1081 1080 end … … 1090 1089 { -- src 1091 1090 ".", 1092 1091 "../../../third_party/jsonspirit" 1093 1092 1094 1093 },{ -- include 1095 1094 "../../../third_party/jsonspirit" 1096 1095 },{ -- extern_libs … … 1187 1186 1188 1187 -- required to use WinMain() on Windows, otherwise will default to main() 1189 1188 flags { "WinMain" } 1190 1189 1191 1190 -- see manifest.cpp 1192 1191 project_add_manifest() 1193 1192 … … 1303 1302 -- If no customizations are implemented for a specific action (e.g. vs2013), passing the 1304 1303 -- parameters won't have any effects. 1305 1304 function configure_cxxtestgen() 1306 1307 1305 local lcxxtestrootfile = source_root.."test_root.cpp" 1308 files { lcxxtestrootfile }1309 1306 1310 1307 -- Define the options used for cxxtestgen 1311 1308 local lcxxtestoptions = "--have-std" … … 1326 1323 lcxxtestrootoptions = lcxxtestrootoptions .. include 1327 1324 lcxxtestoptions = lcxxtestoptions .. include 1328 1325 1329 -- Set all the parameters used in our cxxtestgen customization in premake.1330 cxxtestrootfile(lcxxtestrootfile)1331 cxxtestpath(lcxxtestpath)1332 cxxtestrootoptions(lcxxtestrootoptions)1333 cxxtestoptions(lcxxtestoptions)1334 1335 -- The file paths needs to be made relative to the project directory for the prebuildcommands.1336 -- premake's paths are relative to premake4.lua by default.1337 lcxxtestrootfile = path.rebase(lcxxtestrootfile, path.getabsolute("."), _OPTIONS["outpath"])1338 lcxxtestpath = path.rebase(lcxxtestpath, path.getabsolute("."), _OPTIONS["outpath"])1339 1340 -- On windows we have to use backlashes in our paths. We don't have to take care1341 -- of that for the parameters passed to our cxxtestgen customizations.1342 if os.is("windows") then1343 lcxxtestrootfile = path.translate(lcxxtestrootfile, "\\")1344 lcxxtestpath = path.translate(lcxxtestpath, "\\")1345 end1346 1347 if _ACTION ~= "gmake" and _ACTION ~= "vs2013" then1348 prebuildcommands { lcxxtestpath.." --root "..lcxxtestrootoptions.." -o "..lcxxtestrootfile }1349 end1350 1351 1326 -- Find header files in 'test' subdirectories 1352 1327 local all_files = os.matchfiles(source_root .. "**/tests/*.h") 1328 local test_files = {} 1353 1329 for i,v in pairs(all_files) do 1354 1330 -- Don't include sysdep tests on the wrong sys 1355 1331 -- Don't include Atlas tests unless Atlas is being built … … 1357 1333 not (string.find(v, "/tools/atlas/") and not _OPTIONS["atlas"]) and 1358 1334 not (string.find(v, "/sysdep/arch/x86_x64/") and ((arch ~= "amd64") or (arch ~= "x86"))) 1359 1335 then 1360 local src_file = string.sub(v, 1, -3) .. ".cpp" 1361 cxxtestsrcfiles { src_file } 1362 files { src_file } 1363 cxxtesthdrfiles { v } 1364 1365 if _ACTION ~= "gmake" and _ACTION ~= "vs2013" then 1366 -- see detailed comment above. 1367 src_file = path.rebase(src_file, path.getabsolute("."), _OPTIONS["outpath"]) 1368 v = path.rebase(v, path.getabsolute("."), _OPTIONS["outpath"]) 1369 1370 if os.is("windows") then 1371 src_file = path.translate(src_file, "\\") 1372 v = path.translate(v, "\\") 1373 end 1374 prebuildcommands { lcxxtestpath.." --part "..lcxxtestoptions.." -o "..src_file.." "..v } 1375 end 1336 table.insert(test_files, v) 1376 1337 end 1338 end 1377 1339 1378 1379 end 1340 require "cxxtest" 1341 cxxtest.path = lcxxtestpath 1342 cxxtest.configure_project(lcxxtestrootfile, test_files, lcxxtestrootoptions, lcxxtestoptions) 1380 1343 end 1381 1344 1382 1345 … … 1388 1351 configure_cxxtestgen() 1389 1352 1390 1353 links { static_lib_names } 1391 configuration"Debug"1354 filter "Debug" 1392 1355 links { static_lib_names_debug } 1393 configuration"Release"1356 filter "Release" 1394 1357 links { static_lib_names_release } 1395 configuration{ }1358 filter { } 1396 1359 1397 1360 links { "mocks_test" } 1398 1361 if _OPTIONS["atlas"] then … … 1414 1377 -- from "lowlevel" static lib; must be added here to be linked in 1415 1378 files { source_root.."lib/sysdep/os/win/error_dialog.rc" } 1416 1379 1417 flags { "NoRTTI" }1380 rtti "off" 1418 1381 1419 1382 -- see wstartup.h 1420 1383 linkoptions { "/INCLUDE:_wstartup_InitAndRegisterShutdown" } … … 1453 1416 end 1454 1417 1455 1418 -- For debug_resolve_symbol 1456 configuration"Debug"1419 filter "Debug" 1457 1420 linkoptions { "-rdynamic" } 1458 configuration{ }1421 filter { } 1459 1422 1460 1423 includedirs { source_root .. "pch/test/" } 1461 1424 end … … 1474 1437 -- work when changing the static lib breakdown. 1475 1438 project("pyrogenesis") -- Set the main project active 1476 1439 links { static_lib_names } 1477 configuration"Debug"1440 filter "Debug" 1478 1441 links { static_lib_names_debug } 1479 configuration"Release"1442 filter "Release" 1480 1443 links { static_lib_names_release } 1481 configuration{ }1444 filter { } 1482 1445 1483 1446 if _OPTIONS["atlas"] then 1484 1447 setup_atlas_projects() -
build/workspaces/update-workspaces.bat
3 3 4 4 cd ..\premake 5 5 rem ** Support for Visual Studio versions <2013 has been dropped (check #2669). 6 if not exist ..\workspaces\vc2013\SKIP_PREMAKE_HERE premake 4\bin\release\premake4 --outpath="../workspaces/vc2013" --collada --use-shared-glooxwrapper %* vs20136 if not exist ..\workspaces\vc2013\SKIP_PREMAKE_HERE premake5 --outpath="../workspaces/vs2013" --collada --use-shared-glooxwrapper %* vs2013 7 7 cd ..\workspaces -
build/workspaces/update-workspaces.sh
93 93 echo 94 94 fi 95 95 96 # Now build premake and run it to create the makefiles 97 cd ../premake/premake4 98 PREMAKE_BUILD_DIR=build/gmake.unix 99 # BSD and OS X need different Makefiles 100 case "`uname -s`" in 101 "GNU/kFreeBSD" ) 102 # use default gmake.unix (needs -ldl as we have a GNU userland and libc) 103 ;; 104 *"BSD" ) 105 PREMAKE_BUILD_DIR=build/gmake.bsd 106 ;; 107 "Darwin" ) 108 PREMAKE_BUILD_DIR=build/gmake.macosx 109 ;; 110 esac 111 ${MAKE} -C $PREMAKE_BUILD_DIR ${JOBS} || die "Premake build failed" 96 cd ../premake 112 97 113 echo114 115 cd ..116 117 98 # If we're in bash then make HOSTTYPE available to Premake, for primitive arch-detection 118 99 export HOSTTYPE="$HOSTTYPE" 119 100 120 101 echo "Premake args: ${premake_args}" 121 102 122 premake 4/bin/release/premake4 --file="premake4.lua"--outpath="../workspaces/gcc/" ${premake_args} gmake || die "Premake failed"123 premake 4/bin/release/premake4 --file="premake4.lua"--outpath="../workspaces/codeblocks/" ${premake_args} codeblocks || die "Premake failed"103 premake5 --outpath="../workspaces/gcc/" ${premake_args} gmake || die "Premake failed" 104 premake5 --outpath="../workspaces/codeblocks/" ${premake_args} codeblocks || die "Premake failed" 124 105 125 106 # Also generate xcode workspaces if on OS X 126 107 if [ "`uname -s`" = "Darwin" ]; then 127 premake 4/bin/release/premake4 --file="premake4.lua"--outpath="../workspaces/xcode3" ${premake_args} xcode3 || die "Premake failed"128 premake 4/bin/release/premake4 --file="premake4.lua"--outpath="../workspaces/xcode4" ${premake_args} xcode4 || die "Premake failed"108 premake5 --outpath="../workspaces/xcode3" ${premake_args} xcode3 || die "Premake failed" 109 premake5 --outpath="../workspaces/xcode4" ${premake_args} xcode4 || die "Premake failed" 129 110 fi 130 111 131 112 # test_root.cpp gets generated by cxxtestgen and passing different arguments to premake could require a regeneration of this file.