CMakeLists.txt 3.9 KB

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