CMakeLists.txt 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. # TODO: Look into the application-extension flag for iOS
  2. #if (IOS)
  3. # set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fapplication-extension")
  4. # set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fapplication-extension")
  5. #endif()
  6. set (CSATOMICDIR "${ATOMIC_SOURCE_DIR}/Artifacts/Build/Source/Generated/CSharp/Packages/")
  7. file (GLOB CSHARP_BINDINGS_SOURCE ${CSATOMICDIR}/Atomic/Native/*.cpp ${CSATOMICDIR}/Atomic/Native/*.h
  8. ${CSATOMICDIR}/AtomicNETNative/Native/*.cpp ${CSATOMICDIR}/AtomicNETNative/Native/*.h
  9. ${CSATOMICDIR}/AtomicNETScript/Native/*.cpp ${CSATOMICDIR}/AtomicNETScript/Native/*.h
  10. ${CSATOMICDIR}/AtomicApp/Native/*.cpp ${CSATOMICDIR}/AtomicApp/Native/*.h
  11. ${CSATOMICDIR}/AtomicPlayer/Native/*.cpp ${CSATOMICDIR}/AtomicPlayer/Native/*.h )
  12. file (GLOB SOURCE_FILES *.cpp *.h)
  13. if (NOT IOS AND NOT ANDROID AND NOT WEB)
  14. file (GLOB DESKTOP_SOURCE_FILES Desktop/*.cpp Desktop/*.h)
  15. set (SOURCE_FILES ${SOURCE_FILES} ${DESKTOP_SOURCE_FILES})
  16. endif()
  17. if (ANDROID)
  18. set (SOURCE_FILES ${SOURCE_FILES} ${ATOMIC_SOURCE_DIR}/Source/ThirdParty/SDL/src/main/android/SDL_android_main.c)
  19. endif()
  20. add_library(AtomicNETNative SHARED ${SOURCE_FILES} ${CSHARP_BINDINGS_SOURCE})
  21. if (ATOMIC_DESKTOP)
  22. add_dependencies(AtomicNETNative AtomicToolCheckScripts)
  23. endif ()
  24. target_link_libraries(AtomicNETNative AtomicApp AtomicNETScriptBindings AtomicNETScript AtomicJS AtomicPlayerLib AtomicPlayerJS Atomic)
  25. target_include_directories(AtomicNETNative PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
  26. if (LINUX)
  27. #https://github.com/nothings/stb/issues/280
  28. target_link_libraries(AtomicNETNative gcc_s gcc)
  29. endif()
  30. if (APPLE)
  31. if (NOT IOS)
  32. target_link_libraries( AtomicNETNative "-stdlib=libc++ -framework AudioToolbox -framework Carbon -framework Cocoa -framework CoreAudio -framework CoreVideo -framework ForceFeedback -framework IOKit -framework OpenGL -framework CoreServices -framework Security")
  33. else()
  34. set_target_properties(AtomicNETNative PROPERTIES
  35. FRAMEWORK TRUE
  36. MACOSX_FRAMEWORK_IDENTIFIER com.atomicgameengine.atomicnetframework
  37. MACOSX_FRAMEWORK_INFO_PLIST ${ATOMIC_SOURCE_DIR}/Build/CMake/IOS/AtomicNET.framework.plist
  38. # PUBLIC_HEADER dynamicFramework.h
  39. XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer"
  40. )
  41. target_link_libraries( AtomicNETNative "-framework AudioToolbox -framework AVFoundation -framework CoreAudio -framework CoreGraphics -framework Foundation -framework OpenGLES -framework QuartzCore -framework UIKit -framework CoreMotion -framework GameController")
  42. endif()
  43. endif()
  44. if (WIN32)
  45. set (ATOMICNET_NATIVE_PLATFORM Windows)
  46. elseif(APPLE)
  47. if (IOS)
  48. set (ATOMICNET_NATIVE_PLATFORM iOS)
  49. else()
  50. set (ATOMICNET_NATIVE_PLATFORM Mac)
  51. endif()
  52. elseif(LINUX)
  53. set (ATOMICNET_NATIVE_PLATFORM Linux)
  54. elseif(ANDROID)
  55. set (ATOMICNET_NATIVE_PLATFORM Android)
  56. endif()
  57. set (ATOMICNET_NATIVE_DIR "${ATOMIC_SOURCE_DIR}/Artifacts/AtomicNET/$<$<CONFIG:debug>:Debug>$<$<CONFIG:release>:Release>/Native/${ATOMICNET_NATIVE_PLATFORM}")
  58. if (NOT IOS)
  59. add_custom_command( TARGET AtomicNETNative POST_BUILD
  60. COMMAND "${CMAKE_COMMAND}" ARGS -E make_directory "\"${ATOMICNET_NATIVE_DIR}\""
  61. COMMAND "${CMAKE_COMMAND}" ARGS -E copy_if_different \"$<TARGET_FILE:AtomicNETNative>\" "\"${ATOMICNET_NATIVE_DIR}\"" )
  62. else()
  63. # See BuildIOS.js for handling of the AtomicNETNative framework, including install_name_tool modification, etc
  64. # Handling it here was causing issues with certain builds of XCode and where it thought the TARGET_FILE was...
  65. endif()
  66. if (WIN32)
  67. # Copy the D3D shader compiler (for pre-Windows 8)
  68. add_custom_command( TARGET AtomicNETNative POST_BUILD
  69. COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different \"${D3DCOMPILER_47_DLL}\" \"${ATOMICNET_NATIVE_DIR}/D3DCompiler_47.dll\" )
  70. endif(WIN32)