diff --git a/.circleci/config.yml b/.circleci/config.yml index 6ebdb31f64a9e..afd78b10a4ae1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -495,7 +495,8 @@ jobs: other.test_libc_progname other.test_realpath other.test_embed_file_dup - other.test_dot_a_all_contents_invalid" + other.test_dot_a_all_contents_invalid + other.test_pkg_config*" # Run a single websockify-based test to ensure it works on windows. - run-tests: test_targets: "sockets.test_nodejs_sockets_echo*" diff --git a/system/lib/pkgconfig/glfw3.pc b/system/lib/pkgconfig/glfw3.pc new file mode 100644 index 0000000000000..40bd617a609f7 --- /dev/null +++ b/system/lib/pkgconfig/glfw3.pc @@ -0,0 +1,4 @@ +Name: GLFW +Description: A multi-platform library for OpenGL, window and input +Version: 3.2.1 +Libs: -sUSE_GLFW=3 diff --git a/tests/cmake/find_pkg_config/CMakeLists.txt b/tests/cmake/find_pkg_config/CMakeLists.txt index d266f741f310e..ba1e665cc7c17 100644 --- a/tests/cmake/find_pkg_config/CMakeLists.txt +++ b/tests/cmake/find_pkg_config/CMakeLists.txt @@ -11,4 +11,5 @@ endif() message(STATUS "Check that all .pc files shipped with Emscripten can be located correctly") pkg_check_modules(EGL REQUIRED egl) pkg_check_modules(GLESV2 REQUIRED glesv2) -pkg_check_modules(SDL2 REQUIRED sdl) +pkg_check_modules(GLFW3 REQUIRED glfw3) +pkg_check_modules(SDL REQUIRED sdl) diff --git a/tests/test_other.py b/tests/test_other.py index 3b0f68cc4b772..18119746c7c8f 100644 --- a/tests/test_other.py +++ b/tests/test_other.py @@ -147,6 +147,21 @@ def decorated(self, *args, **kwargs): return decorated +def requires_pkg_config(func): + assert callable(func) + + @wraps(func) + def decorated(self, *args, **kwargs): + if not utils.which('pkg-config'): + if 'EMTEST_SKIP_PKG_CONFIG' in os.environ: + self.skipTest('test requires pkg-config and EMTEST_SKIP_PKG_CONFIG is set') + else: + self.fail('pkg-config is required to run this test') + return func(self, *args, **kwargs) + + return decorated + + class other(RunnerCore): def assertIsObjectFile(self, filename): self.assertTrue(building.is_wasm(filename)) @@ -816,14 +831,25 @@ def test_cmake_find_modules(self): self.assertContained('AL_VERSION: 1.1', output) self.assertContained('SDL version: 2.0.', output) + @requires_pkg_config def test_cmake_find_pkg_config(self): - if not utils.which('pkg-config'): - self.fail('pkg-config is required to run this test') out = self.run_process([EMCMAKE, 'cmake', test_file('cmake/find_pkg_config')], stdout=PIPE).stdout libdir = shared.Cache.get_sysroot_dir('local', 'lib', 'pkgconfig') libdir += os.path.pathsep + shared.Cache.get_sysroot_dir('lib', 'pkgconfig') self.assertContained('PKG_CONFIG_LIBDIR: ' + libdir, out) + @requires_pkg_config + def test_pkg_config_packages(self): + packages = [ + ('egl', '10.2.2'), + ('glesv2', '10.2.2'), + ('glfw3', '3.2.1'), + ('sdl', '1.2.15'), + ] + for package, version in packages: + out = self.run_process([emmake, 'pkg-config', '--modversion', package], stdout=PIPE).stdout + self.assertContained(version, out) + def test_system_include_paths(self): # Verify that all default include paths are within `emscripten/system`