update-workspaces.sh: generate atlas makefiles by default

*.lua: some extra libraries and options to make atlas work
premake:
- fixed #156 (creation of spurious dirs with strange permissions)
- implemented the "run" project kind to run the tests automatically
- changed the clean target for cxxtestgen projects to delete the
generated .cpp
files so that a make clean all actually regenerates the tests.

This was SVN commit r4639.
This commit is contained in:
Simon Brenner 2006-11-12 03:39:40 +00:00
parent 591f1f1232
commit 05c9525fdc
5 changed files with 64 additions and 35 deletions

View File

@ -45,6 +45,7 @@ libraries_dir = "../../../libraries/"
-- library installation rules.
extern_lib_defs = {
boost = {
unix_names = { "boost_signals" }
},
cxxtest = {
},
@ -55,6 +56,7 @@ extern_lib_defs = {
dbg_suffix = "",
},
devil = {
unix_names = { "IL", "ILU" },
},
directx = {
win_names = { "ddraw", "dsound" },
@ -89,11 +91,16 @@ extern_lib_defs = {
},
wxwidgets = {
add_func = function()
tinsert(package.includepaths, libraries_dir.."wxwidgets/include/msvc")
tinsert(package.includepaths, libraries_dir.."wxwidgets/include")
tinsert(package.libpaths, libraries_dir.."wxwidgets/lib/vc_lib")
package.config["Debug" ].links = { "wxmsw26ud_gl" }
package.config["Release"].links = { "wxmsw26u_gl" }
if OS == "windows" then
tinsert(package.includepaths, libraries_dir.."wxwidgets/include/msvc")
tinsert(package.includepaths, libraries_dir.."wxwidgets/include")
tinsert(package.libpaths, libraries_dir.."wxwidgets/lib/vc_lib")
package.config["Debug" ].links = { "wxmsw26ud_gl" }
package.config["Release"].links = { "wxmsw26u_gl" }
else
tinsert(package.buildoptions, "`wx-config --cxxflags`")
tinsert(package.linkoptions, "`wx-config --libs std,gl,ogl,media`")
end
end,
},
xerces = {

View File

@ -83,6 +83,13 @@ function package_set_build_flags()
-- non-IEEE-conformant results, but haven't noticed any trouble so far.
"-ffast-math",
}
package.includepaths = {
"/usr/X11R6/include/X11",
"/usr/include/X11",
}
package.libpaths = {
"/usr/X11R6/lib"
}
package.defines = {
"__STDC_VERSION__=199901L",
"CONFIG_USE_MMGR"
@ -102,6 +109,8 @@ function package_create(package_name, target_type)
package.name = package_name
package.kind = target_type
package.includepaths = {}
package_set_target(package_name)
package_set_build_flags()
@ -125,8 +134,6 @@ function package_add_contents(source_root, rel_source_dirs, rel_include_dirs, ex
package.trimprefix = source_root
package.files = sourcesfromdirs(source_root, rel_source_dirs)
package.includepaths = {}
-- Put the project-specific PCH directory at the start of the
-- include path, so '#include "precompiled.h"' will look in
-- there first
@ -322,17 +329,13 @@ function setup_all_libs ()
"directx"
}
setup_static_lib_package("lowlevel", source_dirs, extern_libs, {})
if OS == "windows" then
tinsert(package.files, sourcesfromdirs(source_root, {"lib/sysdep/win"}))
sysdep_dirs = {
linux = { "lib/sysdep/unix" },
-- note: RC file must be added to main_exe package.
elseif OS == "linux" then
tinsert(package.files, sourcesfromdirs(source_root, {"lib/sysdep/unix"}))
-- (X11 include path isn't standard across distributions)
tinsert(package.includepaths, "/usr/X11R6/include/X11" )
tinsert(package.includepaths, "/usr/include/X11" )
elseif OS == "macosx" then
tinsert(package.files, sourcesfromdirs(source_root, {"lib/sysdep/osx"}))
end
windows = { "lib/sysdep/win" },
macosx = { "lib/sysdep/osx" },
}
tinsert(package.files, sourcesfromdirs(source_root, sysdep_dirs[OS]));
end
@ -422,9 +425,6 @@ function setup_main_exe ()
package.config["Debug"].linkoptions = { "-rdynamic" }
package.config["Testing"].linkoptions = { "-rdynamic" }
tinsert(package.libpaths, "/usr/X11R6/lib")
elseif OS == "macosx" then
-- Libraries
tinsert(package.links, { -- Utilities
@ -478,7 +478,8 @@ local function setup_atlas_package(package_name, target_type, rel_source_dirs, r
end
else -- Non-Windows, = Unix
-- TODO
tinsert(package.buildoptions, "-rdynamic")
tinsert(package.linkoptions, "-rdynamic")
end
end
@ -492,7 +493,8 @@ function setup_atlas_packages()
""
},{ -- include
},{ -- extern_libs
"xerces"
"xerces",
"wxwidgets"
},{ -- extra_params
})
@ -526,7 +528,8 @@ function setup_atlas_packages()
"ScenarioEditor/Tools/Common"
},{ -- include
"..",
"CustomControls"
"CustomControls",
"Misc"
},{ -- extern_libs
"boost",
"devil",
@ -571,18 +574,22 @@ local function setup_atlas_frontend_package (package_name)
package.trimprefix = source_root
package.includepaths = { source_root .. ".." }
package_add_extern_libs(used_extern_libs)
-- Platform Specifics
if OS == "windows" then
tinsert(package.defines, "_UNICODE")
tinsert(package.links, "AtlasUI")
-- required to use WinMain() on Windows, otherwise will default to main()
tinsert(package.buildflags, "no-main")
else -- Non-Windows, = Unix
-- TODO
tinsert(package.links, "DatafileIO")
tinsert(package.links, "AtlasObject")
end
tinsert(package.links, "AtlasUI")
end
function setup_atlas_frontends()
@ -686,6 +693,7 @@ function setup_tests()
package.config["Testing"].linkoptions = { "-rdynamic" }
tinsert(package.includepaths, ".")
tinsert(package.libpaths, "/usr/X11R6/lib")
package.rootoptions = "--include=precompiled.h"

View File

@ -56,6 +56,8 @@ int gnu_cpp()
io_print("CxxTest Generator");
else if (prj_is_kind("lib"))
io_print("Static Library");
else if (prj_is_kind("run"))
io_print("Run Target");
io_print(" Makefile autogenerated by premake\n");
io_print("# Don't edit this file! Instead edit `premake.lua` then rerun `make`\n\n");
@ -157,6 +159,8 @@ int gnu_cpp()
io_print("ar -cr $(OUTDIR)/$(TARGET) $(OBJECTS); ranlib $(OUTDIR)/$(TARGET)");
else if (prj_is_kind("cxxtestgen"))
io_print("true");
else if (prj_is_kind("run"))
io_print("for a in $(LDDEPS); do echo Running $$a; $$a; done");
else
io_print("$(%s) -o $(OUTDIR)/$(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES)", prj_is_lang("c") ? "CC" : "CXX");
io_print("\n");
@ -211,7 +215,17 @@ int gnu_cpp()
}
io_print(": $(OBJECTS) $(LDDEPS) $(RESOURCES)\n");
if (!prj_is_kind("cxxtestgen"))
if (prj_is_kind("cxxtestgen"))
{
io_print("\t@%s --root", prj_get_cxxtestpath());
io_print(" %s ", prj_get_cxxtest_rootoptions());
io_print(" -o %s\n\n", prj_get_cxxtest_rootfile());
}
else if (prj_is_kind("run"))
{
io_print("\t%s$(BLDCMD)\n\n", prefix);
}
else
{
if (!g_verbose)
io_print("\t@echo Linking %s\n", prj_get_pkgname());
@ -222,12 +236,6 @@ int gnu_cpp()
io_print("\t-%sif [ ! -d $(OUTDIR)/$(MACAPP)/MacOS ]; then mkdir -p $(OUTDIR)/$(MACAPP)/MacOS; fi\n", prefix);
io_print("\t%s$(BLDCMD)\n\n", prefix);
}
else
{
io_print("\t@%s --root", prj_get_cxxtestpath());
io_print(" %s ", prj_get_cxxtest_rootoptions());
io_print(" -o %s\n\n", prj_get_cxxtest_rootfile());
}
/*
if (prj_is_kind("lib"))
@ -255,6 +263,8 @@ int gnu_cpp()
{
io_print("\t-%srm -rf $(OUTDIR)/$(TARGET).app $(OBJDIR)\n", prefix);
}
else if (prj_is_kind("cxxtestgen"))
io_print("\t-%srm -f $(OBJECTS)\n", prefix);
else
{
io_print("\t-%srm -rf $(OUTDIR)/$(TARGET) $(OBJDIR)\n", prefix);

View File

@ -120,14 +120,18 @@ int io_mkdir(const char* path)
while (path != NULL)
{
char* ptr = strchr(path, '/');
// If this is the first time through, we want to ignore a possible first
// slash (absolute path).
// If this is the N'th time around (N > 1), path will point to the slash
// that was found. Skip it.
char* ptr = strchr(path+1, '/');
if (ptr != NULL)
*ptr = '\0';
platform_mkdir(path);
platform_chdir(path);
path = (ptr != NULL) ? ptr + 1 : NULL;
path = ptr;
}
/* Restore the original working directory */

View File

@ -11,7 +11,7 @@ cd $premake_dir
# build/premake/
mkdir -p $workspace_dir
./premake --target gnu --outpath $workspace_dir
./premake --target gnu --outpath $workspace_dir --atlas $*
# These files need to be linked; premake makefiles assume that the
# lua file is accessible from the makefile directory