build fix for BSD systems

This commit is contained in:
David Carlier
2017-04-14 20:43:45 +01:00
parent 874d02d7aa
commit 756568ad9c
12 changed files with 29 additions and 33 deletions

View File

@@ -84,7 +84,7 @@ ELSE(WIN32)
ADD_DEFINITIONS("-DGLEW_STATIC")
ADD_DEFINITIONS("-DGLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS=1")
LINK_LIBRARIES( pthread dl )
LINK_LIBRARIES( pthread ${DL} )
ENDIF(APPLE)
ENDIF(WIN32)

View File

@@ -1,5 +1,16 @@
SUBDIRS( HelloWorld BasicDemo )
IF(BUILD_BULLET3)
SET(DL dl)
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
SET(OSDEF -D_LINUX)
ELSE(CMAKE_SYSTEM_NAME MATCHES "Linux")
IF(APPLE)
SET(OSDEF -D_DARWIN)
ELSE(APPLE)
SET(OSDEF -D_BSD)
SET(DL "")
ENDIF(APPLE)
ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
SUBDIRS( ExampleBrowser RobotSimulator SharedMemory ThirdPartyLibs/Gwen ThirdPartyLibs/BussIK ThirdPartyLibs/clsocket OpenGLWindow )
ENDIF()
IF(BUILD_PYBULLET)

View File

