Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
alliekins committed Jun 5, 2014
0 parents commit 7fe6cdd
Show file tree
Hide file tree
Showing 3,906 changed files with 1,026,509 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
33 changes: 33 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Visual Studio
[Bb]in/
[Dd]ebug/
[Rr]elease/
x64/

*.opensdf
*.sdf
*.user
*.suo

# Xcode and OS X
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
contents.xcworkspacedata
Debug/
Release/
Lib/
.DS_Store
.Trashes
15 changes: 15 additions & 0 deletions 3.x_to_4.x_upgrade.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Major changes from version 3:

RakPeer::Startup() and RakPeer::Connect() now return enumeration results, rather than true or false.
Security rewritten. InitializeSecurity now does not work unless LIBCAT_SECURITY is set to 1 in NativeFeatureIncludesOverrides.h. You pass the remote public key to RakPeer::Connect(), instead of RakPeer::InitializeSecurity()
RakNetworkFactory has been deleted. Instead, most classes have a static function GetInstance() and DestroyInstance() defined by the macro STATIC_FACTORY_DECLARATIONS
Deleted RakPeer::RPC, AutoRPC, ConnectionGraph, ReplicaManager, ReplicaManager2, Router, LightweightDatabase, and RakNetTransport. Use newer versions of these classes/function instead.
BitStream now takes const references for all input parameters. If you want to cast, use SerializeCasted(), WriteCasted, and ReadCasted(), or else just copy the variable to the desired type first.
RakNetTimeMS, RakNetTime, and RakNetTimeUS have been renamed and put in namespaces RakNet::TimeMS, RakNet::Time, and RakNet::TimeUS
Most classes are now in the RakNet namespace.
Added _FILE_AND_LINE_ to RakNetDefines.h so the user can strip out this information if desired.
C# is now supported. See Help\swigtutorial.html
NetworkIDObject and NetworkIDManager systems largely rewritten. IsNetworkIDAuthority() no longer is needed, so was removed.
RakPeer::Startup() no longer takes a threadSleepTimer parameter.
ID_UNCONNECTED_PONG now returns the pong always in 4 bytes (RakNet::TimeMS). Furthermore, the timestamp is in network order. Use BitStreams to read the timestamp out.
IsConnected() was replaced with GetConnectionState()
58 changes: 58 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
cmake_minimum_required(VERSION 2.6)

project(RakNet)

if( NOT APPLE )
# check 64 bit
if( CMAKE_SIZEOF_VOID_P MATCHES "4" )
set( HAVE_64_BIT 0 )
else( CMAKE_SIZEOF_VOID_P MATCHES "4")
set( HAVE_64_BIT 1 )
endif( CMAKE_SIZEOF_VOID_P MATCHES "4")
endif( NOT APPLE )

IF (WIN32 AND NOT UNIX)
set (PROGRAMFILESX86 $ENV{PROGRAMFILES})
string(REPLACE "\\" "/" PROGRAMFILESX86 ${PROGRAMFILESX86})
ENDIF(WIN32 AND NOT UNIX)

IF (WIN32 AND NOT UNIX)
set(RAKNET_LIBRARY_LIBS ws2_32.lib)
ELSE(WIN32 AND NOT UNIX)
set(RAKNET_LIBRARY_LIBS pthread)
ENDIF(WIN32 AND NOT UNIX)


# Options
option( RAKNET_ENABLE_SAMPLES "Generate RakNet sample projects if true." TRUE )
option( RAKNET_ENABLE_DLL "Generate the DLL project if true." TRUE )
option( RAKNET_ENABLE_STATIC "Generate the static library project if true." TRUE )
option( RAKNET_GENERATE_INCLUDE_ONLY_DIR "Setup a include/RakNet/ directory in which all the headers are copied." FALSE )

set( RAKNETHEADERFILES ${RakNet_SOURCE_DIR}/Source ) #This name doesn't follow CMake conventions but for retro compatibility I'll let it there.

