-
Notifications
You must be signed in to change notification settings - Fork 24
/
Rakefile
executable file
·83 lines (67 loc) · 2.16 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
if File.exist?(File.expand_path('./cmake_utils/Rakefile_common.rb', File.dirname(__FILE__))) then
require_relative "./cmake_utils/Rakefile_common.rb"
else
require_relative "../Rakefile_common.rb"
end
CLEAN.include ["./**/*.o", "./**/*.obj", "./bin/**/example*", "./build"]
CLEAN.clear_exclude.exclude { |fn| fn.pathmap("%f").downcase == "core" }
CLOBBER.include []
desc "compile for Visual Studio"
task :build_win do
# check architecture
case `where cl.exe`.chop
when /(x64|amd64)\\cl\.exe/
VS_ARCH = 'x64'
when /(bin|x86|amd32)\\cl\.exe/
VS_ARCH = 'x86'
else
raise RuntimeError, "Cannot determine architecture for Visual Studio".red
end
FileUtils.rm_rf "build"
FileUtils.mkdir_p "build"
FileUtils.cd "build"
puts "run CMAKE for SPLINES".yellow
sh "cmake -G Ninja -DBITS:VAR=#{VS_ARCH} " + cmd_cmake_build() + ' ..'
puts "compile with CMAKE for SPLINES".yellow
if COMPILE_DEBUG then
sh 'cmake --build . --config Debug --target install '+PARALLEL
else
sh 'cmake --build . --config Release --target install '+PARALLEL
end
FileUtils.cd '..'
end
desc "compile for OSX/LINUX/MINGW"
task :build_common do
FileUtils.rm_rf "build"
FileUtils.mkdir_p "build"
FileUtils.cd "build"
puts "run CMAKE for SPLINES".yellow
sh "cmake -G Ninja " + cmd_cmake_build() + ' ..'
puts "compile with CMAKE for SPLINES".yellow
if COMPILE_DEBUG then
sh 'cmake --build . --config Debug --target install '+PARALLEL
else
sh 'cmake --build . --config Release --target install '+PARALLEL
end
FileUtils.cd '..'
end
task :build_linux => :build_common do end
task :build_osx => :build_common do end
task :build_mingw => :build_common do end
task :clean_common do
FileUtils.rm_rf 'build'
FileUtils.rm_rf 'lib'
FileUtils.rm_rf 'lib3rd'
end
task :clean_osx => :clean_common do end
task :clean_linux => :clean_common do end
task :clean_mingw => :clean_common do end
task :clean_win => :clean_common do end
desc 'pack for OSX/LINUX/MINGW/WINDOWS'
task :cpack do
FileUtils.cd "build"
puts "run CPACK for SPLINES".yellow
sh 'cpack -C CPackConfig.cmake'
sh 'cpack -C CPackSourceConfig.cmake'
FileUtils.cd ".."
end