Skip to content

WIP: enable FreeBSD build

username-removed-195241 requested to merge illwieckz/netradiant:freebsd into master

I've put the WIP flag because some implementation details do not make me happy and I'm looking for help to find cleaner solutions, otherwise it works:

NetRadiant on FreeBSD

What does not makes me happy first is I just commented out some redundant definitions in vector: do not redefine lrint on FreeBSD commit, this code was just doing “if freebsd, redefines lrint and llrint”, but it was leading to a definition mismatch, and these stuff is already defined so this code just seems useless.

#if defined ( _MSC_VER )

#elif defined( __FreeBSD__ )

/* do NOT redefine that!
inline long lrint( double f ){
	return static_cast<long>( f + 0.5 );
}

inline long long llrint( double f ){
	return static_cast<long long>( f + 0.5 );
}
*/

#elif defined( __GNUC__ )

The second thing that does not make me happy is the way I discovered cmake fails to add -L/usr/local/lib on FreeBSD even if pkg-config provides it:

[illwieckz@freebsd:~/dev/netradiant/build] freebsd ± pkg-config --libs glib-2.0
-L/usr/local/lib -lglib-2.0 -lintl 

So my cmake: add quick and dirty -L/usr/local/lib on FreeBSD commit just adds this code in CMakeLists.txt:

IF(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
    link_directories(
            /usr/local/lib
    )
endif ()

It works but it's a bit ugly, I'm looking for help to find a better solution (based on pkg-config for example).

Also, this branch is a child of that other gcc8 branch (see !74) because the provided fix is also needed for clang 4.0 on FreeBSD.

Merge request reports