CMakeLists.txt 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. # ATOMIC BEGIN
  43. set(LIBS ws2_32.lib)
  44. # ATOMIC END
  45. endif ()
  46. # Define source files
  47. set (SOURCE_FILES ${kNetSourceFiles} ${kNetHeaderFiles})
  48. # Define dependency libs
  49. set (INCLUDE_DIRS include)
  50. # Setup target
  51. setup_library ()
  52. # ATOMIC BEGIN
  53. if (UNIX)
  54. target_compile_definitions(${TARGET_NAME} PUBLIC -DKNET_UNIX)
  55. endif ()
  56. # ATOMIC END