Removed the OSG_SYSTEM_SUPPORTED cmake var and added use of posix_spawn under Apple with C system function used elsewhere.
This commit is contained in:
parent
022d1df97d
commit
e49aaa9f2c
@ -480,7 +480,6 @@ OPTION(OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION "Set to ON to use the ref_ptr<
|
||||
OPTION(OSG_USE_REF_PTR_SAFE_DEREFERENCE "Set to ON to throw an exception whenever ref_ptr<> is dereferenced or called. " OFF)
|
||||
|
||||
OPTION(OSG_ENVVAR_SUPPORTED "Set to ON to build OpenSceneGraph with the OSG_ENVVAR_SUPPOERTED #define enabled to enable use of getenv() related functions." ON)
|
||||
OPTION(OSG_SYSTEM_SUPPORTED "Set to ON to build OpenSceneGraph with the OSG_SYSTEM_SUPPOERTED #define enabled to enable use of system() related functions." ON)
|
||||
|
||||
|
||||
|
||||
|
@ -35,6 +35,5 @@
|
||||
#cmakedefine OSG_PROVIDE_READFILE
|
||||
#cmakedefine OSG_USE_DEPRECATED_API
|
||||
#cmakedefine OSG_ENVVAR_SUPPORTED
|
||||
#cmakedefine OSG_SYSTEM_SUPPORTED
|
||||
|
||||
#endif
|
||||
|
@ -15,14 +15,29 @@
|
||||
|
||||
extern "C" {
|
||||
|
||||
#define USE_POSIX_SPAWN defined(__APPLE__)
|
||||
//#define USE_POSIX_SPAWN true
|
||||
|
||||
#if USE_POSIX_SPAWN
|
||||
|
||||
#include <spawn.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
int osg_system(const char* command)
|
||||
{
|
||||
pid_t pid;
|
||||
posix_spawn(&pid, command, NULL, NULL, NULL, NULL);
|
||||
return waitpid(pid, NULL, 0);
|
||||
}
|
||||
|
||||
#else // use tranditional C sysmtem call for osg_system implementation
|
||||
|
||||
int osg_system(const char* command)
|
||||
{
|
||||
#ifdef OSG_SYSTEM_SUPPORTED
|
||||
return system(command);
|
||||
#else
|
||||
printf("osg_system(%s) not supported.\n", command);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user