forked from ebertolazzi/Splines
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
executable file
·145 lines (117 loc) · 3.25 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
#
#
#
%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 "rake/clean"
require_relative "./Rakefile_common.rb"
CLEAN.include ["./**/*.o", "./**/*.obj", "./bin/**/example*", "./build"]
CLOBBER.include []
CLEAN.exclude('**/[cC][oO][rR][eE]')
file_base = File.expand_path(File.dirname(__FILE__)).to_s+'/lib'
cmd_cmake_build = ""
if COMPILE_EXECUTABLE then
cmd_cmake_build += ' -DBUILD_EXECUTABLE:VAR=true '
else
cmd_cmake_build += ' -DBUILD_EXECUTABLE:VAR=false '
end
if COMPILE_DYNAMIC then
cmd_cmake_build += ' -DBUILD_SHARED:VAR=true '
else
cmd_cmake_build += ' -DBUILD_SHARED:VAR=false '
end
if COMPILE_DEBUG then
cmd_cmake_build += ' -DCMAKE_BUILD_TYPE:VAR=Debug --loglevel=WARNING '
else
cmd_cmake_build += ' -DCMAKE_BUILD_TYPE:VAR=Release --loglevel=WARNING '
end
cmd_cmake_build += " -DINSTALL_HERE:VAR=true "
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'
desc "run tests"
task :run do
sh "./bin/test1"
sh "./bin/test2"
sh "./bin/test3"
sh "./bin/test4"
sh "./bin/test5"
sh "./bin/test6"
##sh "./bin/test7"
sh "./bin/test8"
sh "./bin/test9"
end
desc "run tests"
task :run_win do
sh "./bin/Release/test1"
sh "./bin/Release/test2"
sh "./bin/Release/test3"
sh "./bin/Release/test4"
sh "./bin/Release/test5"
sh "./bin/Release/test6"
##sh "./bin/Release/test7"
sh "./bin/Release/test8"
sh "./bin/Release/test9"
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
cmd_cmake = win_vs(args.bits,args.year) + cmd_cmake_build
puts "run CMAKE for SPLINES".yellow
sh cmd_cmake + ' ..'
puts "compile with CMAKE for SPLINES".yellow
if COMPILE_DEBUG then
sh 'cmake --build . --config Debug --target install '+PARALLEL+QUIET
else
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" )
dir = "build"
FileUtils.rm_rf dir
FileUtils.mkdir_p dir
FileUtils.cd dir
cmd_cmake = "cmake " + cmd_cmake_build
puts "run CMAKE for SPLINES".yellow
sh cmd_cmake + ' ..'
puts "compile with CMAKE for SPLINES".yellow
if COMPILE_DEBUG then
sh 'cmake --build . --config Debug --target install '+PARALLEL+QUIET
else
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
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