Comments (9)
I pushed a trial as feature/pkgconfig branch. New CMake file in this trial will generate a pc file for each target. Also, you can specify a representative target with PKG_CONFIG_REPRESENTATIVE_TARGET option to use with glew
name.
I'm not familiar with pkg-config. So, I don't guarantee it works correctly. Before merging it to master, Could you test it?
from glew-cmake.
I found -llibglew.so
is a portable way to link with a specific name. But it seems not working. Without using a specific name for linking, I can't handle name collision - liblgew.a with libglew.so. So, I give up to provide pc files for all targets. Make it generate the only glew.pc.
About GLU, I didn't notice it should be a PUBLIC definition. I moved it to PRIVATE definitions. Now it will propagate to other targets link to glew when USE_GLU is set, Or cmake checks the GLU exists when USE_GLU is not set.
glew.pc - single context, static, no_glu
prefix=/usr/local
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include
Name: glew
Description: The OpenGL Extension Wrangler library
Version: 2.2.0
Cflags: -I${includedir} -DGLEW_STATIC -DGLEW_NO_GLU
Libs: -L${libdir} -lglew -lGL -lX11 -ldl -lXext
from glew-cmake.
Works fine here 👍 so closed by these additions https://github.com/Perlmint/glew-cmake/tree/feature/pkgconfig
it would be cool if you would draft a v2.2 RC2 release with fixed pkgconfig 🥇
from glew-cmake.
EDIT: it builds with -D ONLY_LIBS=ON
https://pastebin.com/8ateLtj6 but the path for the pkgconfig files is wrong:
Installing: /home/supervisedthinking/git/libreelec-rr/LibreELEC.tv/build.LibreELEC-Generic.x86_64-9.80-devel/.sysroot/glew-cmake.target/pkgconfig/glew_shared.pc
I guess you missed /usr/lib
as in:
Installing: /home/supervisedthinking/git/libreelec-rr/LibreELEC.tv/build.LibreELEC-Generic.x86_64-9.80-devel/.sysroot/glew-cmake.target/usr/lib/libglew.so.2.2.0
I guess this is the reason https://github.com/Perlmint/glew-cmake/blob/feature/pkgconfig/GeneratePkgConfig.cmake#L6 and you need to add something like https://git.codingcafe.org/Mirrors/google/glog/blob/5c576f78c49b28d89b23fbb1fc80f54c879ec02e/CMakeLists.txt#L511
I added this patch & it stores the .pc file in the correct directory:
--- a/GeneratePkgConfig.cmake
+++ b/GeneratePkgConfig.cmake
@@ -3,7 +3,7 @@
if(WIN32)
set(PKGCONFIG_INSTALL_DIR)
else()
- set(PKGCONFIG_INSTALL_DIR ${_glog_CMake_LIBDIR}/pkgconfig)
+ set(PKGCONFIG_INSTALL_DIR lib/pkgconfig)
endif()
if(pc_NAME)
set(name ${pc_NAME})
But your config generates a glew_shared.pc
which should probably be glew.pc
same as it's still libglew.so
which other programs & the linker will look for. And about the content:
prefix=/usr
exec_prefix=${prefix}
libdir=${prefix}/
includedir=${prefix}/include
Name: glew_shared
Description: The OpenGL Extension Wrangler library - shared, single context
Version: 2.2.0
Cflags: -I${includedir} -DGLEW_BUILD
Libs: -L${libdir} -llibglew_shared -lGL -lX11 -ldl -lXext
libdir=${prefix}/
should probably point to libdir=${prefix}/lib
because otherwhise it would look in /usr
for libs which is quite wrong. The Name:
should probably be Name: glew
too? https://github.com/Perlmint/glew-cmake/blob/master/glew.pc.in#L6
Maybe this could be helpful for you? This is the way how FluidSynth handles it:
https://github.com/FluidSynth/fluidsynth/blob/master/CMakeLists.txt#L734-L750
from glew-cmake.
Thanks for detail comment! 👍
I have a question.
Has Name
in pkg-config a special behaviour? If it is just an identifier - have no change in pkg-config behaviour, I think keeping them - 4 targets be built - different can be useful.
Also, I fixed you commented.
Here is a generated glew.pc with PKG_CONFIG_REPRESENTATIVE_TARGET=libglew_static
prefix=/usr/local
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include
Name: glew
Description: The OpenGL Extension Wrangler library
Version: 2.2.0
Cflags: -I${includedir} -DGLEW_STATIC
Libs: -L${libdir} -llibglew.a -lGL -lX11 -ldl -lXext
from glew-cmake.
According too https://people.freedesktop.org/~dbn/pkg-config-guide.html
Name: A human-readable name for the library or package. This does not affect usage of the pkg-config tool, which uses the name of the .pc file.
so I guess it's fine if you use a custom name too 👍
I'll test it later then and see if I run into any issues.
EDIT:
After compiling it installs:
Installing: /home/supervisedthinking/git/libreelec-rr/LibreELEC.tv/build.LibreELEC-Generic.x86_64-9.80-devel/.sysroot/glew-cmake.target/usr/lib/pkgconfig/glew_shared.pc
-- Installing: /home/supervisedthinking/git/libreelec-rr/LibreELEC.tv/build.LibreELEC-Generic.x86_64-9.80-devel/.sysroot/glew-cmake.target/usr/lib/pkgconfig/glew.pc
but I guess glew_shared.pc
is superflous because there is no libglew_shared.so
.
The generated glew.pc
contains this line:
Libs: -L${libdir} -llibglew.so -lGL -lX11 -ldl -lXext
it should not be -llibglew.so
but Libs: -L${libdir} -lglew -lGL -lX11 -ldl -lXext
after this change https://github.com/freedesktop/mesa-demos build fine.
Buildlog:
https://pastebin.com/JS8QyLTM
When I don't use -D ONLY_LIBS=ON
then I end up with:
FAILED: bin/visualinfo
: && /home/supervisedthinking/git/libreelec-rr/LibreELEC.tv/build.LibreELEC-Generic.x86_64-9.80-devel/toolchain/bin/x86_64-libreelec-linux-gnu-gcc -march=x86-64 -m64 -mmmx -msse -msse2 -mfpmath=sse -fomit-frame-pointer -Wall -pipe -O2 -O3 -DNDEBUG -march=x86-64 -m64 -Wl,--as-needed -fuse-ld=gold -rdynamic CMakeFiles/visualinfo.dir/src/visualinfo.c.o -o bin/visualinfo -Wl,-rpath,/home/supervisedthinking/git/libreelec-rr/LibreELEC.tv/build.LibreELEC-Generic.x86_64-9.80-devel/glew-cmake-ba9e32c7fa5e7a7e38f51aad42ba3fe7de8364f8/.x86_64-libreelec-linux-gnu/lib: lib/libglew.so.2.2.0 -lGL -lX11 -ldl -lXext && :
CMakeFiles/visualinfo.dir/src/visualinfo.c.o:visualinfo.c:function main: error: undefined reference to 'gluGetString'
CMakeFiles/visualinfo.dir/src/visualinfo.c.o:visualinfo.c:function main: error: undefined reference to 'gluGetString'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
So I guess it fails because of this:
#ifndef GLEW_NO_GLU
/* GLU extensions */
fprintf(file, "GLU version string: %s\n", gluGetString(GLU_VERSION));
fprintf(file, "GLU extensions (GLU_): \n");
PrintExtensions((const char*)gluGetString(GLU_EXTENSIONS));
#endif
https://github.com/Perlmint/glew-cmake/blob/feature/pkgconfig/src/visualinfo.c#L183-L188
I guess this doesn't work fine?
https://github.com/Perlmint/glew-cmake/blob/feature/pkgconfig/CMakeLists.txt#L18 because you handled the definitions different in the past https://github.com/Perlmint/glew-cmake/blob/glew-cmake-release/CMakeLists.txt#L28-L30
I tried to add CFLAGS+=" -DGLEW_NO_GLU"
but this did not work too. So I guess when visualinfo is compiled it doesn't respect these flags.
Buildlog:
https://pastebin.com/uDLRCMyZ
from glew-cmake.
I made some tests and lgtm. I'll start a clean build and see if I run into any issues.
Afaik it's either -L${libdir} libglew.so
or -L${libdir} -lglew
if you want to link specific libs so if you would have dropped -l it could probably work. But IMHO this is a job for the linker which should deal with this. If you want to add custom libs you could always add LDFLAGS
in your project.
from glew-cmake.
feature/pkgconfig branch is not found.
I installed pkg-config by choco
. The pkg-config
command cannot recognize the pc.in
file.
from glew-cmake.
@cnDelbert feature/pkgconfig
branch was merged into master
branch. Also, pkg-config does not use .pc.in
file. it is a template to generate .pc
file. Also, .pc.in
file is not used in glew-cmake. It is used in original glew.
If you want to use glew-cmake with pkg-config, please build it and install it with CMake command (use CMakeLists.txt
in the root of this repository).
from glew-cmake.
Related Issues (20)
- Warning: Compatibility with CMake < 2.8.12 will be removed from a future version of CMake. HOT 1
- Missing file HOT 4
- config/version is missing in v2.2.0 HOT 1
- libglew instead of libGLEW / add symlink HOT 2
- cmake: "install TARGETS given no LIBRARY DESTINATION for shared library target" on LINUX HOT 5
- set a cmake policy HOT 1
- Error including OpenGL/X11 libraries on CMake when USE_NAMESPACED_LIB not defined HOT 2
- Compilation error on macOS regarding symlinks HOT 2
- glew not building as a submodule HOT 2
- glew native target coherency HOT 2
- Undefined Reference Error while building using CMake HOT 4
- Maybe update readme.md to apply to this repo. :) HOT 5
- Using eglew.h yields missing headers HOT 1
- Due for a refresh from upstream? HOT 2
- The FindGLEW CMake module can't find libraries HOT 2
- Symlink issue when building on WSL mounted drives HOT 1
- install FILES given no DESTINATION! : on WINDOWS HOT 1
- How to build static library? HOT 2
- How to use EGLEW in Linux ? HOT 2
- Having trouble with linking glew-cmake\bin\glew-sharedd.dll HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from glew-cmake.