/ externals / CMakeLists.txt
CMakeLists.txt
 1  # Always build externals as static libraries, even when dynarmic is built as shared
 2  if (BUILD_SHARED_LIBS)
 3      set(BUILD_SHARED_LIBS OFF)
 4      set(CMAKE_POSITION_INDEPENDENT_CODE ON)
 5      set_property(DIRECTORY PROPERTY EXCLUDE_FROM_ALL ON)
 6  endif()
 7  
 8  # Allow options shadowing with normal variables when subproject use old cmake policy
 9  set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
10  
11  # Disable tests in all externals supporting the standard option name
12  set(BUILD_TESTING OFF)
13  
14  # For libraries that already come with a CMakeLists file,
15  # simply add the directory to that file as a subdirectory
16  # to have CMake automatically recognize them.
17  
18  # biscuit
19  
20  if (NOT TARGET biscuit::biscuit)
21      if ("riscv" IN_LIST ARCHITECTURE)
22          add_subdirectory(biscuit)
23      endif()
24  endif()
25  
26  # catch
27  
28  if (NOT TARGET Catch2::Catch2WithMain)
29      if (DYNARMIC_TESTS)
30          add_subdirectory(catch EXCLUDE_FROM_ALL)
31      endif()
32  endif()
33  
34  # fmt
35  
36  if (NOT TARGET fmt::fmt)
37      # fmtlib formatting library
38      set(FMT_INSTALL ON)
39      add_subdirectory(fmt)
40  endif()
41  
42  # mcl
43  
44  if (NOT TARGET merry::mcl)
45      set(MCL_INSTALL ON)
46      add_subdirectory(mcl)
47  endif()
48  
49  # oaknut
50  
51  if (NOT TARGET merry::oaknut)
52      if ("arm64" IN_LIST ARCHITECTURE)
53          add_subdirectory(oaknut)
54      elseif (DYNARMIC_TESTS)
55          add_subdirectory(oaknut EXCLUDE_FROM_ALL)
56      endif()
57  endif()
58  
59  # robin-map
60  
61  if (NOT TARGET tsl::robin_map)
62      add_subdirectory(robin-map)
63  endif()
64  
65  # xbyak
66  
67  if (NOT TARGET xbyak::xbyak)
68      if ("x86_64" IN_LIST ARCHITECTURE)
69          add_subdirectory(xbyak)
70      endif()
71  endif()
72  
73  # zydis
74  
75  if (NOT TARGET Zydis::Zydis)
76      if ("x86_64" IN_LIST ARCHITECTURE)
77          set(ZYDIS_BUILD_TOOLS OFF)
78          set(ZYDIS_BUILD_EXAMPLES OFF)
79          set(ZYDIS_BUILD_DOXYGEN OFF)
80          set(ZYAN_ZYCORE_PATH "${CMAKE_CURRENT_LIST_DIR}/zycore" CACHE PATH "")
81          set(CMAKE_DISABLE_FIND_PACKAGE_Doxygen ON)
82          add_subdirectory(zydis)
83          add_library(Zydis::Zydis ALIAS Zydis)
84      endif()
85  endif()