diff --git a/src/ppui/CMakeLists.txt b/src/ppui/CMakeLists.txt index df809706..9dd490cc 100644 --- a/src/ppui/CMakeLists.txt +++ b/src/ppui/CMakeLists.txt @@ -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) @@ -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 @@ -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 @@ -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) diff --git a/src/ppui/osinterface/CMakeLists.txt b/src/ppui/osinterface/CMakeLists.txt index 6452f515..a30fd67e 100644 --- a/src/ppui/osinterface/CMakeLists.txt +++ b/src/ppui/osinterface/CMakeLists.txt @@ -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 diff --git a/src/tools/export-to-wav/CMakeLists.txt b/src/tools/export-to-wav/CMakeLists.txt index 91e33176..a6e9cbe3 100644 --- a/src/tools/export-to-wav/CMakeLists.txt +++ b/src/tools/export-to-wav/CMakeLists.txt @@ -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} @@ -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) diff --git a/src/tracker/CMakeLists.txt b/src/tracker/CMakeLists.txt index d3f92cb7..d99c43fc 100644 --- a/src/tracker/CMakeLists.txt +++ b/src/tracker/CMakeLists.txt @@ -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 @@ -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)