if( RAKNET_GENERATE_INCLUDE_ONLY_DIR )
set( RAKNET_INCLUDE_ONLY_DIR ${RakNet_SOURCE_DIR}/include ) # this will be visible by client code
set( RAKNET_NAMED_INCLUDE_ONLY_DIR ${RAKNET_INCLUDE_ONLY_DIR}/RakNet )
message( STATUS "Setting up the ${RAKNET_NAMED_INCLUDE_ONLY_DIR} directory..." )
# Now setup the include/RakNet/*.h files.
file( MAKE_DIRECTORY ${RAKNET_NAMED_INCLUDE_ONLY_DIR} )
file( COPY ${RAKNETHEADERFILES}/ DESTINATION ${RAKNET_NAMED_INCLUDE_ONLY_DIR} FILES_MATCHING PATTERN "*.h" )
message( STATUS "DONE: Setting up the ${RAKNET_NAMED_INCLUDE_ONLY_DIR} directory." )
endif()

set( RAKNET_INCLUDE_DIRS ${RAKNETHEADERFILES} ${RAKNET_INCLUDE_ONLY_DIR} PARENT_SCOPE ) # Visible from outside

include(./CmakeIncludes/CmakeMacros.txt)
FIXLINKOPTIONS()
FIXCOMPILEOPTIONS()


add_subdirectory(Lib)


set(RAKNET_COMMON_LIBS RakNetLibStatic)

if( RAKNET_GENERATE_SAMPLES )
add_subdirectory(Samples)
endif()
107 changes: 107 additions & 0 deletions CmakeIncludes/CmakeMacros.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#This file includes the global macros for the RakNet CMake files

MACRO(STANDARDSUBPROJECT PROJECTNAME)#Many of the projects just need the cpp files compiled and the header added to the project, this avoids repeating code
project(${PROJECTNAME})
FILE(GLOB ALL_CPP_SRCS *.cpp)
FILE(GLOB ALL_HEADER_SRCS *.h)
FILE(GLOB READMES readme.txt Specification.txt)
include_directories(${RAKNETHEADERFILES} ./)
FIXCOMPILEOPTIONS()
add_executable(${PROJECTNAME} ${ALL_CPP_SRCS} ${ALL_HEADER_SRCS} ${READMES})
target_link_libraries(${PROJECTNAME} ${RAKNET_COMMON_LIBS})
set_target_properties(${PROJECTNAME} PROPERTIES PROJECT_GROUP Samples)
ENDMACRO(STANDARDSUBPROJECT)

MACRO(STANDARDSUBPROJECTWITHOPTIONS PROJECTNAME EXTRAINCLUDES EXTRASOURCES EXTRALIBS)#Same as STANDARDSUBPROJECT but allows options changing
project(${PROJECTNAME})
FILE(GLOB ALL_CPP_SRCS *.cpp)
FILE(GLOB ALL_HEADER_SRCS *.h)
FILE(GLOB READMES readme.txt Specification.txt)
FIXCOMPILEOPTIONS()
include_directories(${RAKNETHEADERFILES} ./ ${EXTRAINCLUDES})
add_executable(${PROJECTNAME} ${ALL_CPP_SRCS} ${ALL_HEADER_SRCS} ${EXTRASOURCES} ${READMES})
target_link_libraries(${PROJECTNAME} ${RAKNET_COMMON_LIBS} ${EXTRALIBS})
set_target_properties(${PROJECTNAME} PROPERTIES PROJECT_GROUP Samples)
ENDMACRO(STANDARDSUBPROJECTWITHOPTIONS)

MACRO(STANDARDSUBPROJECTWITHOPTIONSSET PROJECTNAME)#Same as STANDARDSUBPROJECT but allows options changing, Items are passed by setting them for times when passing variable to the macro doesn't work
project(${PROJECTNAME})
FILE(GLOB ALL_CPP_SRCS *.cpp)
FILE(GLOB ALL_HEADER_SRCS *.h)
FILE(GLOB READMES readme.txt Specification.txt)
FIXCOMPILEOPTIONS()
include_directories(${RAKNETHEADERFILES} ./ ${EXTRAINCLUDES})
add_executable(${PROJECTNAME} ${ALL_CPP_SRCS} ${ALL_HEADER_SRCS} ${EXTRASOURCES} ${READMES})
target_link_libraries(${PROJECTNAME} ${RAKNET_COMMON_LIBS} ${EXTRALIBS})
set_target_properties(${PROJECTNAME} PROPERTIES PROJECT_GROUP Samples)
ENDMACRO(STANDARDSUBPROJECTWITHOPTIONSSET)

