yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

CMake: Correct inter-module dependencies and library visibility

Modules didn't correctly define their dependencies before, which relied
on the frontends implicitly including every module for linking to
succeed.

Also changed every target_link_libraries call to specify visibility of
dependencies to avoid leaking definitions to dependents when not
necessary.
This commit is contained in:
Yuri Kunde Schlesner 2017-05-27 18:26:55 -07:00
parent 62f34c8e5c
commit 7b81903756
8 changed files with 27 additions and 23 deletions

View File

@ -38,9 +38,10 @@ endif()
create_directory_groups(${SRCS} ${HEADERS})
add_library(audio_core STATIC ${SRCS} ${HEADERS})
target_link_libraries(audio_core SoundTouch)
target_link_libraries(audio_core PUBLIC common core)
target_link_libraries(audio_core PRIVATE SoundTouch)
if(SDL2_FOUND)
target_link_libraries(audio_core ${SDL2_LIBRARY})
set_property(TARGET audio_core APPEND PROPERTY COMPILE_DEFINITIONS HAVE_SDL2)
target_link_libraries(audio_core PRIVATE ${SDL2_LIBRARY})
target_compile_definitions(audio_core PRIVATE HAVE_SDL2)
endif()

View File

@ -18,12 +18,12 @@ create_directory_groups(${SRCS} ${HEADERS})
include_directories(${SDL2_INCLUDE_DIR})
add_executable(citra ${SRCS} ${HEADERS})
target_link_libraries(citra core video_core audio_core common input_common)
target_link_libraries(citra ${SDL2_LIBRARY} ${OPENGL_gl_LIBRARY} inih glad)
target_link_libraries(citra PRIVATE common core input_common)
target_link_libraries(citra PRIVATE ${SDL2_LIBRARY} ${OPENGL_gl_LIBRARY} inih glad)
if (MSVC)
target_link_libraries(citra getopt)
target_link_libraries(citra PRIVATE getopt)
endif()
target_link_libraries(citra ${PLATFORM_LIBRARIES} Threads::Threads)
target_link_libraries(citra PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
if(UNIX AND NOT APPLE)
install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")

View File

@ -91,9 +91,9 @@ if (APPLE)
else()
add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS})
endif()
target_link_libraries(citra-qt core video_core audio_core common input_common)
target_link_libraries(citra-qt ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS})
target_link_libraries(citra-qt ${PLATFORM_LIBRARIES} Threads::Threads)
target_link_libraries(citra-qt PRIVATE audio_core common core input_common video_core)
target_link_libraries(citra-qt PRIVATE ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS} glad)
target_link_libraries(citra-qt PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
if(UNIX AND NOT APPLE)
install(TARGETS citra-qt RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")

View File

@ -96,5 +96,5 @@ create_directory_groups(${SRCS} ${HEADERS})
add_library(common STATIC ${SRCS} ${HEADERS})
if (ARCHITECTURE_x86_64)
target_link_libraries(common xbyak)
target_link_libraries(common PRIVATE xbyak)
endif()

View File

@ -380,5 +380,5 @@ include_directories(../../externals/cryptopp)
create_directory_groups(${SRCS} ${HEADERS})
add_library(core STATIC ${SRCS} ${HEADERS})
target_link_libraries(core dynarmic cryptopp)
target_link_libraries(core PUBLIC common PRIVATE audio_core video_core)
target_link_libraries(core PRIVATE cryptopp dynarmic)

View File

@ -19,9 +19,9 @@ endif()
create_directory_groups(${SRCS} ${HEADERS})
add_library(input_common STATIC ${SRCS} ${HEADERS})
target_link_libraries(input_common common core)
target_link_libraries(input_common PUBLIC core PRIVATE common)
if(SDL2_FOUND)
target_link_libraries(input_common ${SDL2_LIBRARY})
set_property(TARGET input_common APPEND PROPERTY COMPILE_DEFINITIONS HAVE_SDL2)
target_link_libraries(input_common PRIVATE ${SDL2_LIBRARY})
target_compile_definitions(input_common PRIVATE HAVE_SDL2)
endif()

View File

@ -13,7 +13,8 @@ create_directory_groups(${SRCS} ${HEADERS})
include_directories(../../externals/catch/single_include/)
add_executable(tests ${SRCS} ${HEADERS})
target_link_libraries(tests core video_core audio_core common)
target_link_libraries(tests ${PLATFORM_LIBRARIES} Threads::Threads)
target_link_libraries(tests PRIVATE common core)
target_link_libraries(tests PRIVATE glad) # To support linker work-around
target_link_libraries(tests PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
add_test(NAME tests COMMAND $<TARGET_FILE:tests>)

View File

@ -79,13 +79,15 @@ endif()
create_directory_groups(${SRCS} ${HEADERS})
add_library(video_core STATIC ${SRCS} ${HEADERS})
target_link_libraries(video_core glad)
target_link_libraries(video_core PUBLIC common core)
target_link_libraries(video_core PRIVATE glad)
if (ARCHITECTURE_x86_64)
target_link_libraries(video_core xbyak)
target_link_libraries(video_core PRIVATE xbyak)
endif()
if (PNG_FOUND)
target_link_libraries(video_core ${PNG_LIBRARIES})
include_directories(${PNG_INCLUDE_DIRS})
add_definitions(${PNG_DEFINITIONS})
target_link_libraries(video_core PRIVATE ${PNG_LIBRARIES})
target_include_directories(video_core PRIVATE ${PNG_INCLUDE_DIRS})
target_compile_definitions(video_core PRIVATE ${PNG_DEFINITIONS})
endif()