-
Notifications
You must be signed in to change notification settings - Fork 116
CURA-2150: Initial Windows support #89
CURA-2150: Initial Windows support #89
Conversation
cura-build itself is not a C/C++ project, like set as default in CMake. Contributes to CURA-2150
Need a CMake guru here. Got a message that doesn't make any sense to me: 🙄 👈
Made sure cura-build-environment works, but running it on Linux and merged some changes. Will go to IRC about this in the meantime.. |
@awhiemstra , @sedwards2009 , @jackha : ping |
Ok, got a bit further.. For a reason my Protobuf build doesn't produce libprotobuf.dll, but I so no differences compared to old code. Additionally the old cura-build doesn't produce any .dll-files, too. |
Also don't like this solution of setting the location of the libraries manually, but CMake can't manage to find the libraries on it's own. Contributes to CURA-2150
Contributes to CURA-2150
Followed a hint on IRC and switched from static to dynamic linked libraries. I ended up with hardcoding the paths of the libraries. Very ugly but it works 😕 |
Haha, that is a very cryptic error message indeed! I'm usually a proponent of static linking. It makes it easier to distribute and build in most cases, and can even provide some performance boost via compiler optimisation (though not for Protobuf, really). It's not the best choice if multiple applications use the same library, but that's not really our use case. So if it's up to me, go for static. Hardcoding the paths of the libraries is not a good idea though, and we'd prefer to keep those out of the code. See if you can get it out, and don't be afraid to ask for help. Most of our developers are online on |
Ok, thanks. Will be there tomorrow. Yes, building statically makes more sense here. Will try to find an alternative solution for this problem here. Thank you for your feedback @Ghostkeeper and good night 😉 |
Also added a comment why it is needed. Contributes to CURA-2150
Contributes to CURA-2150
Contributes to CURA-2150
Contributes to CURA-2150
…thub.com/thopiekar/cura-build into master-environment_split-windows-support
Moreover it makes sure that the usage of "\" and "/" in the given path is correct. Without you'll run into this problem during building an NSIS installer on Windows: Running cx_Freeze File "setup.py", line 29 search_path.insert(2, "C:\Users\thopi\Documents\GitHub\cura-build-environment\build\env/lib/python3.5/site-packages/") ^ SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape CMakeFiles\build_bundle.dir\build.make:56: recipe for target 'build_bundle' failed mingw32-make[2]: *** [build_bundle] Error 1 CMakeFiles\Makefile2:407: recipe for target 'CMakeFiles/build_bundle.dir/all' failed mingw32-make[1]: *** [CMakeFiles/build_bundle.dir/all] Error 2 makefile:137: recipe for target 'all' failed mingw32-make: *** [all] Error 2 Contributes to CURA-2150
Is partial based on the script for OSX. Also had to add little changes for PyQt5, as it is preinstalled on Windows and not built by cura-build-environment. Contributes to CURA-2150
We don't build deb's anymore..
Can't say anything special here. The difference between this and the "old" cura-build is that we are calling now a python script, which is now using cx_Freeze. The results are then moved like before from Py2Exe to NSIS and then the installer is built (triggered by CPack). Contributes to CURA-2150
A very well known signing tool comes from Microsoft itself. Following their manual and some examples gives on the internet I made this script. (See https://msdn.microsoft.com/de-de/library/8s9b9yaz(v=vs.110).aspx) To make signing work, you'll needed here a pfx file. The script will check whether it exists and if there is no file, it will warn about this and skip signing. There is also a way to pass the password for signtool.exe by setting WINDOWS_IDENTITIY_PFX_PASSWORD. But the user will be warned about the usage of this for security reasons. Contributes to 2150
Useful when it is needed to add private sources into the build.
Now finally signs Cura.exe, CuraEngine.exe and the installer. As we can't make the sign command depend on the "package" target as it is an built-in command, you'll need to execute "sign_installer" here. Contributes to CURA-2150 Contributes to CURA-2473
…thub.com/thopiekar/cura-build into master-environment_split-windows-support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! I have posted a bunch of comments but most of them should be fairly minor.
* **SciPy** (http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy) | ||
You'll need to download a .whl from this site for Python 3.5 and install it via `pip install <your_whl_file>.whl`. | ||
* **Protobuf** (https://pypi.python.org/pypi/protobuf/3.1.0.post1) | ||
It can be easyly installed via `pip3 install protobuf` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/easyly/easily/g ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooops 😅
You'll need to download a .whl from this site for Python 3.5 and install it via `pip install <your_whl_file>.whl`. | ||
* **SciPy** (http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy) | ||
You'll need to download a .whl from this site for Python 3.5 and install it via `pip install <your_whl_file>.whl`. | ||
* **Protobuf** (https://pypi.python.org/pypi/protobuf/3.1.0.post1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not need the Protobuf Python bindings. They have been replaced by the Arcus Python bindings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, yes, we are building our binding using the protobuf tools, but don't need the protobuf python binding, isn't it?
configure_file(${CMAKE_CURRENT_LIST_DIR}/setup_win32.py.in setup.py @ONLY) | ||
add_custom_target(build_bundle) | ||
add_dependencies(packaging build_bundle) | ||
add_dependencies(build_bundle cura-binary-data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably depend on the projects
target, not a random project target. Depending on projects will trigger building the build_bundle target after all projects have built.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm not wrong I found these lines somewhere in the old cura-build and as I didn't know why it was set like that I just kept it like that.
Missed to ask about it sorry. But yes, makes sense!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
# TODO: Find a variable which holds the needed "win32"/"win64" | ||
# There is a CPACK* variable which holds this variable, but it doesn't exist at this moment here... | ||
if(${BUILD_OS_WIN32}) | ||
set(NSIS_SCRIPT_COPY_PATH "${CMAKE_BINARY_DIR}/_CPack_Packages/win32/${CPACK_GENERATOR}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than try and divine the win32/win64 here, why not set CPACK_PACKAGE_DIRECTORY to something known? Doing 32-bit/64-bit builds from the same build directory is not supported anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just the other way around ^^' Good idea! Will see how it works!
Thanks!
# Signing Cura.exe | ||
add_custom_command( | ||
TARGET signing PRE_BUILD | ||
COMMAND signtool sign ${signtool_OPTIONS} Cura.exe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to add a FindSigntool.cmake or similar file that searches for the signtool binary. That way we will have a bit more flexibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, but the path to signtool.exe needs to be set in PATH anyway.
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | ||
) | ||
else() | ||
message(FATAL_ERROR "Could not find the PFX file. Can not sign the executables!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Failing to sign should not be a fatal error in my opinion, it should just fail to sign but still build.
"excludes": [ ] | ||
} | ||
|
||
# Extra libraries for numpy.core* | ||
print("Copy numpy DLLs") | ||
numpy_core_dir = os.path.dirname(numpy.core.__file__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still needed with cx_Freeze? As far as I know it has better handling of dependencies so we do not need code like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, can't remember. I just focused on the old code and tried to convert it to be used with cx_Freeze.
I'll retry without.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, @awhiemstra. Made one rebuild with and without and compared with Meld for missing files. Both were the same 👍
SectionEnd | ||
|
||
Section /o "Open 3MF files with Cura" | ||
${RegisterExtension} "$INSTDIR\Cura.exe" ".3mf" "Cura.model.3MF" | ||
SectionEnd | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to add an X3D entry too? Or maybe we even want to make this more dynamic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done and sorted all types..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PS: Do you know a way to make for loops in NSIS? I couldn't find any 😕
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NSIS script is pretty limited and lacks decent control structures. The only thing I can think of is some trickery with the jump instructions. But I'd personally stay away from that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
We only need the protobuf compiler to generate our Arcus binding. No need for the protobuf Python module. Contributes to CURA-2150
Contributes to CURA-2150
Contributes to CURA-2150
Contributes to CURA-2150
In Py2Exe we had to care about adding additional libraries for NumPy. Now cx_Freeze does this job for us. Contributes to CURA-2150
Discussion: Ultimaker#89 (comment) Contributes to CURA-2150
This was mixed up before. Variables related to NSIS packaging were at signing before. Now everything related to NSIS is in packaging/windows.cmake. Contributes to CURA-2150
Contributes to CURA-2150
Contributes to CURA-2150
Contributes to CURA-2150
Added a TODO to check whether CPACK_SYSTEM_NAME is "win64", like expected. Contributes to CURA-2150
Contributes to CURA-2150
@awhiemstra Thanks! |
A change that I forget to remove, while experimenting on getting a rid of ${CMAKE_BINARY_DIR}/_CPack_Packages/${CPACK_SYSTEM_NAME}/NSIS Contributes to CURA-2150
These lines are necessary to get a working Cura installation! This reverts commit d2a8d3c.
At the moment the plugins directory of cura and uranium are moved into a new plugins directory. So finally are plugins are installed at {INSTALL_DIR}/plugins/plugins This change moves all plugins back to {INSTALL_DIR}/plugins. Contributes to CURA-2150
Now everything works, like shown on JIRA.