1set cpu_cores $env(NUMBER_OF_PROCESSORS)
2if {$cpu_cores > 1} {
3	incr cpu_cores -1 ;# if more than 1 available, leave 1 for OS to run smoothly
4}
5puts "Using $cpu_cores CPU cores."
6
7if {![catch {exec where /q qmake}]} {
8	set QMAKE [exec where qmake]
9	puts "INFO: Qt's qmake found at $QMAKE"
10} else {
11	puts "ERROR: Cannot find Qt"
12	exit 1
13}
14puts "Using qmake: $QMAKE"
15
16if {![catch {exec where /q mingw32-make}]} {
17	set MAKE [exec where mingw32-make]
18	puts "INFO: MinGW32's make found in $MAKE"
19} else {
20	puts "ERROR: Cannot find MinGW32 \[mingw32-make.exe]"
21	exit 1
22}
23puts "Using make: $MAKE"
24
25set cdir [pwd]
26cd ../..
27set parent_dir [pwd]
28cd $cdir
29puts [pwd]
30
31set output "$parent_dir/output"
32
33file delete -force $output
34
35cd $parent_dir
36file mkdir output output/build output/build/Plugins
37
38proc dt {} {
39	return "\[[clock format [clock seconds] -format "%Y-%m-%d %H:%M:%S"]\]"
40}
41
42puts "[dt] Compiling core app."
43cd output/build
44exec $QMAKE ../../SQLiteStudio3
45catch {exec $MAKE -j $cpu_cores} res
46puts $res
47
48puts "[dt] Compiling plugins."
49cd Plugins
50exec $QMAKE ../../../Plugins
51catch {exec $MAKE -j $cpu_cores} res
52puts $res
53
54puts "[dt] Compilation finished."
55cd $cdir