blob: a60001039932307178566edefe1e98320bf81f12 [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001import os
2import subprocess
3import tempfile
4import unittest
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08005from oeqa.sdk.case import OESDKTestCase
6
7from oeqa.utils.subprocesstweak import errors_have_output
8errors_have_output()
9
10class BuildAssimp(OESDKTestCase):
11 """
12 Test case to build a project using cmake.
13 """
14
Brad Bishop19323692019-04-05 15:28:33 -040015 def setUp(self):
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080016 if not (self.tc.hasHostPackage("nativesdk-cmake") or
17 self.tc.hasHostPackage("cmake-native")):
18 raise unittest.SkipTest("Needs cmake")
19
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080020 def test_assimp(self):
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080021 with tempfile.TemporaryDirectory(prefix="assimp", dir=self.tc.sdk_dir) as testdir:
Brad Bishop19323692019-04-05 15:28:33 -040022 tarball = self.fetch(testdir, self.td["DL_DIR"], "https://github.com/assimp/assimp/archive/v4.1.0.tar.gz")
23
24 dirs = {}
25 dirs["source"] = os.path.join(testdir, "assimp-4.1.0")
26 dirs["build"] = os.path.join(testdir, "build")
27 dirs["install"] = os.path.join(testdir, "install")
28
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080029 subprocess.check_output(["tar", "xf", tarball, "-C", testdir])
Brad Bishop19323692019-04-05 15:28:33 -040030 self.assertTrue(os.path.isdir(dirs["source"]))
31 os.makedirs(dirs["build"])
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080032
Brad Bishop19323692019-04-05 15:28:33 -040033 self._run("cd {build} && cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON {source}".format(**dirs))
34 self._run("cmake --build {build} -- -j".format(**dirs))
35 self._run("cmake --build {build} --target install -- DESTDIR={install}".format(**dirs))
36 self.check_elf(os.path.join(dirs["install"], "usr", "local", "lib", "libassimp.so.4.1.0"))