Emscripten build

This commit is contained in:
kevinbchen
2021-01-04 00:58:24 -08:00
parent 63466dc2ea
commit 6ade1624f1
4 changed files with 115 additions and 79 deletions

View File

@ -89,13 +89,16 @@ endif()
# Link and create SDL2 Definition if we're using it
if (SDL2_ENABLED)
add_compile_definitions(BLAH_USE_SDL2)
if (NOT DEFINED SDL2_INCLUDE_DIRS OR NOT DEFINED SDL2_LIBRARIES)
find_package(SDL2 REQUIRED)
if (${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
set_target_properties(blah PROPERTIES COMPILE_FLAGS "-s USE_SDL=2")
else()
if (NOT DEFINED SDL2_INCLUDE_DIRS OR NOT DEFINED SDL2_LIBRARIES)
find_package(SDL2 REQUIRED)
endif()
target_include_directories(blah PUBLIC "$<BUILD_INTERFACE:${SDL2_INCLUDE_DIRS}>")
set(LIBS ${LIBS} ${SDL2_LIBRARIES})
endif()
target_include_directories(blah PUBLIC "$<BUILD_INTERFACE:${SDL2_INCLUDE_DIRS}>")
set(LIBS ${LIBS} ${SDL2_LIBRARIES})
endif()
target_link_libraries(blah PUBLIC ${LIBS})