diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2019-06-06 21:55:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-06 21:55:55 +0300 |
commit | 266b297515f0e6d0e864564a2fc2f079e829a033 (patch) | |
tree | 79d0cacab38ea2919ee52786ac601aa7ba80fe10 /mesonbuild/wrap/wrap.py | |
parent | 7561926a70e1920c6ff8754ee1a66ab0bc3ff431 (diff) | |
parent | 9a9ea1434ab4d204d73503a61d5c1a044ce07366 (diff) | |
download | meson-266b297515f0e6d0e864564a2fc2f079e829a033.zip meson-266b297515f0e6d0e864564a2fc2f079e829a033.tar.gz meson-266b297515f0e6d0e864564a2fc2f079e829a033.tar.bz2 |
Merge pull request #4969 from mensinda/cmakeSubProject
CMake subprojects
Diffstat (limited to 'mesonbuild/wrap/wrap.py')
-rw-r--r-- | mesonbuild/wrap/wrap.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index 3eb68a7..55f86bc 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -111,7 +111,7 @@ class Resolver: self.subdir_root = subdir_root self.cachedir = os.path.join(self.subdir_root, 'packagecache') - def resolve(self, packagename): + def resolve(self, packagename: str, method: str): self.packagename = packagename self.directory = packagename # We always have to load the wrap file, if it exists, because it could @@ -123,9 +123,15 @@ class Resolver: raise WrapException('Directory key must be a name and not a path') self.dirname = os.path.join(self.subdir_root, self.directory) meson_file = os.path.join(self.dirname, 'meson.build') + cmake_file = os.path.join(self.dirname, 'CMakeLists.txt') + + if method not in ['meson', 'cmake']: + raise WrapException('Only the methods "meson" and "cmake" are supported') # The directory is there and has meson.build? Great, use it. - if os.path.exists(meson_file): + if method == 'meson' and os.path.exists(meson_file): + return self.directory + if method == 'cmake' and os.path.exists(cmake_file): return self.directory # Check if the subproject is a git submodule @@ -153,9 +159,11 @@ class Resolver: else: raise WrapException('Unknown wrap type {!r}'.format(self.wrap.type)) - # A meson.build file is required in the directory - if not os.path.exists(meson_file): + # A meson.build or CMakeLists.txt file is required in the directory + if method == 'meson' and not os.path.exists(meson_file): raise WrapException('Subproject exists but has no meson.build file') + if method == 'cmake' and not os.path.exists(cmake_file): + raise WrapException('Subproject exists but has no CMakeLists.txt file') return self.directory |