diff --git a/CMakeLists.txt b/CMakeLists.txt index 39318dd94b..909b897993 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -354,6 +354,8 @@ add_library(Common STATIC include_directories(Common) setup_target_project(Common Common) +target_link_libraries(Common Snappy::Snappy) + if(WIN32) include_directories(dx9sdk/Include) target_link_libraries(Common winmm d3d9 dxguid dsound) @@ -363,24 +365,11 @@ if(TARGET SDL2::SDL2) target_link_libraries(Common SDL2::SDL2) endif() -if(NOT USING_GLES2) - add_subdirectory(ext/glew) -else() +if(USING_GLES2) find_package(X11) endif() -find_package(Snappy) -if(SNAPPY_FOUND) - add_definitions(-DSHARED_SNAPPY) -else() - add_subdirectory(ext/snappy) -endif() - -if(WIN32) - add_subdirectory(ext/cmake/armips) -endif() - -add_subdirectory(ext/udis86) +add_subdirectory(ext) add_library(vjson STATIC ext/native/ext/vjson/json.cpp @@ -607,9 +596,6 @@ include_directories(ext/cityhash) if (NOT MSVC) # These can be fast even for debug. - if(NOT SNAPPY_FOUND) - set_target_properties(snappy PROPERTIES COMPILE_FLAGS "-O3") - endif() set_target_properties(udis86 PROPERTIES COMPILE_FLAGS "-O3") set_target_properties(cityhash PROPERTIES COMPILE_FLAGS "-O3") if(NOT ZLIB_FOUND) @@ -1049,7 +1035,7 @@ if(ANDROID) SET(ATOMIC_LIB atomic) endif() -target_link_libraries(native ${LIBZIP_LIBRARY} ${ZLIB_LIBRARY} ${PNG_LIBRARY} rg_etc1 vjson snappy udis86 ${RT_LIB} ${nativeExtraLibs} ${ATOMIC_LIB}) +target_link_libraries(native ${LIBZIP_LIBRARY} ${ZLIB_LIBRARY} ${PNG_LIBRARY} rg_etc1 vjson udis86 ${RT_LIB} ${nativeExtraLibs} ${ATOMIC_LIB}) if(TARGET glew) target_link_libraries(native glew) endif() diff --git a/Common/ChunkFile.cpp b/Common/ChunkFile.cpp index 985cfe9424..a3288b27c0 100644 --- a/Common/ChunkFile.cpp +++ b/Common/ChunkFile.cpp @@ -16,6 +16,7 @@ // http://code.google.com/p/dolphin-emu/ #include +#include #include "ChunkFile.h" diff --git a/Common/ChunkFile.h b/Common/ChunkFile.h index 5f47a4a3d4..8bfca2b5fa 100644 --- a/Common/ChunkFile.h +++ b/Common/ChunkFile.h @@ -36,11 +36,6 @@ #include "Common.h" #include "FileUtil.h" -#ifdef SHARED_SNAPPY -#include -#else -#include "../ext/snappy/snappy-c.h" -#endif template struct LinkedListItem : public T diff --git a/Common/Common.vcxproj b/Common/Common.vcxproj index cfd26a5698..97867bd8a3 100644 --- a/Common/Common.vcxproj +++ b/Common/Common.vcxproj @@ -72,7 +72,7 @@ _CRTDBG_MAP_ALLOC;USING_WIN_UI;_CRT_SECURE_NO_WARNINGS;WIN32;_ARCH_32=1;_M_IX86=1;_DEBUG;_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions) stdafx.h;Common/DbgNew.h MultiThreadedDebug - ../ext/native;.. + ../ext/native;../ext/snappy;.. StreamingSIMDExtensions2 Fast true @@ -99,7 +99,7 @@ stdafx.h;Common/DbgNew.h MultiThreadedDebug _CRTDBG_MAP_ALLOC;USING_WIN_UI;_CRT_SECURE_NO_WARNINGS;WIN32;_ARCH_64=1;_M_X64=1;_DEBUG;_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions) - ../ext/native;.. + ../ext/native;../ext/snappy;.. NotSet Fast false @@ -132,7 +132,7 @@ false StreamingSIMDExtensions2 Fast - ../ext/native;.. + ../ext/native;../ext/snappy;.. Speed true false @@ -161,7 +161,7 @@ true USING_WIN_UI;_CRT_SECURE_NO_WARNINGS;WIN32;_ARCH_64=1;_M_X64=1;NDEBUG;_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions) stdafx.h - ../ext/native;.. + ../ext/native;../ext/snappy;.. false NotSet Fast diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 1a5f1a465b..569e317a3f 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -68,7 +68,7 @@ Level3 - ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86\include;../common;..;../ext/native;../ext/glew;../ext/zlib;../ext/native/ext + ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86\include;../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/zlib;../ext/native/ext _CRTDBG_MAP_ALLOC;USING_WIN_UI;_CRT_SECURE_NO_WARNINGS;USE_FFMPEG;WIN32;_ARCH_32=1;_M_IX86=1;_DEBUG;_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions) StreamingSIMDExtensions2 Fast @@ -90,7 +90,7 @@ Level3 - ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\include;../common;..;../ext/native;../ext/glew;../ext/zlib;../ext/native/ext + ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\include;../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/zlib;../ext/native/ext _CRTDBG_MAP_ALLOC;USING_WIN_UI;_CRT_SECURE_NO_WARNINGS;USE_FFMPEG;WIN32;_ARCH_64=1;_M_X64=1;_DEBUG;_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions) NotSet Fast @@ -116,7 +116,7 @@ MaxSpeed true true - ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86\include;../common;..;../ext/native;../ext/glew;../ext/zlib;../ext/native/ext + ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86\include;../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/zlib;../ext/native/ext false StreamingSIMDExtensions2 Fast @@ -146,7 +146,7 @@ MaxSpeed true true - ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\include;../common;..;../ext/native;../ext/glew;../ext/zlib;../ext/native/ext + ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\include;../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/zlib;../ext/native/ext NotSet Fast false diff --git a/GPU/GPU.vcxproj b/GPU/GPU.vcxproj index 94b56fbea7..0da54d1281 100644 --- a/GPU/GPU.vcxproj +++ b/GPU/GPU.vcxproj @@ -83,7 +83,7 @@ Level3 - ../common;..;../ext;../ext/native;../ext/glew; + ../common;..;../ext;../ext/native;../ext/glew;../ext/snappy; _CRTDBG_MAP_ALLOC;USING_WIN_UI;_CRT_SECURE_NO_WARNINGS;WIN32;_ARCH_32=1;_M_IX86=1;_DEBUG;_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions) StreamingSIMDExtensions2 Fast @@ -105,7 +105,7 @@ Level3 - ../common;..;../ext;../ext/native;../ext/glew; + ../common;..;../ext;../ext/native;../ext/glew;../ext/snappy; NotSet Fast false @@ -131,7 +131,7 @@ MaxSpeed true true - ../common;..;../ext;../ext/native;../ext/glew; + ../common;..;../ext;../ext/native;../ext/glew;../ext/snappy; false StreamingSIMDExtensions2 Fast @@ -157,7 +157,7 @@ MaxSpeed true true - ../common;..;../ext;../ext/native;../ext/glew; + ../common;..;../ext;../ext/native;../ext/glew;../ext/snappy; false NotSet Fast diff --git a/UI/UI.vcxproj b/UI/UI.vcxproj index d5116f5c23..3a12bb046f 100644 --- a/UI/UI.vcxproj +++ b/UI/UI.vcxproj @@ -132,7 +132,7 @@ Level3 _CRTDBG_MAP_ALLOC;USING_WIN_UI;_CRT_SECURE_NO_WARNINGS;_ARCH_32=1;WIN32;_DEBUG;_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions) - ../common;..;../ext/native;../ext/glew;../ext/zlib;../ext/native/ext + ../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/zlib;../ext/native/ext true false false @@ -155,7 +155,7 @@ Level3 _CRTDBG_MAP_ALLOC;USING_WIN_UI;_CRT_SECURE_NO_WARNINGS;_ARCH_64=1;WIN32;_DEBUG;_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions) - ../common;..;../ext/native;../ext/glew;../ext/zlib;../ext/native/ext + ../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/zlib;../ext/native/ext true false false @@ -182,7 +182,7 @@ true true USING_WIN_UI;_CRT_SECURE_NO_WARNINGS;_ARCH_32=1;WIN32;NDEBUG;_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions) - ../common;..;../ext/native;../ext/glew;../ext/zlib;../ext/native/ext + ../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/zlib;../ext/native/ext false Speed true @@ -209,7 +209,7 @@ true true USING_WIN_UI;_CRT_SECURE_NO_WARNINGS;_ARCH_64=1;WIN32;NDEBUG;_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions) - ../common;..;../ext/native;../ext/glew;../ext/zlib;../ext/native/ext + ../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/zlib;../ext/native/ext false true false diff --git a/android/jni/Locals.mk b/android/jni/Locals.mk index b67d1559d4..e881796df7 100644 --- a/android/jni/Locals.mk +++ b/android/jni/Locals.mk @@ -9,6 +9,7 @@ LOCAL_C_INCLUDES := \ $(LOCAL_PATH)/../../Common \ $(LOCAL_PATH)/../.. \ $(LOCAL_PATH)/../../ext \ + $(LOCAL_PATH)/../../ext/snappy \ $(LOCAL_PATH)/$(NATIVE)/base \ $(LOCAL_PATH)/$(NATIVE)/ext \ $(LOCAL_PATH)/$(NATIVE)/ext/libzip \ diff --git a/cmake/Modules/FindSnappy.cmake b/cmake/Modules/FindSnappy.cmake index 2541e97432..312dfb1299 100644 --- a/cmake/Modules/FindSnappy.cmake +++ b/cmake/Modules/FindSnappy.cmake @@ -57,3 +57,9 @@ mark_as_advanced( SNAPPY_ROOT_DIR SNAPPY_LIBRARIES SNAPPY_INCLUDE_DIR) + +add_library(Snappy::Snappy IMPORTED UNKNOWN GLOBAL) +set_target_properties(Snappy::Snappy PROPERTIES + IMPORTED_LOCATION "${SNAPPY_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${SNAPPY_INCLUDE_DIR}" +) diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt new file mode 100644 index 0000000000..28c09ad1b1 --- /dev/null +++ b/ext/CMakeLists.txt @@ -0,0 +1,7 @@ +add_subdirectory(cmake/armips) +if(NOT USING_GLES2) + add_subdirectory(glew) +endif() + +add_subdirectory(snappy) +add_subdirectory(udis86) diff --git a/ext/cmake/armips/CMakeLists.txt b/ext/cmake/armips/CMakeLists.txt index a348dabb3b..0bac8f0e50 100644 --- a/ext/cmake/armips/CMakeLists.txt +++ b/ext/cmake/armips/CMakeLists.txt @@ -107,4 +107,6 @@ add_library(armips ) target_include_directories(armips BEFORE PUBLIC ${ARMIPS_PATH}) - +set_target_properties(armips PROPERTIES + EXCLUDE_FROM_ALL ON +) diff --git a/ext/glew/CMakeLists.txt b/ext/glew/CMakeLists.txt index 5e5a9df970..f69cc7d008 100644 --- a/ext/glew/CMakeLists.txt +++ b/ext/glew/CMakeLists.txt @@ -10,4 +10,7 @@ if(NOT GLEW_FOUND) target_link_libraries(glew PUBLIC ${OPENGL_LIBRARIES}) target_compile_definitions(glew PUBLIC GLEW_STATIC) target_include_directories(glew PUBLIC . ${OPENGL_INCLUDE_DIR}) + set_target_properties(glew PROPERTIES + EXCLUDE_FROM_ALL ON + ) endif() diff --git a/ext/snappy/CMakeLists.txt b/ext/snappy/CMakeLists.txt index f2a9573977..e817f73fef 100644 --- a/ext/snappy/CMakeLists.txt +++ b/ext/snappy/CMakeLists.txt @@ -1,10 +1,21 @@ -add_library(snappy STATIC - snappy-c.cpp - snappy-internal.h - snappy-sinksource.h - snappy-stubs-internal.h - snappy-stubs-public.h - snappy.cpp - snappy.h -) +find_package(Snappy) +if(NOT SNAPPY_FOUND) + add_library(snappy STATIC + snappy-c.cpp + snappy-c.h + snappy-internal.h + snappy-sinksource.h + snappy-stubs-internal.h + snappy-stubs-public.h + snappy.cpp + snappy.h + ) + target_include_directories(snappy PUBLIC .) + + if(NOT MSVC) + target_compile_options(snappy PRIVATE "-O3") + endif() + + add_library(Snappy::Snappy ALIAS snappy) +endif()