1
0
forked from 0ad/0ad

premake: detect processor architecture from script

lib/sysdep: clean up by moving OS and cpu-arch folders into "os" and
"arch" folders

This was SVN commit r6162.
This commit is contained in:
janwas 2008-06-30 17:34:18 +00:00
parent 58407c7438
commit a3696c0b91
148 changed files with 79 additions and 58 deletions

View File

@ -8,6 +8,18 @@ addoption("without-pch", "Disable generation and usage of precompiled headers")
dofile("functions.lua")
dofile("extern_libs.lua")
-- detect CPU architecture (simplistic, currently only supports x86 and amd64
arch = "x86"
if OS == "windows" then
if os.getenv("PROCESSOR_ARCHITECTURE") == "amd64" or os.getenv("PROCESSOR_ARCHITEW6432") == "amd64" then
arch = "amd64"
end
else
if os.getenv("HOSTTYPE") == "x86_64" then
arch = "amd64"
end
end
-- Set up the Project
project.name = "pyrogenesis"
project.bindir = "../../binaries/system"
@ -432,13 +444,22 @@ function setup_all_libs ()
"valgrind"
}
-- CPU architecture-specific
if arch == "amd64" then
tinsert(source_dirs, "lib/sysdep/arch/amd64");
tinsert(source_dirs, "lib/sysdep/arch/x86_x64");
else
tinsert(source_dirs, "lib/sysdep/arch/ia32");
tinsert(source_dirs, "lib/sysdep/arch/x86_x64");
end
-- OS-specific
sysdep_dirs = {
linux = { "lib/sysdep/linux", "lib/sysdep/unix", "lib/sysdep/unix/x" },
linux = { "lib/sysdep/os/linux", "lib/sysdep/os/unix", "lib/sysdep/os/unix/x" },
-- note: RC file must be added to main_exe package.
-- note: don't add "lib/sysdep/win/aken.cpp" because that must be compiled with the DDK.
windows = { "lib/sysdep/win", "lib/sysdep/win/wposix", "lib/sysdep/win/whrt" },
macosx = { "lib/sysdep/osx", "lib/sysdep/unix" },
windows = { "lib/sysdep/os/win", "lib/sysdep/os/win/wposix", "lib/sysdep/os/win/whrt" },
macosx = { "lib/sysdep/os/osx", "lib/sysdep/os/unix" },
}
for i,v in sysdep_dirs[OS] do
tinsert(source_dirs, v);

View File

