# SPDX-License-Identifier: LGPL-2.1-or-later

if(WIN32)
    add_definitions(-DFCAppSandbox)
endif(WIN32)

include_directories(
    ${CMAKE_CURRENT_BINARY_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}
)

if (BUILD_QT5)
    include_directories(
        SYSTEM
        ${Qt5Core_INCLUDE_DIRS}
    )
else()
    include_directories(
        SYSTEM
        ${QT_INCLUDE_DIR}
    )
endif()


set(Sandbox_LIBS
    Mesh
)

SET(Sandbox_SRCS
    AppSandbox.cpp
    DocumentProtector.cpp
    DocumentProtector.h
    DocumentProtectorPy.cpp
    DocumentProtectorPy.h
    DocumentThread.cpp
    DocumentThread.h
    PreCompiled.h
)

set (Sandbox_Scripts
    ../Init.py
    ../exportDRAWEXE.py
)

add_library(Sandbox SHARED ${Sandbox_SRCS} ${Sandbox_Scripts})
target_link_libraries(Sandbox ${Sandbox_LIBS})


if(FREECAD_USE_PCH)
    target_precompile_headers(Sandbox PRIVATE
            $<$<COMPILE_LANGUAGE:CXX>:"${CMAKE_CURRENT_LIST_DIR}/PreCompiled.h">
    )
endif(FREECAD_USE_PCH)

fc_target_copy_resource_flat(Sandbox
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_BINARY_DIR}/Mod/Sandbox
    ${Sandbox_Scripts})

SET_BIN_DIR(Sandbox Sandbox /Mod/Sandbox)
SET_PYTHON_PREFIX_SUFFIX(Sandbox)

INSTALL(TARGETS Sandbox DESTINATION ${CMAKE_INSTALL_LIBDIR})
