-
Notifications
You must be signed in to change notification settings - Fork 160
/
premake5.lua
120 lines (104 loc) · 4.38 KB
/
premake5.lua
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
-- http://industriousone.com/scripting-reference
local action = _ACTION or ""
local OPENCV_PATH = "d:/opencv/build"
-- OPENCV_PATH = "d:/opencv4/build"
OPENCV_VER = 666
solution "opencv-cookbook"
location (action)
configurations { "Debug", "Release" }
platforms {"x64"}
language "C++"
os.mkdir("bin")
targetdir ("bin")
-- TODO: it's ugly but it works
if os.isfile(path.join(OPENCV_PATH, "x64/vc14/bin/opencv_world330.dll")) then
OPENCV_VER = 330
elseif os.isfile(path.join(OPENCV_PATH, "x64/vc14/bin/opencv_world331.dll")) then
OPENCV_VER = 331
elseif os.isfile(path.join(OPENCV_PATH, "x64/vc14/bin/opencv_world340.dll")) then
OPENCV_VER = 340
elseif os.isfile(path.join(OPENCV_PATH, "x64/vc14/bin/opencv_world341.dll")) then
OPENCV_VER = 341
elseif os.isfile(path.join(OPENCV_PATH, "x64/vc14/bin/opencv_world342.dll")) then
OPENCV_VER = 342
elseif os.isfile(path.join(OPENCV_PATH, "x64/vc14/bin/opencv_world343.dll")) then
OPENCV_VER = 343
elseif os.isfile(path.join(OPENCV_PATH, "x64/vc14/bin/opencv_world400.dll")) then
OPENCV_VER = 400
end
filter "action:vs*"
defines { "_CRT_SECURE_NO_WARNINGS" }
if not os.isfile("bin/opencv_world" .. OPENCV_VER .. "d.dll") then
os.copyfile(path.join(OPENCV_PATH, "x64/vc14/bin/opencv_world" .. OPENCV_VER .. "d.dll"), "bin/opencv_world" .. OPENCV_VER .. "d.dll")
os.copyfile(path.join(OPENCV_PATH, "x64/vc14/bin/opencv_world" .. OPENCV_VER .. ".dll"), "bin/opencv_world" .. OPENCV_VER .. ".dll")
os.copyfile(path.join(OPENCV_PATH, "x64/vc14/bin/opencv_ffmpeg" .. OPENCV_VER .. "_64.dll"), "bin/opencv_ffmpeg" .. OPENCV_VER .. "_64.dll")
end
filter "system:macosx"
defines {
"_MACOSX",
}
configuration "Debug"
defines { "DEBUG" }
symbols "On"
targetsuffix "-d"
configuration "Release"
defines { "NDEBUG" }
flags { "No64BitChecks" }
editandcontinue "Off"
optimize "Speed"
optimize "On"
editandcontinue "Off"
function create_example_project( example )
local proj = example[1]
project (proj)
kind "ConsoleApp"
files {
{table.unpack(example, 2, 8)}
}
includedirs {
path.join(OPENCV_PATH, "include")
}
libdirs {
path.join(OPENCV_PATH, "x64/vc14/lib"),
}
configuration "Debug"
links {
"opencv_world" .. OPENCV_VER .. "d",
}
configuration "Release"
links {
"opencv_world".. OPENCV_VER,
}
end
local examples = {
{"01-main1", "Chapter 01/main1.cpp"},
{"01-main2", "Chapter 01/main2.cpp"},
{"02-addImages", "Chapter 02/addImages.cpp"},
{"02-colorReduce", "Chapter 02/colorReduce.cpp"},
{"02-contrast", "Chapter 02/contrast.cpp"},
{"02-saltImage", "Chapter 02/saltImage.cpp"},
{"03-colorDetection", "Chapter 03/colorDetection.cpp", "Chapter 03/colordetector.cpp"},
{"04-finder", "Chapter 04/finder.cpp"},
{"04-histograms", "Chapter 04/histograms.cpp"},
{"04-objectfinder", "Chapter 04/objectfinder.cpp"},
{"04-retrieve", "Chapter 04/retrieve.cpp"},
{"05-morpho2", "Chapter 05/morpho2.cpp"},
{"05-morphology", "Chapter 05/morphology.cpp"},
{"05-segment", "Chapter 05/segment.cpp"},
{"06-derivatives", "Chapter 06/derivatives.cpp"},
{"06-filters", "Chapter 06/filters.cpp"},
{"07-blobs", "Chapter 07/blobs.cpp"},
{"07-contours", "Chapter 07/contours.cpp"},
{"08-interestPoints", "Chapter 08/interestPoints.cpp"},
{"08-tracking", "Chapter 08/tracking.cpp"},
{"09-calibrate", "Chapter 09/calibrate.cpp", "Chapter 09/CameraCalibrator.cpp"},
{"09-estimateF", "Chapter 09/estimateF.cpp"},
{"09-estimateH", "Chapter 09/estimateH.cpp"},
{"09-robustmatching", "Chapter 09/robustmatching.cpp"},
{"10-foreground", "Chapter 10/foreground.cpp"},
{"10-tracking", "Chapter 10/tracking.cpp"},
{"10-videoprocessing", "Chapter 10/videoprocessing.cpp"},
}
for _, example in ipairs(examples) do
create_example_project(example)
end