CMakeLists.txt 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. # Copyright 2010 Jukka Jylänki
  2. # Licensed under the Apache License, Version 2.0 (the "License");
  3. # you may not use this file except in compliance with the License.
  4. # You may obtain a copy of the License at
  5. # http://www.apache.org/licenses/LICENSE-2.0
  6. # Unless required by applicable law or agreed to in writing, software
  7. # distributed under the License is distributed on an "AS IS" BASIS,
  8. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. # See the License for the specific language governing permissions and
  10. # limitations under the License.
  11. # Modified by Lasse Oorni and Yao Wei Tjong for Urho3D
  12. set (TARGET_NAME kNet)
  13. file (GLOB kNetSourceFiles src/*.cpp)
  14. file (GLOB kNetHeaderFiles include/*.h include/kNet/*.h include/kNet/*.inl)
  15. if (WIN32)
  16. file (GLOB kNetWin32SourceFiles src/win32/*.cpp)
  17. file (GLOB kNetWin32HeaderFiles include/kNet/win32/*.h)
  18. if (USE_BOOST)
  19. list (REMOVE_ITEM kNetWin32SourceFiles ${CMAKE_CURRENT_SOURCE_DIR}/src/win32/W32Thread.cpp)
  20. endif ()
  21. list (APPEND kNetSourceFiles ${kNetWin32SourceFiles})
  22. list (APPEND kNetHeaderFiles ${kNetWin32HeaderFiles})
  23. add_definitions (-D_WINSOCKAPI_)
  24. add_definitions (-D_CRT_SECURE_NO_WARNINGS)
  25. add_definitions (-DKNET_MEMORY_LEAK_CHECK)
  26. elseif (UNIX)
  27. file (GLOB kNetUnixSourceFiles src/unix/*.cpp)
  28. file (GLOB kNetUnixHeaderFiles include/*.h include/kNet/*.h include/kNet/unix/*.h)
  29. if (USE_BOOST)
  30. list (REMOVE_ITEM kNetUnixSourceFiles ${CMAKE_CURRENT_SOURCE_DIR}/src/unix/UnixThread.cpp)
  31. endif ()
  32. list (APPEND kNetSourceFiles ${kNetUnixSourceFiles})
  33. list (APPEND kNetHeaderFiles ${kNetUnixHeaderFiles})
  34. # Urho3D: KNET_UNIX definition removed
  35. endif ()
  36. # Urho3D: set DEBUG_CPP_NAME only on Windows, Xcode project file can not be opened if this is included
  37. if (WIN32)
  38. foreach (srcFile ${kNetSourceFiles})
  39. get_filename_component (baseName ${srcFile} NAME)
  40. set_source_files_properties (${srcFile} PROPERTIES COMPILE_FLAGS "-DDEBUG_CPP_NAME=\"\\\"${baseName}\"\\\"")
  41. endforeach ()
  42. endif ()
  43. # Define source files
  44. set (SOURCE_FILES ${kNetSourceFiles} ${kNetHeaderFiles})
  45. # Define dependency libs
  46. set (INCLUDE_DIRS include)
  47. # Setup target
  48. setup_library ()
  49. # Install headers for building and using the Urho3D library (install dependency for Urho3D/Network/Connection.h and Urho3D/Network/Network.h)
  50. install_header_files (DIRECTORY include/kNet/ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/kNet FILES_MATCHING PATTERN *.h *.inl USE_FILE_SYMLINK) # Note: the trailing slash is significant
  51. file (GLOB kNetHeaderFiles include/*.h)
  52. install_header_files (FILES ${kNetHeaderFiles} DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/kNet)