-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CMakeLists.txt #25
Conversation
This PR is ready for review. Some questions to the authors:
Thanks! |
Yes, this is pretty complicated. The requirements are:
That way we get something like There's a unix shell script Now, opusfile library code doesn't currently use the You can't call the unix shell script on Windows. I suggest copying |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can take a look next week. Do you need cmake_minimum_required(VERSION 3.16) ? (people with old linux distros always complain with high cmake versions :) ) |
I've only tested with CMake 3.16 (officially available on Ubuntu 20.04) and I know at least one feature (timestamping of Doxygen) which requires 3.16. But compatibility vs. modern features is always a hard question... In the book Professional CMake, the author says that it is preferred to not limit the project maintainers in functionality caused by old CMake versions but rather require users to download a more recent version of CMake themselves (which is very easy).
Done, version is retrieved via a CMake module taken from opus.
Done with changing behavior: The output paths change because I would like to use the official
Currently, there is no CMake find module for opus and ogg which means that the |
|
.gitlab-ci.yml
Outdated
apt-get install -y libopus-dev libogg-dev libssl-dev | ||
doxygen | ||
script: | ||
- wget https://cmake.org/files/v3.16/cmake-3.16.9-Linux-x86_64.tar.gz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding a CI config. That's nice to see, and these steps are green on our gitlab.
Pulling a binary like this is unfortunate. It makes the build description specific to x86_64-linux, so at the very least you need an arch-specific tag.
The gcc:9
container we use is based on debian:10
which has cmake 3.13.3, and is used by all our other gitlab ci jobs. Is that also too old? See, I'm already complaining about the aggressive cmake version. :)
There's a kitware/cmake
container feed on docker hub (just as huge as the gcc images!) but it seems to just be their internal ci runners, rather than something for external use. At least, I couldn't make sense of the versioning for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you mean with arch-specific tag. Could you elaborate on this?
I also found rikorose/gcc-cmake
, but it is third-party and I'm not sure if you want to rely on that.
Regarding the CMake version, see my comment below.
.travis.yml
Outdated
homebrew: | ||
brewfile: true | ||
|
||
env: PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/opt/openssl/lib/pkgconfig | ||
|
||
before_script: | ||
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then | ||
wget https://cmake.org/files/v3.16/cmake-3.16.9-Linux-x86_64.tar.gz; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use curl -O
here to avoid having to install wget
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
CMakeLists.txt
Outdated
@@ -52,6 +56,7 @@ target_link_libraries(opusfile | |||
PUBLIC | |||
Ogg::ogg | |||
Opus::opus | |||
$<$<BOOL:OP_HAVE_LIBM>:m> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$<$<BOOL:${OP_HAVE_LIBM}>:m>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
In theory it is correct. In practice version it is too high for some Linux distros. It's surprising to me that someone is using such old distros, but i have encountered similar reports on a regular basis. I could recommend to use more or less safe version (e.g. 3.6) and enable features depending on |
CMakeLists.txt
Outdated
include(CheckCSourceCompiles) | ||
cmake_push_check_state(RESET) | ||
if(WIN32) | ||
check_include_file("winsock2.h" OP_HAVE_WINSOCK2_H) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
winsock2 is from Win95 times, not sure it is required to check it today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to do a nearly exact port of the autoconf/autotools scripts. Since I don't have access to Windows please say more directly how we should proceed here. Should I just remove the check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
$<$<C_COMPILER_ID:MSVC>:/wd4267> | ||
$<$<C_COMPILER_ID:MSVC>:/wd4244> | ||
$<$<C_COMPILER_ID:MSVC>:/wd4090> | ||
$<$<C_COMPILER_ID:Clang,GNU>:-std=c89> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd propose to just omit that compiler flag because C_STANDARD
does not seem to support any value for C89. Maybe that is already default?
Testing and back-porting the CMake scripts is a lot of effort because
These points are also argued by CMake experts, saying that developers of CMake build systems should not try to support very old versions but rather require the version that they have developed on. Because of these reasons I would like to keep |
While I agree that it is good to have conservative build dependencies,
to help those that do not have luxury of trying the latest and less
tested versions of software, I thought it might be useful with a data
point on cmake versions in Debian. From
<URL: https://tracker.debian.org/pkg/cmake > it can be seen that
oldstable (9) is the version of Debian with cmake < 3.16. Stable and
newer have =< 3.16. Is it known which distributions and versions will
be locked out by depending on 3.16?
…--
Happy hacking
Petter Reinholdtsen
|
Thanks for working on this! It will make this library easier to use, especially on Windows. |
Ping |
CMakeLists.txt
Outdated
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" | ||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" | ||
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" | ||
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be ${CMAKE_INSTALL_INCLUDEDIR}/opus
?
https://packages.debian.org/sid/amd64/libopusfile-dev/filelist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it correct that we install in /usr/include/opus
instead of /usr/include/opusfile
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess so:
Line 7 in 5672864
opusincludedir = ${includedir}/opus |
And public include directory should be ${CMAKE_INSTALL_INCLUDEDIR}/include/opus
:
opusfile/examples/opusfile_example.c
Line 25 in 5672864
#include <opusfile.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. You wrote ${CMAKE_INSTALL_INCLUDEDIR}/include/opus
, I'am putting it in ${CMAKE_INSTALL_INCLUDEDIR}/opus
. I hope this is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you're right.
Hi, any news for this PR ? |
Merged upstream in cf218fb. Thanks! |
This PR adds CMake support for opusfile and opusurl. autoconf is untouched.
Fixes #15