Hi Jim,

On Wed, Mar 24, 2010 at 4:59 PM, Robert Osfield
<[email protected]> wrote:
> The other possible solution might be to use the compilation of local
> source to see if the method is there.  I will now look into this...

I have just tested out the following:

CHECK_FUNCTION_EXISTS(pthread_setaffinity_np HAVE_PTHREAD_SETAFFINITY_NP)
IF(HAVE_PTHREAD_SETAFFINITY_NP)
  # double check that pthread_setaffinity_np is available as FreeBSD
header doesn't contain required function
  CHECK_CXX_SOURCE_COMPILES("
        #include <pthread.h>
        int main() {
        cpu_set_t cpumask;
        CPU_ZERO( &cpumask );
        CPU_SET( 0, &cpumask );
        pthread_setaffinity_np( pthread_self(), sizeof(cpumask), &cpumask);
        return 0;
        }" COMPILES_PTHREAD_SETAFFINITY_NP)

    IF (NOT COMPILES_PTHREAD_SETAFFINITY_NP)
        SET(HAVE_PTHREAD_SETAFFINITY_NP OFF)
    ENDIF()
ENDIF()

I tried out tweaking the source to compile/not compile and made sure
that the appropriate code paths are selected in the build of the
library.   I've only attempted to recreate what I expect you'll find
under FreeBSD, but my guess is that it should work as there is other
similar bits of script used in this CMakeLists.txt.  While this is
obviously a lot more long winded than a if FreeBSD check, it should at
least be a portable solution and if there comes a time when FreeBSD
does include the required functions in the main header it'll then
start working.

Could you do update to svn/trunk, remove your CMakeCache.txt and then
re-run "./configure" or "cmake ." and let me know how you get on.

Thanks,
Robert.
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to