rust-lang / cmake-rs

Rust build dependency for running cmake
https://docs.rs/cmake
Apache License 2.0
310 stars 124 forks source link

MSBUILD : error MSB1009: Project file does not exist. #192

Closed shelbyd closed 1 year ago

shelbyd commented 1 year ago

Trying to build libobs from https://github.com/obsproject/obs-studio on windows. I currently have the following build.rs:

fn main() {
    let dest = cmake::Config::new("obs-studio")
        .configure_arg("--preset windows-x64")
        .configure_arg("-Wno-dev")
        .build_target("libobs")
        .build();

    println!("cargo:rustc-link-search=native={}", dest.display());
    println!("cargo:rustc-link-lib=static=obs");
}

AFAICT, configure works fine, but the build fails with MSBUILD : error MSB1009: Project file does not exist.

Full output is:

  --- stdout
  CMAKE_TOOLCHAIN_FILE_x86_64-pc-windows-msvc = None
  CMAKE_TOOLCHAIN_FILE_x86_64_pc_windows_msvc = None
  HOST_CMAKE_TOOLCHAIN_FILE = None
  CMAKE_TOOLCHAIN_FILE = None
  CMAKE_GENERATOR_x86_64-pc-windows-msvc = None
  CMAKE_GENERATOR_x86_64_pc_windows_msvc = None
  HOST_CMAKE_GENERATOR = None
  CMAKE_GENERATOR = None
  CMAKE_PREFIX_PATH_x86_64-pc-windows-msvc = None
  CMAKE_PREFIX_PATH_x86_64_pc_windows_msvc = None
  HOST_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = None
  CMAKE_x86_64-pc-windows-msvc = None
  CMAKE_x86_64_pc_windows_msvc = None
  HOST_CMAKE = None
  CMAKE = None
  running: "cmake" "C:\my-project\obs-studio" "-G" "Visual Studio 17 2022" "-Thost=x64" "-Ax64" "-DCMAKE_INSTALL_PREFIX=C:\\my-project\\target\\debug\\build\\app-61d344a1600365f8\\out" "-DCMAKE_C_FLAGS= -nologo -MD -Brepro" "-DCMAKE_C_FLAGS_RELWITHDEBINFO= -nologo -MD -Brepro" "-DCMAKE_CXX_FLAGS= -nologo -MD -Brepro" "-DCMAKE_CXX_FLAGS_RELWITHDEBINFO= -nologo -MD -Brepro" "-DCMAKE_ASM_FLAGS= -nologo -MD -Brepro" "-DCMAKE_ASM_FLAGS_RELWITHDEBINFO= -nologo -MD -Brepro" "-DCMAKE_BUILD_TYPE=RelWithDebInfo" "--preset windows-x64" "-Wno-dev"
  Preset CMake variables:

    ENABLE_BROWSER:BOOL="TRUE"
    ENABLE_CCACHE:BOOL="FALSE"
    GPU_PRIORITY_VAL:STRING=""
    OBS_CMAKE_VERSION:STRING="3.0.0"
    RESTREAM_CLIENTID:STRING=""
    RESTREAM_HASH:STRING=""
    TWITCH_CLIENTID:STRING=""
    TWITCH_HASH:STRING=""
    VIRTUALCAM_GUID:STRING="A3FCE0F5-3493-419F-958A-ABA1250EC20B"
    YOUTUBE_CLIENTID:STRING=""
    YOUTUBE_CLIENTID_HASH:STRING=""
    YOUTUBE_SECRET:STRING=""
    YOUTUBE_SECRET_HASH:STRING=""

  -- Setting up Pre-Built obs-deps (x64)
  -- Setting up Pre-Built obs-deps (x64) - skipped
  -- Setting up Pre-Built Qt6 (x64)
  -- Setting up Pre-Built Qt6 (x64) - skipped
  -- Setting up Chromium Embedded Framework (x64)
  -- Setting up Chromium Embedded Framework (x64) - skipped
  -- Setting up Pre-Built obs-deps (x86)
  -- Setting up Pre-Built obs-deps (x86) - skipped
  -- Configuring done (0.2s)
  -- Generating done (0.1s)
  -- Build files have been written to: C:/my-project/obs-studio/build_x86
  -- Found FFmpeg: C:/my-project/obs-studio/.deps/obs-deps-2023-11-03-x64/bin/avcodec-60.dll (found version "6.0") found components: avformat avutil swscale swresample avcodec
  -- Found nlohmann_json: C:/my-project/obs-studio/.deps/obs-deps-2023-11-03-x64/share/cmake/nlohmann_json/nlohmann_jsonConfig.cmake (found version "3.11.2")
  -- Found FFmpeg: C:/my-project/obs-studio/.deps/obs-deps-2023-11-03-x64/bin/swresample-4.dll (found version "6.0") found components: avcodec avfilter avdevice avutil swscale avformat swresample
  -- Found FFmpeg: C:/my-project/obs-studio/.deps/obs-deps-2023-11-03-x64/bin/swresample-4.dll (found version "6.0") found components: avcodec avdevice avutil avformat
  -- Found FFmpeg: C:/my-project/obs-studio/.deps/obs-deps-2023-11-03-x64/bin/swresample-4.dll (found version "6.0") found components: avcodec avutil avformat
  -- Found VPL: optimized;C:/my-project/obs-studio/.deps/obs-deps-2023-11-03-x64/lib/vpld.lib (Required is at least version "2.6")
  -- Found VPL: optimized;C:/my-project/obs-studio/.deps/obs-deps-2023-11-03-x64/lib/vpld.lib (found suitable version "2.9", minimum required is "2.6")
  -- Found nlohmann_json: C:/my-project/obs-studio/.deps/obs-deps-2023-11-03-x64/share/cmake/nlohmann_json/nlohmann_jsonConfig.cmake (found suitable version "3.11.2", minimum required is "3")
  -- Found FFmpeg: C:/my-project/obs-studio/.deps/obs-deps-2023-11-03-x64/bin/avutil-58.dll (found version "6.0") found components: avcodec avutil
  -- Found FFmpeg: C:/my-project/obs-studio/.deps/obs-deps-2023-11-03-x64/bin/avformat-60.dll (found version "6.0") found components: avcodec avutil avformat
  -- Found nlohmann_json: C:/my-project/obs-studio/.deps/obs-deps-2023-11-03-x64/share/cmake/nlohmann_json/nlohmann_jsonConfig.cmake (found version "3.11.2")
  -- Found nlohmann_json: C:/my-project/obs-studio/.deps/obs-deps-2023-11-03-x64/share/cmake/nlohmann_json/nlohmann_jsonConfig.cmake (found suitable version "3.11.2", minimum required is "3")
  -- Configuring done (1.9s)
  -- Generating done (1.8s)
  -- Build files have been written to: C:/my-project/obs-studio/build_x64
  running: "cmake" "--build" "." "--target" "libobs" "--config" "RelWithDebInfo" "--parallel" "24"
  MSBuild version 17.7.2+d6990bcfa for .NET Framework
  MSBUILD : error MSB1009: Project file does not exist.
  Switch: libobs.vcxproj

  --- stderr
  CMake Warning (dev) at cmake/common/versionconfig.cmake:52 (message):

    ******************************************************************************

      + OBS-Studio - Release candidate detected, OBS_VERSION is now: 30.0.0-rc1-75-g35f848149

    ******************************************************************************
  Call Stack (most recent call first):
    cmake/common/bootstrap.cmake:60 (include)
    CMakeLists.txt:4 (include)
  This warning is for project developers.  Use -Wno-dev to suppress it.

  CMake Warning (dev) at cmake/finders/FindDetours.cmake:81 (message):
    Failed to find detours version.
  Call Stack (most recent call first):
    plugins/win-capture/graphics-hook/CMakeLists.txt:3 (find_package)
  This warning is for project developers.  Use -Wno-dev to suppress it.

                        _                   _             _ _
                   ___ | |__  ___       ___| |_ _   _  __| (_) ___
                  / _ \| '_ \/ __|_____/ __| __| | | |/ _` | |/ _ \
                 | (_) | |_) \__ \_____\__ \ |_| |_| | (_| | | (_) |
                  \___/|_.__/|___/     |___/\__|\__,_|\__,_|_|\___/

  OBS:  Application Version: 30.0.0-rc1-75-g35f848149 - Build Number: 66
  ==================================================================================

  ------------------------       Enabled Features           ------------------------
   - Browser panels
   - Direct3D 11 renderer
   - FTL protocol support
   - NVIDIA Audio FX support
   - NVIDIA Video FX support
   - OpenGL renderer
   - Plugin Support
   - RNNoise noise suppression
   - Scripting Support (Frontend)
   - Scripting support
   - SpeexDSP noise suppression
   - User Interface
   - What's New panel
  ------------------------       Disabled Features          ------------------------
   - Restream API connection
   - Sparkle updater
   - Twitch API connection
   - YouTube API connection
  ------------------------        Enabled Modules           ------------------------
   - aja
   - aja-output-ui
   - coreaudio-encoder
   - decklink
   - decklink-captions
   - decklink-output-ui
   - frontend-tools
   - graphics-hook
   - image-source
   - libobs-d3d11
   - libobs-winrt
   - obs-browser
   - obs-ffmpeg
   - obs-filters
   - obs-outputs
   - obs-qsv11
   - obs-text
   - obs-transitions
   - obs-virtualcam-module
   - obs-vst
   - obs-webrtc
   - obs-websocket
   - obs-x264
   - obslua
   - obspython
   - rtmp-services
   - text-freetype2
   - vlc-video
   - win-capture
   - win-dshow
   - win-wasapi
  ------------------------        Disabled Modules          ------------------------
   - test-input
  ----------------------------------------------------------------------------------
  CMake Warning:
    Manually-specified variables were not used by the project:

      CMAKE_ASM_FLAGS
      CMAKE_ASM_FLAGS_RELWITHDEBINFO

I have no idea what to do next. I am not particularly familiar with cmake and c-lang building in general. Spoiled by Rust. Totally possible I'm overlooking something obvious.

Thanks!

shelbyd commented 1 year ago

I have also tried setting the target to libobs/libobs, it fails with the same error but the "switch" is libobs/libobs.vcxproj.

If I cd into obs-studio/build_x64 and run the exact command (AFAICT) "cmake" "--build" "." "--target" "libobs" "--config" "RelWithDebInfo" "--parallel" "24" it works.

shelbyd commented 1 year ago

Seems like the obs-studio build is putting the configuration(?) into my-project/obs-studio/build_x64 and not cargo's OUT_DIR. If so, it makes sense that the target wouldn't be found.

shelbyd commented 1 year ago

I was able to get to the next error, that seems like an issue I need to resolve, by .define("OBS_CMAKE_VERSION", "3.0.0") like the windows-x64 preset.