<commit_before>cmake_minimum_required( VERSION 3.8.0 )

project(Intel.RealSense)

set(LRS_DOTNET_TARGET ${PROJECT_NAME})

add_library(${PROJECT_NAME}
    Context.cs
    NativeMethods.cs
    .nuget/Intel.RealSense.targets
    GlobalSuppressions.cs
    Properties/AssemblyInfo.cs
    packages.config
    stylecop.json
)

include(Base/CMakeLists.txt)
include(Devices/CMakeLists.txt)
include(Frames/CMakeLists.txt)
include(Pipeline/CMakeLists.txt)
include(Processing/CMakeLists.txt)
include(StreamProfiles/CMakeLists.txt)
include(Sensors/CMakeLists.txt)
include(Types/CMakeLists.txt)
include(Helpers/CMakeLists.txt)
include(Options/CMakeLists.txt)

csharp_set_designer_cs_properties(
    .nuget/Intel.RealSense.targets
)

if(BUILD_UNITY_BINDINGS)
	string(REPLACE "/" "\\" CMAKE_BINARY_WIN_DIR ${CMAKE_BINARY_DIR})
	string(REPLACE "/" "\\" CMAKE_SOURCE_WIN_DIR ${CMAKE_SOURCE_DIR})
	file(MAKE_DIRECTORY ${CMAKE_BINARY_WIN_DIR}/wrappers)
	if(NOT EXISTS ${CMAKE_BINARY_WIN_DIR}/wrappers/unity)
		execute_process(COMMAND cmd "/C mklink /D ${CMAKE_BINARY_WIN_DIR}\\wrappers\\unity ${CMAKE_SOURCE_WIN_DIR}\\wrappers\\unity")
	endif()
    add_custom_command(TARGET ${PROJECT_NAME}
               POST_BUILD
               COMMAND XCOPY /y /s "$(OutDir)Intel.RealSense.dll" "${CMAKE_BINARY_WIN_DIR}\\wrappers\\unity\\Assets\\RealSenseSDK2.0\\Plugins\\"
               COMMENT "Copy Intel.RealSense.dll to Unity plugins folder")
    add_custom_command(TARGET ${PROJECT_NAME}
               POST_BUILD
               COMMAND XCOPY /y /s "$(OutDir)realsense2.dll" "${CMAKE_BINARY_WIN_DIR}\\wrappers\\unity\\Assets\\RealSenseSDK2.0\\Plugins\\"
               COMMENT "Copy realsense2.dll to Unity plugins folder")

    find_program (UNITY_PATH Unity\\Editor\\Unity.exe)
    if(EXISTS ${UNITY_PATH})
        message(STATUS "Found Unity at - ${UNITY_PATH}, will try to generate RealSense Unity package on C# wrapper build")
        string(REPLACE "/" "\\" UNITY_WIN_PATH ${UNITY_PATH})
        add_custom_command(TARGET ${PROJECT_NAME}
                   POST_BUILD
                   COMMAND ${UNITY_WIN_PATH} -quit -batchmode -projectPath "${CMAKE_BINARY_WIN_DIR}\\wrappers\\unity" -exportPackage "Assets" "$(OutDir)realsense.unitypackage" || EXIT 0
                   COMMENT "Try to generate a Unity package")
    else()
        message(WARNING "Couldn't locate Unity.exe")
    endif()
endif()

set_property(SOURCE App.xaml PROPERTY VS_XAML_TYPE "ApplicationDefinition")

set_property(TARGET ${PROJECT_NAME} PROPERTY VS_DOTNET_TARGET_FRAMEWORK_VERSION "v${DOTNET_VERSION_LIBRARY}")

add_dependencies(${PROJECT_NAME} realsense2)
<commit_msg>PR #8135 from Nir: Add log to unity build command<commit_after>cmake_minimum_required( VERSION 3.8.0 )

project(Intel.RealSense)

