Skip to content
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 MinGW build #68

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ set(SLikeNet_VERSION_PATCH "0")
set(SLikeNet_VERSION ${SLikeNet_VERSION_MAJOR}.${SLikeNet_VERSION_MINOR}.${SLikeNet_VERSION_PATCH})
set(SLikeNet_API_VERSION ${SLikeNet_VERSION_MAJOR}.${SLikeNet_VERSION_MINOR})

if(MINGW)
add_compile_definitions(_RAKNET_SUPPORT_TwoWayAuthentication=0)
endif()

# explicitly enable @rpath in the install name for any shared library being built (for cmake >=2.8.12 and <3.0 - it's enabled by default for >= 3.0)
# note that for cmake < 2.8.12 we do not use rpath but rather keep the RakNet 4.082 behavior
if( CMAKE_VERSION VERSION_LESS 3.0 )
Expand Down
4 changes: 2 additions & 2 deletions CmakeIncludes/CmakeMacros.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ ENDMACRO(ADDCPPDEF)

MACRO(FIXCOMPILEOPTIONS)#Fix added compile options that may cause problems, also fix warnings

IF(NOT ${CMAKE_GENERATOR} STREQUAL "MSYS Makefiles")
IF(NOT ${CMAKE_GENERATOR} MATCHES "MSYS Makefiles" AND NOT MINGW)
IF(WIN32 AND NOT UNIX)
STRING(REGEX REPLACE "/Z[0-9a-zA-Z]+" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
STRING(REGEX REPLACE "/Z[0-9a-zA-Z]+" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
Expand All @@ -93,7 +93,7 @@ MACRO(FIXCOMPILEOPTIONS)#Fix added compile options that may cause problems, also

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")# -nowarn 4018 -nowarn 4305 -nowarn 4244")
ENDIF(WIN32 AND NOT UNIX)
ENDIF(NOT ${CMAKE_GENERATOR} STREQUAL "MSYS Makefiles")
ENDIF(NOT ${CMAKE_GENERATOR} MATCHES "MSYS Makefiles|MinGW Makefiles")
ENDMACRO(FIXCOMPILEOPTIONS)

MACRO(FIXLINKOPTIONS)#Fix added link options that may cause problems
Expand Down
4 changes: 3 additions & 1 deletion Lib/DLL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ add_definitions(-D_RETAIL)

IF(WIN32 AND NOT UNIX)
add_definitions(-DWIN32 -D_RAKNET_DLL -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE)
SET( CMAKE_CXX_FLAGS "/GS- /GR-" )
IF(MSVC)
SET( CMAKE_CXX_FLAGS "/GS- /GR-" )
ENDIF()
ELSE(WIN32 AND NOT UNIX)
set_target_properties(SLikeNetDLL PROPERTIES
OUTPUT_NAME "slikenet"
Expand Down
4 changes: 3 additions & 1 deletion Lib/LibStatic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ add_definitions(-D_RETAIL)

IF(WIN32 AND NOT UNIX)
add_definitions(-DWIN32 -D_RAKNET_DLL -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE)
SET( CMAKE_CXX_FLAGS "/GS- /GR-" )
IF(MSVC)
SET( CMAKE_CXX_FLAGS "/GS- /GR-" )
ENDIF()
ELSE(WIN32 AND NOT UNIX)
set_target_properties(SLikeNetLibStatic PROPERTIES
OUTPUT_NAME "slikenet"
Expand Down
6 changes: 3 additions & 3 deletions Source/include/slikenet/BitStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -1694,9 +1694,9 @@ namespace SLNet
if (qx < 0.0) qx=0.0;
if (qy < 0.0) qy=0.0;
if (qz < 0.0) qz=0.0;
qx = _copysign( (double) qx, (double) (m21 - m12) );
qy = _copysign( (double) qy, (double) (m02 - m20) );
qz = _copysign( (double) qz, (double) (m10 - m01) );
qx = std::copysign( (double) qx, (double) (m21 - m12) );
qy = std::copysign( (double) qy, (double) (m02 - m20) );
qz = std::copysign( (double) qz, (double) (m10 - m01) );

WriteNormQuat(qw,qx,qy,qz);
}
Expand Down
Loading