-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathRakefile
executable file
·137 lines (112 loc) · 2.95 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
%w(colorize rake fileutils).each do |gem|
begin
require gem
rescue LoadError
warn "Install the #{gem} gem:\n $ (sudo) gem install #{gem}".magenta
exit 1
end
end
require_relative "./Rakefile_common.rb"
task :default => [:build]
task :mkl, [:year, :bits] do |t, args|
args.with_defaults(:year => "2017", :bits => "x64" )
sh "'C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/bin/compilervars.bat' -arch #{args.bits} vs#{args.year}shell"
end
TESTS = [
"testBiarc",
"testDistance",
"testG2",
"testG2plot",
"testG2stat",
"testG2stat2arc",
"testG2statCLC",
"testIntersect",
"testPolyline",
"testTriangle2D"
]
"run tests on linux/osx"
task :run do
TESTS.each do |cmd|
sh "./bin/#{cmd}"
end
end
desc "run tests (Release) on windows"
task :run_win do
TESTS.each do |cmd|
sh "bin\\Release\\#{cmd}.exe"
end
end
desc "run tests (Debug) on windows"
task :run_win_debug do
TESTS.each do |cmd|
sh "bin\\Debug\\#{cmd}.exe"
end
end
desc "compile for Visual Studio [default year=2017, bits=x64]"
task :build_win, [:year, :bits] do |t, args|
args.with_defaults( :year => "2017", :bits => "x64" )
dir = "vs_#{args.year}_#{args.bits}"
FileUtils.rm_rf dir
FileUtils.mkdir_p dir
FileUtils.cd dir
cmake_cmd = win_vs(args.bits,args.year)
if COMPILE_EXECUTABLE then
cmake_cmd += ' -DBUILD_EXECUTABLE:VAR=true '
else
cmake_cmd += ' -DBUILD_EXECUTABLE:VAR=false '
end
if COMPILE_DYNAMIC then
cmake_cmd += ' -DBUILD_SHARED:VAR=true '
else
cmake_cmd += ' -DBUILD_SHARED:VAR=false '
end
FileUtils.mkdir_p "../lib/lib"
FileUtils.mkdir_p "../lib/bin"
FileUtils.mkdir_p "../lib/bin/"+args.bits
FileUtils.mkdir_p "../lib/dll"
FileUtils.mkdir_p "../lib/include"
if COMPILE_DEBUG then
sh cmake_cmd + ' -DCMAKE_BUILD_TYPE:VAR=Debug ..'
sh 'cmake --build . --config Debug --target install '+PARALLEL
end
sh cmake_cmd + ' -DCMAKE_BUILD_TYPE:VAR=Release ..'
sh 'cmake --build . --config Release --target install '+PARALLEL
FileUtils.cd '..'
end
desc 'compile for OSX'
task :build_osx do
dir = "build"
FileUtils.rm_rf dir
FileUtils.mkdir_p dir
FileUtils.cd dir
cmake_cmd = 'cmake '
if COMPILE_EXECUTABLE then
cmake_cmd += ' -DBUILD_EXECUTABLE:VAR=true '
else
cmake_cmd += ' -DBUILD_EXECUTABLE:VAR=false '
end
if COMPILE_DYNAMIC then
cmake_cmd += ' -DBUILD_SHARED:VAR=true '
else
cmake_cmd += ' -DBUILD_SHARED:VAR=false '
end
if COMPILE_DEBUG then
sh cmake_cmd + ' -DCMAKE_BUILD_TYPE:VAR=Debug ..'
sh 'cmake --build . --config Debug --target install '+PARALLEL
end
sh cmake_cmd + ' -DCMAKE_BUILD_TYPE:VAR=Release ..'
sh 'cmake --build . --config Release --target install '+PARALLEL
FileUtils.cd '..'
end
desc 'compile for LINUX'
task :build_linux => [ :build_osx ] do
end
desc "clean for OSX"
task :clean_osx do
end
desc "clean for LINUX"
task :clean_linux do
end
desc "clean for WINDOWS"
task :clean_win do
end