@@ -65,7 +65,7 @@ IF (BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES(
BulletExampleBrowserLib Bullet3Common BulletSoftBody BulletDynamics BulletCollision BulletInverseDynamicsUtils
BulletInverseDynamics LinearMath OpenGLWindow gwen BussIK
pthread dl
pthread ${DL}
)
ENDIF(APPLE)
ENDIF(WIN32)
@@ -106,7 +106,7 @@ ELSE(WIN32)
ADD_DEFINITIONS("-DGLEW_STATIC")
ADD_DEFINITIONS("-DGLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS=1")
INCLUDE_DIRECTORIES( ${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/Glew )
LINK_LIBRARIES( pthread dl)
LINK_LIBRARIES( pthread ${DL})
ENDIF(APPLE)
ENDIF(WIN32)

View File

@@ -61,7 +61,7 @@ if (BUILD_SHARED_LIBS)
else()
set (CMAKE_THREAD_PREFER_PTHREAD TRUE)
FIND_PACKAGE(Threads)
target_link_libraries(OpenGLWindow dl ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(OpenGLWindow ${DL} ${CMAKE_THREAD_LIBS_INIT})
endif()
endif()

View File

@@ -99,11 +99,7 @@ ELSE(WIN32)
ENDIF(BUILD_ENET)
IF(BUILD_CLSOCKET)
IF(APPLE)
ADD_DEFINITIONS(-D_DARWIN)
ELSE()
ADD_DEFINITIONS(-D_LINUX)
ENDIF()
ADD_DEFINITIONS(${OSDEF})
ENDIF(BUILD_CLSOCKET)
ENDIF(WIN32)
@@ -160,7 +156,7 @@ ELSE(WIN32)
ADD_DEFINITIONS("-DGLEW_STATIC")
ADD_DEFINITIONS("-DGLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS=1")
LINK_LIBRARIES( pthread dl )
LINK_LIBRARIES( pthread ${DL} )
ENDIF(APPLE)
ENDIF(WIN32)

View File

@@ -114,7 +114,7 @@ ELSE(WIN32)
)
ELSE(APPLE)
LINK_LIBRARIES( pthread dl )
LINK_LIBRARIES( pthread ${DL} )
ADD_EXECUTABLE(App_PhysicsServer_SharedMemory
${SharedMemory_SRCS}
../MultiThreading/b3PosixThreadSupport.cpp
@@ -181,7 +181,7 @@ ELSE(WIN32)
)
ELSE(APPLE)
LINK_LIBRARIES( pthread dl )
LINK_LIBRARIES( pthread ${DL} )
ADD_DEFINITIONS("-DGLEW_INIT_OPENGL11_FUNCTIONS=1")
ADD_DEFINITIONS("-DGLEW_STATIC")
ADD_DEFINITIONS("-DGLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS=1")

View File

@@ -37,7 +37,7 @@ ELSE(WIN32)
ADD_DEFINITIONS("-DGLEW_STATIC")
ADD_DEFINITIONS("-DGLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS=1")
LINK_LIBRARIES( X11 pthread dl Xext)
LINK_LIBRARIES( X11 pthread ${DL} Xext)
ENDIF(APPLE)
ENDIF(WIN32)

View File

@@ -4,7 +4,7 @@
#define GWEN_MACROS_H
#include <stdlib.h>
#include <stdarg.h>
#ifndef __APPLE__
#if !defined(__APPLE__) && !defined(__OpenBSD__)
#include <malloc.h>
#endif //__APPLE__
#include <memory.h>
@@ -38,7 +38,7 @@
#define GwenUtil_OutputDebugWideString( lpOutputString ) //wprintf( lpOutputString )
#define GwenUtil_WideStringToFloat( _Str ) wcstof(_Str, NULL)
#elif defined(__linux__)
#elif defined(__linux__) || defined(__OpenBSD__)
#define GwenUtil_VSNPrintFSafe( _DstBuf, _DstSize, _MaxCount, _Format, _ArgList ) vsnprintf( _DstBuf, _DstSize, _Format, _ArgList )
#define GwenUtil_VSWPrintFSafe( _DstBuf, _SizeInWords, _Format, _ArgList ) vswprintf( _DstBuf, _SizeInWords, _Format, _ArgList )

View File

@@ -30,14 +30,7 @@ LIST(APPEND CLSOCKET_SOURCES ${CLSOCKET_HEADERS})
# OS and compiler checks.
if(UNIX)
# linux / normal unix
add_definitions(-D_LINUX)
if(CYGWIN)
# Special Cygwin stuff here
elseif(APPLE)
# Special Apple stuff here
remove_definitions(-D_LINUX)
add_definitions(-D_DARWIN)
endif()
add_definitions(${OSDEF})
elseif(WIN32)
add_definitions(-DWIN32)
SET(PROJECT_LIBS Ws2_32.lib)

View File

@@ -61,7 +61,7 @@ extern "C"
#define __WORDSIZE 32
#endif
#if defined(_LINUX) || defined(_DARWIN)
#if defined(_LINUX) || defined(_DARWIN) || defined(_BSD)
typedef unsigned char uint8;
typedef char int8;
typedef unsigned short uint16;
@@ -176,7 +176,7 @@ extern "C"
#define GETHOSTBYNAME(a) gethostbyname(a)
#endif
#if defined(_LINUX) || defined(_DARWIN)
#if defined(_LINUX) || defined(_DARWIN) || defined(_BSD)
#define ACCEPT(a,b,c) accept(a,b,c)
#define CONNECT(a,b,c) connect(a,b,c)
#define CLOSE(a) close(a)

View File

@@ -49,7 +49,7 @@
#include <stdarg.h>
#include <errno.h>
#if defined(_LINUX) || defined (_DARWIN)
#if defined(_LINUX) || defined (_DARWIN) || defined(_BSD)
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -66,7 +66,7 @@
#ifdef _DARWIN
#include <net/if.h>
#endif
#if defined(_LINUX) || defined (_DARWIN)
#if defined(_LINUX) || defined (_DARWIN) || defined(_BSD)
#include <sys/time.h>
#include <sys/uio.h>
#include <unistd.h>

View File

@@ -101,11 +101,7 @@ ELSE(WIN32)
ENDIF(BUILD_PYBULLET_ENET)
IF(BUILD_PYBULLET_CLSOCKET)
IF(APPLE)
ADD_DEFINITIONS(-D_DARWIN)
ELSE()
ADD_DEFINITIONS(-D_LINUX)
ENDIF()
ADD_DEFINITIONS(${OSDEF})
ENDIF(BUILD_PYBULLET_CLSOCKET)
ENDIF(WIN32)