project(ProtectAsset)

set(SOURCE_FILES
    "ProtectAssetCommand.cpp"
    "ProtectAssetCommand.h"
    "plugin.cpp"
)

# Find Maya SDK using custom FindMaya module
find_package(Maya REQUIRED)

# Include directories
include_directories(
    ${MAYA_INCLUDE_DIR}
    ${CMAKE_SOURCE_DIR}/src
)

# Create the plugin library
add_library(ProtectAsset SHARED
    ${SOURCE_FILES}
)

# Target libraries
target_link_libraries(ProtectAsset
    ${MAYA_LIBRARIES}
)

# Platform-specific settings
if(WIN32)
    target_compile_definitions(ProtectAsset PRIVATE
        _CRT_SECURE_NO_WARNINGS
        _USRDLL
        _WINDLL
        NT_PLUGIN
    )
    # Ignore code page 950 (Traditional Chinese) warnings for source files
    target_compile_options(ProtectAsset PRIVATE "/wd4819")
    set_target_properties(ProtectAsset PROPERTIES
        OUTPUT_NAME "ProtectAsset"
        PREFIX ""
        SUFFIX ".mll"
    )
elseif(UNIX)
    set_target_properties(ProtectAsset PROPERTIES
        OUTPUT_NAME "ProtectAsset"
        PREFIX ""
        SUFFIX ".so"
    )
endif()

# Install rules
install(TARGETS ProtectAsset
    RUNTIME DESTINATION plug-ins/${MAYA_VERSION}
    LIBRARY DESTINATION plug-ins/${MAYA_VERSION}
)