CMakeLists.txt 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. # Generate cpp with Git revision from template
  2. # Also if this is a CI build, add the build name (ie: Nightly, Canary) to the scm_rev file as well
  3. set(REPO_NAME "")
  4. set(BUILD_VERSION "0")
  5. if ($ENV{CI})
  6. if ($ENV{TRAVIS})
  7. set(BUILD_REPOSITORY $ENV{TRAVIS_REPO_SLUG})
  8. set(BUILD_TAG $ENV{TRAVIS_TAG})
  9. elseif($ENV{APPVEYOR})
  10. set(BUILD_REPOSITORY $ENV{APPVEYOR_REPO_NAME})
  11. set(BUILD_TAG $ENV{APPVEYOR_REPO_TAG_NAME})
  12. endif()
  13. # regex capture the string nightly or canary into CMAKE_MATCH_1
  14. string(REGEX MATCH "yuzu-emu/yuzu-?(.*)" OUTVAR ${BUILD_REPOSITORY})
  15. if (${CMAKE_MATCH_COUNT} GREATER 0)
  16. # capitalize the first letter of each word in the repo name.
  17. string(REPLACE "-" ";" REPO_NAME_LIST ${CMAKE_MATCH_1})
  18. foreach(WORD ${REPO_NAME_LIST})
  19. string(SUBSTRING ${WORD} 0 1 FIRST_LETTER)
  20. string(SUBSTRING ${WORD} 1 -1 REMAINDER)
  21. string(TOUPPER ${FIRST_LETTER} FIRST_LETTER)
  22. set(REPO_NAME "${REPO_NAME}${FIRST_LETTER}${REMAINDER}")
  23. endforeach()
  24. if (BUILD_TAG)
  25. string(REGEX MATCH "${CMAKE_MATCH_1}-([0-9]+)" OUTVAR ${BUILD_TAG})
  26. if (${CMAKE_MATCH_COUNT} GREATER 0)
  27. set(BUILD_VERSION ${CMAKE_MATCH_1})
  28. endif()
  29. if (BUILD_VERSION)
  30. # This leaves a trailing space on the last word, but we actually want that
  31. # because of how it's styled in the title bar.
  32. set(BUILD_FULLNAME "${REPO_NAME} ${BUILD_VERSION} ")
  33. else()
  34. set(BUILD_FULLNAME "")
  35. endif()
  36. endif()
  37. endif()
  38. endif()
  39. configure_file("${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.cpp.in" "${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.cpp" @ONLY)
  40. add_library(common STATIC
  41. alignment.h
  42. assert.h
  43. detached_tasks.cpp
  44. detached_tasks.h
  45. bit_field.h
  46. bit_util.h
  47. cityhash.cpp
  48. cityhash.h
  49. color.h
  50. common_funcs.h
  51. common_paths.h
  52. common_types.h
  53. file_util.cpp
  54. file_util.h
  55. hash.h
  56. hex_util.cpp
  57. hex_util.h
  58. logging/backend.cpp
  59. logging/backend.h
  60. logging/filter.cpp
  61. logging/filter.h
  62. logging/log.h
  63. logging/text_formatter.cpp
  64. logging/text_formatter.h
  65. math_util.h
  66. microprofile.cpp
  67. microprofile.h
  68. microprofileui.h
  69. misc.cpp
  70. param_package.cpp
  71. param_package.h
  72. quaternion.h
  73. ring_buffer.h
  74. scm_rev.cpp
  75. scm_rev.h
  76. scope_exit.h
  77. string_util.cpp
  78. string_util.h
  79. swap.h
  80. telemetry.cpp
  81. telemetry.h
  82. thread.cpp
  83. thread.h
  84. thread_queue_list.h
  85. threadsafe_queue.h
  86. timer.cpp
  87. timer.h
  88. vector_math.h
  89. web_result.h
  90. )
  91. if(ARCHITECTURE_x86_64)
  92. target_sources(common
  93. PRIVATE
  94. x64/cpu_detect.cpp
  95. x64/cpu_detect.h
  96. )
  97. endif()
  98. create_target_directory_groups(common)
  99. target_link_libraries(common PUBLIC Boost::boost fmt microprofile)