Ticket #3729: 3729.diff

File 3729.diff, 49.7 KB (added by Zsolt Dollenstein, 8 years ago)
  • build/premake/cxxtest/cxxtest.lua

     
     1local m = {}
     2m._VERSION = "0.0.0-dev"
     3
     4m.path = nil
     5
     6function 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}
     26end
     27
     28cxxtest = m
     29return m
  • build/premake/extern_libs.lua

     
    7777        result_libs = string.gsub(result_libs, ",", " ")
    7878        result_libs = string.gsub(result_libs, "\n", "")
    7979        linkoptions { result_libs }
    80     elseif _ACTION == "gmake" then 
     80    elseif _ACTION == "gmake" then
    8181        gnuexternals { "`"..cmd_libs.."`" }
    8282    else
    8383        linkoptions { "`"..cmd_libs.."`" }
     
    109109        local dbg_cmd = "/DELAYLOAD:" .. name .. suffix .. ".dll"
    110110        local cmd     = "/DELAYLOAD:" .. name .. ".dll"
    111111
    112         configuration "Debug"
     112        filter "Debug"
    113113            linkoptions { dbg_cmd }
    114         configuration "Release"
     114        filter "Release"
    115115            linkoptions { cmd }
    116         configuration { }
     116        filter { }
    117117    end
    118118
    119119end
     
    158158        end
    159159    else
    160160        for i,name in pairs(names) do
    161             configuration "Debug"
     161            filter "Debug"
    162162                links { name .. suffix }
    163             configuration "Release"
     163            filter "Release"
    164164                links { name }
    165             configuration { }
     165            filter { }
    166166
    167167            add_delayload(name, suffix, def)
    168168        end
     
    290290        link_settings = function()
    291291            add_source_lib_paths("fcollada")
    292292            if os.is("windows") then
    293                 configuration "Debug"
     293                filter "Debug"
    294294                    links { "FColladaD" }
    295                 configuration "Release"
     295                filter "Release"
    296296                    links { "FCollada" }
    297                 configuration { }
     297                filter { }
    298298            else
    299                 configuration "Debug"
     299                filter "Debug"
    300300                    links { "FColladaSD" }
    301                 configuration "Release"
     301                filter "Release"
    302302                    links { "FColladaSR" }
    303                 configuration { }
     303                filter { }
    304304            end
    305305        end,
    306306    },
     
    483483        link_settings = function()
    484484            if os.is("windows") then
    485485                add_default_lib_paths("libxml2")
    486                 configuration "Debug"
     486                filter "Debug"
    487487                    links { "libxml2" }
    488                 configuration "Release"
     488                filter "Release"
    489489                    links { "libxml2" }
    490                 configuration { }
     490                filter { }
    491491            elseif os.is("macosx") then
    492492                xml2_config_path = os.getenv("XML2_CONFIG")
    493493                if not xml2_config_path then
     
    618618                else
    619619                    include_dir = "include-unix"
    620620                end
    621                 configuration "Debug"
     621                filter "Debug"
    622622                    includedirs { libraries_source_dir.."spidermonkey/"..include_dir.."-debug" }
    623623                    defines { "DEBUG" }
    624                 configuration "Release"
     624                filter "Release"
    625625                    includedirs { libraries_source_dir.."spidermonkey/"..include_dir.."-release" }
    626                 configuration { }
     626                filter { }
    627627            end
    628628        end,
    629629        link_settings = function()
     
    639639                    add_default_lib_paths("nspr")
    640640                    links { "nspr4", "plc4", "plds4" }
    641641                end
    642                 configuration "Debug"
     642                filter "Debug"
    643643                    links { "mozjs31-ps-debug" }
    644                 configuration "Release"
     644                filter "Release"
    645645                    links { "mozjs31-ps-release" }
    646                 configuration { }
     646                filter { }
    647647                add_source_lib_paths("spidermonkey")
    648648            end
    649649        end,
  • build/premake/premake5.lua

     
    3333-- Root directory of project checkout relative to this .lua file
    3434rootdir = "../.."
    3535
    36 dofile("extern_libs4.lua")
     36dofile("extern_libs5.lua")
    3737
    3838-- detect compiler for non-Windows
    3939if os.is("macosx") then
     
    9393    end
    9494end
    9595
    96 -- Set up the Solution
    97 solution "pyrogenesis"
     96-- Set up the Workspace
     97workspace "pyrogenesis"
    9898targetdir(rootdir.."/binaries/system")
    9999libdirs(rootdir.."/binaries/system")
    100100if not _OPTIONS["outpath"] then
     
    105105
    106106-- Get some environement specific information used later.
    107107if os.is("windows") then
    108     nasmpath(rootdir.."/build/bin/nasm.exe")
    109108    lcxxtestpath = rootdir.."/build/bin/cxxtestgen.exe"
    110109else
    111110
     
    142141
    143142    local obj_dir_prefix = _OPTIONS["outpath"].."/obj/"..project_name.."_"
    144143
    145     configuration "Debug"
     144    filter "Debug"
    146145        objdir(obj_dir_prefix.."Debug")
    147146        targetsuffix("_dbg")
    148147
    149     configuration "Release"
     148    filter "Release"
    150149        objdir(obj_dir_prefix.."Release")
    151150
    152     configuration { }
     151    filter { }
    153152
    154153end
    155154
     
    156155
    157156function project_set_build_flags()
    158157
    159     flags { "NoEditAndContinue" }
     158    editandcontinue "Off"
    160159
    161160    if not _OPTIONS["minimal-flags"] then
    162161        flags { "Symbols" }
     
    164163
    165164    if cc ~= "icc" and (os.is("windows") or not _OPTIONS["minimal-flags"]) then
    166165        -- adds the -Wall compiler flag
    167         flags { "ExtraWarnings" } -- this causes far too many warnings/remarks on ICC
     166        warnings "Extra" -- this causes far too many warnings/remarks on ICC
    168167    end
    169168
    170169    -- disable Windows debug heap, since it makes malloc/free hugely slower when
    171170    -- running inside a debugger
    172     if os.is("windows") then
    173         flags { "NoDebugHeap" }
    174     end
     171    -- if os.is("windows") then
     172    -- flags { "NoDebugHeap" }
     173    -- end
    175174
    176     configuration "Debug"
     175    filter "Debug"
    177176        defines { "DEBUG" }
    178177
    179     configuration "Release"
     178    filter "Release"
    180179        if os.is("windows") or not _OPTIONS["minimal-flags"] then
    181             flags { "OptimizeSpeed" }
     180            optimize "Speed"
    182181        end
    183182        defines { "NDEBUG", "CONFIG_FINAL=1" }
    184183
    185     configuration { }
     184    filter { }
    186185
    187186    if _OPTIONS["gles"] then
    188187        defines { "CONFIG2_GLES=1" }
     
    212211    if os.is("windows") then
    213212
    214213        -- use native wchar_t type (not typedef to unsigned short)
    215         flags { "NativeWChar" }
     214        nativewchar "on"
    216215
    217216    else    -- *nix
    218217
    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
    220219        -- compiler is ICC and minimal-flags is specified (ticket: #2994)
    221220        if cc == "icc" and not _OPTIONS["minimal-flags"] then
    222221            buildoptions {
     
    231230                "-Wunused-function",
    232231                "-wd1292" -- avoid lots of 'attribute "__nonnull__" ignored'
    233232            }
    234             configuration "Debug"
     233            filter "Debug"
    235234                buildoptions { "-O0" } -- ICC defaults to -O2
    236             configuration { }
     235            filter { }
    237236            if os.is("macosx") then
    238237                linkoptions { "-multiply_defined","suppress" }
    239238            end
     
    296295                    }
    297296                end
    298297            end
    299            
     298
    300299            buildoptions {
    301300                -- Enable C++11 standard.
    302301                "-std=c++0x"
     
    379378
    380379                -- Adding the executable path and taking care of correct escaping
    381380                if _ACTION == "gmake" then
    382                     linkoptions { "-Wl,-rpath,'$$ORIGIN'" } 
     381                    linkoptions { "-Wl,-rpath,'$$ORIGIN'" }
    383382                elseif _ACTION == "codeblocks" then
    384383                    linkoptions { "-Wl,-R\\\\$$$ORIGIN" }
    385384                end
     
    474473    -- * precompiled.cpp (needed to "Create" the PCH) also goes in
    475474    --   the abovementioned dir.
    476475    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
    478477        pchsource(pch_dir.."precompiled.cpp")
    479478        defines { "USING_PCH" }
    480479        files { pch_dir.."precompiled.h", pch_dir.."precompiled.cpp" }
     
    545544    end
    546545
    547546    if os.is("windows") then
    548         flags { "NoRTTI" }
     547        rtti "off"
    549548    end
    550549end
    551550
     
    568567    end
    569568
    570569    if os.is("windows") then
    571         flags { "NoRTTI" }
     570        rtti "off"
    572571        links { "delayimp" }
    573572    end
    574573end
     
    607606        "boost",
    608607    }
    609608    setup_third_party_static_lib_project("tinygettext", source_dirs, extern_libs, { } )
    610    
     609
    611610    -- 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
    612611    if _ACTION == "vs2013" then
    613         buildoptions { 
     612        buildoptions {
    614613            "/wd4127",
    615614            "/wd4309",
    616615            "/wd4800",
     
    730729        "icu",
    731730        "iconv",
    732731    }
    733    
     732
    734733    if not _OPTIONS["without-audio"] then
    735734        table.insert(extern_libs, "openal")
    736735        table.insert(extern_libs, "vorbis")
    737736    end
    738    
     737
    739738    setup_static_lib_project("engine", source_dirs, extern_libs, {})
    740739
    741740
     
    844843    for i,v in pairs(sysdep_dirs[os.get()]) do
    845844        table.insert(source_dirs, v);
    846845    end
    847    
     846
    848847    if os.is("linux") then
    849848        if _OPTIONS["android"] then
    850849            table.insert(source_dirs, "lib/sysdep/os/android")
     
    963962        -- from "lowlevel" static lib; must be added here to be linked in
    964963        files { source_root.."lib/sysdep/os/win/error_dialog.rc" }
    965964
    966         flags { "NoRTTI" }
     965        rtti "off"
    967966
    968967        linkoptions {
    969968            -- wraps main thread in a __try block(see wseh.cpp). replace with mainCRTStartup if that's undesired.
     
    10111010        end
    10121011
    10131012        -- For debug_resolve_symbol
    1014         configuration "Debug"
     1013        filter "Debug"
    10151014            linkoptions { "-rdynamic" }
    1016         configuration { }
     1015        filter { }
    10171016
    10181017    elseif os.is("macosx") then
    10191018
     
    10651064        if target_type == "SharedLib" then
    10661065            if _OPTIONS["macosx-bundle"] then
    10671066                -- If we're building a bundle, it will be in ../Frameworks
    1068                 configuration "Debug"
     1067                filter "Debug"
    10691068                    linkoptions { "-install_name @executable_path/../Frameworks/lib"..project_name.."_dbg.dylib" }
    1070                 configuration "Release"
     1069                filter "Release"
    10711070                    linkoptions { "-install_name @executable_path/../Frameworks/lib"..project_name..".dylib" }
    1072                 configuration { }
     1071                filter { }
    10731072            else
    1074                 configuration "Debug"
     1073                filter "Debug"
    10751074                    linkoptions { "-install_name @executable_path/lib"..project_name.."_dbg.dylib" }
    1076                 configuration "Release"
     1075                filter "Release"
    10771076                    linkoptions { "-install_name @executable_path/lib"..project_name..".dylib" }
    1078                 configuration { }
     1077                filter { }
    10791078            end
    10801079        end
    10811080    end
     
    10901089    {   -- src
    10911090        ".",
    10921091        "../../../third_party/jsonspirit"
    1093        
     1092
    10941093    },{ -- include
    10951094        "../../../third_party/jsonspirit"
    10961095    },{ -- extern_libs
     
    11871186
    11881187        -- required to use WinMain() on Windows, otherwise will default to main()
    11891188        flags { "WinMain" }
    1190        
     1189
    11911190        -- see manifest.cpp
    11921191        project_add_manifest()
    11931192
     
    13031302-- If no customizations are implemented for a specific action (e.g. vs2013), passing the
    13041303-- parameters won't have any effects.
    13051304function configure_cxxtestgen()
    1306 
    13071305    local lcxxtestrootfile = source_root.."test_root.cpp"
    1308     files { lcxxtestrootfile }
    13091306
    13101307    -- Define the options used for cxxtestgen
    13111308    local lcxxtestoptions = "--have-std"
     
    13261323    lcxxtestrootoptions = lcxxtestrootoptions .. include
    13271324    lcxxtestoptions = lcxxtestoptions .. include
    13281325
    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 care
    1341     -- of that for the parameters passed to our cxxtestgen customizations.
    1342     if os.is("windows") then
    1343         lcxxtestrootfile = path.translate(lcxxtestrootfile, "\\")
    1344         lcxxtestpath = path.translate(lcxxtestpath, "\\")
    1345     end
    1346 
    1347     if _ACTION ~= "gmake" and _ACTION ~= "vs2013" then
    1348         prebuildcommands { lcxxtestpath.." --root "..lcxxtestrootoptions.." -o "..lcxxtestrootfile }
    1349     end
    1350 
    13511326    -- Find header files in 'test' subdirectories
    13521327    local all_files = os.matchfiles(source_root .. "**/tests/*.h")
     1328    local test_files = {}
    13531329    for i,v in pairs(all_files) do
    13541330        -- Don't include sysdep tests on the wrong sys
    13551331        -- Don't include Atlas tests unless Atlas is being built
     
    13571333           not (string.find(v, "/tools/atlas/") and not _OPTIONS["atlas"]) and
    13581334           not (string.find(v, "/sysdep/arch/x86_x64/") and ((arch ~= "amd64") or (arch ~= "x86")))
    13591335        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)
    13761337        end
     1338    end
    13771339
    1378 
    1379     end
     1340    require "cxxtest"
     1341    cxxtest.path = lcxxtestpath
     1342    cxxtest.configure_project(lcxxtestrootfile, test_files, lcxxtestrootoptions, lcxxtestoptions)
    13801343end
    13811344
    13821345
     
    13881351    configure_cxxtestgen()
    13891352
    13901353    links { static_lib_names }
    1391     configuration "Debug"
     1354    filter "Debug"
    13921355        links { static_lib_names_debug }
    1393     configuration "Release"
     1356    filter "Release"
    13941357        links { static_lib_names_release }
    1395     configuration { }
     1358    filter { }
    13961359
    13971360    links { "mocks_test" }
    13981361    if _OPTIONS["atlas"] then
     
    14141377        -- from "lowlevel" static lib; must be added here to be linked in
    14151378        files { source_root.."lib/sysdep/os/win/error_dialog.rc" }
    14161379
    1417         flags { "NoRTTI" }
     1380        rtti "off"
    14181381
    14191382        -- see wstartup.h
    14201383        linkoptions { "/INCLUDE:_wstartup_InitAndRegisterShutdown" }
     
    14531416        end
    14541417
    14551418        -- For debug_resolve_symbol
    1456         configuration "Debug"
     1419        filter "Debug"
    14571420            linkoptions { "-rdynamic" }
    1458         configuration { }
     1421        filter { }
    14591422
    14601423        includedirs { source_root .. "pch/test/" }
    14611424    end
     
    14741437-- work when changing the static lib breakdown.
    14751438project("pyrogenesis") -- Set the main project active
    14761439    links { static_lib_names }
    1477     configuration "Debug"
     1440    filter "Debug"
    14781441        links { static_lib_names_debug }
    1479     configuration "Release"
     1442    filter "Release"
    14801443        links { static_lib_names_release }
    1481     configuration { }
     1444    filter { }
    14821445
    14831446if _OPTIONS["atlas"] then
    14841447    setup_atlas_projects()
  • build/workspaces/update-workspaces.bat

     
    33
    44cd ..\premake
    55rem ** Support for Visual Studio versions <2013 has been dropped (check #2669).
    6 if not exist ..\workspaces\vc2013\SKIP_PREMAKE_HERE premake4\bin\release\premake4 --outpath="../workspaces/vc2013" --collada --use-shared-glooxwrapper %* vs2013
     6if not exist ..\workspaces\vc2013\SKIP_PREMAKE_HERE premake5 --outpath="../workspaces/vs2013" --collada --use-shared-glooxwrapper %* vs2013
    77cd ..\workspaces
  • build/workspaces/update-workspaces.sh

     
    9393  echo
    9494fi
    9595
    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"
     96cd ../premake
    11297
    113 echo
    114 
    115 cd ..
    116 
    11798# If we're in bash then make HOSTTYPE available to Premake, for primitive arch-detection
    11899export HOSTTYPE="$HOSTTYPE"
    119100
    120101echo "Premake args: ${premake_args}"
    121102
    122 premake4/bin/release/premake4 --file="premake4.lua" --outpath="../workspaces/gcc/" ${premake_args} gmake || die "Premake failed"
    123 premake4/bin/release/premake4 --file="premake4.lua" --outpath="../workspaces/codeblocks/" ${premake_args} codeblocks || die "Premake failed"
     103premake5 --outpath="../workspaces/gcc/" ${premake_args} gmake || die "Premake failed"
     104premake5 --outpath="../workspaces/codeblocks/" ${premake_args} codeblocks || die "Premake failed"
    124105
    125106# Also generate xcode workspaces if on OS X
    126107if [ "`uname -s`" = "Darwin" ]; then
    127   premake4/bin/release/premake4 --file="premake4.lua" --outpath="../workspaces/xcode3" ${premake_args} xcode3 || die "Premake failed"
    128   premake4/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"
    129110fi
    130111
    131112# test_root.cpp gets generated by cxxtestgen and passing different arguments to premake could require a regeneration of this file.