architecture.include 1.82 KB
Newer Older
Jan Möbius's avatar
Jan Möbius committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14

################################################################################
# Architecture detection
# The following Variables are defined by this include:
# OPERATING_SYSTEM : Debian / Fedora / Windows
# ARCHITECTURE         : 32 / 64
# MODE                        : Debug / Release
# BUILDDIRECTORY     : Concat of all above variables sesparated by underscores e.g. Debian_64_debug
################################################################################

unix {
	
	OPERATING_SYSTEM = UNKNOWN_OS

Jan Möbius's avatar
Jan Möbius committed
15 16 17 18 19
	exists( /etc/lsb-release ) {
		OPERATING_SYSTEM = Ubuntu
	}


Jan Möbius's avatar
Jan Möbius committed
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
	exists( /etc/debian_version ) | exists( /etc/debian_release ) {
		OPERATING_SYSTEM = Debian
	}

	exists( /etc/fedora-release ) {
		OPERATING_SYSTEM = Fedora
	}

	exists( /etc/gentoo-release ) {
		OPERATING_SYSTEM = Gentoo
	}

	exists( /etc/lfs-release ) {
		OPERATING_SYSTEM = Linux_From_Scratch
	}

	exists( /etc/mandrake-release ) | exists( /etc/mandrakelinux-release ) {
		OPERATING_SYSTEM = Mandrake
	}

	exists( /etc/mandriva-release ) {
		OPERATING_SYSTEM = Mandriva
	}

	exists( /etc/redhat-release ) | exists( /etc/redhat_version ) {
		OPERATING_SYSTEM = Redhat
	}

	exists( /etc/SuSE-release ) | exists( /etc/novell-release ) {
		OPERATING_SYSTEM = SuSE
	}

	TEST_DARWIN = $$system(uname -s)
	contains( TEST_DARWIN, Darwin) {
		OPERATING_SYSTEM = Darwin
		DEFINES += ARCH_DARWIN
		export(DEFINES)
	}

	HARDWARE_PLATFORM = $$system(uname -a)
	contains( HARDWARE_PLATFORM, x86_64 ) {
		# 64-bit Linux
		ARCHITECTURE = 64
	} else {
		# 32-bit Linux
		ARCHITECTURE = 32
	}

	contains(TEST_DARWIN, Darwin) {
		SYSTEMTYPE = Darwin
	} else {
		SYSTEMTYPE = Linux
	}
}

win32 {
	OPERATING_SYSTEM = Windows
	ARCHITECTURE = 32
	SYSTEMTYPE = Windows
}

CONFIG( debug, debug|release ){
	MODE = Debug
} else {
	MODE = Release
}

BUILDDIRECTORY = $${OPERATING_SYSTEM}_$${ARCHITECTURE}_$${MODE}