target_sources(citra_core PRIVATE "${CMAKE_SOURCE_DIR}/src/core/arm/dynarmic/arm_tick_counts.cpp")
add_executable(azaharplus_web web_main.cpp)
target_compile_definitions(azaharplus_web PRIVATE ENABLE_SOFTWARE_RENDERER)
target_link_libraries(azaharplus_web PRIVATE citra_core video_core audio_core citra_common input_common)
target_include_directories(azaharplus_web PRIVATE ${CMAKE_SOURCE_DIR}/src)
target_link_options(azaharplus_web PRIVATE
  -pthread -msimd128 -fexceptions
  "-sINITIAL_MEMORY=536870912" "-sALLOW_MEMORY_GROWTH=1" "-sMAXIMUM_MEMORY=2147483648"
  "-sSTACK_SIZE=8388608" "-sPTHREAD_POOL_SIZE=4"
  "-sMODULARIZE=1" "-sEXPORT_NAME=createAzaharPlus" "-sEXIT_RUNTIME=0"
  "-sFORCE_FILESYSTEM=1" "-sENVIRONMENT=web,worker" "-sALLOW_BLOCKING_ON_MAIN_THREAD=1"
  "-sEXPORTED_FUNCTIONS=['_main','_az_boot','_az_cia_id','_az_install_cia','_az_title_path','_az_step','_az_buttons','_az_touch','_az_debug','_malloc','_free']"
  "-sINCOMING_MODULE_JS_API=['locateFile','mainScriptUrlOrBlob','print','printErr','onAbort','onRuntimeInitialized']"
  "-sEXPORTED_RUNTIME_METHODS=['ccall','FS','UTF8ToString','HEAPU8']"
  -lidbfs.js -lworkerfs.js)
set_target_properties(azaharplus_web PROPERTIES SUFFIX ".js")
