Skip to content

Commit

Permalink
do not build sdl2 for ui-wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Busse committed Nov 16, 2023
1 parent 4af96eb commit 5778d39
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/ui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ if(EMSCRIPTEN)
-Wformat
-Os
-fwasm-exceptions
"SHELL:-s USE_SDL=2"
-pthread)

add_link_options(
Expand All @@ -57,6 +58,7 @@ if(EMSCRIPTEN)
--shell-file
${CMAKE_CURRENT_SOURCE_DIR}/shell_minimal.html
"SHELL:-s PTHREAD_POOL_SIZE=30"
"SHELL:-s USE_SDL=2"
-fwasm-exceptions
-pthread
-sFETCH)
Expand Down Expand Up @@ -109,7 +111,6 @@ if(EMSCRIPTEN)
${outputFileName}
PRIVATE implot
function2::function2
SDL2::SDL2
plf_colony
app_header
utils
Expand Down Expand Up @@ -181,5 +182,4 @@ target_link_libraries(
remotesignalsources_test
PRIVATE client
services
imgui
SDL2::SDL2)
imgui)
11 changes: 4 additions & 7 deletions src/ui/cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,20 @@ FetchContent_Declare(

FetchContent_MakeAvailable(imgui implot imgui-node-editor yaml-cpp stb opencmw-cpp plf_colony function2)

if (NOT EMSCRIPTEN)
FetchContent_Declare(
sdl2
OVERRIDE_FIND_PACKAGE
GIT_REPOSITORY "https://github.com/libsdl-org/SDL"
GIT_TAG release-2.28.2
)

if (EMSCRIPTEN)
set(sdl2_SDL_ATOMIC ON CACHE INTERNAL "ON")
endif()

FetchContent_MakeAvailable(sdl2)

find_package(SDL2 REQUIRED)
find_package(OpenGL REQUIRED COMPONENTS OpenGL)

endif()

# imgui and implot are not CMake Projects, so we have to define their targets manually here
add_library(
imgui
Expand All @@ -84,8 +83,6 @@ add_library(
)
if(NOT EMSCRIPTEN) # emscripten comes with its own sdl, for native we have to specify the dependency
target_link_libraries(imgui PUBLIC SDL2::SDL2 OpenGL::GL)
else()
target_link_libraries(imgui PUBLIC SDL2::SDL2 )
endif()

target_include_directories(
Expand Down

0 comments on commit 5778d39

Please sign in to comment.