set(LRS_DOTNET_TARGET ${PROJECT_NAME})

add_library(${PROJECT_NAME}
    Context.cs
    NativeMethods.cs
    .nuget/Intel.RealSense.targets
    GlobalSuppressions.cs
    Properties/AssemblyInfo.cs
    packages.config
    stylecop.json
)

include(Base/CMakeLists.txt)
include(Devices/CMakeLists.txt)
include(Frames/CMakeLists.txt)
include(Pipeline/CMakeLists.txt)
include(Processing/CMakeLists.txt)
include(StreamProfiles/CMakeLists.txt)
include(Sensors/CMakeLists.txt)
include(Types/CMakeLists.txt)
include(Helpers/CMakeLists.txt)
include(Options/CMakeLists.txt)

csharp_set_designer_cs_properties(
    .nuget/Intel.RealSense.targets
)

if(BUILD_UNITY_BINDINGS)
	string(REPLACE "/" "\\" CMAKE_BINARY_WIN_DIR ${CMAKE_BINARY_DIR})
	string(REPLACE "/" "\\" CMAKE_SOURCE_WIN_DIR ${CMAKE_SOURCE_DIR})
	file(MAKE_DIRECTORY ${CMAKE_BINARY_WIN_DIR}/wrappers)
	if(NOT EXISTS ${CMAKE_BINARY_WIN_DIR}/wrappers/unity)
		execute_process(COMMAND cmd "/C mklink /D ${CMAKE_BINARY_WIN_DIR}\\wrappers\\unity ${CMAKE_SOURCE_WIN_DIR}\\wrappers\\unity")
	endif()
    add_custom_command(TARGET ${PROJECT_NAME}
               POST_BUILD
               COMMAND XCOPY /y /s "$(OutDir)Intel.RealSense.dll" "${CMAKE_BINARY_WIN_DIR}\\wrappers\\unity\\Assets\\RealSenseSDK2.0\\Plugins\\"
               COMMENT "Copy Intel.RealSense.dll to Unity plugins folder")
    add_custom_command(TARGET ${PROJECT_NAME}
               POST_BUILD
               COMMAND XCOPY /y /s "$(OutDir)realsense2.dll" "${CMAKE_BINARY_WIN_DIR}\\wrappers\\unity\\Assets\\RealSenseSDK2.0\\Plugins\\"
               COMMENT "Copy realsense2.dll to Unity plugins folder")

    find_program (UNITY_PATH Unity\\Editor\\Unity.exe)
    if(EXISTS ${UNITY_PATH})
        message(STATUS "Found Unity at - ${UNITY_PATH}, will try to generate RealSense Unity package on C# wrapper build")
        string(REPLACE "/" "\\" UNITY_WIN_PATH ${UNITY_PATH})
        add_custom_command(TARGET ${PROJECT_NAME}
                   POST_BUILD
                   COMMAND ${UNITY_WIN_PATH} -quit -batchmode -logFile "$(OutDir)Unity.log" -projectPath "${CMAKE_BINARY_WIN_DIR}\\wrappers\\unity" -exportPackage "Assets" "$(OutDir)realsense.unitypackage" || EXIT 0
                   COMMENT "Try to generate a Unity package")
    else()
        message(WARNING "Couldn't locate Unity.exe")
    endif()
endif()

set_property(SOURCE App.xaml PROPERTY VS_XAML_TYPE "ApplicationDefinition")

set_property(TARGET ${PROJECT_NAME} PROPERTY VS_DOTNET_TARGET_FRAMEWORK_VERSION "v${DOTNET_VERSION_LIBRARY}")

add_dependencies(${PROJECT_NAME} realsense2)

{'fraction_non_alphanumeric': 0.11714930424971794, 'fraction_numerical': 0.004889056036103798, 'mean_word_length': 4.065714285714286, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4324528', 'n_tokens_mistral': 1939, 'n_tokens_neox': 1814, 'n_words': 295}