-
Notifications
You must be signed in to change notification settings - Fork 861
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
Fix BSD Builds. Builds and the SRT library on FreeBSD-11, TrueOS-12, … #588
Conversation
…and OpenBSD-6.4 and my tests are working.
CMakeLists.txt
Outdated
@@ -77,6 +78,7 @@ endif() | |||
# options | |||
option(CYGWIN_USE_POSIX "Should the POSIX API be used for cygwin. Ignored if the system isn't cygwin." OFF) | |||
option(ENABLE_CXX11 "Should the c++11 parts (srt-live-transmit) be enabled" ON) | |||
option(DISABLE_SUPPORT_APPLICATIONS "Should the Support Applications be Disabled?" OFF) |
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.
In this system there's an enable/disable symmetry in configure
, therefore all boolean enabler options must have ENABLE_
prefix. Also, for options please use as short name as possible - ENABLE_APPS
should be enough.
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.
ENABLE_APPS
or ENABLE_SAMPLE_APPS
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.
Other parts of the code refers to them as support applications. Maybe there needs to be some consistency about what to call them. Either Sample Applications or Support Applications.
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.
Committed a change to use ENABLE_APPS
CMakeLists.txt
Outdated
endif() | ||
|
||
if ( ENABLE_CXX11 | ||
AND NOT DISABLE_SUPPORT_APPLICATIONS ) |
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.
For me this looks like two separate variables for the same purpose. My proposal is: make the ENABLE_CXX11
option control the other, and here only the other option shall be in the condition.
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.
@jlsantiago0
Modify line 248 (add set(ENABLE_APPS 0)
):
if (NOT ENABLE_CXX11)
set(ENABLE_APPS 0)
message(WARNING "Parts that require C++11 support will be disabled (srt-live-transmit)")
endif()
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.
It feels to me that using a variable ENABLE_CXX11 to determine select building of the sample/support applications is the problem. Not the ENABLE_APPS or ENABLE/DISABLE_SUPPORT/SAMPLE_APPLICATIONS/APPS. In otherwords the decision to ENABLE_APPS depends on ENABLE_CXX11, and then the guard to actually do the building of the applications should be using ENABLE_APPS or whatever.
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 just checked in a change to use the ENABLE_APPS as the guard to build the applications that is set to OFF when ENABLE_CXX11 is OFF.
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 agree that ENABLE_CXX11 is now redundant since enabling APPS or TESTS implicitly means CXX11. We should probably have a statement for backward compatibility where disabling CXX automatically means disabling APPS and TESTS, but, otherwise, ENABLE_CXX11 should not be used anywhere in the make logic.
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.
OK. I committed a change to resolve this issue.
srtcore/srt_compat.c
Outdated
@@ -22,7 +22,8 @@ written by | |||
#include <stdio.h> | |||
#include <errno.h> | |||
#if !defined(_WIN32) \ | |||
&& !defined(__MACH__) | |||
&& !defined(__MACH__) \ | |||
&& !(defined(__unix__) && defined(BSD)) |
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.
Well, isn't that kinda simpler - that is, Mac and Linux only?
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.
What about Solaris or other operating systems that do have features.h? There are more things in heaven and earth Horatio than fit into your philosphy. So maybe it can be simplified by checking for defined(__unix__)
and not defined(BSD)
for now. I assume OSX and its variants define(BSD)
? I dont know. There is probably a portable way to determine if features.h is available in the OS. But I dont know what that is.
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 commited a change to simplify this to check for __unix__
and not BSD
. BSD
seems to be defined on all the BSD derived OSes including OSX. I am not sure however whether that is the case for iOS, Watch, and AppleTV OSes tho. But I assume it is. Like for instance Android != linux, but does defined __unix__
and __linux__
. I tested and it builds correctly on OSX.
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.
Important thing for it is not that it should be enabled on every system that features features.h
, but to be enabled on every system where we want something specific from its features.h
. We might have some "sensible default portable" method for systems that this project wasn't tested against, but this should simply NOT try to include this file at all, even if it exists.
CMakeLists.txt
Outdated
@@ -24,6 +24,7 @@ include(CheckFunctionExists) | |||
# Platform shortcuts | |||
set_if(DARWIN ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") | |||
set_if(LINUX ${CMAKE_SYSTEM_NAME} MATCHES "Linux") | |||
set_if(BSD ${CMAKE_SYSTEM_NAME} MATCHES "[bB][sS][dD]$") |
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 know that CMake is poor as it comes to support case insensitive matching, but I really think this can be less clumsy:
string(TOLOWER ${CMAKE_SYSTEM_NAME} SYSNAME_LC)
set_if(BSD ${SYSNAME_LC} MATCHES "bsd$")
Similarly in line 702:
AND ${SYSNAME_LC} MATCHES "openbsd$"
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.
It seems clumsier to make a new variable. But I think that is just a measure of preference.
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 agree with @jlsantiago0 , single line statement, even with "[bB][sS][dD]$" in it, makes my mind twist less than tracing all that variable spaghetti.
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.
OK. I submitted a commit that uses a seperate variable for the lower case representation of the system name and use that for comparisons to support case variability.
I have one more question: I can see lots of places which are enabled under conditions of BTW. For the case when the apps have to be disabled per nonportable multicast entries, please make a separate issue for that. |
… shorten the variable name as requested.
…ystems, but not in BSD based ones.
I think that code can be changed to just check for |
Separate issue created #590 |
…n MATCHING the system name patterns so that we dont have to use regular expressions to handle case variability.
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.
Just leaving the links for possible future references.
Fix BSD Builds. Builds and the SRT library on FreeBSD-11, TrueOS-12, and OpenBSD-6.4 and my tests are working. NOTE: the support applications currently do not build on OpenBSD, but do on FreeBSD. I have not done a lot of testing. All testing was with my application and the library sending/receiving TS over SRT. With and without encryption was tested. This commit also adds the ability to disable the SUPPORT applications in the top level of the build. Added a CMAKE variable DISABLE_SUPPORT which is OFF by default. I have not tested DragonFlyBSD or NetBSD.