diff --git a/.gitmodules b/.gitmodules index d501359b..91dde495 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ +[submodule "externals/fmt"] + path = externals/fmt + url = https://github.com/fmtlib/fmt.git [submodule "externals/xbyak"] path = externals/xbyak url = https://github.com/herumi/xbyak diff --git a/CMakeLists.txt b/CMakeLists.txt index 204b3b43..09cff012 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,6 +87,9 @@ if (DYNARMIC_USE_LLVM) llvm_map_components_to_libnames(llvm_libs x86desc x86disassembler) endif() +# Pull in externals CMakeLists for libs where available +add_subdirectory(externals) + # Dynarmic project files add_subdirectory(src) add_subdirectory(tests) diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt new file mode 100644 index 00000000..7df8cfac --- /dev/null +++ b/externals/CMakeLists.txt @@ -0,0 +1,6 @@ +# For libraries that already come with a CMakeLists file, +# simply add the directory to that file as a subdirectory +# to have CMake automatically recognize them. + +# fmtlib formatting library +add_subdirectory(fmt) diff --git a/externals/fmt b/externals/fmt new file mode 160000 index 00000000..2ae6bca4 --- /dev/null +++ b/externals/fmt @@ -0,0 +1 @@ +Subproject commit 2ae6bca488795929a0207d109e135751f10c53d9 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 44775466..550cf9ba 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -81,3 +81,8 @@ set_target_properties(dynarmic PROPERTIES LINKER_LANGUAGE CXX) target_include_directories(dynarmic PUBLIC ../include PRIVATE .) +# Link fmt +target_link_libraries(dynarmic PRIVATE fmt-header-only) +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + target_compile_definitions(dynarmic PRIVATE FMT_USE_WINDOWS_H=0) +endif()