Merge pull request #6508 from lioncash/cmake-common

Common/CMakeLists: Migrate off add_dolphin_library
This commit is contained in:
Léo Lam 2018-03-24 09:08:20 +01:00 committed by GitHub
commit 4c5efb0f3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 38 additions and 30 deletions

View File

@ -1,4 +1,4 @@
set(SRCS add_library(common
Analytics.cpp Analytics.cpp
CDUtils.cpp CDUtils.cpp
ColorUtil.cpp ColorUtil.cpp
@ -44,83 +44,91 @@ set(SRCS
x64Emitter.cpp x64Emitter.cpp
) )
set(LIBS ${LIBS} ${MBEDTLS_LIBRARIES}) target_link_libraries(common PUBLIC
${CMAKE_THREAD_LIBS_INIT}
${CURL_LIBRARIES}
enet
${MBEDTLS_LIBRARIES}
${VTUNE_LIBRARIES}
)
if(ANDROID) if(ANDROID)
set(SRCS ${SRCS} target_sources(common PRIVATE
Logging/ConsoleListenerDroid.cpp) Logging/ConsoleListenerDroid.cpp
)
target_link_libraries(common PRIVATE iconv)
elseif(WIN32) elseif(WIN32)
set(SRCS ${SRCS} target_sources(common PRIVATE
Logging/ConsoleListenerWin.cpp) Logging/ConsoleListenerWin.cpp
)
else() else()
set(SRCS ${SRCS} target_sources(common PRIVATE
Logging/ConsoleListenerNix.cpp) Logging/ConsoleListenerNix.cpp
)
endif() endif()
list(APPEND LIBS enet ${CURL_LIBRARIES})
if(_M_ARM_64) if(_M_ARM_64)
set(SRCS ${SRCS} target_sources(common PRIVATE
Arm64Emitter.cpp Arm64Emitter.cpp
ArmCPUDetect.cpp ArmCPUDetect.cpp
GenericFPURoundMode.cpp GenericFPURoundMode.cpp
) )
else() else()
if(_M_X86) #X86 if(_M_X86) #X86
set(SRCS ${SRCS} target_sources(common PRIVATE
x64FPURoundMode.cpp x64FPURoundMode.cpp
x64CPUDetect.cpp x64CPUDetect.cpp
) )
else() # Generic else() # Generic
set(SRCS ${SRCS} target_sources(common PRIVATE
GenericFPURoundMode.cpp GenericFPURoundMode.cpp
GenericCPUDetect.cpp GenericCPUDetect.cpp
) )
endif() endif()
endif() endif()
list(APPEND LIBS "${CMAKE_THREAD_LIBS_INIT}" ${VTUNE_LIBRARIES})
# OpenGL Interface # OpenGL Interface
set(SRCS ${SRCS} target_sources(common PRIVATE
GL/GLUtil.cpp GL/GLUtil.cpp
GL/GLExtensions/GLExtensions.cpp GL/GLExtensions/GLExtensions.cpp
GL/GLInterface/GLInterface.cpp GL/GLInterface/GLInterface.cpp
) )
if(USE_EGL) if(USE_EGL)
set(SRCS ${SRCS} GL/GLInterface/EGL.cpp) target_sources(common PRIVATE GL/GLInterface/EGL.cpp)
if(ANDROID) if(ANDROID)
set(SRCS ${SRCS} GL/GLInterface/EGLAndroid.cpp) target_sources(common PRIVATE GL/GLInterface/EGLAndroid.cpp)
elseif(USE_X11) elseif(USE_X11)
set(SRCS ${SRCS} GL/GLInterface/EGLX11.cpp) target_sources(common PRIVATE GL/GLInterface/EGLX11.cpp)
endif() endif()
set(LIBS ${LIBS} EGL) target_link_libraries(common PUBLIC EGL)
endif() endif()
if(WIN32) if(WIN32)
set(SRCS ${SRCS} GL/GLInterface/WGL.cpp CompatPatches.cpp) target_sources(common PRIVATE
CompatPatches.cpp
GL/GLInterface/WGL.cpp
)
elseif(APPLE) elseif(APPLE)
set(SRCS ${SRCS} GL/GLInterface/AGL.mm) target_sources(common PRIVATE GL/GLInterface/AGL.mm)
elseif(HAIKU) elseif(HAIKU)
set(SRCS ${SRCS} GL/GLInterface/BGL.cpp) target_sources(common PRIVATE GL/GLInterface/BGL.cpp)
set(LIBS ${LIBS} be GL) target_link_libraries(common PUBLIC be GL)
elseif(USE_X11) elseif(USE_X11)
if (NOT USE_EGL) if (NOT USE_EGL)
set(SRCS ${SRCS} GL/GLInterface/GLX.cpp) target_sources(common PRIVATE GL/GLInterface/GLX.cpp)
# GLX has a hard dependency on libGL. # GLX has a hard dependency on libGL.
# Make sure to link to it if using GLX. # Make sure to link to it if using GLX.
set(LIBS ${LIBS} ${OPENGL_LIBRARIES}) target_link_libraries(common PUBLIC ${OPENGL_LIBRARIES})
endif() endif()
set(SRCS ${SRCS} GL/GLInterface/X11_Util.cpp) target_sources(common PRIVATE GL/GLInterface/X11_Util.cpp)
set(LIBS ${LIBS} ${XRANDR_LIBRARIES}) target_link_libraries(common PUBLIC ${XRANDR_LIBRARIES})
endif() endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(LIBS ${LIBS} dl) target_link_libraries(common PUBLIC dl rt)
endif() endif()
add_dolphin_library(common "${SRCS}" "${LIBS}")
if(USE_UPNP) if(USE_UPNP)
target_link_libraries(common PRIVATE Miniupnpc::miniupnpc) target_link_libraries(common PRIVATE Miniupnpc::miniupnpc)
endif() endif()