Skip to content

Commit

Permalink
Remove duplicate dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
techanvil committed Dec 30, 2024
1 parent 97b8eee commit e2737e7
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 12 deletions.
31 changes: 26 additions & 5 deletions src/ppui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ add_library(ppui STATIC

target_include_directories(ppui
PUBLIC
.
PRIVATE
osinterface
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/osinterface
)

target_link_libraries(ppui PRIVATE osinterface)
# Link against osinterface
target_link_libraries(ppui PUBLIC osinterface)

# Add platform-specific sources and include paths
if(APPLE)
Expand All @@ -123,6 +123,7 @@ if(APPLE)
${PROJECT_SOURCE_DIR}/src/tracker/cocoa
PUBLIC
cocoa
${CMAKE_CURRENT_SOURCE_DIR}/osinterface/posix
)
elseif(WIN32)
target_sources(ppui
Expand All @@ -136,6 +137,13 @@ elseif(WIN32)
PUBLIC
win32
)

if(TARGET SDL2::SDL2)
target_link_libraries(ppui PUBLIC SDL2::SDL2)
else()
target_include_directories(ppui PUBLIC ${SDL2_INCLUDE_DIRS})
target_link_libraries(ppui PUBLIC ${SDL2_LIBRARIES})
endif()
else()
target_sources(ppui
PRIVATE
Expand All @@ -147,7 +155,20 @@ else()
sdl/DisplayDeviceFB_SDL.h
sdl/DisplayDevice_SDL.h
)
target_include_directories(ppui PUBLIC sdl)
target_include_directories(ppui
PUBLIC
sdl
${CMAKE_CURRENT_SOURCE_DIR}/osinterface/posix
)

if(TARGET SDL2::SDL2)
# If the distro built SDL2 with CMake, we can just link to an exported target
target_link_libraries(ppui PUBLIC SDL2::SDL2)
else()
# Otherwise we need to do things the old-fashioned way for compatibility
target_include_directories(ppui PUBLIC ${SDL2_INCLUDE_DIRS})
target_link_libraries(ppui PUBLIC ${SDL2_LIBRARIES})
endif()
endif()

if(APPLE)
Expand Down
12 changes: 11 additions & 1 deletion src/ppui/osinterface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,17 @@ if(APPLE)
posix/PPSystemString_POSIX.h
posix/PPSystem_POSIX.h
)
target_include_directories(osinterface PUBLIC posix)
target_include_directories(osinterface
PUBLIC
posix
${PROJECT_SOURCE_DIR}/src/tracker/cocoa
)

# Link against Cocoa framework and make osinterface PUBLIC
target_link_libraries(osinterface
PUBLIC
"-framework Cocoa"
)
elseif(WIN32)
target_sources(osinterface
PRIVATE
Expand Down
5 changes: 3 additions & 2 deletions src/tools/export-to-wav/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ add_executable(export-to-wav
WAVUtils.cpp
)

target_link_libraries(export-to-wav
target_link_libraries(export-to-wav PRIVATE
trackerlib
milkyplay
compression
osinterface
${LHASA_LIBRARIES}
${ZZIPLIB_LIBRARIES}
${ZLIB_LIBRARIES}
Expand All @@ -18,6 +18,7 @@ target_include_directories(export-to-wav PRIVATE
${PROJECT_SOURCE_DIR}/src/milkyplay
${PROJECT_SOURCE_DIR}/src/ppui
${PROJECT_SOURCE_DIR}/src/ppui/osinterface
${ZLIB_INCLUDE_DIRS}
)

if(WIN32)
Expand Down
15 changes: 11 additions & 4 deletions src/tracker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,18 @@ target_include_directories(trackerlib
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/src/ppui
${PROJECT_SOURCE_DIR}/src/ppui/osinterface
${PROJECT_SOURCE_DIR}/src/ppui/osinterface/posix
)

if(WIN32)
target_include_directories(trackerlib PUBLIC
${PROJECT_SOURCE_DIR}/src/ppui/osinterface/win32
)
else()
target_include_directories(trackerlib PUBLIC
${PROJECT_SOURCE_DIR}/src/ppui/osinterface/posix
)
endif()

target_link_libraries(trackerlib
PUBLIC
milkyplay
Expand Down Expand Up @@ -153,10 +162,8 @@ target_include_directories(tracker

target_link_libraries(tracker
fx
milkyplay
osinterface
ppui
trackerlib
osinterface
)

if(CMAKE_VERSION GREATER_EQUAL 3.12)
Expand Down

0 comments on commit e2737e7

Please sign in to comment.