cmake_minimum_required(VERSION 3.4.1)
add_compile_definitions(WORKLETS_VERSION=0.7.1)
add_compile_definitions(JS_RUNTIME_HERMES=1)
add_compile_definitions(HERMES_ENABLE_DEBUGGER=1)

set(WORKLET_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Common")

file(GLOB rnoh_worklet_SRC CONFIGURE_DEPENDS *.cpp)

add_library(rnoh_worklets SHARED ${rnoh_worklet_SRC})

target_include_directories(
  rnoh_worklets
  PUBLIC
  "${WORKLET_SRC_DIR}/cpp/worklets/AnimationFrameQueue"
  "${WORKLET_SRC_DIR}/cpp/worklets/NativeModules"
  "${WORKLET_SRC_DIR}/cpp/worklets/Registries"
  "${WORKLET_SRC_DIR}/cpp/worklets/Resources"
  "${WORKLET_SRC_DIR}/cpp/worklets/RunLoop"
  "${WORKLET_SRC_DIR}/cpp/worklets/SharedItems"
  "${WORKLET_SRC_DIR}/cpp/worklets/Tools"
  "${WORKLET_SRC_DIR}/cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/WorkletRuntime"
)
target_sources(rnoh_worklets
  PUBLIC
  "${WORKLET_SRC_DIR}/cpp/worklets/AnimationFrameQueue/AnimationFrameBatchinator.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/NativeModules/JSIWorkletsModuleProxy.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/NativeModules/WorkletsModuleProxy.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/Registries/EventHandlerRegistry.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/Registries/WorkletRuntimeRegistry.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/Resources/CustomSerializableUnpacker.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/Resources/SynchronizableUnpacker.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/Resources/ValueUnpacker.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/RunLoop/AsyncQueueImpl.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/RunLoop/EventLoop.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/SharedItems/MemoryManager.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/SharedItems/Serializable.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/SharedItems/Synchronizable.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/SharedItems/SynchronizableAccess.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/Tools/FeatureFlags.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/Tools/JSISerializer.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/Tools/JSLogger.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/Tools/JSScheduler.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/Tools/UIScheduler.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/Tools/VersionUtils.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/Tools/WorkletEventHandler.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/Tools/WorkletsJSIUtils.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/Tools/WorkletsVersion.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/WorkletRuntime/RuntimeData.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/WorkletRuntime/RuntimeManager.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/WorkletRuntime/UIRuntimeDecorator.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/WorkletRuntime/WorkletHermesRuntime.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/WorkletRuntime/WorkletRuntime.cpp"
  "${WORKLET_SRC_DIR}/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp"
  )

target_include_directories(rnoh_worklets PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(rnoh_worklets PUBLIC rnoh)
target_link_libraries(rnoh_worklets PUBLIC librawfile.z.so)

