CMakeLists.txt 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. set (kNetSourceFiles ${kNetSourceFiles} ${kNetWin32SourceFiles})
  22. set (kNetHeaderFiles ${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. list (REMOVE_ITEM kNetSourceFiles ${CMAKE_CURRENT_SOURCE_DIR}/./src/Clock.cpp)
  28. file (GLOB kNetUnixSourceFiles ./src/unix/*.cpp)
  29. file (GLOB kNetUnixHeaderFiles ./include/*.h ./include/kNet/*.h ./include/kNet/unix/*.h)
  30. if (USE_BOOST)
  31. list (REMOVE_ITEM kNetUnixSourceFiles ${CMAKE_CURRENT_SOURCE_DIR}/./src/unix/UnixThread.cpp)
  32. endif ()
  33. set (kNetSourceFiles ${kNetSourceFiles} ${kNetUnixSourceFiles})
  34. set (kNetHeaderFiles ${kNetHeaderFiles} ${kNetUnixHeaderFiles})
  35. add_definitions (-DUNIX)
  36. endif ()
  37. # Urho3D: set DEBUG_CPP_NAME only on Windows, Xcode project file can not be opened if this is included
  38. if (WIN32)
  39. foreach (srcFile ${kNetSourceFiles})
  40. get_filename_component (baseName ${srcFile} NAME)
  41. set_source_files_properties (${srcFile} PROPERTIES COMPILE_FLAGS "-DDEBUG_CPP_NAME=\"\\\"${baseName}\"\\\"")
  42. endforeach ()
  43. endif ()
  44. # Define source files
  45. set (SOURCE_FILES ${kNetSourceFiles} ${kNetHeaderFiles})
  46. # Install dependency for Engine/Network/Connection.h and Engine/Network/Network.h
  47. install (DIRECTORY include/ DESTINATION ${DEST_INCLUDE_DIR}/kNet ${DEST_PERMISSIONS} FILES_MATCHING PATTERN *.h PATTERN *.inl) # Note: the trailing slash is significant
  48. set (INSTALL_INCLUDE_DIRS ${INSTALL_INCLUDE_DIRS} kNet PARENT_SCOPE)
  49. # Define dependency libs
  50. set (INCLUDE_DIRS_ONLY include)
  51. # Setup target
  52. setup_library ()