Skip to content

Commit 6758836

Browse files
committed
Fix MinGW build
1 parent 3b3632a commit 6758836

8 files changed

Lines changed: 364 additions & 9 deletions

File tree

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ set(SLikeNet_VERSION_PATCH "0")
2828
set(SLikeNet_VERSION ${SLikeNet_VERSION_MAJOR}.${SLikeNet_VERSION_MINOR}.${SLikeNet_VERSION_PATCH})
2929
set(SLikeNet_API_VERSION ${SLikeNet_VERSION_MAJOR}.${SLikeNet_VERSION_MINOR})
3030

31+
if(MINGW)
32+
add_compile_definitions(_RAKNET_SUPPORT_TwoWayAuthentication=0)
33+
endif()
34+
3135
# 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)
3236
# note that for cmake < 2.8.12 we do not use rpath but rather keep the RakNet 4.082 behavior
3337
if( CMAKE_VERSION VERSION_LESS 3.0 )

CmakeIncludes/CmakeMacros.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ ENDMACRO(ADDCPPDEF)
7878

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

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

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

9999
MACRO(FIXLINKOPTIONS)#Fix added link options that may cause problems

Lib/DLL/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ add_definitions(-D_RETAIL)
4242

4343
IF(WIN32 AND NOT UNIX)
4444
add_definitions(-DWIN32 -D_RAKNET_DLL -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE)
45-
SET( CMAKE_CXX_FLAGS "/GS- /GR-" )
45+
IF(MSVC)
46+
SET( CMAKE_CXX_FLAGS "/GS- /GR-" )
47+
ENDIF()
4648
ELSE(WIN32 AND NOT UNIX)
4749
set_target_properties(SLikeNetDLL PROPERTIES
4850
OUTPUT_NAME "slikenet"

Lib/LibStatic/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ add_definitions(-D_RETAIL)
4242

4343
IF(WIN32 AND NOT UNIX)
4444
add_definitions(-DWIN32 -D_RAKNET_DLL -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE)
45-
SET( CMAKE_CXX_FLAGS "/GS- /GR-" )
45+
IF(MSVC)
46+
SET( CMAKE_CXX_FLAGS "/GS- /GR-" )
47+
ENDIF()
4648
ELSE(WIN32 AND NOT UNIX)
4749
set_target_properties(SLikeNetLibStatic PROPERTIES
4850
OUTPUT_NAME "slikenet"

Source/include/slikenet/BitStream.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,9 +1694,9 @@ namespace SLNet
16941694
if (qx < 0.0) qx=0.0;
16951695
if (qy < 0.0) qy=0.0;
16961696
if (qz < 0.0) qz=0.0;
1697-
qx = _copysign( (double) qx, (double) (m21 - m12) );
1698-
qy = _copysign( (double) qy, (double) (m02 - m20) );
1699-
qz = _copysign( (double) qz, (double) (m10 - m01) );
1697+
qx = std::copysign( (double) qx, (double) (m21 - m12) );
1698+
qy = std::copysign( (double) qy, (double) (m02 - m20) );
1699+
qz = std::copysign( (double) qz, (double) (m10 - m01) );
17001700

17011701
WriteNormQuat(qw,qx,qy,qz);
17021702
}

0 commit comments

Comments
 (0)