| Summary: | Build issues on Windows | ||
|---|---|---|---|
| Product: | [Unmaintained] rust-qt-binding-generator | Reporter: | Svend Tofte <stofte> |
| Component: | demo | Assignee: | Jos van den Oever <jos> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Other | ||
| Latest Commit: | https://commits.kde.org/rust-qt-binding-generator/f678d441e9fe31d6d933f6c27b884b807438fcad | Version Fixed/Implemented In: | |
| Sentry Crash Report: | |||
|
Description
Svend Tofte
2018-11-05 19:55:34 UTC
Nice to hear you got it working on windows.
Would these changes work for you?
diff --git a/examples/todos/CMakeLists.txt b/examples/todos/CMakeLists.txt
index 9a940af..8400542 100644
--- a/examples/todos/CMakeLists.txt
+++ b/examples/todos/CMakeLists.txt
@@ -37,7 +37,11 @@ feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAG
### build commands ###
SET(RUST_DIR "${CMAKE_CURRENT_SOURCE_DIR}/rust")
-SET(RUST_LIB "${RUST_DIR}/${RUST_TARGET_DIR}/librust.a")
+if (MSVC)
+ SET(RUST_LIB "${RUST_DIR}/${RUST_TARGET_DIR}/rust.lib")
+else()
+ SET(RUST_LIB "${RUST_DIR}/${RUST_TARGET_DIR}/librust.a")
+endif()
# generate c++ and rust code from bindings.json
add_custom_command(
@@ -61,6 +65,9 @@ add_custom_command(
add_custom_target(rust_target DEPENDS "${RUST_LIB}")
list(APPEND Libs "${RUST_LIB}")
+if (MSVC)
+ list(APPEND Libs WS2_32.LIB Userenv.lib)
+endif()
list(APPEND Libs Qt5::Core Qt5::Quick Threads::Threads ${CMAKE_DL_LIBS})
set(SRCS src/main.cpp src/Bindings.cpp "qml.qrc")
add_executable(todos ${SRCS})
Applying the patch fixes my build issues yes :) Git commit f678d441e9fe31d6d933f6c27b884b807438fcad by Jos van den Oever. Committed on 11/11/2018 at 15:03. Pushed by vandenoever into branch 'master'. Fix building with MSVC M +10 -3 demo/CMakeLists.txt M +8 -1 examples/todos/CMakeLists.txt M +5 -1 templates/qt_quick/CMakeLists.txt M +5 -1 templates/qt_widgets/CMakeLists.txt M +8 -3 tests/CMakeLists.txt https://commits.kde.org/rust-qt-binding-generator/f678d441e9fe31d6d933f6c27b884b807438fcad The patch also fixes the 'test' and 'demo' targets. I'm curious if the demo application works on windows. Hello Jos, I'm not able to build the demo app (using cmake and the same approach as used for the todo sample). It breaks on the usage of a "build" command, which is not found. Looking at the generated msbuild files (specificallly "rust_target.vcxproj", which is generated in both cases). In todos, the build steps look like this: <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Generating rust/target/release/rust.lib</Message> <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">setlocal cd C:\src\rust-qt-binding-generator\examples\todos\rust if %errorlevel% neq 0 goto :cmEnd C: if %errorlevel% neq 0 goto :cmEnd C:\Users\svto\.cargo\bin\cargo.exe build --release if %errorlevel% neq 0 goto :cmEnd :cmEnd endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone :cmErrorLevel exit /b %1 :cmDone if %errorlevel% neq 0 goto :VCEnd</Command> The same section for the demo project looks like this: <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Generating rust/rust.lib</Message> <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">setlocal cd C:\src\rust-qt-binding-generator\demo\rust if %errorlevel% neq 0 goto :cmEnd C: if %errorlevel% neq 0 goto :cmEnd build if %errorlevel% neq 0 goto :cmEnd :cmEnd endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone :cmErrorLevel exit /b %1 :cmDone if %errorlevel% neq 0 goto :VCEnd</Command> The bare "build" line causes the issue. Might be as simple as quotes missing? I will try to investigate during the week and see if I can learn anything. Here's the cmake output btw: https://gist.github.com/stofte/4cbe0e8afcc38dca3a718b2738a25708 cmake output from building todo also included at the bottom, for comparison. When I look at the cmakelist.txt it looks fairly different from the one in the todo dir. In the todo dir, there's also a cmake subdir, which has stuff like FindCargo.cmake, which I guess cmake is auto including, the bare "build" line I mention seems to be the attempt to run "cargo build" on line 23. There's also no find_package commands in the demo cmake? Sorry for spamming, but I can't edit this in, but my cmake version is 3.12.2 The demo application takes information from the parent directory CMakeLists.txt. The example and template applications are stand-alone. You can run cmake and build in example/todo/, but not in demo/. For demo you run cmake for the parent and then 'make Demo'. Ok, that helped alot. It still fails on "ECM", which I guess is this repo https://github.com/KDE/extra-cmake-modules I ran cmake in ecm cloned folder, and it didn't complain too much (a doc generation tool was missing, no problem). In the following, I've used "set ECM_DIR=C:\src\extra-cmake-modules" to indicate the path, and when I run cmake, I get the following: https://gist.github.com/stofte/238c20d2a2788f53749e9be23ad3e3e2 Have you tried running 'make install' on the ECM in Windows? Or you might be able to change the demo CMakeLists.txt with some IF statement so that missing ECM is not a problem. KDE parts are optional and just for the use with Kirigami. cmake -P cmake_install.cmake worked for installing ecm, and then commenting out these two lines, and cmake generated the project:
L:39 find_library(DL_LIBRARY ${CMAKE_DL_LIBS})
L:46 message(FATAL_ERROR "No runtime information library (-ldl or -lexecinfo)")
Even so, I should have simply tried the rust code to start with because it doesn't build :(
https://gist.github.com/stofte/0dd1b6bee4502f32c3076a0b6419312b
Seems pid_t is unsupported on windows https://github.com/rust-lang/libc/pull/833
|