CMakeLists.txt 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # Copyright (c) 2008-2023 the Urho3D project
  2. # License: MIT
  3. # Define target name
  4. set (TARGET_NAME AngelScript)
  5. # Define preprocessor macros
  6. if (CLANG_PRE_STANDARD)
  7. add_definitions (-DCLANG_PRE_STANDARD)
  8. endif ()
  9. if (NOT EXCEPTIONS)
  10. add_definitions (-DAS_NO_EXCEPTIONS)
  11. endif ()
  12. if (URHO3D_FORCE_AS_MAX_PORTABILITY)
  13. add_definitions (-DAS_MAX_PORTABILITY)
  14. endif ()
  15. # Define source files
  16. define_source_files (GLOB_CPP_PATTERNS source/*.cpp GLOB_H_PATTERNS include/*.h source/*.h)
  17. if (ARM)
  18. enable_language (ASM)
  19. if (XCODE)
  20. # It is safe to add this assembler code in universal binary build because it has sufficient preprocessor define guards to exclude unsupported archs
  21. set (ASM_FILES source/as_callfunc_arm_xcode.S)
  22. else ()
  23. if (URHO3D_64BIT)
  24. set (ASM_FILES source/as_callfunc_arm64_gcc.S)
  25. else ()
  26. set (ASM_FILES source/as_callfunc_arm_gcc.S)
  27. endif ()
  28. set (CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} ${ARM_CFLAGS}")
  29. endif ()
  30. elseif (MSVC AND URHO3D_64BIT)
  31. enable_language (ASM_MASM)
  32. # Commented out due to cmake bug - todo: Recheck if this workaround is still necessary when increasing CMake minimum version
  33. #set (ASM_FILES source/as_callfunc_x64_msvc_asm.asm)
  34. # As a temporary workaround
  35. add_custom_command (OUTPUT as_callfunc_x64_msvc_asm.obj COMMAND ${CMAKE_ASM_MASM_COMPILER} -Fo ${CMAKE_CURRENT_BINARY_DIR}/as_callfunc_x64_msvc_asm.obj -c ${CMAKE_CURRENT_SOURCE_DIR}/source/as_callfunc_x64_msvc_asm.asm DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/source/as_callfunc_x64_msvc_asm.asm COMMENT "Temporary workaround for MASM")
  36. set (ASM_FILES ${CMAKE_CURRENT_BINARY_DIR}/as_callfunc_x64_msvc_asm.obj ${CMAKE_CURRENT_SOURCE_DIR}/source/as_callfunc_x64_msvc_asm.asm)
  37. endif ()
  38. list (APPEND SOURCE_FILES ${ASM_FILES})
  39. # Define dependency libs
  40. set (INCLUDE_DIRS include)
  41. # Setup target
  42. setup_library ()
  43. # Install headers for building and using the Urho3D library (install dependency for Urho3D/Script/APITemplates.h)
  44. install_header_files (DIRECTORY include/ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/AngelScript FILES_MATCHING PATTERN *.h) # Note: the trailing slash is significant