forked from conan-io/examples2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathci_test_example.py
More file actions
87 lines (76 loc) · 3.66 KB
/
ci_test_example.py
File metadata and controls
87 lines (76 loc) · 3.66 KB
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
import platform
from test.examples_tools import chdir, run
if platform.system() == "Windows":
# Build for Release and Debug with static libraries
run("conan install . --output-folder=build --build=missing -s build_type=Release")
with chdir("build"):
command = []
command.append("conanbuild.bat")
command.append("cmake .. -G \"Visual Studio 17 2022\" -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake")
command.append("deactivate_conanbuild.bat")
command.append("cmake --build . --config Release")
run(" && ".join(command))
cmd_out = run("Release\\compressor.exe")
assert "Release configuration!" in cmd_out
run("conan install . --output-folder=build --build=missing -s build_type=Debug")
with chdir("build"):
command.append("conanbuild.bat")
command.append("cmake .. -G \"Visual Studio 17 2022\" -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake")
command.append("deactivate_conanbuild.bat")
command.append("cmake --build . --config Debug")
run(" && ".join(command))
cmd_out = run("Debug\\compressor.exe")
assert "Debug configuration!" in cmd_out
# Build for Release with shared libraries
run("conan install . --output-folder=build --build=missing -s build_type=Release --options=zlib/1.3.1:shared=True")
with chdir("build"):
command = []
command.append("conanbuild.bat")
command.append("cmake .. -G \"Visual Studio 17 2022\" -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake")
command.append("deactivate_conanbuild.bat")
command.append("cmake --build . --config Release")
run(" && ".join(command))
command = []
command.append("conanrun.bat")
command.append("Release\\compressor.exe")
command.append("deactivate_conanrun.bat")
cmd_out = run(" && ".join(command))
assert "Release configuration!" in cmd_out
else:
run("conan install . --output-folder=build --build=missing -s build_type=Release")
with chdir("build"):
command = []
command.append(". ./conanbuild.sh")
command.append("cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release")
command.append(". ./deactivate_conanbuild.sh")
command.append("cmake --build .")
run(" && ".join(command))
cmd_out = run("./compressor")
assert "Release configuration!" in cmd_out
run("rm -rf build")
run("conan install . --output-folder=build --build=missing -s build_type=Debug")
with chdir("build"):
command = []
command.append(". ./conanbuild.sh")
command.append("cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Debug")
command.append(". ./deactivate_conanbuild.sh")
command.append("cmake --build .")
run(" && ".join(command))
cmd_out = run("./compressor")
assert "Debug configuration!" in cmd_out
# Build for Release with shared libraries
run("rm -rf build")
run("conan install . --output-folder=build --build=missing -s build_type=Release --options=zlib/1.3.1:shared=True")
with chdir("build"):
command = []
command.append(". ./conanbuild.sh")
command.append("cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release")
command.append(". ./deactivate_conanbuild.sh")
command.append("cmake --build .")
run(" && ".join(command))
command = []
command.append(". ./conanrun.sh")
command.append("./compressor")
command.append(". ./deactivate_conanrun.sh")
cmd_out = run(" && ".join(command))
assert "Release configuration!" in cmd_out