MACRO(STANDARDCSUBPROJECT PROJECTNAME)#Same as STANDARDSUBPROJECT but for C files
project(${PROJECTNAME})
FILE(GLOB ALL_C_SRCS *.c)
FILE(GLOB ALL_HEADER_SRCS *.h)
FILE(GLOB READMES readme.txt Specification.txt)
include_directories(${RAKNETHEADERFILES} ./)
FIXCOMPILEOPTIONS()
add_executable(${PROJECTNAME} ${ALL_C_SRCS} ${ALL_HEADER_SRCS} ${READMES})
target_link_libraries(${PROJECTNAME} ${RAKNET_COMMON_LIBS})
set_target_properties(${PROJECTNAME} PROPERTIES PROJECT_GROUP Samples)
ENDMACRO(STANDARDCSUBPROJECT)

MACRO(GETCURRENTFOLDER)#Gets the current foldername without the path
string(REGEX REPLACE
".+/(.?)"
"\\1"
current_folder "${CMAKE_CURRENT_SOURCE_DIR}")
ENDMACRO(GETCURRENTFOLDER)

MACRO(VSUBFOLDER PROJECTNAME FOLDERNAME)#A macro interface for adding solution folders with a patched cmake
set_target_properties(${PROJECTNAME} PROPERTIES PROJECT_GROUP ${FOLDERNAME})
ENDMACRO(VSUBFOLDER)

MACRO(STANDARDNOTFOUNDMESSAGE NAME PLIBRARIES PINCLUDES EXTRA_INFORMATION)#If the libraries are not found, what to display
message(STATUS "${NAME} was not found, paths were set to:\nLibrary: ${PLIBRARIES}\nInclude: ${PINCLUDES}\n${EXTRA_INFORMATION}The project will not compile unless installed to those locations.\nAs an alternative you can install the libraries and rerun cmake\n and see if the autosearch finds them")
ENDMACRO(STANDARDNOTFOUNDMESSAGE)

MACRO(ADDCPPDEF DEF)#Currently replaces CXX flags with a define for WIN32 projects, may be changed
IF(WIN32)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D ${DEF}")
ENDIF()
ENDMACRO(ADDCPPDEF)

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

IF(NOT ${CMAKE_GENERATOR} STREQUAL "MSYS Makefiles")
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}")
ADDCPPDEF(_CRT_SECURE_NO_DEPRECATE)
ADDCPPDEF(_CRT_NONSTDC_NO_DEPRECATE)
SET(CMAKE_CXX_WARNING_LEVEL 0)
IF(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
STRING(REGEX REPLACE "/W[0-4]" "/W0" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
ELSE(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W0")
ENDIF(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")

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")
ENDMACRO(FIXCOMPILEOPTIONS)

MACRO(FIXLINKOPTIONS)#Fix added link options that may cause problems
IF(WIN32 AND NOT UNIX)
IF(NOT ${CMAKE_GENERATOR} STREQUAL "MSYS Makefiles")
STRING(REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
STRING(REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
STRING(REGEX REPLACE "/machine:[0-9a-zA-Z]+" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
STRING(REGEX REPLACE "/machine:[0-9a-zA-Z]+" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
ENDIF(NOT ${CMAKE_GENERATOR} STREQUAL "MSYS Makefiles")
ENDIF(WIN32 AND NOT UNIX)
ENDMACRO(FIXLINKOPTIONS)

MACRO(FINDREADMES)
FILE(GLOB READMES readme.txt)
ENDMACRO(FINDREADMES)

include(${RakNet_SOURCE_DIR}/CmakeIncludes/FindMacros.txt)#The macros for setting variables and performing finds
Loading

0 comments on commit 7fe6cdd

Please sign in to comment.