-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathRakefile
executable file
·194 lines (163 loc) · 4.84 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
%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]
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" )
Rake::Task[:win_3rd].invoke(args.year,args.bits,args.lapack)
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 --loglevel=WARNING ..'
sh 'cmake --build . --config Debug --target install '+PARALLEL+QUIET
else
sh cmake_cmd + ' -DCMAKE_BUILD_TYPE:VAR=Release --loglevel=WARNING ..'
sh 'cmake --build . --config Release --target install '+PARALLEL+QUIET
end
FileUtils.cd '..'
end
desc "compile for OSX"
task :build, [:os] do |t, args|
args.with_defaults( :os => "osx" )
case args.os
when 'osx'
Rake::Task[:osx_3rd].invoke()
when 'linux'
Rake::Task[:linux_3rd].invoke()
end
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 .. ' #--loglevel=WARNING ..'
sh 'cmake --build . --config Debug --target install '+PARALLEL+QUIET
else
sh cmake_cmd + '-DCMAKE_BUILD_TYPE:VAR=Release .. ' #--loglevel=WARNING ..'
sh 'cmake --build . --config Release --target install '+PARALLEL+QUIET
end
FileUtils.cd '..'
end
desc "compile for LINUX"
task :build_linux do
Rake::Task[:build].invoke("linux")
end
desc "compile for OSX"
task :build_osx do
Rake::Task[:build].invoke("osx")
end
desc 'install third parties for osx'
task :osx_3rd do
FileUtils.rm_rf 'lib'
FileUtils.rm_rf 'lib3rd'
FileUtils.cp 'CMakeLists-cflags.txt', 'submodules/Utils/CMakeLists-cflags.txt'
FileUtils.cp 'CMakeLists-cflags.txt', 'submodules/quarticRootsFlocke/CMakeLists-cflags.txt'
FileUtils.cp 'CMakeLists-cflags.txt', 'submodules/GenericContainer/CMakeLists-cflags.txt'
FileUtils.cd 'submodules'
puts "\n\nSUBMODULES (for SPLINES)\n\n".green
sh "rake build_osx"
FileUtils.cd '..'
end
desc 'install third parties for linux'
task :linux_3rd do
FileUtils.rm_rf 'lib'
FileUtils.rm_rf 'lib3rd'
FileUtils.cp 'CMakeLists-cflags.txt', 'submodules/Utils/CMakeLists-cflags.txt'
FileUtils.cp 'CMakeLists-cflags.txt', 'submodules/quarticRootsFlocke/CMakeLists-cflags.txt'
FileUtils.cp 'CMakeLists-cflags.txt', 'submodules/GenericContainer/CMakeLists-cflags.txt'
FileUtils.cd 'submodules'
puts "\n\nSUBMODULES (for SPLINES)\n\n".green
sh "rake build_linux"
FileUtils.cd '..'
end
desc "compile for Visual Studio [default year=2017, bits=x64]"
task :win_3rd, [:year, :bits] do |t, args|
FileUtils.rm_rf 'lib'
FileUtils.rm_rf 'lib3rd'
FileUtils.cp 'CMakeLists-cflags.txt', 'submodules/Utils/CMakeLists-cflags.txt'
FileUtils.cp 'CMakeLists-cflags.txt', 'submodules/quarticRootsFlocke/CMakeLists-cflags.txt'
FileUtils.cp 'CMakeLists-cflags.txt', 'submodules/GenericContainer/CMakeLists-cflags.txt'
args.with_defaults( :year => "2017", :bits => "x64" )
FileUtils.cd 'submodules'
puts "\n\nSUBMODULES (for SPLINES)\n\n".green
sh "rake build_win[#{args.year},#{args.bits}]"
FileUtils.cd '..'
end
task :clean_osx do
FileUtils.rm_rf 'lib'
FileUtils.rm_rf 'lib3rd'
end
task :clean_linux do
FileUtils.rm_rf 'lib'
FileUtils.rm_rf 'lib3rd'
end
task :clean_win do
FileUtils.rm_rf 'lib'
FileUtils.rm_rf 'lib3rd'
end