From bbb52f352c620fca3d8a62ca4cdee20dfff7b322 Mon Sep 17 00:00:00 2001 From: Carsten Hartenfels Date: Sun, 23 Jun 2019 13:24:06 +0200 Subject: [PATCH 1/5] Add missing struct headers to makefile.am --- makefile.am | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/makefile.am b/makefile.am index 546e67a..962e1d3 100644 --- a/makefile.am +++ b/makefile.am @@ -59,7 +59,9 @@ cglm_HEADERS = include/cglm/version.h \ include/cglm/sphere.h \ include/cglm/ease.h \ include/cglm/curve.h \ - include/cglm/bezier.h + include/cglm/bezier.h \ + include/cglm/types-struct.h \ + include/cglm/struct.h cglm_calldir=$(includedir)/cglm/call cglm_call_HEADERS = include/cglm/call/mat4.h \ From 99cff9e74ee7a8df785fd4c2a606c03de36d93c1 Mon Sep 17 00:00:00 2001 From: Carsten Hartenfels Date: Sun, 23 Jun 2019 13:25:29 +0200 Subject: [PATCH 2/5] Add pkg-config support --- .gitignore | 1 + cglm.pc.in | 11 +++++++++++ configure.ac | 6 +++++- makefile.am | 2 ++ 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 cglm.pc.in diff --git a/.gitignore b/.gitignore index 195a82c..0655cc2 100644 --- a/.gitignore +++ b/.gitignore @@ -70,3 +70,4 @@ win/x64 win/x85 win/Debug cglm-test-ios* +/cglm.pc diff --git a/cglm.pc.in b/cglm.pc.in new file mode 100644 index 0000000..b80b401 --- /dev/null +++ b/cglm.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: @PACKAGE_NAME@ +Description: OpenGL Mathematics (glm) for C +URL: https://github.com/recp/cglm +Version: @PACKAGE_VERSION@ +Cflags: -I${includedir} +Libs: -L${libdir} -lcglm @LIBS@ diff --git a/configure.ac b/configure.ac index 9a26778..8ee6f0d 100644 --- a/configure.ac +++ b/configure.ac @@ -14,6 +14,10 @@ AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR([src/]) AC_CONFIG_HEADERS([config.h]) +# Dependencies for pkg-config. +PKG_PROG_PKG_CONFIG +PKG_INSTALLDIR + # Checks for programs. AC_PROG_CC AM_PROG_CC_C_O @@ -53,6 +57,6 @@ AC_TYPE_UINT8_T # Checks for library functions. AC_FUNC_ERROR_AT_LINE -AC_CONFIG_FILES([makefile]) +AC_CONFIG_FILES([makefile cglm.pc]) AC_OUTPUT diff --git a/makefile.am b/makefile.am index 962e1d3..922aefe 100644 --- a/makefile.am +++ b/makefile.am @@ -154,6 +154,8 @@ test_tests_SOURCES=\ test/src/test_affine.c \ test/src/test_bezier.c +pkgconfig_DATA=cglm.pc + # When running configure with --prefix, $VPATH references # the source directory that post-build.sh is in. When not # using a prefix, $VPATH will be unset, so we need to fall From b231645131286c117a340f72a90f9054700a6455 Mon Sep 17 00:00:00 2001 From: Carsten Hartenfels Date: Sun, 23 Jun 2019 13:48:02 +0200 Subject: [PATCH 3/5] Capitalize Makefiles, sometimes matters on Linux Lowercased Makefiles don't get picked up by the .gitignore for example, which always looks odd after configuring. This commit just puts a capital 'M' in front, like it's common. --- makefile.am => Makefile.am | 0 configure.ac | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename makefile.am => Makefile.am (100%) diff --git a/makefile.am b/Makefile.am similarity index 100% rename from makefile.am rename to Makefile.am diff --git a/configure.ac b/configure.ac index 8ee6f0d..004d5bc 100644 --- a/configure.ac +++ b/configure.ac @@ -57,6 +57,6 @@ AC_TYPE_UINT8_T # Checks for library functions. AC_FUNC_ERROR_AT_LINE -AC_CONFIG_FILES([makefile cglm.pc]) +AC_CONFIG_FILES([Makefile cglm.pc]) AC_OUTPUT From caba5b3c7c1a5b95c516ba0d0d0c945fa9c98714 Mon Sep 17 00:00:00 2001 From: Carsten Hartenfels Date: Sun, 23 Jun 2019 14:04:34 +0200 Subject: [PATCH 4/5] Document pkg-config usage and prefix pitfalls --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 243d5f9..aedd43d 100644 --- a/README.md +++ b/README.md @@ -145,6 +145,17 @@ $ make check # [Optional] (if you run `sh ./build-deps.sh`) $ [sudo] make install ``` +This will also install pkg-config files so you can use +`pkg-config --cflags cglm` and `pkg-config --libs cglm` to retrieve compiler +and linker flags. + +The files will be installed into the given prefix (usually `/usr/local` by +default on Linux), but your pkg-config may not be configured to actually check +there. You can figure out where it's looking by running `pkg-config --variable +pc_path pkg-config` and change the path the files are installed to via +`./configure --with-pkgconfigdir=/your/path`. Alternatively, you can add the +prefix path to your `PKG_CONFIG_PATH` environment variable. + ### Windows (MSBuild) Windows related build files, project files are located in `win` folder, make sure you are inside `cglm/win` folder. From a651827012330560684e0eef89c0af7da795e072 Mon Sep 17 00:00:00 2001 From: Carsten Hartenfels Date: Sun, 23 Jun 2019 14:48:50 +0200 Subject: [PATCH 5/5] Make things work for ancient pkg-config versions Travis CI uses a really, really old pkg-config apparently, which doesn't have the PKG_INSTALLDIR macro. In that case, we have to emulate it manually. --- configure.ac | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 004d5bc..071ac47 100644 --- a/configure.ac +++ b/configure.ac @@ -16,7 +16,17 @@ AC_CONFIG_HEADERS([config.h]) # Dependencies for pkg-config. PKG_PROG_PKG_CONFIG -PKG_INSTALLDIR +# Ancient versions of pkg-config (such as the one used in Travis CI) +# don't have this macro, so we need to do it manually. +m4_ifdef([PKG_INSTALLDIR], [ + PKG_INSTALLDIR +], [ + AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], + [pkg-config installation directory ['${libdir}/pkgconfig']])],, + [with_pkgconfigdir=]'${libdir}/pkgconfig') + AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +]) # Checks for programs. AC_PROG_CC