mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-24 15:24:30 +01:00
Check for EMSCRIPTEN variable in emscripten builds
This commit is contained in:
@@ -17,7 +17,7 @@ file(GLOB_RECURSE OPENRCT2_CLI_SOURCES
|
||||
add_executable(${PROJECT_NAME} ${OPENRCT2_CLI_SOURCES})
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_LIST_DIR}/..")
|
||||
ipo_set_target_properties(${PROJECT_NAME})
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Emscripten")
|
||||
if (EMSCRIPTEN)
|
||||
target_link_libraries(${PROJECT_NAME} ${ICU_DT_LIBRARY_RELEASE} ${ICU_DATA_LIBRARIES})
|
||||
endif ()
|
||||
target_link_libraries(${PROJECT_NAME} libopenrct2 Threads::Threads)
|
||||
|
||||
@@ -11,7 +11,7 @@ option(DISABLE_VORBIS "Disable OGG/VORBIS support.")
|
||||
option(DISABLE_OPENGL "Disable OpenGL support.")
|
||||
|
||||
# Third party libraries
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Emscripten")
|
||||
if (EMSCRIPTEN)
|
||||
set(USE_FLAGS "${EMSCRIPTEN_FLAGS}")
|
||||
if (NOT DISABLE_VORBIS)
|
||||
set(USE_FLAGS "${USE_FLAGS} -s USE_VORBIS=1 -s USE_OGG=1")
|
||||
@@ -42,7 +42,7 @@ else ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (NOT DISABLE_OPENGL AND NOT CMAKE_SYSTEM_NAME MATCHES "Emscripten")
|
||||
if (NOT DISABLE_OPENGL AND NOT EMSCRIPTEN)
|
||||
# GL doesn't work nicely with macOS, while find_package doesn't work with multiarch on Ubuntu.
|
||||
if (APPLE)
|
||||
find_package(OpenGL REQUIRED)
|
||||
@@ -70,7 +70,7 @@ SET_CHECK_CXX_FLAGS(${PROJECT_NAME})
|
||||
ipo_set_target_properties(${PROJECT_NAME})
|
||||
|
||||
# mingw builds cannot use the PkgConfig imported targets
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Emscripten")
|
||||
if (EMSCRIPTEN)
|
||||
target_link_libraries(${PROJECT_NAME} "libopenrct2"
|
||||
${SPEEXDSP_LIBRARIES}
|
||||
${ICU_DATA_LIBRARIES}
|
||||
@@ -95,7 +95,7 @@ if (NOT DISABLE_FLAC)
|
||||
endif ()
|
||||
|
||||
if (NOT DISABLE_VORBIS)
|
||||
if (NOT MSVC AND NOT WIN32 AND NOT CMAKE_SYSTEM_NAME MATCHES "Emscripten")
|
||||
if (NOT MSVC AND NOT WIN32 AND NOT EMSCRIPTEN)
|
||||
target_link_libraries(${PROJECT_NAME} PkgConfig::OGG PkgConfig::VORBISFILE)
|
||||
else ()
|
||||
target_link_libraries(${PROJECT_NAME} ${OGG_LDFLAGS} ${VORBISFILE_LDFLAGS})
|
||||
|
||||
@@ -114,7 +114,7 @@ if (NOT DISABLE_GOOGLE_BENCHMARK)
|
||||
endif ()
|
||||
|
||||
# Third party libraries
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Emscripten")
|
||||
if (EMSCRIPTEN)
|
||||
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${ICU_INCLUDE_DIR})
|
||||
set(USE_FLAGS "${EMSCRIPTEN_FLAGS}")
|
||||
if (NOT DISABLE_VORBIS)
|
||||
@@ -152,7 +152,7 @@ if (STATIC)
|
||||
${ZLIB_STATIC_LIBRARIES}
|
||||
${LIBZIP_STATIC_LIBRARIES})
|
||||
else ()
|
||||
if (NOT MSVC AND NOT CMAKE_SYSTEM_NAME MATCHES "Emscripten")
|
||||
if (NOT MSVC AND NOT EMSCRIPTEN)
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
PkgConfig::PNG
|
||||
PkgConfig::ZLIB
|
||||
@@ -182,11 +182,11 @@ find_package(Threads REQUIRED)
|
||||
target_link_libraries(${PROJECT_NAME} Threads::Threads)
|
||||
|
||||
# For some reason, these flags break the check for pthreads. Add them after.
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Emscripten")
|
||||
if (EMSCRIPTEN)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXPORTED_FUNCTIONS=_GetVersion,_main --js-library ${ROOT_DIR}/emscripten/deps.js")
|
||||
endif()
|
||||
|
||||
if (NOT MINGW AND NOT MSVC AND NOT CMAKE_SYSTEM_NAME MATCHES "Emscripten")
|
||||
if (NOT MINGW AND NOT MSVC AND NOT EMSCRIPTEN)
|
||||
if (APPLE AND NOT MACOS_USE_DEPENDENCIES)
|
||||
execute_process(COMMAND brew --prefix icu4c OUTPUT_VARIABLE HOMEBREW_PREFIX_ICU OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
# Needed for linking with non-broken icu on Apple platforms
|
||||
@@ -264,7 +264,7 @@ if (NOT OPENRCT2_COMMIT_SHA1_SHORT STREQUAL "HEAD" AND NOT OPENRCT2_COMMIT_SHA1_
|
||||
OPENRCT2_COMMIT_SHA1_SHORT="${OPENRCT2_COMMIT_SHA1_SHORT}")
|
||||
endif()
|
||||
|
||||
if((X86 OR X86_64) AND NOT MSVC AND NOT CMAKE_SYSTEM_NAME MATCHES "Emscripten")
|
||||
if((X86 OR X86_64) AND NOT MSVC AND NOT EMSCRIPTEN)
|
||||
set_source_files_properties(${CMAKE_CURRENT_LIST_DIR}/drawing/SSE41Drawing.cpp PROPERTIES COMPILE_FLAGS -msse4.1)
|
||||
set_source_files_properties(${CMAKE_CURRENT_LIST_DIR}/drawing/AVX2Drawing.cpp PROPERTIES COMPILE_FLAGS -mavx2)
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user