Unity-Technologies / com.unity.webrtc

WebRTC package for Unity
Other
753 stars 191 forks source link

[BUG]: Fix MSVC compiler support on CLion #892

Closed doctorpangloss closed 1 year ago

doctorpangloss commented 1 year ago

Package version

3.0.0-pre.4

Environment

Windows 2022 LTSC
Unity 2021.3

Steps To Reproduce

  1. Use the MSVC cmake configuration, which is needed for nvcc support and for correct debugging in Unity.
  2. Observe CLion spits out a bunch of errors.
  3. Apply this patch to correctly specified precompiled headers in CMake:
    
    diff --git a/Plugin~/WebRTCPlugin/CMakeLists.txt b/Plugin~/WebRTCPlugin/CMakeLists.txt
    index 73b7411..e0b0212 100644
    --- a/Plugin~/WebRTCPlugin/CMakeLists.txt
    +++ b/Plugin~/WebRTCPlugin/CMakeLists.txt
    @@ -1,5 +1,7 @@
    add_library(WebRTCLib STATIC)

+target_precompile_headers(WebRTCLib PRIVATE pch.h) + target_sources( WebRTCLib PRIVATE Context.cpp @@ -121,8 +123,7 @@ if(Windows) endif()

if(Windows)

+target_precompile_headers(WebRTCLibTest PRIVATE pch.h) + target_sources( WebRTCLibTest PRIVATE pch.cpp @@ -84,8 +86,7 @@ else() endif()

if(Windows)

Current Behavior

CLion can't load the msvc cmake configuration.

Expected Behavior

It should be able to.

Anything else?

No response

karasusan commented 1 year ago

@doctorpangloss It looks good to me. Can you make the PR for this fix?

kannan-xiao4 commented 1 year ago

memo: WRS-464