mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-12-27 15:29:39 +00:00
1f7edfdb3b
While Emscripten has an SDL compabtility layer, it assumes that the code is executing in the main browser process (and thus has access to them DOM). The Infinite Mac project runs emulators in a worker thread (for better performance) and has a custom API for the display, sound, input, etc. Similarly, it does not need the cross-platform sound support from cubeb, there there is a sound API as well. This commit makes SDL (*_sdl.cpp) and cubeb-based (*_cubeb.cpp) code be skipped when targeting Emscripten, and instead *_js.cpp files are used instead (this is the cross-platform convention used by Chromium[^1], and could be extended for other targets). For hostevents.cpp and soundserver.cpp the entire file was replaced, whereas for videoctrl.cpp there was enough shared logic that it was kept, and the platform-specific bits were moved behind a Display class that can have per-platform implementations. For cases where we need additional private fields in the platform-specific classes, we use a PIMPL pattern. The *_js.cpp files with implementations are not included in this commit, since they are closely tied to the Infinite Mac project, and will live in its fork of DingusPPC. [^1]: https://www.chromium.org/developers/design-documents/conventions-and-patterns-for-multi-platform-development/
31 lines
1.3 KiB
CMake
31 lines
1.3 KiB
CMake
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
|
include(PlatformGlob)
|
|
|
|
include_directories("${PROJECT_SOURCE_DIR}"
|
|
"${PROJECT_SOURCE_DIR}/thirdparty/loguru/"
|
|
)
|
|
|
|
platform_glob(SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/common/*.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/common/adb/*.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/common/i2c/*.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/common/ata/*.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/common/pci/*.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/common/scsi/*.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/ethernet/*.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/floppy/*.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/ioctrl/*.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/memctrl/*.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/serial/*.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/sound/*.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/storage/*.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/video/*.cpp"
|
|
)
|
|
|
|
add_library(devices OBJECT ${SOURCES})
|
|
if (EMSCRIPTEN)
|
|
target_link_libraries(devices PRIVATE)
|
|
else()
|
|
target_link_libraries(devices PRIVATE cubeb SDL2::SDL2)
|
|
endif()
|