2023-06-20 05:36:09 +00:00
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
2020-03-13 21:49:58 +00:00
|
|
|
|
2021-09-15 22:46:38 +00:00
|
|
|
include_directories("${PROJECT_SOURCE_DIR}"
|
2021-10-23 18:17:47 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/devices"
|
2021-09-15 22:46:38 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/thirdparty/loguru/")
|
2020-03-13 21:49:58 +00:00
|
|
|
|
|
|
|
file(GLOB SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
|
|
|
|
|
|
|
|
add_library(machines OBJECT ${SOURCES})
|
Make Emscripten build not depend on SDL2 or cubeb
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/
2023-09-04 00:59:35 +00:00
|
|
|
target_link_libraries(machines PRIVATE)
|