2005-10-17 03:11:12 +02:00
|
|
|
addoption("atlas", "Include Atlas scenario editor packages")
|
2006-12-06 01:06:05 +01:00
|
|
|
addoption("collada", "Include COLLADA packages (requires FCollada library)")
|
2007-01-02 19:11:00 +01:00
|
|
|
addoption("icc", "Use Intel C++ Compiler (Linux only; should set CXX=icpc before calling make)")
|
2006-04-20 03:20:24 +02:00
|
|
|
addoption("outpath", "Location for generated project files")
|
2006-06-09 00:33:59 +02:00
|
|
|
addoption("without-tests", "Disable generation of test projects")
|
2006-11-12 20:46:47 +01:00
|
|
|
addoption("without-pch", "Disable generation and usage of precompiled headers")
|
2005-10-17 03:11:12 +02:00
|
|
|
|
2006-04-20 03:20:24 +02:00
|
|
|
dofile("functions.lua")
|
2006-06-07 06:34:48 +02:00
|
|
|
dofile("extern_libs.lua")
|
2004-06-02 12:47:27 +02:00
|
|
|
|
|
|
|
-- Set up the Project
|
2004-12-02 19:22:46 +01:00
|
|
|
project.name = "pyrogenesis"
|
2006-04-20 03:20:24 +02:00
|
|
|
project.bindir = "../../binaries/system"
|
|
|
|
project.libdir = "../../binaries/system"
|
|
|
|
project.debugdir = "../../binaries/system"
|
|
|
|
if not options["outpath"] then
|
|
|
|
error("You must specify the 'outpath' parameter")
|
|
|
|
end
|
|
|
|
project.path = options["outpath"]
|
2004-07-27 02:47:15 +02:00
|
|
|
project.configs = { "Debug", "Release", "Testing" }
|
2004-06-02 12:47:27 +02:00
|
|
|
|
2006-06-02 06:07:18 +02:00
|
|
|
if OS == "windows" then
|
2006-04-20 03:20:24 +02:00
|
|
|
project.nasmpath = "../../build/bin/nasm.exe"
|
2006-06-09 00:28:23 +02:00
|
|
|
project.cxxtestpath = "../../build/bin/cxxtestgen.exe"
|
2006-06-08 00:19:42 +02:00
|
|
|
else
|
2006-09-30 20:47:24 +02:00
|
|
|
project.cxxtestpath = "../../build/bin/cxxtestgen.pl"
|
2006-04-20 03:20:24 +02:00
|
|
|
end
|
|
|
|
|
2007-01-02 19:11:00 +01:00
|
|
|
if OS == "linux" and options["icc"] then
|
|
|
|
options["without-pch"] = 1 -- ICC9.1 doesn't support GCC-style PCH
|
|
|
|
end
|
|
|
|
|
2006-06-02 06:07:18 +02:00
|
|
|
source_root = "../../../source/" -- default for most projects - overridden by local in others
|
|
|
|
|
|
|
|
-- Rationale: packages should not have any additional include paths except for
|
|
|
|
-- those required by external libraries. Instead, we should always write the
|
|
|
|
-- full relative path, e.g. #include "maths/Vector3d.h". This avoids confusion
|
2006-06-03 07:08:32 +02:00
|
|
|
-- ("which file is meant?") and avoids enormous include path lists.
|
2006-06-02 06:07:18 +02:00
|
|
|
|
|
|
|
|
2006-06-07 06:34:48 +02:00
|
|
|
-- packages: engine static libs, main exe, atlas, atlas frontends, test.
|
|
|
|
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
-- package helper functions
|
|
|
|
--------------------------------------------------------------------------------
|
2006-06-02 06:07:18 +02:00
|
|
|
|
2006-06-07 03:40:24 +02:00
|
|
|
function package_set_target(package_name)
|
2006-06-02 06:07:18 +02:00
|
|
|
|
|
|
|
-- Note: On Windows, ".exe" is added on the end, on unices the name is used directly
|
|
|
|
package.config["Debug" ].target = package_name.."_dbg"
|
|
|
|
package.config["Testing"].target = package_name.."_test"
|
|
|
|
package.config["Release"].target = package_name
|
|
|
|
|
|
|
|
local obj_dir_prefix = "obj/"..package_name.."_"
|
|
|
|
package.config["Debug" ].objdir = obj_dir_prefix.."Debug"
|
|
|
|
package.config["Testing"].objdir = obj_dir_prefix.."Test"
|
|
|
|
package.config["Release"].objdir = obj_dir_prefix.."Release"
|
2006-06-07 03:40:24 +02:00
|
|
|
end
|
2006-06-02 06:07:18 +02:00
|
|
|
|
2006-06-07 06:34:48 +02:00
|
|
|
|
2006-06-07 03:40:24 +02:00
|
|
|
function package_set_build_flags()
|
2006-06-02 06:07:18 +02:00
|
|
|
|
2007-01-02 19:11:00 +01:00
|
|
|
package.buildflags = { "with-symbols", "no-edit-and-continue" }
|
|
|
|
if not options["icc"] then
|
|
|
|
tinsert(package.buildflags, "extra-warnings") -- this causes far too many warnings/remarks on ICC
|
|
|
|
end
|
2006-06-02 06:07:18 +02:00
|
|
|
|
|
|
|
-- PremakeWiki says with-symbols and optimize are automatically set for
|
|
|
|
-- Debug and Release builds, respectively. doesn't happen though, so do it manually.
|
|
|
|
|
|
|
|
package.config["Testing"].buildflags = { "no-runtime-checks" }
|
|
|
|
package.config["Testing"].defines = { "TESTING" }
|
|
|
|
|
|
|
|
package.config["Release"].buildflags = { "no-runtime-checks", "optimize" }
|
|
|
|
package.config["Release"].defines = { "NDEBUG" }
|
|
|
|
|
|
|
|
-- various platform-specific build flags
|
|
|
|
if OS == "windows" then
|
2006-06-07 03:40:24 +02:00
|
|
|
tinsert(package.buildflags, "no-rtti")
|
2006-06-02 06:07:18 +02:00
|
|
|
|
|
|
|
-- use native wchar_t type (not typedef to unsigned short)
|
2006-06-07 03:40:24 +02:00
|
|
|
tinsert(package.buildflags, "native-wchar_t")
|
2006-06-02 06:07:18 +02:00
|
|
|
else -- *nix
|
2007-01-02 19:11:00 +01:00
|
|
|
if options["icc"] then
|
|
|
|
tinsert(package.buildoptions, {
|
|
|
|
"-w1",
|
2007-01-03 16:45:13 +01:00
|
|
|
-- "-Wabi",
|
2007-01-02 19:11:00 +01:00
|
|
|
-- "-Wp64", -- complains about OBJECT_TO_JSVAL which is annoying
|
|
|
|
"-Wpointer-arith",
|
|
|
|
"-Wreturn-type",
|
|
|
|
-- "-Wshadow",
|
|
|
|
"-Wuninitialized",
|
|
|
|
"-Wunknown-pragmas",
|
|
|
|
"-Wunused-function",
|
|
|
|
})
|
|
|
|
tinsert(package.config["Debug"].buildoptions, {
|
|
|
|
"-O0", -- ICC defaults to -O2
|
|
|
|
})
|
|
|
|
else
|
|
|
|
tinsert(package.buildoptions, {
|
|
|
|
"-Wall",
|
|
|
|
"-Wunused-parameter", -- needs to be enabled explicitly
|
|
|
|
"-Wno-switch", -- enumeration value not handled in switch
|
|
|
|
"-Wno-reorder", -- order of initialization list in constructors
|
|
|
|
"-Wno-non-virtual-dtor",
|
|
|
|
|
|
|
|
-- do something (?) so that ccache can handle compilation with PCH enabled
|
|
|
|
"-fpch-preprocess",
|
|
|
|
|
|
|
|
-- speed up math functions by inlining. warning: this may result in
|
|
|
|
-- non-IEEE-conformant results, but haven't noticed any trouble so far.
|
|
|
|
"-ffast-math",
|
|
|
|
})
|
|
|
|
end
|
2006-11-12 04:39:40 +01:00
|
|
|
package.includepaths = {
|
|
|
|
"/usr/X11R6/include/X11",
|
|
|
|
"/usr/include/X11",
|
|
|
|
}
|
|
|
|
package.libpaths = {
|
2007-01-02 19:11:00 +01:00
|
|
|
"/usr/X11R6/lib",
|
|
|
|
"/usr/i686-pc-linux-gnu/lib", -- needed for ICC to find libbfd
|
2006-11-12 04:39:40 +01:00
|
|
|
}
|
2006-06-02 06:07:18 +02:00
|
|
|
package.defines = {
|
|
|
|
"__STDC_VERSION__=199901L",
|
2007-01-02 19:11:00 +01:00
|
|
|
"CONFIG_USE_MMGR",
|
2006-06-02 06:07:18 +02:00
|
|
|
}
|
|
|
|
end
|
2006-06-07 03:40:24 +02:00
|
|
|
end
|
|
|
|
|
2006-06-07 06:34:48 +02:00
|
|
|
|
2006-06-07 03:40:24 +02:00
|
|
|
-- create a package and set the attributes that are common to all packages.
|
|
|
|
function package_create(package_name, target_type)
|
|
|
|
|
|
|
|
-- Note: don't store in local variable. A global variable needs to
|
|
|
|
-- be set for Premake's use; it is implicitly used in e.g. matchfiles()
|
|
|
|
package = newpackage()
|
|
|
|
package.path = project.path
|
|
|
|
package.language = "c++"
|
|
|
|
package.name = package_name
|
|
|
|
package.kind = target_type
|
|
|
|
|
2006-11-12 04:39:40 +01:00
|
|
|
package.includepaths = {}
|
|
|
|
|
2006-06-07 03:40:24 +02:00
|
|
|
package_set_target(package_name)
|
|
|
|
package_set_build_flags()
|
2006-06-02 06:07:18 +02:00
|
|
|
|
2006-04-20 03:20:24 +02:00
|
|
|
return package
|
2005-09-13 05:51:48 +02:00
|
|
|
end
|
|
|
|
|
2005-10-17 03:11:12 +02:00
|
|
|
|
2006-06-23 19:41:55 +02:00
|
|
|
-- extra_params: table including zero or more of the following:
|
|
|
|
-- * no_default_pch: (any type) prevents adding the PCH include dir.
|
|
|
|
-- see setup_static_lib_package() for explanation of this scheme and rationale.
|
|
|
|
-- * extra_files: table of filenames (relative to source_root) to add to project
|
|
|
|
-- * extra_links: table of library names to add to link step
|
2006-06-07 03:40:24 +02:00
|
|
|
function package_add_contents(source_root, rel_source_dirs, rel_include_dirs, extra_params)
|
2004-12-28 00:27:26 +01:00
|
|
|
|
2006-06-02 06:07:18 +02:00
|
|
|
-- We don't want the VC project to be deeply nested (once for each
|
|
|
|
-- folder in source_root). Therefore, remove the source_root
|
|
|
|
-- directory from the filenames (where those
|
|
|
|
-- names are used by Premake to construct the project tree), but set
|
|
|
|
-- 'trimprefix' (with Premake altered to recognise that) so the project
|
|
|
|
-- will still point to the correct filenames.
|
|
|
|
package.trimprefix = source_root
|
|
|
|
package.files = sourcesfromdirs(source_root, rel_source_dirs)
|
|
|
|
|
2006-06-03 07:08:32 +02:00
|
|
|
-- Put the project-specific PCH directory at the start of the
|
|
|
|
-- include path, so '#include "precompiled.h"' will look in
|
|
|
|
-- there first
|
|
|
|
if not extra_params["no_default_pch"] then
|
2006-06-07 03:40:24 +02:00
|
|
|
tinsert(package.includepaths, source_root .. "pch/" .. package.name)
|
2006-06-03 07:08:32 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
-- next is source root dir, for absolute (nonrelative) includes
|
|
|
|
-- (e.g. "lib/precompiled.h")
|
2006-06-07 03:40:24 +02:00
|
|
|
tinsert(package.includepaths, source_root)
|
2006-06-03 07:08:32 +02:00
|
|
|
|
2006-06-02 06:07:18 +02:00
|
|
|
for i,v in rel_include_dirs do
|
2006-06-07 03:40:24 +02:00
|
|
|
tinsert(package.includepaths, source_root .. v)
|
2006-06-02 06:07:18 +02:00
|
|
|
end
|
2004-12-28 00:27:26 +01:00
|
|
|
|
2006-06-07 03:40:24 +02:00
|
|
|
|
|
|
|
if extra_params["extra_files"] then
|
|
|
|
for i,v in extra_params["extra_files"] do
|
|
|
|
tinsert(package.files, source_root .. v)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if extra_params["extra_links"] then
|
|
|
|
listconcat(package.links, extra_params["extra_links"])
|
2006-06-02 06:07:18 +02:00
|
|
|
end
|
2004-12-28 00:27:26 +01:00
|
|
|
|
2006-06-02 06:07:18 +02:00
|
|
|
end
|
2005-07-02 23:42:55 +02:00
|
|
|
|
2006-11-12 20:46:47 +01:00
|
|
|
-- Detect and set up PCH for the current package
|
|
|
|
function package_setup_pch(pch_dir, header, source)
|
|
|
|
if OS == "windows" or not options["without-pch"] then
|
|
|
|
package.pchheader = header -- "precompiled.h"
|
|
|
|
package.pchsource = source -- "precompiled.cpp"
|
|
|
|
if pch_dir then
|
|
|
|
tinsert(package.files, {
|
|
|
|
pch_dir..header,
|
|
|
|
pch_dir..source
|
|
|
|
})
|
|
|
|
end
|
|
|
|
for i,v in project.configs do
|
2006-12-09 15:39:52 +01:00
|
|
|
tinsert(package.config[v].defines, "USING_PCH")
|
2006-11-12 20:46:47 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2004-12-28 00:27:26 +01:00
|
|
|
|
2006-06-02 06:07:18 +02:00
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
-- engine static libraries
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
-- the engine is split up into several static libraries. this eases separate
|
2006-06-07 03:40:24 +02:00
|
|
|
-- distribution of those components, reduces dependencies a bit, and can
|
2006-06-02 06:07:18 +02:00
|
|
|
-- also speed up builds.
|
2006-06-07 06:34:48 +02:00
|
|
|
-- more to the point, it is necessary to efficiently support a separate
|
|
|
|
-- test executable that also includes much of the game code.
|
2006-06-02 06:07:18 +02:00
|
|
|
|
2006-06-23 19:41:55 +02:00
|
|
|
-- names of all static libs created. automatically added to the
|
|
|
|
-- main app project later (see explanation at end of this file)
|
2006-06-07 03:40:24 +02:00
|
|
|
static_lib_names = {}
|
|
|
|
|
2006-06-23 19:41:55 +02:00
|
|
|
-- set up one of the static libraries into which the main engine code is split.
|
|
|
|
-- extra_params: see package_add_contents().
|
2006-06-02 06:07:18 +02:00
|
|
|
-- note: rel_source_dirs and rel_include_dirs are relative to global source_root.
|
2006-12-06 01:06:05 +01:00
|
|
|
function setup_static_lib_package (package_name, rel_source_dirs, extern_libs, extra_params)
|
2006-06-02 06:07:18 +02:00
|
|
|
|
2006-06-07 03:40:24 +02:00
|
|
|
package_create(package_name, "lib")
|
|
|
|
package_add_contents(source_root, rel_source_dirs, {}, extra_params)
|
|
|
|
package_add_extern_libs(extern_libs)
|
|
|
|
|
|
|
|
tinsert(static_lib_names, package_name)
|
2006-06-03 07:08:32 +02:00
|
|
|
|
2006-11-12 20:46:47 +01:00
|
|
|
-- Precompiled Headers
|
|
|
|
-- rationale: we need one PCH per static lib, since one global header would
|
|
|
|
-- increase dependencies. To that end, we can either include them as
|
|
|
|
-- "packagedir/precompiled.h", or add "source/PCH/packagedir" to the
|
|
|
|
-- include path and put the PCH there. The latter is better because
|
|
|
|
-- many packages contain several dirs and it's unclear where there the
|
|
|
|
-- PCH should be stored. This way is also a bit easier to use in that
|
|
|
|
-- source files always include "precompiled.h".
|
|
|
|
-- Notes:
|
|
|
|
-- * Visual Assist manages to use the project include path and can
|
|
|
|
-- correctly open these files from the IDE.
|
|
|
|
-- * precompiled.cpp (needed to "Create" the PCH) also goes in
|
|
|
|
-- the abovementioned dir.
|
|
|
|
pch_dir = source_root.."pch/"..package_name.."/"
|
|
|
|
package_setup_pch(pch_dir, "precompiled.h", "precompiled.cpp")
|
2006-06-02 06:07:18 +02:00
|
|
|
end
|
2005-07-02 23:42:55 +02:00
|
|
|
|
2006-06-02 06:07:18 +02:00
|
|
|
-- this is where the source tree is chopped up into static libs.
|
2006-06-07 03:40:24 +02:00
|
|
|
-- can be changed very easily; just copy+paste a new setup_static_lib_package,
|
|
|
|
-- or remove existing ones. static libs are automagically added to
|
|
|
|
-- main_exe link step.
|
2006-06-02 06:07:18 +02:00
|
|
|
function setup_all_libs ()
|
2006-06-07 03:40:24 +02:00
|
|
|
|
2006-06-02 06:07:18 +02:00
|
|
|
-- relative to global source_root.
|
|
|
|
local source_dirs = {}
|
|
|
|
-- names of external libraries used (see libraries_dir comment)
|
|
|
|
local extern_libs = {}
|
2004-12-28 00:27:26 +01:00
|
|
|
|
2006-08-26 22:26:17 +02:00
|
|
|
|
|
|
|
source_dirs = {
|
|
|
|
"network",
|
|
|
|
}
|
|
|
|
extern_libs = {
|
|
|
|
"spidermonkey",
|
|
|
|
"xerces",
|
|
|
|
"boost", -- dragged in via server->simulation.h->random
|
|
|
|
}
|
|
|
|
setup_static_lib_package("network", source_dirs, extern_libs, {})
|
|
|
|
|
2005-08-13 19:07:05 +02:00
|
|
|
source_dirs = {
|
2004-12-05 18:59:29 +01:00
|
|
|
"ps",
|
|
|
|
"ps/scripting",
|
|
|
|
"ps/Network",
|
2005-08-15 01:50:37 +02:00
|
|
|
"ps/GameSetup",
|
|
|
|
"ps/XML",
|
2004-12-05 18:59:29 +01:00
|
|
|
"simulation",
|
|
|
|
"simulation/scripting",
|
2006-06-02 06:07:18 +02:00
|
|
|
"sound",
|
|
|
|
"scripting",
|
|
|
|
"maths",
|
|
|
|
"maths/scripting"
|
|
|
|
}
|
|
|
|
extern_libs = {
|
|
|
|
"spidermonkey",
|
2006-06-23 19:41:55 +02:00
|
|
|
"sdl", -- key definitions
|
2006-06-02 06:07:18 +02:00
|
|
|
"xerces",
|
2006-06-07 03:40:24 +02:00
|
|
|
"opengl",
|
2006-06-02 06:07:18 +02:00
|
|
|
"zlib",
|
|
|
|
"boost"
|
|
|
|
}
|
|
|
|
setup_static_lib_package("engine", source_dirs, extern_libs, {})
|
2004-11-15 14:38:07 +01:00
|
|
|
|
|
|
|
|
2006-06-02 06:07:18 +02:00
|
|
|
source_dirs = {
|
2004-12-05 18:59:29 +01:00
|
|
|
"graphics",
|
|
|
|
"graphics/scripting",
|
2006-06-02 06:07:18 +02:00
|
|
|
"renderer"
|
|
|
|
}
|
|
|
|
extern_libs = {
|
2006-06-07 03:40:24 +02:00
|
|
|
"opengl",
|
2006-06-23 19:41:55 +02:00
|
|
|
"sdl", -- key definitions
|
2006-06-02 06:07:18 +02:00
|
|
|
"spidermonkey", -- for graphics/scripting
|
|
|
|
"boost"
|
|
|
|
}
|
|
|
|
setup_static_lib_package("graphics", source_dirs, extern_libs, {})
|
2004-11-15 14:38:07 +01:00
|
|
|
|
|
|
|
|
2006-06-02 06:07:18 +02:00
|
|
|
-- internationalization = i18n
|
|
|
|
-- note: this package isn't large, but is separate because it may be
|
|
|
|
-- useful for other projects.
|
|
|
|
source_dirs = {
|
|
|
|
"i18n"
|
|
|
|
}
|
|
|
|
extern_libs = {
|
|
|
|
"spidermonkey"
|
|
|
|
}
|
|
|
|
setup_static_lib_package("i18n", source_dirs, extern_libs, {})
|
2005-07-02 23:42:55 +02:00
|
|
|
|
2005-09-14 07:37:52 +02:00
|
|
|
|
2006-06-02 06:07:18 +02:00
|
|
|
source_dirs = {
|
2005-09-14 07:37:52 +02:00
|
|
|
"tools/atlas/GameInterface",
|
|
|
|
"tools/atlas/GameInterface/Handlers"
|
2006-04-20 03:20:24 +02:00
|
|
|
}
|
2006-06-02 06:07:18 +02:00
|
|
|
extern_libs = {
|
|
|
|
"boost",
|
2006-06-23 19:41:55 +02:00
|
|
|
"sdl", -- key definitions
|
2006-06-07 03:40:24 +02:00
|
|
|
"opengl",
|
2006-06-02 06:07:18 +02:00
|
|
|
"spidermonkey"
|
|
|
|
}
|
|
|
|
setup_static_lib_package("atlas", source_dirs, extern_libs, {})
|
2004-07-27 02:47:15 +02:00
|
|
|
|
2005-07-02 23:42:55 +02:00
|
|
|
|
2006-06-02 06:07:18 +02:00
|
|
|
source_dirs = {
|
|
|
|
"gui",
|
|
|
|
"gui/scripting"
|
|
|
|
}
|
|
|
|
extern_libs = {
|
|
|
|
"spidermonkey",
|
2006-06-23 19:41:55 +02:00
|
|
|
"sdl", -- key definitions
|
2006-06-07 03:40:24 +02:00
|
|
|
"opengl",
|
2006-06-02 06:07:18 +02:00
|
|
|
"boost"
|
|
|
|
}
|
|
|
|
setup_static_lib_package("gui", source_dirs, extern_libs, {})
|
2005-07-02 23:42:55 +02:00
|
|
|
|
2006-06-02 06:07:18 +02:00
|
|
|
|
|
|
|
source_dirs = {
|
2004-12-28 00:27:26 +01:00
|
|
|
"lib",
|
2007-01-01 23:54:42 +01:00
|
|
|
"lib/posix",
|
2006-06-02 06:07:18 +02:00
|
|
|
"lib/sysdep",
|
|
|
|
"lib/res",
|
|
|
|
"lib/res/file",
|
|
|
|
"lib/res/graphics",
|
|
|
|
"lib/res/sound"
|
2004-11-29 05:22:37 +01:00
|
|
|
}
|
2006-06-02 06:07:18 +02:00
|
|
|
extern_libs = {
|
2006-06-23 19:41:55 +02:00
|
|
|
"sdl",
|
2006-06-07 03:40:24 +02:00
|
|
|
"opengl",
|
2006-06-02 06:07:18 +02:00
|
|
|
"libpng",
|
|
|
|
"zlib",
|
|
|
|
"openal",
|
|
|
|
"vorbis",
|
|
|
|
"libjpg",
|
|
|
|
"dbghelp",
|
|
|
|
"directx"
|
|
|
|
}
|
|
|
|
setup_static_lib_package("lowlevel", source_dirs, extern_libs, {})
|
2006-11-12 04:39:40 +01:00
|
|
|
sysdep_dirs = {
|
|
|
|
linux = { "lib/sysdep/unix" },
|
2006-06-02 06:07:18 +02:00
|
|
|
-- note: RC file must be added to main_exe package.
|
2007-01-01 23:54:42 +01:00
|
|
|
windows = { "lib/sysdep/win", "lib/sysdep/win/wposix" },
|
2006-11-12 04:39:40 +01:00
|
|
|
macosx = { "lib/sysdep/osx" },
|
|
|
|
}
|
|
|
|
tinsert(package.files, sourcesfromdirs(source_root, sysdep_dirs[OS]));
|
2006-06-02 06:07:18 +02:00
|
|
|
end
|
2005-07-02 23:42:55 +02:00
|
|
|
|
|
|
|
|
2006-06-07 03:40:24 +02:00
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
-- main EXE
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
2006-06-07 06:34:48 +02:00
|
|
|
-- used for main EXE as well as test
|
2006-06-07 16:22:26 +02:00
|
|
|
used_extern_libs = {
|
2006-06-07 05:02:20 +02:00
|
|
|
"opengl",
|
|
|
|
"sdl",
|
|
|
|
|
|
|
|
"libjpg",
|
|
|
|
"libpng",
|
|
|
|
"zlib",
|
|
|
|
|
|
|
|
"spidermonkey",
|
|
|
|
"xerces",
|
|
|
|
|
|
|
|
"openal",
|
|
|
|
"vorbis",
|
|
|
|
|
|
|
|
"boost",
|
|
|
|
"dbghelp",
|
|
|
|
"cxxtest",
|
|
|
|
"directx",
|
|
|
|
}
|
|
|
|
|
2006-06-02 06:07:18 +02:00
|
|
|
-- Bundles static libs together with main.cpp and builds game executable.
|
|
|
|
function setup_main_exe ()
|
2006-04-25 07:10:47 +02:00
|
|
|
|
2006-06-07 03:40:24 +02:00
|
|
|
package_create("pyrogenesis", "winexe")
|
2005-05-31 21:02:38 +02:00
|
|
|
|
2006-06-03 07:08:32 +02:00
|
|
|
-- For VS2005, tell the linker to use the libraries' .obj files instead of
|
|
|
|
-- the .lib, to allow incremental linking.
|
|
|
|
-- (Reduces re-link time from ~20 seconds to ~2 secs)
|
2006-06-07 03:40:24 +02:00
|
|
|
tinsert(package.buildflags, "use-library-dep-inputs")
|
2006-06-03 07:08:32 +02:00
|
|
|
|
2006-06-07 03:40:24 +02:00
|
|
|
local extra_params = {
|
|
|
|
extra_files = { "main.cpp" },
|
2006-06-02 06:07:18 +02:00
|
|
|
}
|
2006-06-07 03:40:24 +02:00
|
|
|
package_add_contents(source_root, {}, {}, extra_params)
|
2005-07-02 23:42:55 +02:00
|
|
|
|
2006-06-07 16:22:26 +02:00
|
|
|
package_add_extern_libs(used_extern_libs)
|
2006-06-07 03:40:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
-- Platform Specifics
|
|
|
|
if OS == "windows" then
|
2006-06-07 16:22:26 +02:00
|
|
|
|
2006-06-07 03:40:24 +02:00
|
|
|
tinsert(package.files, source_root.."lib/sysdep/win/icon.rc")
|
2006-06-07 16:22:26 +02:00
|
|
|
-- from "lowlevel" static lib; must be added here to be linked in
|
2006-06-07 03:40:24 +02:00
|
|
|
tinsert(package.files, source_root.."lib/sysdep/win/error_dialog.rc")
|
2005-07-02 23:42:55 +02:00
|
|
|
|
2006-04-25 07:10:47 +02:00
|
|
|
-- VS2005 generates its own manifest, but earlier ones need us to add it manually
|
|
|
|
if (options["target"] == "vs2002" or options["target"] == "vs2003") then
|
2006-06-07 03:40:24 +02:00
|
|
|
tinsert(package.files, source_root.."lib/sysdep/win/manifest.rc")
|
2006-04-25 07:10:47 +02:00
|
|
|
end
|
|
|
|
|
2006-06-07 16:22:26 +02:00
|
|
|
package.linkoptions = {
|
|
|
|
-- required for win.cpp's init mechanism
|
|
|
|
"/ENTRY:entry",
|
|
|
|
|
|
|
|
-- delay loading of various Windows DLLs (not specific to any of the
|
2006-12-01 21:34:28 +01:00
|
|
|
-- external libraries; those are handled separately)
|
2005-05-31 21:02:38 +02:00
|
|
|
"/DELAYLOAD:oleaut32.dll",
|
2004-12-28 00:27:26 +01:00
|
|
|
"/DELAYLOAD:advapi32.dll",
|
|
|
|
"/DELAYLOAD:user32.dll",
|
|
|
|
"/DELAYLOAD:ws2_32.dll",
|
|
|
|
"/DELAYLOAD:version.dll",
|
2006-06-07 16:22:26 +02:00
|
|
|
|
|
|
|
-- allow manual unload of delay-loaded DLLs
|
|
|
|
"/DELAY:UNLOAD"
|
2004-12-28 00:27:26 +01:00
|
|
|
}
|
2005-07-02 23:42:55 +02:00
|
|
|
|
2006-09-04 18:33:47 +02:00
|
|
|
elseif OS == "linux" then
|
2005-07-02 23:42:55 +02:00
|
|
|
|
2004-12-28 00:27:26 +01:00
|
|
|
-- Libraries
|
2006-06-07 03:40:24 +02:00
|
|
|
tinsert(package.links, {
|
2004-12-28 00:27:26 +01:00
|
|
|
"fam",
|
|
|
|
-- Utilities
|
2006-06-07 03:40:24 +02:00
|
|
|
"pthread", "rt",
|
2005-09-13 02:16:47 +02:00
|
|
|
-- Debugging
|
|
|
|
"bfd", "iberty"
|
2006-06-02 06:07:18 +02:00
|
|
|
})
|
2006-09-04 18:33:47 +02:00
|
|
|
|
2006-11-12 20:46:47 +01:00
|
|
|
-- For debug_resolve_symbol
|
2005-09-13 02:16:47 +02:00
|
|
|
package.config["Debug"].linkoptions = { "-rdynamic" }
|
|
|
|
package.config["Testing"].linkoptions = { "-rdynamic" }
|
2006-09-04 18:33:47 +02:00
|
|
|
elseif OS == "macosx" then
|
|
|
|
-- Libraries
|
|
|
|
tinsert(package.links, { -- Utilities
|
|
|
|
"pthread"
|
|
|
|
})
|
|
|
|
|
|
|
|
tinsert(package.libpaths, "/usr/X11R6/lib")
|
2004-12-28 00:27:26 +01:00
|
|
|
end
|
2004-06-02 12:47:27 +02:00
|
|
|
end
|
2004-12-28 00:27:26 +01:00
|
|
|
|
2005-10-17 03:11:12 +02:00
|
|
|
|
2006-06-07 05:02:20 +02:00
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
-- atlas
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
2006-06-07 06:34:48 +02:00
|
|
|
-- setup a typical Atlas component package
|
2006-06-23 19:41:55 +02:00
|
|
|
-- extra_params: as in package_add_contents; also zero or more of the following:
|
|
|
|
-- * pch: (any type) set stdafx.h and .cpp as PCH
|
2006-12-06 01:06:05 +01:00
|
|
|
function setup_atlas_package(package_name, target_type, rel_source_dirs, rel_include_dirs, extern_libs, extra_params)
|
2005-10-17 03:11:12 +02:00
|
|
|
|
2006-06-03 07:08:32 +02:00
|
|
|
local source_root = "../../../source/tools/atlas/" .. package_name .. "/"
|
2006-06-07 03:40:24 +02:00
|
|
|
package_create(package_name, target_type)
|
2006-06-03 07:08:32 +02:00
|
|
|
|
|
|
|
-- Don't add the default 'sourceroot/pch/projectname' for finding PCH files
|
2006-06-23 19:41:55 +02:00
|
|
|
extra_params["no_default_pch"] = 1
|
2006-06-03 07:08:32 +02:00
|
|
|
|
2006-06-23 19:41:55 +02:00
|
|
|
package_add_contents(source_root, rel_source_dirs, rel_include_dirs, extra_params)
|
2006-06-07 03:40:24 +02:00
|
|
|
package_add_extern_libs(extern_libs)
|
2005-10-17 03:11:12 +02:00
|
|
|
|
2006-11-12 20:46:47 +01:00
|
|
|
if extra_params["pch"] then
|
|
|
|
package_setup_pch(nil, "stdafx.h", "stdafx.cpp");
|
|
|
|
end
|
|
|
|
|
2005-10-17 03:11:12 +02:00
|
|
|
-- Platform Specifics
|
2006-06-02 06:07:18 +02:00
|
|
|
if OS == "windows" then
|
2005-10-17 03:11:12 +02:00
|
|
|
|
2006-06-07 03:40:24 +02:00
|
|
|
tinsert(package.defines, "_UNICODE")
|
2005-10-17 03:11:12 +02:00
|
|
|
|
2006-04-25 07:10:47 +02:00
|
|
|
-- Link to required libraries
|
2006-12-05 03:35:00 +01:00
|
|
|
package.links = { "winmm", "comctl32", "rpcrt4", "delayimp" }
|
2005-10-17 03:11:12 +02:00
|
|
|
|
|
|
|
-- required to use WinMain() on Windows, otherwise will default to main()
|
2006-06-07 03:40:24 +02:00
|
|
|
tinsert(package.buildflags, "no-main")
|
2005-10-17 03:11:12 +02:00
|
|
|
|
2006-07-12 16:49:10 +02:00
|
|
|
if extra_params["extra_links"] then
|
|
|
|
listconcat(package.links, extra_params["extra_links"])
|
|
|
|
end
|
|
|
|
|
2005-10-17 03:11:12 +02:00
|
|
|
else -- Non-Windows, = Unix
|
2006-11-12 04:39:40 +01:00
|
|
|
tinsert(package.buildoptions, "-rdynamic")
|
|
|
|
tinsert(package.linkoptions, "-rdynamic")
|
2005-10-17 03:11:12 +02:00
|
|
|
end
|
2006-04-25 07:10:47 +02:00
|
|
|
|
2005-10-17 03:11:12 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2006-06-07 06:34:48 +02:00
|
|
|
-- build all Atlas component packages
|
|
|
|
function setup_atlas_packages()
|
2005-10-17 03:11:12 +02:00
|
|
|
|
2006-06-07 06:34:48 +02:00
|
|
|
setup_atlas_package("AtlasObject", "lib",
|
2006-06-03 07:08:32 +02:00
|
|
|
{ -- src
|
2006-04-20 03:20:24 +02:00
|
|
|
""
|
2006-06-03 07:08:32 +02:00
|
|
|
},{ -- include
|
|
|
|
},{ -- extern_libs
|
2006-11-12 04:39:40 +01:00
|
|
|
"xerces",
|
|
|
|
"wxwidgets"
|
2006-06-23 19:41:55 +02:00
|
|
|
},{ -- extra_params
|
2005-10-17 03:11:12 +02:00
|
|
|
})
|
|
|
|
|
2006-06-07 06:34:48 +02:00
|
|
|
setup_atlas_package("AtlasUI", "dll",
|
2006-06-03 07:08:32 +02:00
|
|
|
{ -- src
|
|
|
|
"ActorEditor",
|
# Added tool for viewing models and animations outside the game.
Atlas: Added ActorViewer. Moved GL canvas into separate class for shared
use. Disabled message-handling callback while blocked on the game, and
stopped creating dialog boxes inside the game thread in order to avoid
deadlocks (hopefully). Support multiple Views (for independent sets of
camera/update/render code). Recalculate territory boundaries when
necessary. Changed default list of animations to match those currently
used by actors.
# Tidied up more code.
Moved some more #includes out of .h files, to minimise unnecessary
compilation.
MathUtil: Deleted unused/unuseful macros (M_PI (use PI instead), M_PI_2
(use PI/2), MAX3, ABS (use abs)).
ObjectManager: Removed some ScEd-specific things.
Unit: Moved creation out of UnitManager, so units can be created without
adding to the manager. Changed CStr8 to the more conventional CStr.
app_hooks: Removed warning for setting multiple times.
win: Restored SEH catcher.
GameSetup, GameView: Removed RenderNoCull, because it doesn't seem to do
what it says it does ("force renderer to load everything") since we're
loading-on-demand most stuff and it doesn't seem especially useful since
we'd prefer to minimise loading times (but feel free to correct me if
I'm wrong). (And because it crashes when things need to be initialised
in a different order, so it's easier to remove than to understand and
fix it.)
PatchRData, Renderer: Work sensibly when there's no game (hence no LOS
manager, water, etc).
LOSManager: Use entity position instead of actor position when possible.
TerritoryManager: Allow delayed recalculations (so Atlas can issue lots
of move+recalculate commands per frame).
Cinematic: Non-pointer wxTimer, so it doesn't leak and doesn't have to
be deleted manually.
This was SVN commit r4261.
2006-08-28 19:36:42 +02:00
|
|
|
"ActorViewer",
|
2006-06-03 07:08:32 +02:00
|
|
|
"ArchiveViewer",
|
|
|
|
"ColourTester",
|
|
|
|
"CustomControls/Buttons",
|
# Added tool for viewing models and animations outside the game.
Atlas: Added ActorViewer. Moved GL canvas into separate class for shared
use. Disabled message-handling callback while blocked on the game, and
stopped creating dialog boxes inside the game thread in order to avoid
deadlocks (hopefully). Support multiple Views (for independent sets of
camera/update/render code). Recalculate territory boundaries when
necessary. Changed default list of animations to match those currently
used by actors.
# Tidied up more code.
Moved some more #includes out of .h files, to minimise unnecessary
compilation.
MathUtil: Deleted unused/unuseful macros (M_PI (use PI instead), M_PI_2
(use PI/2), MAX3, ABS (use abs)).
ObjectManager: Removed some ScEd-specific things.
Unit: Moved creation out of UnitManager, so units can be created without
adding to the manager. Changed CStr8 to the more conventional CStr.
app_hooks: Removed warning for setting multiple times.
win: Restored SEH catcher.
GameSetup, GameView: Removed RenderNoCull, because it doesn't seem to do
what it says it does ("force renderer to load everything") since we're
loading-on-demand most stuff and it doesn't seem especially useful since
we'd prefer to minimise loading times (but feel free to correct me if
I'm wrong). (And because it crashes when things need to be initialised
in a different order, so it's easier to remove than to understand and
fix it.)
PatchRData, Renderer: Work sensibly when there's no game (hence no LOS
manager, water, etc).
LOSManager: Use entity position instead of actor position when possible.
TerritoryManager: Allow delayed recalculations (so Atlas can issue lots
of move+recalculate commands per frame).
Cinematic: Non-pointer wxTimer, so it doesn't leak and doesn't have to
be deleted manually.
This was SVN commit r4261.
2006-08-28 19:36:42 +02:00
|
|
|
"CustomControls/Canvas",
|
2006-07-12 16:49:10 +02:00
|
|
|
"CustomControls/ColourDialog",
|
2006-06-03 07:08:32 +02:00
|
|
|
"CustomControls/DraggableListCtrl",
|
|
|
|
"CustomControls/EditableListCtrl",
|
|
|
|
"CustomControls/FileHistory",
|
|
|
|
"CustomControls/HighResTimer",
|
|
|
|
"CustomControls/SnapSplitterWindow",
|
|
|
|
"CustomControls/VirtualDirTreeCtrl",
|
|
|
|
"CustomControls/Windows",
|
|
|
|
"FileConverter",
|
|
|
|
"General",
|
2006-12-05 03:35:00 +01:00
|
|
|
"General/VideoRecorder",
|
2006-06-03 07:08:32 +02:00
|
|
|
"Misc",
|
|
|
|
"ScenarioEditor",
|
|
|
|
"ScenarioEditor/Sections/Common",
|
2006-07-12 16:49:10 +02:00
|
|
|
"ScenarioEditor/Sections/Cinematic",
|
2006-06-03 07:08:32 +02:00
|
|
|
"ScenarioEditor/Sections/Environment",
|
|
|
|
"ScenarioEditor/Sections/Map",
|
|
|
|
"ScenarioEditor/Sections/Object",
|
|
|
|
"ScenarioEditor/Sections/Terrain",
|
2006-11-30 00:37:10 +01:00
|
|
|
"ScenarioEditor/Sections/Trigger",
|
2006-06-03 07:08:32 +02:00
|
|
|
"ScenarioEditor/Tools",
|
|
|
|
"ScenarioEditor/Tools/Common"
|
|
|
|
},{ -- include
|
|
|
|
"..",
|
2006-11-12 04:39:40 +01:00
|
|
|
"CustomControls",
|
|
|
|
"Misc"
|
2006-06-03 07:08:32 +02:00
|
|
|
},{ -- extern_libs
|
2006-06-02 06:07:18 +02:00
|
|
|
"boost",
|
|
|
|
"devil",
|
2006-12-05 03:35:00 +01:00
|
|
|
"ffmpeg",
|
|
|
|
"wxwidgets",
|
|
|
|
"xerces"
|
2006-06-23 19:41:55 +02:00
|
|
|
},{ -- extra_params
|
2005-10-17 03:11:12 +02:00
|
|
|
pch = 1,
|
2006-06-23 19:41:55 +02:00
|
|
|
extra_links = { "AtlasObject", "DatafileIO" },
|
2006-06-07 06:34:48 +02:00
|
|
|
extra_files = { "Misc/atlas.rc" }
|
2005-10-17 03:11:12 +02:00
|
|
|
})
|
|
|
|
|
2006-06-07 06:34:48 +02:00
|
|
|
setup_atlas_package("DatafileIO", "lib",
|
2006-06-03 07:08:32 +02:00
|
|
|
{ -- src
|
2006-04-20 03:20:24 +02:00
|
|
|
"",
|
2006-06-03 07:08:32 +02:00
|
|
|
"BAR",
|
|
|
|
"DDT",
|
|
|
|
"SCN",
|
|
|
|
"Stream",
|
|
|
|
"XMB"
|
|
|
|
},{ -- include
|
|
|
|
},{ -- extern_libs
|
2006-06-02 06:07:18 +02:00
|
|
|
"devil",
|
|
|
|
"xerces",
|
|
|
|
"zlib"
|
2006-06-23 19:41:55 +02:00
|
|
|
},{ -- extra_params
|
2005-10-17 03:11:12 +02:00
|
|
|
pch = 1,
|
|
|
|
})
|
2006-04-25 07:10:47 +02:00
|
|
|
|
2006-06-07 03:40:24 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2006-06-07 06:34:48 +02:00
|
|
|
-- Atlas 'frontend' tool-launching packages
|
2006-12-06 01:06:05 +01:00
|
|
|
function setup_atlas_frontend_package (package_name)
|
2006-06-07 03:40:24 +02:00
|
|
|
|
|
|
|
package_create(package_name, "winexe")
|
|
|
|
|
|
|
|
local source_root = "../../../source/tools/atlas/AtlasFrontends/"
|
|
|
|
package.files = {
|
|
|
|
source_root..package_name..".cpp",
|
|
|
|
source_root..package_name..".rc"
|
|
|
|
}
|
|
|
|
package.trimprefix = source_root
|
2006-06-07 05:02:20 +02:00
|
|
|
package.includepaths = { source_root .. ".." }
|
2006-06-07 03:40:24 +02:00
|
|
|
|
|
|
|
-- Platform Specifics
|
|
|
|
if OS == "windows" then
|
|
|
|
tinsert(package.defines, "_UNICODE")
|
|
|
|
|
|
|
|
-- required to use WinMain() on Windows, otherwise will default to main()
|
|
|
|
tinsert(package.buildflags, "no-main")
|
|
|
|
|
|
|
|
else -- Non-Windows, = Unix
|
2006-11-12 04:39:40 +01:00
|
|
|
tinsert(package.links, "DatafileIO")
|
|
|
|
tinsert(package.links, "AtlasObject")
|
2006-06-07 03:40:24 +02:00
|
|
|
end
|
|
|
|
|
2006-11-12 04:39:40 +01:00
|
|
|
tinsert(package.links, "AtlasUI")
|
|
|
|
|
2006-06-07 03:40:24 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function setup_atlas_frontends()
|
2006-06-07 06:34:48 +02:00
|
|
|
setup_atlas_frontend_package("ActorEditor")
|
|
|
|
setup_atlas_frontend_package("ArchiveViewer")
|
|
|
|
setup_atlas_frontend_package("ColourTester")
|
|
|
|
setup_atlas_frontend_package("FileConverter")
|
2005-10-17 03:11:12 +02:00
|
|
|
end
|
|
|
|
|
2006-06-07 05:02:20 +02:00
|
|
|
|
2006-12-06 01:06:05 +01:00
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
-- collada
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
function setup_collada_package(package_name, target_type, rel_source_dirs, rel_include_dirs, extern_libs, extra_params)
|
|
|
|
|
|
|
|
package_create(package_name, target_type)
|
|
|
|
|
|
|
|
-- Don't add the default 'sourceroot/pch/projectname' for finding PCH files
|
|
|
|
extra_params["no_default_pch"] = 1
|
|
|
|
|
|
|
|
package_add_contents(source_root, rel_source_dirs, rel_include_dirs, extra_params)
|
|
|
|
package_add_extern_libs(extern_libs)
|
|
|
|
|
|
|
|
if extra_params["pch"] then
|
|
|
|
package_setup_pch(nil, "precompiled.h", "precompiled.cpp");
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Platform Specifics
|
|
|
|
if OS == "windows" then
|
|
|
|
|
|
|
|
-- required to use WinMain() on Windows, otherwise will default to main()
|
|
|
|
tinsert(package.buildflags, "no-main")
|
|
|
|
|
|
|
|
if extra_params["extra_links"] then
|
|
|
|
listconcat(package.links, extra_params["extra_links"])
|
|
|
|
end
|
|
|
|
|
|
|
|
else -- Non-Windows, = Unix
|
2006-12-06 18:39:49 +01:00
|
|
|
tinsert(package.defines, "LINUX");
|
|
|
|
tinsert(package.includepaths, "/usr/include/libxml2")
|
|
|
|
tinsert(package.links, "xml2")
|
|
|
|
|
2006-12-06 01:06:05 +01:00
|
|
|
tinsert(package.buildoptions, "-rdynamic")
|
|
|
|
tinsert(package.linkoptions, "-rdynamic")
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
-- build all Collada component packages
|
|
|
|
function setup_collada_packages()
|
|
|
|
|
|
|
|
setup_collada_package("Collada", "dll",
|
|
|
|
{ -- src
|
|
|
|
"collada"
|
|
|
|
},{ -- include
|
|
|
|
},{ -- extern_libs
|
|
|
|
"fcollada",
|
|
|
|
},{ -- extra_params
|
|
|
|
pch = 1,
|
|
|
|
})
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2006-06-07 05:02:20 +02:00
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
-- tests
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
2006-06-08 20:48:40 +02:00
|
|
|
function get_all_test_files(root, src_files, hdr_files)
|
2006-06-07 05:02:20 +02:00
|
|
|
|
|
|
|
-- note: lua doesn't have any directory handling functions at all, ugh.
|
|
|
|
-- premake's matchrecursive on patterns like *tests*.h doesn't work -
|
|
|
|
-- apparently it applies them to filenames, not the complete path.
|
2006-06-08 20:48:40 +02:00
|
|
|
-- our workaround is to enumerate all files and manually filter out the
|
|
|
|
-- desired */tests/* files. this is a bit slow, but hey.
|
2006-06-07 05:02:20 +02:00
|
|
|
|
2006-06-08 20:48:40 +02:00
|
|
|
local all_files = matchrecursive(root .. "*.h")
|
2006-06-07 05:02:20 +02:00
|
|
|
for i,v in all_files do
|
2006-06-08 20:48:40 +02:00
|
|
|
-- header file in subdirectory test
|
|
|
|
if string.sub(v, -2) == ".h" and string.find(v, "/tests/") then
|
2006-09-30 23:09:02 +02:00
|
|
|
-- don't include sysdep tests on the wrong sys
|
|
|
|
if not (string.find(v, "/sysdep/win/") and OS ~= "windows") then
|
|
|
|
tinsert(hdr_files, v)
|
|
|
|
-- add the corresponding source file immediately, instead of
|
|
|
|
-- waiting for it to appear after cxxtestgen. this avoids
|
|
|
|
-- having to recreate workspace 2x after adding a test.
|
|
|
|
tinsert(src_files, string.sub(v, 1, -3) .. ".cpp")
|
|
|
|
end
|
2006-06-07 05:02:20 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function setup_tests()
|
2006-06-08 20:48:40 +02:00
|
|
|
|
|
|
|
local src_files = {}
|
|
|
|
local hdr_files = {}
|
|
|
|
get_all_test_files(source_root, src_files, hdr_files)
|
|
|
|
|
|
|
|
|
|
|
|
package_create("test_3_gen", "cxxtestgen")
|
|
|
|
package.files = hdr_files
|
2006-06-08 00:19:42 +02:00
|
|
|
package.rootfile = source_root .. "test_root.cpp"
|
2006-11-12 20:46:47 +01:00
|
|
|
package.testoptions = ""
|
2006-06-08 00:19:42 +02:00
|
|
|
if OS == "windows" then
|
2006-11-12 20:46:47 +01:00
|
|
|
package.rootoptions = "--gui=Win32Gui --runner=ParenPrinter"
|
2006-06-08 00:19:42 +02:00
|
|
|
else
|
2006-11-12 20:46:47 +01:00
|
|
|
package.rootoptions = "--runner=ErrorPrinter"
|
2006-06-08 00:19:42 +02:00
|
|
|
end
|
2006-11-12 20:46:47 +01:00
|
|
|
-- precompiled headers - the header is added to all generated .cpp files
|
|
|
|
-- note that the header isn't actually precompiled here, only #included
|
|
|
|
-- so that the build stage can use it as a precompiled header.
|
|
|
|
include = " --include=precompiled.h"
|
|
|
|
package.rootoptions = package.rootoptions .. include
|
|
|
|
package.testoptions = package.testoptions .. include
|
2006-06-08 20:48:40 +02:00
|
|
|
|
2006-06-07 05:02:20 +02:00
|
|
|
package_create("test_2_build", "winexe")
|
2006-06-08 20:48:40 +02:00
|
|
|
links = static_lib_names
|
|
|
|
tinsert(links, "test_3_gen")
|
|
|
|
extra_params = {
|
2006-12-20 04:09:21 +01:00
|
|
|
extra_files = { "test_root.cpp", "test_setup.cpp" },
|
2006-06-08 20:48:40 +02:00
|
|
|
extra_links = links,
|
|
|
|
}
|
|
|
|
package_add_contents(source_root, {}, {}, extra_params)
|
|
|
|
-- note: these are not relative to source_root and therefore can't be included via package_add_contents.
|
|
|
|
listconcat(package.files, src_files)
|
2006-06-07 16:22:26 +02:00
|
|
|
package_add_extern_libs(used_extern_libs)
|
2006-06-08 20:48:40 +02:00
|
|
|
if OS == "windows" then
|
|
|
|
-- required for win.cpp's init mechanism
|
2006-12-09 15:39:52 +01:00
|
|
|
tinsert(package.linkoptions, "/ENTRY:entry_noSEH")
|
|
|
|
|
2006-06-08 20:48:40 +02:00
|
|
|
-- from "lowlevel" static lib; must be added here to be linked in
|
|
|
|
tinsert(package.files, source_root.."lib/sysdep/win/error_dialog.rc")
|
2006-08-22 23:38:53 +02:00
|
|
|
|
2006-09-30 23:09:02 +02:00
|
|
|
elseif OS == "linux" then
|
|
|
|
|
|
|
|
tinsert(package.links, {
|
|
|
|
"fam",
|
|
|
|
-- Utilities
|
|
|
|
"pthread", "rt",
|
|
|
|
-- Debugging
|
|
|
|
"bfd", "iberty"
|
|
|
|
})
|
2006-11-12 20:46:47 +01:00
|
|
|
|
2006-09-30 23:09:02 +02:00
|
|
|
-- For debug_resolve_symbol
|
|
|
|
package.config["Debug"].linkoptions = { "-rdynamic" }
|
|
|
|
package.config["Testing"].linkoptions = { "-rdynamic" }
|
|
|
|
|
2006-11-12 20:46:47 +01:00
|
|
|
tinsert(package.includepaths, source_root .. "pch/test/")
|
2006-09-30 23:09:02 +02:00
|
|
|
tinsert(package.libpaths, "/usr/X11R6/lib")
|
2006-06-08 20:48:40 +02:00
|
|
|
end
|
|
|
|
|
2006-11-12 20:46:47 +01:00
|
|
|
package_setup_pch(
|
|
|
|
source_root .. "pch/test/",
|
|
|
|
"precompiled.h",
|
|
|
|
"precompiled.cpp");
|
|
|
|
|
2006-06-11 09:03:59 +02:00
|
|
|
tinsert(package.buildflags, "use-library-dep-inputs")
|
|
|
|
|
2006-06-07 05:02:20 +02:00
|
|
|
|
2006-06-08 20:48:40 +02:00
|
|
|
package_create("test_1_run", "run")
|
2006-06-08 00:19:42 +02:00
|
|
|
package.links = { "test_2_build" } -- This determines which project's executable to run
|
|
|
|
|
2006-06-07 05:02:20 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-10-17 03:11:12 +02:00
|
|
|
|
2006-06-02 06:13:37 +02:00
|
|
|
-- must come first, so that VC sets it as the default project and therefore
|
|
|
|
-- allows running via F5 without the "where is the EXE" dialog.
|
2006-06-02 06:07:18 +02:00
|
|
|
setup_main_exe()
|
2006-06-07 03:40:24 +02:00
|
|
|
|
|
|
|
-- save package global variable for later (will be overwritten by setup_all_libs)
|
|
|
|
main_exe_package = package
|
|
|
|
|
2006-06-02 06:13:37 +02:00
|
|
|
setup_all_libs()
|
2005-10-17 03:11:12 +02:00
|
|
|
|
2006-06-07 03:40:24 +02:00
|
|
|
-- HACK: add the static libs to the main EXE project. only now (after
|
|
|
|
-- setup_all_libs has run) are the lib names known. cannot move
|
|
|
|
-- setup_main_exe to run after setup_all_libs (see comment above).
|
|
|
|
-- we also don't want to hardcode the names - that would require more
|
|
|
|
-- work when changing the static lib breakdown.
|
|
|
|
listconcat(main_exe_package.links, static_lib_names)
|
|
|
|
|
2006-06-02 06:07:18 +02:00
|
|
|
if options["atlas"] then
|
2006-06-07 16:22:26 +02:00
|
|
|
setup_atlas_packages()
|
2006-06-07 03:40:24 +02:00
|
|
|
setup_atlas_frontends()
|
2005-01-28 18:37:21 +01:00
|
|
|
end
|
2006-06-07 05:02:20 +02:00
|
|
|
|
2006-12-06 01:06:05 +01:00
|
|
|
if options["collada"] then
|
|
|
|
setup_collada_packages()
|
|
|
|
end
|
|
|
|
|
2006-06-09 00:33:59 +02:00
|
|
|
if not options["without-tests"] then
|
|
|
|
setup_tests()
|
|
|
|
end
|