@ -12,7 +12,7 @@
#include "maths/MathUtil.h"
#include "graphics/SColor.h"
#include "lib/sysdep/x86_x64/x86_x64.h"
#include "lib/sysdep/arch/x86_x64/x86_x64.h"
static u32 fallback_ConvertRGBColorTo4ub(const RGBColor& src)
{

View File

@ -1,4 +1,4 @@
%include "../lib/sysdep/ia32/ia32.inc"
%include "../lib/sysdep/arch/ia32/ia32.inc"
;-------------------------------------------------------------------------------
; Color conversion (SSE)

View File

@ -12,7 +12,7 @@
#define ALIGNED_ALLOCATOR
#include "lib/bits.h" // round_up
#include "lib/sysdep/x86_x64/x86_x64.h" // x86_x64_L1CacheLineSize
#include "lib/sysdep/arch/x86_x64/x86_x64.h" // x86_x64_L1CacheLineSize
#include "lib/sysdep/rtl.h" // rtl_AllocateAligned

View File

@ -23,7 +23,7 @@
#include "lib/sysdep/sysdep.h"
#if OS_WIN
#include "lib/sysdep/win/wdbg_heap.h"
#include "lib/sysdep/os/win/wdbg_heap.h"
#endif

View File

@ -15,7 +15,7 @@
#include "lib/config2.h" // CONFIG2_WSDL
#if OS_WIN && CONFIG2_WSDL
# include "lib/sysdep/win/wsdl.h"
# include "lib/sysdep/os/win/wsdl.h"
#else
# include <SDL/SDL.h>

View File

@ -15,7 +15,7 @@
// wgl.h is a private header and should only be included from here.
// if this isn't defined, it'll complain.
#define WGL_HEADER_NEEDED
#include "lib/sysdep/win/wgl.h"
#include "lib/sysdep/os/win/wgl.h"
#endif

View File

@ -2,7 +2,7 @@
#include "posix.h"
#if ARCH_IA32
# include "lib/sysdep/ia32/ia32_asm.h"
# include "lib/sysdep/arch/ia32/ia32_asm.h"
#endif

View File

@ -47,7 +47,7 @@ need only be renamed (e.g. _open, _stat).
#include <cmath> // see isfinite comment below
#if OS_WIN
# include "lib/sysdep/win/wposix/wposix.h"
# include "lib/sysdep/os/win/wposix/wposix.h"
#endif
#include "posix_types.h"

View File

@ -4,7 +4,7 @@
#include <fcntl.h>
#if OS_WIN
# include "lib/sysdep/win/wposix/waio.h"
# include "lib/sysdep/os/win/wposix/waio.h"
#else
# include <aio.h>
#endif

View File

@ -1,5 +1,5 @@
#if OS_WIN
# include "lib/sysdep/win/wposix/wdlfcn.h"
# include "lib/sysdep/os/win/wposix/wdlfcn.h"
#else
# include <dlfcn.h>
#endif

View File

@ -1,5 +1,5 @@
#if OS_WIN
# include "lib/sysdep/win/wposix/werrno.h"
# include "lib/sysdep/os/win/wposix/werrno.h"
#else
# include <errno.h>
#endif

View File

@ -1,5 +1,5 @@
#if OS_WIN
# include "lib/sysdep/win/wposix/wfilesystem.h"
# include "lib/sysdep/os/win/wposix/wfilesystem.h"
#else
# include <sys/stat.h>
# include <sys/types.h>

View File

@ -1,5 +1,5 @@
#if OS_WIN
# include "lib/sysdep/win/wposix/wmman.h"
# include "lib/sysdep/os/win/wposix/wmman.h"
#else
# include <sys/mman.h>
#endif

View File

@ -1,5 +1,5 @@
#if OS_WIN
# include "lib/sysdep/win/wposix/wpthread.h"
# include "lib/sysdep/os/win/wposix/wpthread.h"
#else
# include <pthread.h>
# include <semaphore.h>

View File

@ -1,5 +1,5 @@
#if OS_WIN
# include "lib/sysdep/win/wposix/wsock.h"
# include "lib/sysdep/os/win/wposix/wsock.h"
#else
# include <sys/socket.h>
# include <netdb.h>

View File

@ -1,5 +1,5 @@
#if OS_WIN
# include "lib/sysdep/win/wposix/wterminal.h"
# include "lib/sysdep/os/win/wposix/wterminal.h"
#else
# include <sys/ioctl.h>
#endif

View File

@ -1,5 +1,5 @@
#if OS_WIN
# include "lib/sysdep/win/wposix/wtime.h"
# include "lib/sysdep/os/win/wposix/wtime.h"
#else
# include <sys/time.h>
#endif

View File

@ -19,7 +19,7 @@
#include <limits.h>
#if OS_WIN
# include "lib/sysdep/win/wposix/wposix_types.h"
# include "lib/sysdep/os/win/wposix/wposix_types.h"
#else
// unix/linux/glibc/gcc says that this macro has to be defined when including

View File

@ -1,5 +1,5 @@
#if OS_WIN
# include "lib/sysdep/win/wposix/wutsname.h"
# include "lib/sysdep/os/win/wposix/wutsname.h"
#else
# include <sys/utsname.h>
#endif

View File

@ -27,7 +27,7 @@ extern PIVFS g_VFS;
// for DLL-load hack in alc_init
#if OS_WIN
# include "lib/sysdep/win/win.h"
# include "lib/sysdep/os/win/win.h"
#endif
#include "lib/timer.h"

View File

@ -1,7 +1,7 @@
#include "precompiled.h"
#include "acpi.h"
#include "win/mahaf.h"
#include "lib/sysdep/os/win/mahaf.h"
#include "lib/sysdep/cpu.h"
#include "lib/module_init.h"

View File

@ -1,6 +1,6 @@
#include "lib/self_test.h"
#include "lib/sysdep/x86_x64/x86_x64.h"
#include "lib/sysdep/arch/x86_x64/x86_x64.h"
// note: ia32_i??_from_*, ia32_rint*, ia32_fm??f are all tested within
// sysdep to avoid test duplication (both the ia32 versions and

View File

@ -5,10 +5,10 @@
#include "lib/self_test.h"
#include "lib/sysdep/win/win.h" // HWND
#include "lib/sysdep/os/win/win.h" // HWND
#include "lib/debug.h" // no wdbg_sym interface needed
#include "lib/sysdep/sysdep.h"
#include "lib/sysdep/win/win.h"
#include "lib/sysdep/os/win/win.h"
#include <queue>
#include <deque>

View File

@ -1,5 +1,5 @@
#include "precompiled.h"
#include "../clipboard.h"
#include "lib/sysdep/clipboard.h"
#include "win.h"
#include "wutil.h"

View File

@ -1,5 +1,5 @@
#include "precompiled.h"
#include "../cursor.h"
#include "lib/sysdep/cursor.h"
#include "win.h"
#include "wutil.h"

View File

@ -1,7 +1,7 @@
#include "precompiled.h"
#include "wdbg_heap.h"
#include "lib/sysdep/win/win.h"
#include "lib/sysdep/os/win/win.h"
#include <crtdbg.h>
#include <excpt.h>
#include <dbghelp.h>

View File

@ -23,8 +23,8 @@
#include "lib/os_path.h"
#include "lib/path_util.h"
#if ARCH_IA32
# include "lib/sysdep/ia32/ia32.h"
# include "lib/sysdep/ia32/ia32_asm.h"
# include "lib/sysdep/arch/ia32/ia32.h"
# include "lib/sysdep/arch/ia32/ia32_asm.h"
#endif
#include "lib/external_libraries/dbghelp.h"
#include "winit.h"

View File

@ -11,8 +11,8 @@
#include "precompiled.h"
#include "hpet.h"
#include "lib/sysdep/win/win.h"
#include "lib/sysdep/win/mahaf.h"
#include "lib/sysdep/os/win/win.h"
#include "lib/sysdep/os/win/mahaf.h"
#include "lib/sysdep/acpi.h"
#include "lib/bits.h"

View File

@ -11,9 +11,9 @@
#include "precompiled.h"
#include "pmt.h"
#include "lib/sysdep/win/win.h"
#include "lib/sysdep/os/win/win.h"
#include "lib/sysdep/acpi.h"
#include "lib/sysdep/win/mahaf.h"
#include "lib/sysdep/os/win/mahaf.h"
#include "lib/bits.h"
#pragma pack(push,1)

View File

@ -12,8 +12,8 @@
#include "qpc.h"
#include "lib/sysdep/os_cpu.h"
#include "lib/sysdep/win/win.h"
#include "lib/sysdep/win/wutil.h" // wutil_argv
#include "lib/sysdep/os/win/win.h"
#include "lib/sysdep/os/win/wutil.h" // wutil_argv
#include "pit.h" // PIT_FREQ
#include "pmt.h" // PMT_FREQ

View File

@ -15,7 +15,7 @@
#include "precompiled.h"
#include "tgt.h"
#include "lib/sysdep/win/win.h"
#include "lib/sysdep/os/win/win.h"
#include <mmsystem.h>
#if MSC_VERSION

View File

@ -13,12 +13,12 @@
#include "lib/bits.h"
#include "lib/sysdep/os_cpu.h"
#include "lib/sysdep/win/win.h"
#include "lib/sysdep/win/wutil.h"
#include "lib/sysdep/os/win/win.h"
#include "lib/sysdep/os/win/wutil.h"
#if ARCH_IA32 || ARCH_AMD64
# include "lib/sysdep/x86_x64/x86_x64.h" // x86_x64_rdtsc
# include "lib/sysdep/x86_x64/topology.h"
# include "lib/sysdep/arch/x86_x64/x86_x64.h" // x86_x64_rdtsc
# include "lib/sysdep/arch/x86_x64/topology.h"
#endif

View File

@ -14,8 +14,8 @@
#include <process.h> // _beginthreadex
#include "lib/sysdep/cpu.h"
#include "lib/sysdep/win/win.h"
#include "lib/sysdep/win/winit.h"
#include "lib/sysdep/os/win/win.h"
#include "lib/sysdep/os/win/winit.h"
#include "lib/sysdep/acpi.h"
#include "lib/adts.h"
#include "lib/bits.h"

Some files were not shown because too many files have changed in this diff Show More