CMakeLists.txt 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. # We need to link our project module into the AtomicNET, unless we optionally disable C# support
  25. target_link_libraries(AtomicNETNative MyProject AtomicApp AtomicNETScriptBindings AtomicNETScript AtomicJS AtomicPlayerLib AtomicPlayerJS Atomic)
  26. target_include_directories(AtomicNETNative PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
  27. if (APPLE)
  28. if (NOT IOS)
  29. 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")
  30. else()
  31. set_target_properties(AtomicNETNative PROPERTIES
  32. FRAMEWORK TRUE
  33. MACOSX_FRAMEWORK_IDENTIFIER com.atomicgameengine.atomicnetframework
  34. MACOSX_FRAMEWORK_INFO_PLIST ${ATOMIC_SOURCE_DIR}/Build/CMake/IOS/AtomicNET.framework.plist
  35. # PUBLIC_HEADER dynamicFramework.h
  36. XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer"
  37. )
  38. target_link_libraries( AtomicNETNative "-framework AudioToolbox -framework AVFoundation -framework CoreAudio -framework CoreGraphics -framework Foundation -framework OpenGLES -framework QuartzCore -framework UIKit -framework CoreMotion -framework GameController")
  39. endif()
  40. endif()
  41. if (WIN32)
  42. set (ATOMICNET_NATIVE_PLATFORM Windows)
  43. elseif(APPLE)
  44. if (IOS)
  45. set (ATOMICNET_NATIVE_PLATFORM iOS)
  46. else()
  47. set (ATOMICNET_NATIVE_PLATFORM Mac)
  48. endif()
  49. elseif(LINUX)
  50. set (ATOMICNET_NATIVE_PLATFORM Linux)
  51. elseif(ANDROID)
  52. set (ATOMICNET_NATIVE_PLATFORM Android)
  53. endif()
  54. set (ATOMICNET_NATIVE_DIR "${ATOMIC_SOURCE_DIR}/Artifacts/AtomicNET/$<$<CONFIG:debug>:Debug>$<$<CONFIG:release>:Release>/Native/${ATOMICNET_NATIVE_PLATFORM}")
  55. if (NOT IOS)
  56. add_custom_command( TARGET AtomicNETNative POST_BUILD
  57. COMMAND "${CMAKE_COMMAND}" ARGS -E make_directory "\"${ATOMICNET_NATIVE_DIR}\""
  58. COMMAND "${CMAKE_COMMAND}" ARGS -E copy_if_different \"$<TARGET_FILE:AtomicNETNative>\" "\"${ATOMICNET_NATIVE_DIR}\"" )
  59. else()
  60. # See BuildIOS.js for handling of the AtomicNETNative framework, including install_name_tool modification, etc
  61. # Handling it here was causing issues with certain builds of XCode and where it thought the TARGET_FILE was...
  62. endif()
  63. if (WIN32)
  64. # Copy the D3D shader compiler (for pre-Windows 8)
  65. add_custom_command( TARGET AtomicNETNative POST_BUILD
  66. COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different \"${D3DCOMPILER_47_DLL}\" \"${ATOMICNET_NATIVE_DIR}/D3DCompiler_47.dll\" )
  67. endif(WIN32)