CMakeLists.txt 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #
  2. # This file was taken from RakNet 4.082.
  3. # Please see licenses/RakNet license.txt for the underlying license and related copyright.
  4. #
  5. #
  6. #
  7. # Modified work: Copyright (c) 2016, SLikeSoft UG (haftungsbeschränkt)
  8. #
  9. # This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
  10. # license found in the license.txt file in the root directory of this source tree.
  11. #
  12. # Define target name
  13. set (TARGET_NAME SLikeNet)
  14. add_definitions (-DRAKNET_ENABLE_STATIC -D_RAKNET_SUPPORT_NatTypeDetectionServer=0 -D_RAKNET_SUPPORT_UDPForwarder=0 -D_RAKNET_SUPPORT_TwoWayAuthentication=0)
  15. add_definitions (-D_RAKNET_SUPPORT_CloudClient=0 -D_RAKNET_SUPPORT_CloudServer=0 -D_RAKNET_SUPPORT_ConnectionGraph2=0 -D_RAKNET_SUPPORT_NatPunchthroughServer=0)
  16. add_definitions (-D_RAKNET_SUPPORT_RelayPlugin=0 -D_RAKNET_SUPPORT_LibVoice=0 -D_RAKNET_SUPPORT_DynDNS=0 -D_RAKNET_SUPPORT_HTTPConnection2=0 -D_RAKNET_SUPPORT_HTTPConnection=0)
  17. add_definitions (-D_RAKNET_SUPPORT_EmailSender=0 -D_RAKNET_SUPPORT_UDPProxyClient=0 -D_RAKNET_SUPPORT_UDPProxyCoordinator=0 -D_RAKNET_SUPPORT_TeamManager=0 -D_RAKNET_SUPPORT_TeamBalancer=0)
  18. add_definitions (-D_RAKNET_SUPPORT_NatTypeDetectionClient=0 -D_RAKNET_SUPPORT_FullyConnectedMesh2=0 -D_RAKNET_SUPPORT_ConnectionGraph2=0 -D_RAKNET_SUPPORT_FullyConnectedMesh=0 -D_RAKNET_SUPPORT_TelnetTransport=0)
  19. add_definitions (-D_RAKNET_SUPPORT_PacketLogger=0 -D_RAKNET_SUPPORT_DirectoryDeltaTransfer=0 -D_RAKNET_SUPPORT_FileOperations=0 -D_RAKNET_SUPPORT_UDPProxyServer=0)
  20. add_definitions (-D_RAKNET_SUPPORT_ConsoleServer=0 -D_RAKNET_SUPPORT_RakNetTransport=0 -D_RAKNET_SUPPORT_TCPInterface=0 -D_RAKNET_SUPPORT_LogCommandParser=0 -D_RAKNET_SUPPORT_RakNetCommandParser=0)
  21. add_definitions (-D_RAKNET_SUPPORT_Rackspace=0 -D_RAKNET_SUPPORT_PacketizedTCP=0 -D_RAKNET_SUPPORT_RPC4Plugin=0 -D_RAKNET_SUPPORT_Router2=0 -D_RAKNET_SUPPORT_ReplicaManager3=0)
  22. add_definitions (-D_RAKNET_SUPPORT_ReadyEvent=0 -D_RAKNET_SUPPORT_MessageFilter=0 -D_RAKNET_SUPPORT_FileListTransfer=0)
  23. # Check specific function availability which may be missing from different MinGW versions
  24. check_cxx_source_compiles ("#include <sys/types.h>\n#include <sys/socket.h>\n#include <netinet/in.h>\n#include <arpa/inet.h>\nint main() {\n struct sockaddr_in sa;\n char str[INET_ADDRSTRLEN];\n inet_pton(AF_INET, \"192.0.2.33\", &(sa.sin_addr));\n inet_ntop(AF_INET, &(sa.sin_addr), str, INET_ADDRSTRLEN);\n}" INET_FUNCTIONS_EXISTS_1)
  25. set (ORIG_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
  26. set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ws2_32)
  27. check_cxx_source_compiles ("#include <winsock2.h>\n#include <ws2tcpip.h>\nint main() {\n struct sockaddr_in sa;\n char str[INET_ADDRSTRLEN];\n inet_pton(AF_INET, \"192.0.2.33\", &(sa.sin_addr));\n inet_ntop(AF_INET, &(sa.sin_addr), str, INET_ADDRSTRLEN);\n}" INET_FUNCTIONS_EXISTS_2)
  28. set (CMAKE_REQUIRED_LIBRARIES ${ORIG_CMAKE_REQUIRED_LIBRARIES})
  29. if (NOT INET_FUNCTIONS_EXISTS_1 AND NOT INET_FUNCTIONS_EXISTS_2 AND NOT HAVE_INET_NTOP)
  30. add_definitions(-DINET_FUNCTIONS_MISSING=1)
  31. endif()
  32. # Check specific function availability which may be missing from different MinGW versions
  33. check_cxx_source_compiles ("#include <stdio.h>\nint main() { char s[80];\nint x = 1;\nsprintf_s(s, 80, \"Test:%d\", x); }" SPRINTFS_FUNCTION_EXISTS)
  34. if (NOT SPRINTFS_FUNCTION_EXISTS)
  35. add_definitions(-DSPRINTFS_FUNCTION_MISSING=1)
  36. endif()
  37. # Check specific function availability which may be missing from different MinGW versions
  38. check_cxx_source_compiles ("#include <stdio.h>\nint main() {\nchar s[80];\nint x = 1;\nva_list args = {};\nvsnprintf_s(s, 80, \"Test:%d\", args);}" VSNPRINTFS_FUNCTION_EXISTS)
  39. if (NOT VSNPRINTFS_FUNCTION_EXISTS)
  40. add_definitions(-DVSNPRINTFS_FUNCTION_MISSING=1)
  41. endif()
  42. if (URHO3D_LIB_TYPE STREQUAL SHARED)
  43. add_definitions(-D_RAKNET_DLL=1)
  44. endif ()
  45. # Define source files
  46. file (GLOB_RECURSE CPP_FILES *.cpp source)
  47. file (GLOB_RECURSE H_FILES *.h include)
  48. set (SOURCE_FILES ${CPP_FILES} ${H_FILES})
  49. # Define dependency libs
  50. set (INCLUDE_DIRS Source/include)
  51. # Setup target
  52. setup_library ()
  53. # Install headers for building the Urho3D library
  54. install_header_files (DIRECTORY Source/include/slikenet/ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/SLikeNet FILES_MATCHING PATTERN *.h BUILD_TREE_ONLY) # Note: the trailing slash is significant