From bb887013952f468006e320d0bff063abfe750d81 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 14 Jul 2016 01:49:41 +0200 Subject: [PATCH 001/101] Start splitting things into Environment and Build bits --- CMakeLists.txt | 1207 ++++++++++++------------- cmake/FindPyQt.cmake | 24 + cmake/FindSciPy.cmake | 24 + cmake/GetFromEnvironmentOrCache.cmake | 9 + 4 files changed, 624 insertions(+), 640 deletions(-) create mode 100644 cmake/FindPyQt.cmake create mode 100644 cmake/FindSciPy.cmake create mode 100644 cmake/GetFromEnvironmentOrCache.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b1b6056..683671ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,656 +7,583 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) include(ExternalProject) include(GNUInstallDirs) -# Define Options -option(BUILD_PYTHON "Include Python" ON) -option(BUILD_QT "Include Qt" ON) -option(BUILD_SIP "Include SIP" ON) -option(BUILD_PYQT "Include PyQt" ON) -option(BUILD_NUMPY "Include Numpy" ON) -option(BUILD_SCIPY "Include Scipy" ON) -option(BUILD_PYSERIAL "Include PySerial" ON) -option(BUILD_NUMPY_STL "Include Numpy-STL" ON) -option(BUILD_ZEROCONF "Include python-zeroconf" ON) +# find_package(CuraBuildEnvironment) +# include(CuraBuildPlatformDetection) +include(GetFromEnvironmentOrCache) -if(WIN32) - option(BUILD_64BIT "Create a 64-bit build" OFF) -endif() - -# Create variables to simplify OS management -set(BUILD_OS_OSX OFF) -set(BUILD_OS_LINUX OFF) -set(BUILD_OS_WINDOWS OFF) -set(BUILD_OS_WIN32 OFF) -set(BUILD_OS_WIN64 OFF) - -if(CYGWIN) - message(FATAL_ERROR "Cygwin is not supported") -endif() - -if(APPLE) - set(BUILD_OS_OSX ON) -elseif(WIN32) - set(BUILD_OS_WINDOWS ON) - if(BUILD_64BIT) - set(BUILD_OS_WIN64 ON) - else() - set(BUILD_OS_WIN32 ON) - endif() -elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - set(BUILD_OS_LINUX ON) -else() - message(FATAL_ERROR "Unsupported Operating System: ${CMAKE_SYSTEM_NAME}") -endif() +find_package(PythonInterp 3.5.0 REQUIRED) +find_package(Qt5 5.6.0 REQUIRED Core Qml Quick Widgets) +# find_package(Arcus 1.1 REQUIRED) -# Explicitly disable unsupported options -if(BUILD_OS_WINDOWS) - set(BUILD_PYTHON OFF) +# find_package(Python-Arcus VERSION 1.1 REQUIRED) +find_package(PyQt 5.6 REQUIRED) +find_package(SciPy 0.17 REQUIRED) - # Disable building of Numpy and Scipy due to build failures. - set(BUILD_NUMPY OFF) - set(BUILD_SCIPY OFF) - set(BUILD_NUMPY_STL OFF) - set(BUILD_ZEROCONF OFF) - - # On Win32, MinGW built Qt ignores environment variable changes made when running the - # application. Since we need that to disable the threaded renderer, we need to use an - # MSVC built Qt/PyQt for now. - # - # On Win64, in addition MinGW built python extensions fail to load properly so we cannot - # use it at all. - set(BUILD_QT OFF) - set(BUILD_PYQT OFF) - if(BUILD_OS_WIN64) - # Sip is required to build the Arcus python bindings, which works fine on Win32 - # but fails on Win64. So we need an externally built SIP and Arcus bindings on Win64. - set(BUILD_SIP OFF) - endif() -elseif(BUILD_OS_LINUX) - set(BUILD_PYTHON OFF) -endif() - -set(TAG_OR_BRANCH "master" CACHE STRING "The name of the tag or branch to build") -set(EXTRA_REPOSITORIES "" CACHE STRING "Extra repositories to install. Expected to have a CMake based build system.") set(EXTERNALPROJECT_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/inst) -set(EXTERNALPROJECT_SITEPACKAGES_DIR ${EXTERNALPROJECT_INSTALL_PREFIX}/lib/python3.4/site-packages) - -# Create the version-related variables -# These can optionally be overridden from the build enviroment. -if(DEFINED ENV{CURA_MAJOR_VERSION}) - set(CURA_MAJOR_VERSION $ENV{CURA_MAJOR_VERSION} CACHE STRING "Cura Major Version" FORCE) -else() - set(CURA_MAJOR_VERSION "master" CACHE STRING "Cura Major Version") -endif() -if(DEFINED ENV{CURA_MINOR_VERSION}) - set(CURA_MINOR_VERSION $ENV{CURA_MINOR_VERSION} CACHE STRING "Cura Minor Version" FORCE) -else() - set(CURA_MINOR_VERSION "0" CACHE STRING "Cura Minor Version") -endif() - -if(DEFINED ENV{CURA_PATCH_VERSION}) - set(CURA_PATCH_VERSION $ENV{CURA_PATCH_VERSION} CACHE STRING "Cura Patch Version" FORCE) -else() - set(CURA_PATCH_VERSION "0" CACHE STRING "Cura Patch Version") -endif() +GetFromEnvironmentOrCache(TAG_OR_BRANCH "master" STRING "The name of the tag or branch to build") +GetFromEnvironmentOrCache(EXTRA_REPOSITORIES "" STRING "Extra repositories to install. Expected to have a CMake based build system. Format is ( ;)*") -if(DEFINED ENV{CURA_EXTRA_VERSION}) - set(CURA_EXTRA_VERSION $ENV{CURA_EXTRA_VERSION} CACHE STRING "Cura Extra Version Information" FORCE) -else() - set(CURA_EXTRA_VERSION "${TAG_OR_BRANCH}" CACHE STRING "Cura Extra Version Information") -endif() +# Create the version-related variables +GetFromEnvironmentOrCache(CURA_VERSION_MAJOR "0" STRING "Cura Major Version") +GetFromEnvironmentOrCache(CURA_VERSION_MINOR "0" STRING "Cura Minor Version") +GetFromEnvironmentOrCache(CURA_VERSION_PATCH "0" STRING "Cura Patch Version") +GetFromEnvironmentOrCache(CURA_VERSION_EXTRA "${TAG_OR_BRANCH}" STRING "Cura Extra Version Information") set(CURA_VERSION "${CURA_MAJOR_VERSION}.${CURA_MINOR_VERSION}.${CURA_PATCH_VERSION}") if(NOT "${CURA_EXTRA_VERSION}" STREQUAL "") set(CURA_VERSION "${CURA_VERSION}-${CURA_EXTRA_VERSION}") endif() -message(STATUS "Building Cura ${CURA_VERSION}") - -if(BUILD_OS_WIN32) - # To deal with stupid setuptools not creating install directories - file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/inst/lib/python3.4/site-packages) -endif() - -if(BUILD_PYTHON) - if(APPLE) - # See http://bugs.python.org/issue21381 - # The interpreter crashes when MACOSX_DEPLOYMENT_TARGET=10.7 due to the increased stack size. - set(patch_command sed -i".bak" "8704,8704d" /configure) - endif() - - ExternalProject_Add(Python - URL https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tgz - PATCH_COMMAND ${patch_command} - CONFIGURE_COMMAND ./configure --prefix=${EXTERNALPROJECT_INSTALL_PREFIX} --enable-shared --with-threads --without-pymalloc - BUILD_IN_SOURCE 1 - ) - - set(PYTHON_EXECUTABLE ${EXTERNALPROJECT_INSTALL_PREFIX}/bin/python3) - set(PYTHON_VERSION_MAJOR 3) - set(PYTHON_VERSION_MINOR 4) -else() - find_package(PythonInterp 3.4.0 REQUIRED) - add_custom_target(Python) -endif() - -if(BUILD_QT) - set(qt_url http://download.qt.io/official_releases/qt/5.5/5.5.1/single/qt-everywhere-opensource-src-5.5.1.tar.gz) - set(qt_md5 59f0216819152b77536cf660b015d784) - - # Qt uses different sources for Windows - if(BUILD_OS_WINDOWS) - set(qt_url http://download.qt.io/official_releases/qt/5.5/5.5.1/single/qt-everywhere-opensource-src-5.5.1.zip) - set(qt_md5 d071cdaa1b8f34fb49f6deac94039c2c) - endif() - - set(qt_options - -release - -prefix ${EXTERNALPROJECT_INSTALL_PREFIX} - -archdatadir ${EXTERNALPROJECT_INSTALL_PREFIX}/lib - -datadir ${EXTERNALPROJECT_INSTALL_PREFIX}/share - -opensource - -confirm-license - -nomake examples - -nomake tests - -nomake tools - -no-cups - -no-sql-db2 - -no-sql-ibase - -no-sql-mysql - -no-sql-oci - -no-sql-odbc - -no-sql-psql - -no-sql-sqlite - -no-sql-sqlite2 - -no-sql-tds - -skip qtconnectivity - -skip qtdoc - -skip qtenginio - -skip qtlocation - -skip qtmultimedia - -skip qtquick1 - -skip qtscript - -skip qtsensors - -skip qtwebchannel - -skip qtwebengine - -skip qtwebkit - -skip qtwebsockets - -skip qtandroidextras - -skip qtactiveqt - -skip qttools - -skip qtxmlpatterns - -skip qt3d - -skip qtcanvas3d - -skip qtserialport - -skip qtwayland - -skip qtwebkit-examples - ) - - if(BUILD_OS_OSX) - list(APPEND qt_options -no-framework) - elseif(BUILD_OS_WINDOWS) - list(APPEND qt_options -opengl desktop) - elseif(BUILD_OS_LINUX) - list(APPEND qt_options -no-rpath -qt-xcb) - endif() - - ExternalProject_Add(Qt - URL ${qt_url} - URL_MD5 ${qt_md5} - CONFIGURE_COMMAND ./configure ${qt_options} - BUILD_IN_SOURCE 1 - ) -else() - add_custom_target(Qt) -endif() - -if(BUILD_SIP) - set(sip_command "") - if(BUILD_OS_WINDOWS) - set(sip_command - ${PYTHON_EXECUTABLE} - configure.py - --platform win32-g++ - --bindir=${EXTERNALPROJECT_INSTALL_PREFIX}/bin - --destdir=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/python3.4/site-packages - --incdir=${EXTERNALPROJECT_INSTALL_PREFIX}/include - --sipdir=${EXTERNALPROJECT_INSTALL_PREFIX}/share/sip - "CFLAGS+=${CMAKE_C_FLAGS}" - "CXXFLAGS+=${CMAKE_CXX_FLAGS}" - ) - elseif(BUILD_OS_LINUX) - set(sip_command - ${PYTHON_EXECUTABLE} - configure.py - --bindir=${EXTERNALPROJECT_INSTALL_PREFIX}/bin - --destdir=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/python3/dist-packages - --incdir=${EXTERNALPROJECT_INSTALL_PREFIX}/include - --sipdir=${EXTERNALPROJECT_INSTALL_PREFIX}/share/sip - ) - elseif(BUILD_OS_OSX) - set(sip_command ${PYTHON_EXECUTABLE} configure.py --sysroot=${EXTERNALPROJECT_INSTALL_PREFIX}) - endif() - - ExternalProject_Add(Sip - DEPENDS Python - URL http://downloads.sourceforge.net/project/pyqt/sip/sip-4.17/sip-4.17.zip - CONFIGURE_COMMAND ${sip_command} - BUILD_IN_SOURCE 1 - ) -else() - add_custom_target(Sip) -endif() - -if(BUILD_PYQT) - set(pyqt_command "") - if(BUILD_OS_WINDOWS) - set(pyqt_command - ${PYTHON_EXECUTABLE} configure.py - --sip ${EXTERNALPROJECT_INSTALL_PREFIX}/bin/sip.exe - --confirm-license - --spec win32-g++ - --destdir ${EXTERNALPROJECT_INSTALL_PREFIX}/lib/python3.4/site-packages - --bindir ${EXTERNALPROJECT_INSTALL_PREFIX}/bin - --sipdir ${EXTERNALPROJECT_INSTALL_PREFIX}/share/sip - "CFLAGS+=${CMAKE_C_FLAGS}" - "CXXFLAGS+=${CMAKE_CXX_FLAGS}" - ) - elseif(BUILD_OS_LINUX) - set(pyqt_command - ${PYTHON_EXECUTABLE} configure.py - --sip ${EXTERNALPROJECT_INSTALL_PREFIX}/bin/sip - --qmake ${EXTERNALPROJECT_INSTALL_PREFIX}/bin/qmake - --confirm-license - --destdir ${EXTERNALPROJECT_INSTALL_PREFIX}/lib/python3/dist-packages - --bindir ${EXTERNALPROJECT_INSTALL_PREFIX}/bin - --sipdir ${EXTERNALPROJECT_INSTALL_PREFIX}/share/sip - ) - elseif(BUILD_OS_OSX) - set(pyqt_command - ${PYTHON_EXECUTABLE} configure.py - --sysroot ${EXTERNALPROJECT_INSTALL_PREFIX} - --qmake ${EXTERNALPROJECT_INSTALL_PREFIX}/bin/qmake - --sip ${EXTERNALPROJECT_INSTALL_PREFIX}/bin/sip - --confirm-license - ) - endif() - - # This patches the PyQt 5.4.2 source code to remove the "disconnectNotify" method from QPyQmlObject. - # This fixes a deadlock that could randomly occur when deleting QML items. - # This workaround should be removed as soon as a new stable release of PyQt is available that includes the fix. - set(pyqt_patch - patch qpy/QtQml/qpyqmlobject.cpp ${CMAKE_SOURCE_DIR}/qpyqmlobject.cpp.patch && patch qpy/QtQml/qpyqmlobject.h ${CMAKE_SOURCE_DIR}/qpyqmlobject.h.patch - ) - - ExternalProject_Add(PyQt - DEPENDS Python Qt Sip - URL http://downloads.sourceforge.net/project/pyqt/PyQt5/PyQt-5.4.2/PyQt-gpl-5.4.2.tar.gz - PATCH_COMMAND ${pyqt_patch} - CONFIGURE_COMMAND ${pyqt_command} - BUILD_IN_SOURCE 1 - ) -else() - add_custom_target(PyQt) -endif() - -if(BUILD_OS_WINDOWS) - # Because setuptools is stupid and will interpret "C:/..." as a relative path - string(REPLACE "/" "\\" native_prefix ${EXTERNALPROJECT_INSTALL_PREFIX}) - set(python_install - --install-lib=${native_prefix}\\lib\\python3.4\\site-packages - --install-data=${native_prefix}\\share - --install-scripts=${native_prefix}\\bin - ) -elseif(BUILD_OS_LINUX) - set(python_install - --root=${EXTERNALPROJECT_INSTALL_PREFIX} - --install-lib=lib/python3/dist-packages - ) -endif() - -if((BUILD_NUMPY OR BUILD_SCIPY) AND BUILD_OS_LINUX) - # Fortran compiler is needed for OpenBLAS, but it does no check whether it is available. - enable_language (Fortran) - set(openblas_options DYNAMIC_ARCH=1 NO_STATIC=1) - ExternalProject_Add(OpenBLAS - URL https://github.com/xianyi/OpenBLAS/archive/v0.2.15.tar.gz - CONFIGURE_COMMAND "" - BUILD_COMMAND make ${openblas_options} - INSTALL_COMMAND make PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} ${openblas_options} install - BUILD_IN_SOURCE 1 - ) -else() - add_custom_target(OpenBLAS) -endif() - -if(BUILD_NUMPY) - if(BUILD_OS_LINUX) - # Inform numpy about using OpenBLAS - set(build_numpy "OPENBLAS=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/libopenblas.so" ${PYTHON_EXECUTABLE} setup.py build) - set(install_numpy "OPENBLAS=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/libopenblas.so" ${PYTHON_EXECUTABLE} setup.py install ${python_install}) - else() - set(build_numpy ${PYTHON_EXECUTABLE} setup.py build) - set(install_numpy ${PYTHON_EXECUTABLE} setup.py install ${python_install}) - endif() - - ExternalProject_Add(Numpy - DEPENDS Python OpenBLAS - URL http://downloads.sourceforge.net/project/numpy/NumPy/1.9.2/numpy-1.9.2.tar.gz - URL_MD5 a1ed53432dbcd256398898d35bc8e645 - CONFIGURE_COMMAND "" - BUILD_COMMAND ${build_numpy} - INSTALL_COMMAND ${install_numpy} - BUILD_IN_SOURCE 1 - ) -endif() - -if(BUILD_SCIPY) - if(BUILD_OS_LINUX) - # Inform scipy about using OpenBLAS - set(build_scipy "OPENBLAS=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/libopenblas.so" "PYTHONPATH=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/python3/dist-packages/" "LD_LIBRARY_PATH=${EXTERNALPROJECT_INSTALL_PREFIX}/lib" ${PYTHON_EXECUTABLE} setup.py build) - set(install_scipy "OPENBLAS=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/libopenblas.so" "PYTHONPATH=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/python3/dist-packages/" "LD_LIBRARY_PATH=${EXTERNALPROJECT_INSTALL_PREFIX}/lib" ${PYTHON_EXECUTABLE} setup.py install ${python_install}) - else() - set(build_scipy ${PYTHON_EXECUTABLE} setup.py build) - set(install_scipy ${PYTHON_EXECUTABLE} setup.py install ${python_install}) - endif() - - ExternalProject_Add(Scipy - DEPENDS Python Numpy - URL http://downloads.sourceforge.net/project/scipy/scipy/0.16.1/scipy-0.16.1.tar.gz - CONFIGURE_COMMAND "" - BUILD_COMMAND ${build_scipy} - INSTALL_COMMAND ${install_scipy} - BUILD_IN_SOURCE 1 - ) -endif() - -if(BUILD_PYSERIAL) - ExternalProject_Add(PySerial - DEPENDS Python - URL https://pypi.python.org/packages/source/p/pyserial/pyserial-2.7.tar.gz - URL_MD5 794506184df83ef2290de0d18803dd11 - CONFIGURE_COMMAND "" - BUILD_COMMAND ${PYTHON_EXECUTABLE} setup.py build - INSTALL_COMMAND ${PYTHON_EXECUTABLE} setup.py install ${python_install} - BUILD_IN_SOURCE 1 - ) -endif() - -if(BUILD_NUMPY_STL) - ExternalProject_Add(NumpySTL - DEPENDS Python - URL https://github.com/WoLpH/numpy-stl/archive/v1.9.0.tar.gz - URL_MD5 cda2531edecff4468a4bbe78c6a2833b - CONFIGURE_COMMAND "" - BUILD_COMMAND "PYTHONPATH=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/python3/dist-packages/" ${PYTHON_EXECUTABLE} setup.py build - INSTALL_COMMAND "PYTHONPATH=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/python3/dist-packages/" ${PYTHON_EXECUTABLE} setup.py install ${python_install} - BUILD_IN_SOURCE 1 - ) -endif() - -if(BUILD_ZEROCONF) - ExternalProject_Add(PythonNetifaces - DEPENDS Python - URL https://pypi.python.org/packages/18/fa/dd13d4910aea339c0bb87d2b3838d8fd923c11869b1f6e741dbd0ff3bc00/netifaces-0.10.4.tar.gz - CONFIGURE_COMMAND "" - BUILD_COMMAND ${PYTHON_EXECUTABLE} setup.py build - INSTALL_COMMAND ${PYTHON_EXECUTABLE} setup.py install ${python_install} - BUILD_IN_SOURCE 1 - ) - - ExternalProject_Add(PythonZeroconf - DEPENDS PythonNetifaces - URL https://github.com/jstasiak/python-zeroconf/archive/0.17.5.tar.gz - CONFIGURE_COMMAND "" - BUILD_COMMAND ${PYTHON_EXECUTABLE} setup.py build - INSTALL_COMMAND ${PYTHON_EXECUTABLE} setup.py install ${python_install} - BUILD_IN_SOURCE 1 - ) -endif() - -if(BUILD_OS_OSX) - set(protobuf_cxx_flags "-fPIC -std=c++11 -stdlib=libc++") -else() - set(protobuf_cxx_flags "-fPIC -std=c++11") -endif() - -ExternalProject_Add(Protobuf - URL https://github.com/google/protobuf/archive/v3.0.0-beta-2.tar.gz - CONFIGURE_COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCMAKE_INSTALL_LIBDIR=lib -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_CXX_FLAGS=${protobuf_cxx_flags} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -G ${CMAKE_GENERATOR} ../Protobuf/cmake -) - -if(BUILD_OS_WIN64) - # Due to problems building Python modules on Win64 we currently need to disable building Arcus. - set(ARCUS_EXTRA_ARGS -DBUILD_PYTHON=OFF) -endif() - -ExternalProject_Add(Arcus - DEPENDS Python Protobuf Sip - GIT_REPOSITORY https://github.com/ultimaker/libArcus - GIT_TAG origin/${TAG_OR_BRANCH} - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DBUILD_EXAMPLES=OFF -DBUILD_STATIC=ON -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} ${ARCUS_EXTRA_ARGS} -) - -ExternalProject_Add(CuraEngine - DEPENDS Arcus - GIT_REPOSITORY https://github.com/ultimaker/CuraEngine - GIT_TAG origin/${TAG_OR_BRANCH} - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCURA_ENGINE_VERSION=${CURA_VERSION} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -) - -ExternalProject_Add(Uranium - DEPENDS PyQt Arcus - GIT_REPOSITORY https://github.com/ultimaker/Uranium - GIT_TAG origin/${TAG_OR_BRANCH} - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -) - -ExternalProject_Add(Cura - DEPENDS Uranium CuraEngine - GIT_REPOSITORY https://github.com/ultimaker/Cura - GIT_TAG origin/${TAG_OR_BRANCH} - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DURANIUM_SCRIPTS_DIR= -DCURA_VERSION=${CURA_VERSION} -) - -ExternalProject_Add(Cura-PostProcessing - DEPENDS Cura - GIT_REPOSITORY https://github.com/nallath/PostProcessingPlugin - GIT_TAG origin/master - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -) - -ExternalProject_Add(cura-binary-data - DEPENDS Cura - GIT_REPOSITORY https://github.com/ultimaker/cura-binary-data - GIT_TAG origin/${TAG_OR_BRANCH} - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -) - -ExternalProject_Add(Cura-Doodle3D - DEPENDS Cura - GIT_REPOSITORY https://github.com/Doodle3D/Doodle3D-cura-plugin - GIT_TAG origin/master - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -) - -foreach(repo ${EXTRA_REPOSITORIES}) - separate_arguments(items UNIX_COMMAND "${repo}") - list(GET items 0 name) - list(GET items 1 repo) - list(REMOVE_AT items 0 1) - - set(cmake "") - foreach(item ${items}) - list(APPEND cmake ${item}) - endforeach() - - ExternalProject_Add(${name} - GIT_REPOSITORY ${repo} - GIT_TAG origin/master - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} ${cmake} - ) -endforeach() - -if(BUILD_OS_OSX) - ExternalProject_Add(Py2App - DEPENDS Python - URL https://pypi.python.org/packages/source/p/py2app/py2app-0.9.tar.gz - CONFIGURE_COMMAND "" - BUILD_COMMAND ${PYTHON_EXECUTABLE} setup.py build - INSTALL_COMMAND ${PYTHON_EXECUTABLE} setup.py install - BUILD_IN_SOURCE 1 - ) -elseif(BUILD_OS_WINDOWS) - # Currently, py2exe can not be built with MinGW since the code apparently uses - # a lot of MSVC-isms. So instead, install py2exe in your Python installation and - # use that. - # ExternalProject_Add(Py2Exe - # DEPENDS Python - # URL https://pypi.python.org/packages/source/p/py2exe/py2exe-0.9.2.0.zip - # CONFIGURE_COMMAND "" - # BUILD_COMMAND ${PYTHON_EXECUTABLE} setup.py build - # INSTALL_COMMAND ${PYTHON_EXECUTABLE} setup.py install ${python_install} - # BUILD_IN_SOURCE 1 - # ) -endif() - -if(BUILD_OS_OSX) - configure_file(setup_osx.py.in setup_osx.py @ONLY) - - add_custom_target(build_app ALL) - add_dependencies(build_app cura-binary-data) - - foreach(repo ${EXTRA_REPOSITORIES}) - separate_arguments(items UNIX_COMMAND "${repo}") - list(GET items 0 name) - add_dependencies(build_app ${name}) - endforeach() - - add_custom_command( - TARGET build_app PRE_LINK - COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/dist - COMMENT "Cleaning old dist/ directory" - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - ) - add_custom_command( - TARGET build_app POST_BUILD - COMMAND ${PYTHON_EXECUTABLE} setup_osx.py py2app - COMMENT "Running py2app" - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - ) - - install(DIRECTORY ${CMAKE_BINARY_DIR}/dist/Cura.app DESTINATION "." USE_SOURCE_PERMISSIONS) - - set(CPACK_GENERATOR "DragNDrop") -elseif(BUILD_OS_WINDOWS) - get_filename_component(compiler_dir ${CMAKE_CXX_COMPILER} DIRECTORY) - configure_file(setup_win32.py.in setup_win32.py @ONLY) - - add_custom_target(build_exe ALL) - add_dependencies(build_exe cura-binary-data) - - foreach(repo ${EXTRA_REPOSITORIES}) - separate_arguments(items UNIX_COMMAND "${repo}") - list(GET items 0 name) - add_dependencies(build_exe ${name}) - endforeach() - - add_custom_command( - TARGET build_exe PRE_LINK - COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/dist - COMMENT "Cleaning old dist/ directory" - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - ) - add_custom_command( - TARGET build_exe POST_BUILD - COMMAND ${PYTHON_EXECUTABLE} setup_win32.py py2exe - COMMENT "Running py2exe" - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - ) - - install(DIRECTORY ${CMAKE_BINARY_DIR}/dist/ DESTINATION "." USE_SOURCE_PERMISSIONS COMPONENT "cura") - - if(BUILD_OS_WIN32) - install(FILES ${EXTERNALPROJECT_INSTALL_PREFIX}/vcredist_x32.exe DESTINATION "." COMPONENT "vcredist") - else() - install(FILES ${EXTERNALPROJECT_INSTALL_PREFIX}/vcredist_x64.exe DESTINATION "." COMPONENT "vcredist") - endif() - - install(DIRECTORY ${EXTERNALPROJECT_INSTALL_PREFIX}/arduino DESTINATION "." COMPONENT "arduino") - - include(CPackComponent) - cpack_add_component(cura DISPLAY_NAME "Cura Executable and Data Files" REQUIRED) - cpack_add_component(vcredist DISPLAY_NAME "Install Visual Studio 2010 Redistributable") - cpack_add_component(arduino DISPLAY_NAME "Install Arduino Drivers") - - set(CPACK_GENERATOR "NSIS") -elseif(BUILD_OS_LINUX) - set(CPACK_GENERATOR "DEB") - - set(CPACK_INSTALL_CMAKE_PROJECTS "") - - set(CPACK_INSTALLED_DIRECTORIES - "${CMAKE_BINARY_DIR}/inst/bin;/opt/cura/bin" - "${CMAKE_BINARY_DIR}/inst/lib;/opt/cura/lib" - "${CMAKE_BINARY_DIR}/inst/share;/opt/cura/share" - ) - - set(package_dir "_CPack_Packages/Linux/${CPACK_GENERATOR}/Cura-${CURA_VERSION}-Linux/") - set(CPACK_INSTALL_COMMANDS - "${CMAKE_COMMAND} -E make_directory ${package_dir}/usr/bin" - "${CMAKE_COMMAND} -E make_directory ${package_dir}/usr/share/applications" - "${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/cura ${package_dir}/usr/bin/" - "${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/cura.desktop ${package_dir}/usr/share/applications/" - "${CMAKE_COMMAND} -E copy /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.20 ${package_dir}/opt/cura/lib/libstdc++.so.6" - ) -endif() - -set(CPACK_PACKAGE_NAME "Cura") -set(CPACK_PACKAGE_VENDOR "Ultimaker") -set(CPACK_PACKAGE_VERSION_MAJOR ${CURA_MAJOR_VERSION}) -set(CPACK_PACKAGE_VERSION_MINOR ${CURA_MINOR_VERSION}) -set(CPACK_PACKAGE_VERSION_PATCH ${CURA_PATCH_VERSION}) -set(CPACK_PACKAGE_VERSION ${CURA_VERSION}) -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Cura 3D Printing Software") -set(CPACK_PACKAGE_CONTACT "Arjen Hiemstra ") -if(NOT BUILD_OS_OSX) - set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE) -endif() -set(CPACK_PACKAGE_EXECUTABLES Cura "Cura ${CURA_MAJOR_VERSION}.${CURA_MINOR_VERSION}.${CURA_PATCH_VERSION}") -set(CPACK_PACKAGE_INSTALL_DIRECTORY "Cura ${CURA_MAJOR_VERSION}.${CURA_MINOR_VERSION}") - -set(RPM_REQUIRES - "python3 >= 3.4.0" - "python3-qt5 >= 5.4.0" - "python3-numpy >= 1.9.0" - "qt5-qtquickcontrols >= 5.4.0" -) -string(REPLACE ";" "," RPM_REQUIRES "${RPM_REQUIRES}") -set(CPACK_RPM_PACKAGE_REQUIRES ${RPM_REQUIRES}) -set(CPACK_RPM_PACKAGE_RELOCATABLE OFF) - -set(DEB_DEPENDS - "python3 (>= 3.4.0)" - "libgfortran3" -) -string(REPLACE ";" "," DEB_DEPENDS "${DEB_DEPENDS}") -set(CPACK_DEBIAN_PACKAGE_DEPENDS ${DEB_DEPENDS}) -set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE amd64) -# Set the right epoch so Debian knows this is a more recent version -set(CPACK_DEBIAN_PACKAGE_VERSION "2:${CPACK_PACKAGE_VERSION}") - -set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) -set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".") -set(CPACK_NSIS_MUI_FINISHPAGE_RUN "Cura.exe") -set(CPACK_NSIS_MENU_LINKS - "https://ultimaker.com/en/support/software" "Cura Online Documentation" - "https://github.com/ultimaker/cura" "Cura Development Resources" -) -if(BUILD_OS_WIN32) - set(CPACK_NSIS_PACKAGE_ARCHITECTURE "32") -else() - set(CPACK_NSIS_PACKAGE_ARCHITECTURE "64") -endif() -include(CPack) +# +# +# message(STATUS "Building Cura ${CURA_VERSION}") +# +# if(BUILD_OS_WIN32) +# # To deal with stupid setuptools not creating install directories +# file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/inst/lib/python3.4/site-packages) +# endif() +# +# if(BUILD_PYTHON) +# if(APPLE) +# # See http://bugs.python.org/issue21381 +# # The interpreter crashes when MACOSX_DEPLOYMENT_TARGET=10.7 due to the increased stack size. +# set(patch_command sed -i".bak" "8704,8704d" /configure) +# endif() +# +# ExternalProject_Add(Python +# URL https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tgz +# PATCH_COMMAND ${patch_command} +# CONFIGURE_COMMAND ./configure --prefix=${EXTERNALPROJECT_INSTALL_PREFIX} --enable-shared --with-threads --without-pymalloc +# BUILD_IN_SOURCE 1 +# ) +# +# set(PYTHON_EXECUTABLE ${EXTERNALPROJECT_INSTALL_PREFIX}/bin/python3) +# set(PYTHON_VERSION_MAJOR 3) +# set(PYTHON_VERSION_MINOR 4) +# else() +# find_package(PythonInterp 3.4.0 REQUIRED) +# add_custom_target(Python) +# endif() +# +# if(BUILD_QT) +# set(qt_url http://download.qt.io/official_releases/qt/5.5/5.5.1/single/qt-everywhere-opensource-src-5.5.1.tar.gz) +# set(qt_md5 59f0216819152b77536cf660b015d784) +# +# # Qt uses different sources for Windows +# if(BUILD_OS_WINDOWS) +# set(qt_url http://download.qt.io/official_releases/qt/5.5/5.5.1/single/qt-everywhere-opensource-src-5.5.1.zip) +# set(qt_md5 d071cdaa1b8f34fb49f6deac94039c2c) +# endif() +# +# set(qt_options +# -release +# -prefix ${EXTERNALPROJECT_INSTALL_PREFIX} +# -archdatadir ${EXTERNALPROJECT_INSTALL_PREFIX}/lib +# -datadir ${EXTERNALPROJECT_INSTALL_PREFIX}/share +# -opensource +# -confirm-license +# -nomake examples +# -nomake tests +# -nomake tools +# -no-cups +# -no-sql-db2 +# -no-sql-ibase +# -no-sql-mysql +# -no-sql-oci +# -no-sql-odbc +# -no-sql-psql +# -no-sql-sqlite +# -no-sql-sqlite2 +# -no-sql-tds +# -skip qtconnectivity +# -skip qtdoc +# -skip qtenginio +# -skip qtlocation +# -skip qtmultimedia +# -skip qtquick1 +# -skip qtscript +# -skip qtsensors +# -skip qtwebchannel +# -skip qtwebengine +# -skip qtwebkit +# -skip qtwebsockets +# -skip qtandroidextras +# -skip qtactiveqt +# -skip qttools +# -skip qtxmlpatterns +# -skip qt3d +# -skip qtcanvas3d +# -skip qtserialport +# -skip qtwayland +# -skip qtwebkit-examples +# ) +# +# if(BUILD_OS_OSX) +# list(APPEND qt_options -no-framework) +# elseif(BUILD_OS_WINDOWS) +# list(APPEND qt_options -opengl desktop) +# elseif(BUILD_OS_LINUX) +# list(APPEND qt_options -no-rpath -qt-xcb) +# endif() +# +# ExternalProject_Add(Qt +# URL ${qt_url} +# URL_MD5 ${qt_md5} +# CONFIGURE_COMMAND ./configure ${qt_options} +# BUILD_IN_SOURCE 1 +# ) +# else() +# add_custom_target(Qt) +# endif() +# +# if(BUILD_SIP) +# set(sip_command "") +# if(BUILD_OS_WINDOWS) +# set(sip_command +# ${PYTHON_EXECUTABLE} +# configure.py +# --platform win32-g++ +# --bindir=${EXTERNALPROJECT_INSTALL_PREFIX}/bin +# --destdir=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/python3.4/site-packages +# --incdir=${EXTERNALPROJECT_INSTALL_PREFIX}/include +# --sipdir=${EXTERNALPROJECT_INSTALL_PREFIX}/share/sip +# "CFLAGS+=${CMAKE_C_FLAGS}" +# "CXXFLAGS+=${CMAKE_CXX_FLAGS}" +# ) +# elseif(BUILD_OS_LINUX) +# set(sip_command +# ${PYTHON_EXECUTABLE} +# configure.py +# --bindir=${EXTERNALPROJECT_INSTALL_PREFIX}/bin +# --destdir=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/python3/dist-packages +# --incdir=${EXTERNALPROJECT_INSTALL_PREFIX}/include +# --sipdir=${EXTERNALPROJECT_INSTALL_PREFIX}/share/sip +# ) +# elseif(BUILD_OS_OSX) +# set(sip_command ${PYTHON_EXECUTABLE} configure.py --sysroot=${EXTERNALPROJECT_INSTALL_PREFIX}) +# endif() +# +# ExternalProject_Add(Sip +# DEPENDS Python +# URL http://downloads.sourceforge.net/project/pyqt/sip/sip-4.17/sip-4.17.zip +# CONFIGURE_COMMAND ${sip_command} +# BUILD_IN_SOURCE 1 +# ) +# else() +# add_custom_target(Sip) +# endif() +# +# if(BUILD_PYQT) +# set(pyqt_command "") +# if(BUILD_OS_WINDOWS) +# set(pyqt_command +# ${PYTHON_EXECUTABLE} configure.py +# --sip ${EXTERNALPROJECT_INSTALL_PREFIX}/bin/sip.exe +# --confirm-license +# --spec win32-g++ +# --destdir ${EXTERNALPROJECT_INSTALL_PREFIX}/lib/python3.4/site-packages +# --bindir ${EXTERNALPROJECT_INSTALL_PREFIX}/bin +# --sipdir ${EXTERNALPROJECT_INSTALL_PREFIX}/share/sip +# "CFLAGS+=${CMAKE_C_FLAGS}" +# "CXXFLAGS+=${CMAKE_CXX_FLAGS}" +# ) +# elseif(BUILD_OS_LINUX) +# set(pyqt_command +# ${PYTHON_EXECUTABLE} configure.py +# --sip ${EXTERNALPROJECT_INSTALL_PREFIX}/bin/sip +# --qmake ${EXTERNALPROJECT_INSTALL_PREFIX}/bin/qmake +# --confirm-license +# --destdir ${EXTERNALPROJECT_INSTALL_PREFIX}/lib/python3/dist-packages +# --bindir ${EXTERNALPROJECT_INSTALL_PREFIX}/bin +# --sipdir ${EXTERNALPROJECT_INSTALL_PREFIX}/share/sip +# ) +# elseif(BUILD_OS_OSX) +# set(pyqt_command +# ${PYTHON_EXECUTABLE} configure.py +# --sysroot ${EXTERNALPROJECT_INSTALL_PREFIX} +# --qmake ${EXTERNALPROJECT_INSTALL_PREFIX}/bin/qmake +# --sip ${EXTERNALPROJECT_INSTALL_PREFIX}/bin/sip +# --confirm-license +# ) +# endif() +# +# # This patches the PyQt 5.4.2 source code to remove the "disconnectNotify" method from QPyQmlObject. +# # This fixes a deadlock that could randomly occur when deleting QML items. +# # This workaround should be removed as soon as a new stable release of PyQt is available that includes the fix. +# set(pyqt_patch +# patch qpy/QtQml/qpyqmlobject.cpp ${CMAKE_SOURCE_DIR}/qpyqmlobject.cpp.patch && patch qpy/QtQml/qpyqmlobject.h ${CMAKE_SOURCE_DIR}/qpyqmlobject.h.patch +# ) +# +# ExternalProject_Add(PyQt +# DEPENDS Python Qt Sip +# URL http://downloads.sourceforge.net/project/pyqt/PyQt5/PyQt-5.4.2/PyQt-gpl-5.4.2.tar.gz +# PATCH_COMMAND ${pyqt_patch} +# CONFIGURE_COMMAND ${pyqt_command} +# BUILD_IN_SOURCE 1 +# ) +# else() +# add_custom_target(PyQt) +# endif() +# +# if(BUILD_OS_WINDOWS) +# # Because setuptools is stupid and will interpret "C:/..." as a relative path +# string(REPLACE "/" "\\" native_prefix ${EXTERNALPROJECT_INSTALL_PREFIX}) +# set(python_install +# --install-lib=${native_prefix}\\lib\\python3.4\\site-packages +# --install-data=${native_prefix}\\share +# --install-scripts=${native_prefix}\\bin +# ) +# elseif(BUILD_OS_LINUX) +# set(python_install +# --root=${EXTERNALPROJECT_INSTALL_PREFIX} +# --install-lib=lib/python3/dist-packages +# ) +# endif() +# +# if((BUILD_NUMPY OR BUILD_SCIPY) AND BUILD_OS_LINUX) +# # Fortran compiler is needed for OpenBLAS, but it does no check whether it is available. +# enable_language (Fortran) +# set(openblas_options DYNAMIC_ARCH=1 NO_STATIC=1) +# ExternalProject_Add(OpenBLAS +# URL https://github.com/xianyi/OpenBLAS/archive/v0.2.15.tar.gz +# CONFIGURE_COMMAND "" +# BUILD_COMMAND make ${openblas_options} +# INSTALL_COMMAND make PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} ${openblas_options} install +# BUILD_IN_SOURCE 1 +# ) +# else() +# add_custom_target(OpenBLAS) +# endif() +# +# if(BUILD_NUMPY) +# if(BUILD_OS_LINUX) +# # Inform numpy about using OpenBLAS +# set(build_numpy "OPENBLAS=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/libopenblas.so" ${PYTHON_EXECUTABLE} setup.py build) +# set(install_numpy "OPENBLAS=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/libopenblas.so" ${PYTHON_EXECUTABLE} setup.py install ${python_install}) +# else() +# set(build_numpy ${PYTHON_EXECUTABLE} setup.py build) +# set(install_numpy ${PYTHON_EXECUTABLE} setup.py install ${python_install}) +# endif() +# +# ExternalProject_Add(Numpy +# DEPENDS Python OpenBLAS +# URL http://downloads.sourceforge.net/project/numpy/NumPy/1.9.2/numpy-1.9.2.tar.gz +# URL_MD5 a1ed53432dbcd256398898d35bc8e645 +# CONFIGURE_COMMAND "" +# BUILD_COMMAND ${build_numpy} +# INSTALL_COMMAND ${install_numpy} +# BUILD_IN_SOURCE 1 +# ) +# endif() +# +# if(BUILD_SCIPY) +# if(BUILD_OS_LINUX) +# # Inform scipy about using OpenBLAS +# set(build_scipy "OPENBLAS=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/libopenblas.so" "PYTHONPATH=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/python3/dist-packages/" "LD_LIBRARY_PATH=${EXTERNALPROJECT_INSTALL_PREFIX}/lib" ${PYTHON_EXECUTABLE} setup.py build) +# set(install_scipy "OPENBLAS=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/libopenblas.so" "PYTHONPATH=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/python3/dist-packages/" "LD_LIBRARY_PATH=${EXTERNALPROJECT_INSTALL_PREFIX}/lib" ${PYTHON_EXECUTABLE} setup.py install ${python_install}) +# else() +# set(build_scipy ${PYTHON_EXECUTABLE} setup.py build) +# set(install_scipy ${PYTHON_EXECUTABLE} setup.py install ${python_install}) +# endif() +# +# ExternalProject_Add(Scipy +# DEPENDS Python Numpy +# URL http://downloads.sourceforge.net/project/scipy/scipy/0.16.1/scipy-0.16.1.tar.gz +# CONFIGURE_COMMAND "" +# BUILD_COMMAND ${build_scipy} +# INSTALL_COMMAND ${install_scipy} +# BUILD_IN_SOURCE 1 +# ) +# endif() +# +# if(BUILD_PYSERIAL) +# ExternalProject_Add(PySerial +# DEPENDS Python +# URL https://pypi.python.org/packages/source/p/pyserial/pyserial-2.7.tar.gz +# URL_MD5 794506184df83ef2290de0d18803dd11 +# CONFIGURE_COMMAND "" +# BUILD_COMMAND ${PYTHON_EXECUTABLE} setup.py build +# INSTALL_COMMAND ${PYTHON_EXECUTABLE} setup.py install ${python_install} +# BUILD_IN_SOURCE 1 +# ) +# endif() +# +# if(BUILD_NUMPY_STL) +# ExternalProject_Add(NumpySTL +# DEPENDS Python +# URL https://github.com/WoLpH/numpy-stl/archive/v1.9.0.tar.gz +# URL_MD5 cda2531edecff4468a4bbe78c6a2833b +# CONFIGURE_COMMAND "" +# BUILD_COMMAND "PYTHONPATH=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/python3/dist-packages/" ${PYTHON_EXECUTABLE} setup.py build +# INSTALL_COMMAND "PYTHONPATH=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/python3/dist-packages/" ${PYTHON_EXECUTABLE} setup.py install ${python_install} +# BUILD_IN_SOURCE 1 +# ) +# endif() +# +# if(BUILD_ZEROCONF) +# ExternalProject_Add(PythonNetifaces +# DEPENDS Python +# URL https://pypi.python.org/packages/18/fa/dd13d4910aea339c0bb87d2b3838d8fd923c11869b1f6e741dbd0ff3bc00/netifaces-0.10.4.tar.gz +# CONFIGURE_COMMAND "" +# BUILD_COMMAND ${PYTHON_EXECUTABLE} setup.py build +# INSTALL_COMMAND ${PYTHON_EXECUTABLE} setup.py install ${python_install} +# BUILD_IN_SOURCE 1 +# ) +# +# ExternalProject_Add(PythonZeroconf +# DEPENDS PythonNetifaces +# URL https://github.com/jstasiak/python-zeroconf/archive/0.17.5.tar.gz +# CONFIGURE_COMMAND "" +# BUILD_COMMAND ${PYTHON_EXECUTABLE} setup.py build +# INSTALL_COMMAND ${PYTHON_EXECUTABLE} setup.py install ${python_install} +# BUILD_IN_SOURCE 1 +# ) +# endif() +# +# if(BUILD_OS_OSX) +# set(protobuf_cxx_flags "-fPIC -std=c++11 -stdlib=libc++") +# else() +# set(protobuf_cxx_flags "-fPIC -std=c++11") +# endif() +# +# ExternalProject_Add(Protobuf +# URL https://github.com/google/protobuf/archive/v3.0.0-beta-2.tar.gz +# CONFIGURE_COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCMAKE_INSTALL_LIBDIR=lib -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_CXX_FLAGS=${protobuf_cxx_flags} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -G ${CMAKE_GENERATOR} ../Protobuf/cmake +# ) +# +# if(BUILD_OS_WIN64) +# # Due to problems building Python modules on Win64 we currently need to disable building Arcus. +# set(ARCUS_EXTRA_ARGS -DBUILD_PYTHON=OFF) +# endif() +# +# ExternalProject_Add(Arcus +# DEPENDS Python Protobuf Sip +# GIT_REPOSITORY https://github.com/ultimaker/libArcus +# GIT_TAG origin/${TAG_OR_BRANCH} +# CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DBUILD_EXAMPLES=OFF -DBUILD_STATIC=ON -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} ${ARCUS_EXTRA_ARGS} +# ) +# +# ExternalProject_Add(CuraEngine +# DEPENDS Arcus +# GIT_REPOSITORY https://github.com/ultimaker/CuraEngine +# GIT_TAG origin/${TAG_OR_BRANCH} +# CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCURA_ENGINE_VERSION=${CURA_VERSION} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} +# ) +# +# ExternalProject_Add(Uranium +# DEPENDS PyQt Arcus +# GIT_REPOSITORY https://github.com/ultimaker/Uranium +# GIT_TAG origin/${TAG_OR_BRANCH} +# CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} +# ) +# +# ExternalProject_Add(Cura +# DEPENDS Uranium CuraEngine +# GIT_REPOSITORY https://github.com/ultimaker/Cura +# GIT_TAG origin/${TAG_OR_BRANCH} +# CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DURANIUM_SCRIPTS_DIR= -DCURA_VERSION=${CURA_VERSION} +# ) +# +# ExternalProject_Add(Cura-PostProcessing +# DEPENDS Cura +# GIT_REPOSITORY https://github.com/nallath/PostProcessingPlugin +# GIT_TAG origin/master +# CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} +# ) +# +# ExternalProject_Add(cura-binary-data +# DEPENDS Cura +# GIT_REPOSITORY https://github.com/ultimaker/cura-binary-data +# GIT_TAG origin/${TAG_OR_BRANCH} +# CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} +# ) +# +# ExternalProject_Add(Cura-Doodle3D +# DEPENDS Cura +# GIT_REPOSITORY https://github.com/Doodle3D/Doodle3D-cura-plugin +# GIT_TAG origin/master +# CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} +# ) +# +# foreach(repo ${EXTRA_REPOSITORIES}) +# separate_arguments(items UNIX_COMMAND "${repo}") +# list(GET items 0 name) +# list(GET items 1 repo) +# list(REMOVE_AT items 0 1) +# +# set(cmake "") +# foreach(item ${items}) +# list(APPEND cmake ${item}) +# endforeach() +# +# ExternalProject_Add(${name} +# GIT_REPOSITORY ${repo} +# GIT_TAG origin/master +# CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} ${cmake} +# ) +# endforeach() +# +# if(BUILD_OS_OSX) +# ExternalProject_Add(Py2App +# DEPENDS Python +# URL https://pypi.python.org/packages/source/p/py2app/py2app-0.9.tar.gz +# CONFIGURE_COMMAND "" +# BUILD_COMMAND ${PYTHON_EXECUTABLE} setup.py build +# INSTALL_COMMAND ${PYTHON_EXECUTABLE} setup.py install +# BUILD_IN_SOURCE 1 +# ) +# elseif(BUILD_OS_WINDOWS) +# # Currently, py2exe can not be built with MinGW since the code apparently uses +# # a lot of MSVC-isms. So instead, install py2exe in your Python installation and +# # use that. +# # ExternalProject_Add(Py2Exe +# # DEPENDS Python +# # URL https://pypi.python.org/packages/source/p/py2exe/py2exe-0.9.2.0.zip +# # CONFIGURE_COMMAND "" +# # BUILD_COMMAND ${PYTHON_EXECUTABLE} setup.py build +# # INSTALL_COMMAND ${PYTHON_EXECUTABLE} setup.py install ${python_install} +# # BUILD_IN_SOURCE 1 +# # ) +# endif() +# +# if(BUILD_OS_OSX) +# configure_file(setup_osx.py.in setup_osx.py @ONLY) +# +# add_custom_target(build_app ALL) +# add_dependencies(build_app cura-binary-data) +# +# foreach(repo ${EXTRA_REPOSITORIES}) +# separate_arguments(items UNIX_COMMAND "${repo}") +# list(GET items 0 name) +# add_dependencies(build_app ${name}) +# endforeach() +# +# add_custom_command( +# TARGET build_app PRE_LINK +# COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/dist +# COMMENT "Cleaning old dist/ directory" +# WORKING_DIRECTORY ${CMAKE_BINARY_DIR} +# ) +# add_custom_command( +# TARGET build_app POST_BUILD +# COMMAND ${PYTHON_EXECUTABLE} setup_osx.py py2app +# COMMENT "Running py2app" +# WORKING_DIRECTORY ${CMAKE_BINARY_DIR} +# ) +# +# install(DIRECTORY ${CMAKE_BINARY_DIR}/dist/Cura.app DESTINATION "." USE_SOURCE_PERMISSIONS) +# +# set(CPACK_GENERATOR "DragNDrop") +# elseif(BUILD_OS_WINDOWS) +# get_filename_component(compiler_dir ${CMAKE_CXX_COMPILER} DIRECTORY) +# configure_file(setup_win32.py.in setup_win32.py @ONLY) +# +# add_custom_target(build_exe ALL) +# add_dependencies(build_exe cura-binary-data) +# +# foreach(repo ${EXTRA_REPOSITORIES}) +# separate_arguments(items UNIX_COMMAND "${repo}") +# list(GET items 0 name) +# add_dependencies(build_exe ${name}) +# endforeach() +# +# add_custom_command( +# TARGET build_exe PRE_LINK +# COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/dist +# COMMENT "Cleaning old dist/ directory" +# WORKING_DIRECTORY ${CMAKE_BINARY_DIR} +# ) +# add_custom_command( +# TARGET build_exe POST_BUILD +# COMMAND ${PYTHON_EXECUTABLE} setup_win32.py py2exe +# COMMENT "Running py2exe" +# WORKING_DIRECTORY ${CMAKE_BINARY_DIR} +# ) +# +# install(DIRECTORY ${CMAKE_BINARY_DIR}/dist/ DESTINATION "." USE_SOURCE_PERMISSIONS COMPONENT "cura") +# +# if(BUILD_OS_WIN32) +# install(FILES ${EXTERNALPROJECT_INSTALL_PREFIX}/vcredist_x32.exe DESTINATION "." COMPONENT "vcredist") +# else() +# install(FILES ${EXTERNALPROJECT_INSTALL_PREFIX}/vcredist_x64.exe DESTINATION "." COMPONENT "vcredist") +# endif() +# +# install(DIRECTORY ${EXTERNALPROJECT_INSTALL_PREFIX}/arduino DESTINATION "." COMPONENT "arduino") +# +# include(CPackComponent) +# cpack_add_component(cura DISPLAY_NAME "Cura Executable and Data Files" REQUIRED) +# cpack_add_component(vcredist DISPLAY_NAME "Install Visual Studio 2010 Redistributable") +# cpack_add_component(arduino DISPLAY_NAME "Install Arduino Drivers") +# +# set(CPACK_GENERATOR "NSIS") +# elseif(BUILD_OS_LINUX) +# set(CPACK_GENERATOR "DEB") +# +# set(CPACK_INSTALL_CMAKE_PROJECTS "") +# +# set(CPACK_INSTALLED_DIRECTORIES +# "${CMAKE_BINARY_DIR}/inst/bin;/opt/cura/bin" +# "${CMAKE_BINARY_DIR}/inst/lib;/opt/cura/lib" +# "${CMAKE_BINARY_DIR}/inst/share;/opt/cura/share" +# ) +# +# set(package_dir "_CPack_Packages/Linux/${CPACK_GENERATOR}/Cura-${CURA_VERSION}-Linux/") +# set(CPACK_INSTALL_COMMANDS +# "${CMAKE_COMMAND} -E make_directory ${package_dir}/usr/bin" +# "${CMAKE_COMMAND} -E make_directory ${package_dir}/usr/share/applications" +# "${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/cura ${package_dir}/usr/bin/" +# "${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/cura.desktop ${package_dir}/usr/share/applications/" +# "${CMAKE_COMMAND} -E copy /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.20 ${package_dir}/opt/cura/lib/libstdc++.so.6" +# ) +# endif() +# +# set(CPACK_PACKAGE_NAME "Cura") +# set(CPACK_PACKAGE_VENDOR "Ultimaker") +# set(CPACK_PACKAGE_VERSION_MAJOR ${CURA_MAJOR_VERSION}) +# set(CPACK_PACKAGE_VERSION_MINOR ${CURA_MINOR_VERSION}) +# set(CPACK_PACKAGE_VERSION_PATCH ${CURA_PATCH_VERSION}) +# set(CPACK_PACKAGE_VERSION ${CURA_VERSION}) +# set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Cura 3D Printing Software") +# set(CPACK_PACKAGE_CONTACT "Arjen Hiemstra ") +# if(NOT BUILD_OS_OSX) +# set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE) +# endif() +# set(CPACK_PACKAGE_EXECUTABLES Cura "Cura ${CURA_MAJOR_VERSION}.${CURA_MINOR_VERSION}.${CURA_PATCH_VERSION}") +# set(CPACK_PACKAGE_INSTALL_DIRECTORY "Cura ${CURA_MAJOR_VERSION}.${CURA_MINOR_VERSION}") +# +# set(RPM_REQUIRES +# "python3 >= 3.4.0" +# "python3-qt5 >= 5.4.0" +# "python3-numpy >= 1.9.0" +# "qt5-qtquickcontrols >= 5.4.0" +# ) +# string(REPLACE ";" "," RPM_REQUIRES "${RPM_REQUIRES}") +# set(CPACK_RPM_PACKAGE_REQUIRES ${RPM_REQUIRES}) +# set(CPACK_RPM_PACKAGE_RELOCATABLE OFF) +# +# set(DEB_DEPENDS +# "python3 (>= 3.4.0)" +# "libgfortran3" +# ) +# string(REPLACE ";" "," DEB_DEPENDS "${DEB_DEPENDS}") +# set(CPACK_DEBIAN_PACKAGE_DEPENDS ${DEB_DEPENDS}) +# set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE amd64) +# # Set the right epoch so Debian knows this is a more recent version +# set(CPACK_DEBIAN_PACKAGE_VERSION "2:${CPACK_PACKAGE_VERSION}") +# +# set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) +# set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".") +# set(CPACK_NSIS_MUI_FINISHPAGE_RUN "Cura.exe") +# set(CPACK_NSIS_MENU_LINKS +# "https://ultimaker.com/en/support/software" "Cura Online Documentation" +# "https://github.com/ultimaker/cura" "Cura Development Resources" +# ) +# if(BUILD_OS_WIN32) +# set(CPACK_NSIS_PACKAGE_ARCHITECTURE "32") +# else() +# set(CPACK_NSIS_PACKAGE_ARCHITECTURE "64") +# endif() +# +# include(CPack) diff --git a/cmake/FindPyQt.cmake b/cmake/FindPyQt.cmake new file mode 100644 index 00000000..003c4e6d --- /dev/null +++ b/cmake/FindPyQt.cmake @@ -0,0 +1,24 @@ +# Copyright 2016 Ultimaker B.V. + +find_package(PythonInterp 3.4.0 QUIET) + +if(PythonInterp_FOUND) + execute_process( + COMMAND ${PYTHON_EXECUTABLE} -c "import PyQt5.QtCore; print(PyQt5.QtCore.__file__, PyQt5.QtCore.PYQT_VERSION_STR)" + RESULT_VARIABLE _findPyQt_status + OUTPUT_VARIABLE _findPyQt_output + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) +endif() + +set(PyQt_CORE_MODULE "PyQt_CORE_MODULE_NOTFOUND") +set(PyQt_VERSION_STR "PyQt_VERSION_STR_NOTFOUND") +if(_findPyQt_status EQUAL 0) + string(REGEX MATCH "[^ ]+" PyQt_CORE_MODULE ${_findPyQt_output}) + string(REGEX MATCH " .+" PyQt_VERSION_STR ${_findPyQt_output}) + string(STRIP ${PyQt_VERSION_STR} PyQt_VERSION_STR) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(PyQt REQUIRED_VARS PyQt_CORE_MODULE VERSION_VAR PyQt_VERSION_STR) diff --git a/cmake/FindSciPy.cmake b/cmake/FindSciPy.cmake new file mode 100644 index 00000000..9f0e8987 --- /dev/null +++ b/cmake/FindSciPy.cmake @@ -0,0 +1,24 @@ +# Copyright 2016 Ultimaker B.V. + +find_package(PythonInterp 3.4.0 QUIET) + +if(PythonInterp_FOUND) + execute_process( + COMMAND ${PYTHON_EXECUTABLE} -c "import scipy; print(scipy.__file__, scipy.__version__)" + RESULT_VARIABLE _findSciPy_status + OUTPUT_VARIABLE _findSciPy_output + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) +endif() + +set(SciPy_MODULE "SciPy_MODULE_NOTFOUND") +set(SciPy_VERSION_STR "SciPy_VERSION_STR_NOTFOUND") +if(_findSciPy_status EQUAL 0) + string(REGEX MATCH "[^ ]+" SciPy_MODULE ${_findSciPy_output}) + string(REGEX MATCH " (.+)" SciPy_VERSION_STR ${_findSciPy_output}) + string(STRIP ${SciPy_VERSION_STR} SciPy_VERSION_STR) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(SciPy REQUIRED_VARS SciPy_MODULE VERSION_VAR SciPy_VERSION_STR) diff --git a/cmake/GetFromEnvironmentOrCache.cmake b/cmake/GetFromEnvironmentOrCache.cmake new file mode 100644 index 00000000..f69b014a --- /dev/null +++ b/cmake/GetFromEnvironmentOrCache.cmake @@ -0,0 +1,9 @@ +# Copyright 2016 Ultimaker + +macro(GetFromEnvironmentOrCache VARIABLE_NAME DEFAULT_VALUE CACHE_TYPE CACHE_DESCRIPTION) + set(${VARIABLE_NAME} ${DEFAULT_VALUE} CACHE ${CACHE_TYPE} ${CACHE_DESCRIPTION}) + + if(DEFINED ENV{${VARIABLE_NAME}}) + set(${VARIABLE_NAME} $ENV{${VARIABLE_NAME}} CACHE ${CACHE_TYPE} ${CACHE_DESCRIPTION} FORCE) + endif() +endmacro(GetFromEnvironmentOrCache) From 4623966585ec9471d6605955934c9bb4bfa613e7 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 19 Jul 2016 17:24:26 +0200 Subject: [PATCH 002/101] Add separate files for individual projects --- CMakeLists.txt | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 683671ea..3367dee2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,13 +11,14 @@ include(GNUInstallDirs) # include(CuraBuildPlatformDetection) include(GetFromEnvironmentOrCache) -find_package(PythonInterp 3.5.0 REQUIRED) -find_package(Qt5 5.6.0 REQUIRED Core Qml Quick Widgets) -# find_package(Arcus 1.1 REQUIRED) +option(BUILD_PACKAGE "Create a package with the build of Cura" ON) +option(SIGN_PACKAGE "Perform signing of the created package. Implies BUILD_PACKAGE" ON) -# find_package(Python-Arcus VERSION 1.1 REQUIRED) -find_package(PyQt 5.6 REQUIRED) -find_package(SciPy 0.17 REQUIRED) +if(SIGN_PACKAGE) + set(BUILD_PACKAGE ON) +endif() + +set(BUILD_OS_LINUX TRUE) set(EXTERNALPROJECT_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/inst) @@ -35,6 +36,18 @@ if(NOT "${CURA_EXTRA_VERSION}" STREQUAL "") set(CURA_VERSION "${CURA_VERSION}-${CURA_EXTRA_VERSION}") endif() +# Build projects step +add_custom_target(projects ALL COMMENT "Building Projects...") + +file(GLOB _projects projects/*.cmake) +foreach(_project ${_projects}) + # Go through all files in projects/ and include them. The project files should define + # targets for the actual projects. In addition, these files are expected to define any + # packages they depend on with find_package and any other projects they depend on as + # dependencies of the target(s). Project files are free to define multiple targets though + # they should only define targets relevant for that project. + include(${_project}) +endforeach() # # From 5d73e5d7f1b0b5b08489cafe18360f7682765baf Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 19 Jul 2016 17:25:21 +0200 Subject: [PATCH 003/101] Add project files for Cura, CuraEngine and Uranium --- projects/Cura.cmake | 5 +++++ projects/CuraEngine.cmake | 7 +++++++ projects/Uranium.cmake | 10 ++++++++++ 3 files changed, 22 insertions(+) create mode 100644 projects/Cura.cmake create mode 100644 projects/CuraEngine.cmake create mode 100644 projects/Uranium.cmake diff --git a/projects/Cura.cmake b/projects/Cura.cmake new file mode 100644 index 00000000..8209fc9b --- /dev/null +++ b/projects/Cura.cmake @@ -0,0 +1,5 @@ +ExternalProject_Add(Cura + GIT_REPOSITORY https://github.com/ultimaker/Cura + GIT_TAG origin/${TAG_OR_BRANCH} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DURANIUM_SCRIPTS_DIR= -DCURA_VERSION=${CURA_VERSION} +) diff --git a/projects/CuraEngine.cmake b/projects/CuraEngine.cmake new file mode 100644 index 00000000..ba1cee47 --- /dev/null +++ b/projects/CuraEngine.cmake @@ -0,0 +1,7 @@ +find_package(Arcus 1.1 REQUIRED) + +ExternalProject_Add(CuraEngine + GIT_REPOSITORY https://github.com/ultimaker/CuraEngine + GIT_TAG origin/${TAG_OR_BRANCH} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCURA_ENGINE_VERSION=${CURA_VERSION} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_PREFIX_PATH=${CMAKE_INSTALL_PREFIX} +) diff --git a/projects/Uranium.cmake b/projects/Uranium.cmake new file mode 100644 index 00000000..ee8cec70 --- /dev/null +++ b/projects/Uranium.cmake @@ -0,0 +1,10 @@ +find_package(PythonInterp 3.5.0 REQUIRED) +find_package(Qt5 5.6.0 REQUIRED Core Qml Quick Widgets) +find_package(PyQt 5.6 REQUIRED) +find_package(SciPy 0.17 REQUIRED) + +ExternalProject_Add(Uranium + GIT_REPOSITORY https://github.com/ultimaker/Uranium + GIT_TAG origin/${TAG_OR_BRANCH} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} +) From 9dace7eb11b476e032d09b5fc934bbd671d3fd4d Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 19 Jul 2016 17:26:12 +0200 Subject: [PATCH 004/101] Refactor python module find files to use a common function This way we can much more easily add find files for other modules --- cmake/FindPyQt.cmake | 22 ++------------ cmake/FindPythonPackage.cmake | 56 +++++++++++++++++++++++++++++++++++ cmake/FindSciPy.cmake | 22 ++------------ 3 files changed, 62 insertions(+), 38 deletions(-) create mode 100644 cmake/FindPythonPackage.cmake diff --git a/cmake/FindPyQt.cmake b/cmake/FindPyQt.cmake index 003c4e6d..f5bf62c5 100644 --- a/cmake/FindPyQt.cmake +++ b/cmake/FindPyQt.cmake @@ -1,24 +1,8 @@ # Copyright 2016 Ultimaker B.V. -find_package(PythonInterp 3.4.0 QUIET) +include(FindPythonPackage) -if(PythonInterp_FOUND) - execute_process( - COMMAND ${PYTHON_EXECUTABLE} -c "import PyQt5.QtCore; print(PyQt5.QtCore.__file__, PyQt5.QtCore.PYQT_VERSION_STR)" - RESULT_VARIABLE _findPyQt_status - OUTPUT_VARIABLE _findPyQt_output - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE - ) -endif() - -set(PyQt_CORE_MODULE "PyQt_CORE_MODULE_NOTFOUND") -set(PyQt_VERSION_STR "PyQt_VERSION_STR_NOTFOUND") -if(_findPyQt_status EQUAL 0) - string(REGEX MATCH "[^ ]+" PyQt_CORE_MODULE ${_findPyQt_output}) - string(REGEX MATCH " .+" PyQt_VERSION_STR ${_findPyQt_output}) - string(STRIP ${PyQt_VERSION_STR} PyQt_VERSION_STR) -endif() +FindPythonPackage(PACKAGE_NAME "PyQt" MODULE_NAME "PyQt5.QtCore" VERSION_PROPERTY "PYQT_VERSION_STR") include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(PyQt REQUIRED_VARS PyQt_CORE_MODULE VERSION_VAR PyQt_VERSION_STR) +find_package_handle_standard_args(PyQt REQUIRED_VARS PyQt_PATH VERSION_VAR PyQt_VERSION) diff --git a/cmake/FindPythonPackage.cmake b/cmake/FindPythonPackage.cmake new file mode 100644 index 00000000..ca705ad0 --- /dev/null +++ b/cmake/FindPythonPackage.cmake @@ -0,0 +1,56 @@ +find_package(PythonInterp 3.4.0 QUIET) + +include(CMakeParseArguments) + +function(FindPythonPackage) + set(_options REQUIRED) + set(_single_args PACKAGE_NAME MODULE_NAME VERSION_PROPERTY) + + cmake_parse_arguments("" "${_options}" "${_single_args}" "" ${ARGN}) + if(_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "FindPythonPackage called with unknown arguments ${FPP_UNPARSED_ARGUMENTS}") + endif() + + if(NOT _PACKAGE_NAME) + message(FATAL_ERROR "FindPythonPackage expects a PACKAGE_NAME argument") + endif() + + if(NOT _MODULE_NAME) + set(_MODULE_NAME ${_PACKAGE_NAME}) + endif() + + if(NOT _VERSION_PROPERTY) + set(_VERSION_PROPERTY "__version__") + endif() + + if(NOT PythonInterp_FOUND) + if(_REQUIRED) + message(FATAL_ERROR "Could not find Python interpreter for required dependency ${_MODULE_NAME}") + else() + message(STATUS "Could not find ${_MODULE_NAME} because no Python interpreter was found") + return() + endif() + endif() + + if(PythonInterp_FOUND) + execute_process( + COMMAND ${PYTHON_EXECUTABLE} -c "import ${_MODULE_NAME}; print(${_MODULE_NAME}.__file__, ${_MODULE_NAME}.${_VERSION_PROPERTY})" + RESULT_VARIABLE _process_status + OUTPUT_VARIABLE _process_output +# ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + endif() + + set(_path "") + set(_version "") + if(_process_status EQUAL 0) + string(REGEX MATCH "[^ ]+" _path ${_process_output}) + get_filename_component(_path ${_path} DIRECTORY) + string(REGEX MATCH " .+" _version ${_process_output}) + string(STRIP ${_version} _version) + endif() + + set(${_PACKAGE_NAME}_PATH "${_path}" PARENT_SCOPE) + set(${_PACKAGE_NAME}_VERSION "${_version}" PARENT_SCOPE) +endfunction() diff --git a/cmake/FindSciPy.cmake b/cmake/FindSciPy.cmake index 9f0e8987..2ad8f0c7 100644 --- a/cmake/FindSciPy.cmake +++ b/cmake/FindSciPy.cmake @@ -1,24 +1,8 @@ # Copyright 2016 Ultimaker B.V. -find_package(PythonInterp 3.4.0 QUIET) +include(FindPythonPackage) -if(PythonInterp_FOUND) - execute_process( - COMMAND ${PYTHON_EXECUTABLE} -c "import scipy; print(scipy.__file__, scipy.__version__)" - RESULT_VARIABLE _findSciPy_status - OUTPUT_VARIABLE _findSciPy_output - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE - ) -endif() - -set(SciPy_MODULE "SciPy_MODULE_NOTFOUND") -set(SciPy_VERSION_STR "SciPy_VERSION_STR_NOTFOUND") -if(_findSciPy_status EQUAL 0) - string(REGEX MATCH "[^ ]+" SciPy_MODULE ${_findSciPy_output}) - string(REGEX MATCH " (.+)" SciPy_VERSION_STR ${_findSciPy_output}) - string(STRIP ${SciPy_VERSION_STR} SciPy_VERSION_STR) -endif() +FindPythonPackage(PACKAGE_NAME "SciPy" MODULE_NAME "scipy") include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(SciPy REQUIRED_VARS SciPy_MODULE VERSION_VAR SciPy_VERSION_STR) +find_package_handle_standard_args(SciPy REQUIRED_VARS SciPy_PATH VERSION_VAR SciPy_VERSION) From 180bb6808840320a65234c66e2375d6e64214744 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 19 Jul 2016 17:26:34 +0200 Subject: [PATCH 005/101] Add a file to find cx_Freeze python module --- cmake/Findcx_Freeze.cmake | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 cmake/Findcx_Freeze.cmake diff --git a/cmake/Findcx_Freeze.cmake b/cmake/Findcx_Freeze.cmake new file mode 100644 index 00000000..56d511a2 --- /dev/null +++ b/cmake/Findcx_Freeze.cmake @@ -0,0 +1,6 @@ +include(FindPythonPackage) + +FindPythonPackage(PACKAGE_NAME "cx_Freeze" VERSION_PROPERTY "version") + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(cx_Freeze REQUIRED_VARS cx_Freeze_PATH VERSION_VAR cx_Freeze_VERSION) From 07527e8b72e552a13e8069b7ba99c30269b4e69c Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 19 Jul 2016 17:27:04 +0200 Subject: [PATCH 006/101] Add a project file for cura-binary-data --- projects/cura-binary-data.cmake | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 projects/cura-binary-data.cmake diff --git a/projects/cura-binary-data.cmake b/projects/cura-binary-data.cmake new file mode 100644 index 00000000..643f5100 --- /dev/null +++ b/projects/cura-binary-data.cmake @@ -0,0 +1,6 @@ + +ExternalProject_Add(cura-binary-data + GIT_REPOSITORY https://github.com/ultimaker/cura-binary-data + GIT_TAG origin/${TAG_OR_BRANCH} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} +) From aa58e695d5387ff93f6a3187d7bd1ed5a1e7e4e0 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 19 Jul 2016 17:28:13 +0200 Subject: [PATCH 007/101] Introduce a SetProjectDependencies macro and use it for Cura Since otherwise we get errors about undefined targets because Cura is included before its dependency Uranium. --- CMakeLists.txt | 2 ++ cmake/SetProjectDependencies.cmake | 23 +++++++++++++++++++++++ projects/Cura.cmake | 2 ++ 3 files changed, 27 insertions(+) create mode 100644 cmake/SetProjectDependencies.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 3367dee2..e99aa596 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ include(GNUInstallDirs) # find_package(CuraBuildEnvironment) # include(CuraBuildPlatformDetection) include(GetFromEnvironmentOrCache) +include(SetProjectDependencies) option(BUILD_PACKAGE "Create a package with the build of Cura" ON) option(SIGN_PACKAGE "Perform signing of the created package. Implies BUILD_PACKAGE" ON) @@ -49,6 +50,7 @@ foreach(_project ${_projects}) include(${_project}) endforeach() +ProcessProjectDependencies(TARGET projects) # # # message(STATUS "Building Cura ${CURA_VERSION}") diff --git a/cmake/SetProjectDependencies.cmake b/cmake/SetProjectDependencies.cmake new file mode 100644 index 00000000..f6842732 --- /dev/null +++ b/cmake/SetProjectDependencies.cmake @@ -0,0 +1,23 @@ + +include(CMakeParseArguments) + +macro(SetProjectDependencies) + set(_single_value_args TARGET) + set(_multi_value_args DEPENDS) + cmake_parse_arguments("" "" "${_single_value_args}" "${_multi_value_args}" ${ARGN}) + + list(APPEND ALL_PROJECT_TARGETS ${_TARGET}) + + set_property(TARGET ${_TARGET} PROPERTY PROJECT_DEPENDS ${_DEPENDS}) +endmacro() + +macro(ProcessProjectDependencies) + set(_single_value_args TARGET) + cmake_parse_arguments("" "" "${_single_value_args}" "" ${ARGN}) + + foreach(_project ${ALL_PROJECT_TARGETS}) + get_property(_depends TARGET ${_project} PROPERTY PROJECT_DEPENDS) + add_dependencies(${_project} ${_depends}) + add_dependencies(${_TARGET} ${_project}) + endforeach() +endmacro() diff --git a/projects/Cura.cmake b/projects/Cura.cmake index 8209fc9b..3ee6b132 100644 --- a/projects/Cura.cmake +++ b/projects/Cura.cmake @@ -3,3 +3,5 @@ ExternalProject_Add(Cura GIT_TAG origin/${TAG_OR_BRANCH} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DURANIUM_SCRIPTS_DIR= -DCURA_VERSION=${CURA_VERSION} ) + +SetProjectDependencies(TARGET Cura DEPENDS Uranium CuraEngine) From ee89d34ad63f1bfff3fd96628949dd37692cb590 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 19 Jul 2016 17:28:45 +0200 Subject: [PATCH 008/101] Introduce a packaging step and add includes for Linux and OSX --- CMakeLists.txt | 15 +++++++++++++++ packaging/linux.cmake | 4 ++++ packaging/osx.cmake | 29 +++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 packaging/linux.cmake create mode 100644 packaging/osx.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index e99aa596..3ac6af93 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,6 +51,21 @@ foreach(_project ${_projects}) endforeach() ProcessProjectDependencies(TARGET projects) + +# Create package step +if(BUILD_PACKAGE) + add_custom_target(packaging ALL DEPENDS projects COMMENT "Packaging Projects...") + + if(BUILD_OS_WINDOWS) + include(packaging/windows.cmake) + elseif(BUILD_OS_OSX) + include(packaging/osx.cmake) + elseif(BUILD_OS_LINUX) + include(packaging/linux.cmake) + else() + message(STATUS "Do not know how to build an executable for the current platform! You will have to create it manually.") + endif() +endif() # # # message(STATUS "Building Cura ${CURA_VERSION}") diff --git a/packaging/linux.cmake b/packaging/linux.cmake new file mode 100644 index 00000000..d2d68dcc --- /dev/null +++ b/packaging/linux.cmake @@ -0,0 +1,4 @@ +find_package(cx_Freeze 4.3 REQUIRED) +# find_package(AppImageKit REQUIRED) +# +# diff --git a/packaging/osx.cmake b/packaging/osx.cmake new file mode 100644 index 00000000..1bd25ec3 --- /dev/null +++ b/packaging/osx.cmake @@ -0,0 +1,29 @@ +find_package(cx_freeze 4.3 REQUIRED) + +configure_file(setup_osx.py.in setup_osx.py @ONLY) + +add_custom_target(build_app ALL) +add_dependencies(build_app cura-binary-data) + +foreach(repo ${EXTRA_REPOSITORIES}) + separate_arguments(items UNIX_COMMAND "${repo}") + list(GET items 0 name) + add_dependencies(build_app ${name}) +endforeach() + +add_custom_command( + TARGET build_app PRE_LINK + COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/dist + COMMENT "Cleaning old dist/ directory" + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} +) +add_custom_command( + TARGET build_app POST_BUILD + COMMAND ${PYTHON_EXECUTABLE} setup_osx.py py2app + COMMENT "Running py2app" + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} +) + +install(DIRECTORY ${CMAKE_BINARY_DIR}/dist/Cura.app DESTINATION "." USE_SOURCE_PERMISSIONS) + +set(CPACK_GENERATOR "DragNDrop") From 06b59872b963b113606f569acc1f064a621ad517 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 19 Jul 2016 17:29:09 +0200 Subject: [PATCH 009/101] Move setup_* files into the packaging directory --- setup_osx.py.in => packaging/setup_osx.py.in | 0 setup_win32.py.in => packaging/setup_win32.py.in | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename setup_osx.py.in => packaging/setup_osx.py.in (100%) rename setup_win32.py.in => packaging/setup_win32.py.in (100%) diff --git a/setup_osx.py.in b/packaging/setup_osx.py.in similarity index 100% rename from setup_osx.py.in rename to packaging/setup_osx.py.in diff --git a/setup_win32.py.in b/packaging/setup_win32.py.in similarity index 100% rename from setup_win32.py.in rename to packaging/setup_win32.py.in From 7ecfce59796aeb3fe91f4183d240aede76f2c192 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 19 Jul 2016 17:29:37 +0200 Subject: [PATCH 010/101] Introduce a signing step and a signing file for Linux --- CMakeLists.txt | 16 ++++++++++++++++ signing/linux.cmake | 1 + 2 files changed, 17 insertions(+) create mode 100644 signing/linux.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ac6af93..7e2a9fa0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,6 +66,22 @@ if(BUILD_PACKAGE) message(STATUS "Do not know how to build an executable for the current platform! You will have to create it manually.") endif() endif() + +# Sign packages step +if(SIGN_PACKAGE) + add_custom_target(signing ALL DEPENDS packaging COMMENT "Signing Package...") + + if(BUILD_OS_WINDOWS) + include(signing/windows.cmake) + elseif(BUILD_OS_OSX) + include(signing/osx.cmake) + elseif(BUILD_OS_LINUX) + include(signing/linux.cmake) + else() + message(STATUS "Do not know how to sign the executable for the current platform! You will need to perform signing manually.") + endif() +endif() + # # # message(STATUS "Building Cura ${CURA_VERSION}") diff --git a/signing/linux.cmake b/signing/linux.cmake new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/signing/linux.cmake @@ -0,0 +1 @@ + From 6666a74d0a2cd5d5731b8d4938008d2af9b5bc00 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 21 Jul 2016 08:49:41 +0200 Subject: [PATCH 011/101] Ensure project dependencies are set properly --- cmake/SetProjectDependencies.cmake | 4 +++- projects/CuraEngine.cmake | 2 ++ projects/Uranium.cmake | 2 ++ projects/cura-binary-data.cmake | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cmake/SetProjectDependencies.cmake b/cmake/SetProjectDependencies.cmake index f6842732..3bc40fcd 100644 --- a/cmake/SetProjectDependencies.cmake +++ b/cmake/SetProjectDependencies.cmake @@ -17,7 +17,9 @@ macro(ProcessProjectDependencies) foreach(_project ${ALL_PROJECT_TARGETS}) get_property(_depends TARGET ${_project} PROPERTY PROJECT_DEPENDS) - add_dependencies(${_project} ${_depends}) + if(_depends) + add_dependencies(${_project} ${_depends}) + endif() add_dependencies(${_TARGET} ${_project}) endforeach() endmacro() diff --git a/projects/CuraEngine.cmake b/projects/CuraEngine.cmake index ba1cee47..5092e7b0 100644 --- a/projects/CuraEngine.cmake +++ b/projects/CuraEngine.cmake @@ -5,3 +5,5 @@ ExternalProject_Add(CuraEngine GIT_TAG origin/${TAG_OR_BRANCH} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCURA_ENGINE_VERSION=${CURA_VERSION} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_PREFIX_PATH=${CMAKE_INSTALL_PREFIX} ) + +SetProjectDependencies(TARGET CuraEngine) diff --git a/projects/Uranium.cmake b/projects/Uranium.cmake index ee8cec70..edb6255e 100644 --- a/projects/Uranium.cmake +++ b/projects/Uranium.cmake @@ -8,3 +8,5 @@ ExternalProject_Add(Uranium GIT_TAG origin/${TAG_OR_BRANCH} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} ) + +SetProjectDependencies(TARGET Uranium) diff --git a/projects/cura-binary-data.cmake b/projects/cura-binary-data.cmake index 643f5100..6de4f554 100644 --- a/projects/cura-binary-data.cmake +++ b/projects/cura-binary-data.cmake @@ -4,3 +4,5 @@ ExternalProject_Add(cura-binary-data GIT_TAG origin/${TAG_OR_BRANCH} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} ) + +SetProjectDependencies(TARGET cura-binary-data DEPENDS Cura) From ceef674dcf3478efd4b7dc5282a5c62a2e1a7758 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 21 Jul 2016 08:50:15 +0200 Subject: [PATCH 012/101] Add a working cx_Freeze script for Linux --- packaging/linux.cmake | 10 ++++++ packaging/setup_linux.py.in | 64 +++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 packaging/setup_linux.py.in diff --git a/packaging/linux.cmake b/packaging/linux.cmake index d2d68dcc..1a9c60a7 100644 --- a/packaging/linux.cmake +++ b/packaging/linux.cmake @@ -1,4 +1,14 @@ find_package(cx_Freeze 4.3 REQUIRED) # find_package(AppImageKit REQUIRED) + +configure_file(${CMAKE_CURRENT_LIST_DIR}/setup_linux.py.in setup.py @ONLY) + +add_custom_command( + TARGET packaging POST_BUILD + COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/package + COMMAND ${PYTHON_EXECUTABLE} setup.py build + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + VERBATIM +) # # diff --git a/packaging/setup_linux.py.in b/packaging/setup_linux.py.in new file mode 100644 index 00000000..f10b4b3b --- /dev/null +++ b/packaging/setup_linux.py.in @@ -0,0 +1,64 @@ +import sys +import os.path + +from cx_Freeze import setup, Executable, hooks + +def load_scipy(finder, module): + finder.IncludePackage("scipy._lib") + finder.IncludePackage("scipy.misc") + finder.IncludePackage("scipy.sparse.csgraph._validation") + +hooks.load_scipy = load_scipy + +def load_pyqt5_qtquick(finder, module): + name, QtCore = hooks._qt_implementation(module) + + finder.IncludeModule("%s.QtCore" % name) + finder.IncludeModule("%s.QtGui" % name) + finder.IncludeModule("%s.QtQml" % name) + finder.IncludeModule("%s.QtNetwork" % name) + finder.IncludeModule("%s._QOpenGLFunctions_2_0" % name) + +hooks.load_PyQt5_QtQuick = load_pyqt5_qtquick + +search_path = sys.path.copy() +search_path.insert(1, "@EXTERNALPROJECT_INSTALL_PREFIX@/lib/python3/dist-packages/") +search_path.insert(2, "@CMAKE_INSTALL_PREFIX@/lib/python3/dist-packages/") + +# Dependencies are automatically detected, but it might need +# fine tuning. +build_options = { + "build_exe": "package/cx_freeze", + "path": search_path, + "packages": [ + "xml.etree", + "uuid", + "UM", + "cura" + ], + "include_files": [ + ("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/cura", "plugins"), + ("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/uranium", "plugins"), + ("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/python3/dist-packages/UM/Qt/qml/UM", "qml/UM"), + ("@EXTERNALPROJECT_INSTALL_PREFIX@/share/cura/resources", "resources"), + ("@EXTERNALPROJECT_INSTALL_PREFIX@/share/uranium/resources", "resources") + ] +} + +base = "Win32GUI" if sys.platform == "win32" else None + +executables = [ + Executable(os.path.join("@EXTERNALPROJECT_INSTALL_PREFIX@", "bin", "cura"), base = base) +] + +setup( + name = "Cura", + version = "@CURA_MAJOR_VERSION@.@CURA_MINOR_VERSION@.@CURA_PATCH_VERSION@", + author = "Ultimaker B.V.", + url="http://software.ultimaker.com/", + description = "3D Slicer Software", + license="GNU AFFERO GENERAL PUBLIC LICENSE (AGPL)", + + options = { "build_exe": build_options }, + executables = executables +) From 0dbdf64817992f88de2a201fd88d04922feef491 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 21 Jul 2016 08:50:42 +0200 Subject: [PATCH 013/101] Start on some preliminary work to support creating AppImages --- cmake/FindAppImageKit.cmake | 154 ++++++++++++++++++++++++++++++++++++ packaging/linux.cmake | 12 +++ 2 files changed, 166 insertions(+) create mode 100644 cmake/FindAppImageKit.cmake diff --git a/cmake/FindAppImageKit.cmake b/cmake/FindAppImageKit.cmake new file mode 100644 index 00000000..d8340f99 --- /dev/null +++ b/cmake/FindAppImageKit.cmake @@ -0,0 +1,154 @@ + +# set ( APPIMAGE_CONFIG_DIR "${CMAKE_SOURCE_DIR}" ) # Specifies where to find template files, in this case this same directory +# +# set ( APPIMAGE_ASSISTANT_PROGRAM CACHE FILEPATH "AppImageAssistant executable" ) +# set ( APPIMAGE_APPRUN_PROGRAM CACHE FILEPATH "AppImage AppRun executable" ) +# +# set ( APPIMAGE_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/deploy/linux-appimage" CACHE PATH "Where to put the AppDir items" ) +# set ( APPIMAGE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/package/linux-appimage" CACHE PATH "AppImage output directory" ) +# set ( APPIMAGE_FOLLOW_STANDARD OFF CACHE BOOL "Whether generator should follow the spec" ) +# +# set ( APPIMAGE_DEFAULT_ICON_FILE "${CMAKE_SOURCE_DIR}/icon.svg" CACHE FILEPATH "Default icon for AppImages" ) + +find_program(APPIMAGEKIT_ASSISTANT AppImageAssistant) + +# find_program(APPIMAGEKIT_APPRUN) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(AppImageKit REQUIRED_VARS APPIMAGEKIT_ASSISTANT VERSION_VAR ) + +mark_as_advanced(APPIMAKEKIT_ASSISTANT APPIMAGEKIT_APPRUN) + +# macro( APPIMAGE_PACKAGE TARGET APPIMAGE_TITLE DATA LIBRARIES LIBRARY_FILES ) +# string ( TOLOWER "${APPIMAGE_TITLE}" APPIMAGE_INTERNALNAME ) +# string ( MAKE_C_IDENTIFIER "${APPIMAGE_INTERNALNAME}" APPIMAGE_INTERNALNAME ) +# +# # Some prerequisites +# # TITLE here is used as the name of the final AppImage as well as the desktop entry's name +# set ( APPIMAGE_TITLE "${APPIMAGE_TITLE}" ) +# set ( APPIMAGE_INTERNALNAME "${APPIMAGE_INTERNALNAME}" ) +# set ( APPIMAGE_LIBRARIES ) +# set ( APPIMAGE_DATA ) +# +# # Icon file to be used for the AppImage, only one in this case, preferrably SVG +# set ( APPIMAGE_ICON "${APPIMAGE_DEFAULT_ICON_FILE}" ) +# # We define a way to reference this icon based on where it is located +# set ( APPIMAGE_ICON_REF "${APPIMAGE_INTERNALNAME}.svg" ) +# +# # This helps the window manager to recognize the program even if it has no embedded or loaded icon +# set ( APPIMAGE_EXEC_WM ${TARGET} ) +# +# # Sets the launch variable in .desktop entry +# set ( APPIMAGE_EXEC ${TARGET} ) +# +# # This directory is used for temporary files, might get messy +# set ( APPIMAGE_CACHE_DIR "${APPIMAGE_WORKING_DIRECTORY}/${APPIMAGE_INTERNALNAME}_cache" ) +# # Where the AppDir is generated +# set ( APPIMAGE_INTERMEDIATE_DIR "${APPIMAGE_WORKING_DIRECTORY}/${APPIMAGE_INTERNALNAME}" ) +# set ( APPIMAGE_ICON_TARGET "${APPIMAGE_INTERMEDIATE_DIR}/${APPIMAGE_ICON_REF}" ) +# set ( APPIMAGE_BINARY_DIR "${APPIMAGE_INTERMEDIATE_DIR}/usr/bin" ) +# set ( APPIMAGE_ASSET_DIR "${APPIMAGE_INTERMEDIATE_DIR}/usr/share" ) +# set ( APPIMAGE_LIBRARY_DIR "${APPIMAGE_INTERMEDIATE_DIR}/usr/lib" ) +# set ( APPIMAGE_FINAL_NAME "${APPIMAGE_OUTPUT_DIRECTORY}/${APPIMAGE_TITLE}.AppImage" ) +# +# list ( APPEND APPIMAGE_LIBRARIES +# ${LIBRARIES} ) +# list ( APPEND APPIMAGE_DATA +# ${DATA} ) +# +# # Remove the previous AppImage file to avoid confusion when generating a new one +# add_custom_command ( TARGET ${TARGET} +# PRE_BUILD +# COMMAND ${CMAKE_COMMAND} -E remove "${APPIMAGE_FINAL_NAME}" +# ) +# +# # Create some necessary directory structure in AppDir +# add_custom_command ( TARGET ${TARGET} +# PRE_BUILD +# COMMAND ${CMAKE_COMMAND} -E make_directory "${APPIMAGE_OUTPUT_DIRECTORY}" +# ) +# add_custom_command ( TARGET ${TARGET} +# PRE_BUILD +# COMMAND ${CMAKE_COMMAND} -E make_directory "${APPIMAGE_BINARY_DIR}" +# ) +# add_custom_command ( TARGET ${TARGET} +# PRE_BUILD +# COMMAND ${CMAKE_COMMAND} -E make_directory "${APPIMAGE_CACHE_DIR}" +# ) +# add_custom_command ( TARGET ${TARGET} +# PRE_BUILD +# COMMAND ${CMAKE_COMMAND} -E make_directory "${APPIMAGE_LIBRARY_DIR}" +# ) +# add_custom_command ( TARGET ${TARGET} +# PRE_BUILD +# COMMAND ${CMAKE_COMMAND} -E make_directory "${APPIMAGE_ASSET_DIR}" +# ) +# +# # Copy and configure some data for the AppDir +# configure_file ( +# "${APPIMAGE_ICON}" +# "${APPIMAGE_ICON_TARGET}" +# COPYONLY +# ) +# configure_file ( +# "${APPIMAGE_ICON}" +# "${APPIMAGE_INTERMEDIATE_DIR}/.DirIcon" +# COPYONLY +# ) +# configure_file ( +# "${APPIMAGE_CONFIG_DIR}/application.desktop.in" +# "${APPIMAGE_INTERMEDIATE_DIR}/${APPIMAGE_INTERNALNAME}.desktop" +# @ONLY +# ) +# configure_file ( +# "${APPIMAGE_APPRUN_PROGRAM}" +# "${APPIMAGE_INTERMEDIATE_DIR}/AppRun" +# COPYONLY +# ) +# +# # Copy resources into AppDir +# foreach ( RESC ${DATA} ) +# add_custom_command ( TARGET ${TARGET} +# PRE_BUILD +# COMMAND ${CMAKE_COMMAND} -E copy_directory "${RESC}" "${APPIMAGE_ASSET_DIR}" +# ) +# endforeach() +# +# # Copy bundled libraries into AppDir +# foreach ( LIB ${LIBRARY_FILES} ) +# add_custom_command ( TARGET ${TARGET} +# PRE_BUILD +# COMMAND ${CMAKE_COMMAND} -E copy "${LIB}" "${APPIMAGE_LIBRARY_DIR}" +# ) +# endforeach() +# +# foreach ( LIB ${LIBRARIES} ) +# add_custom_command ( TARGET ${TARGET} +# PRE_BUILD +# COMMAND ${CMAKE_COMMAND} -E copy "$" "${APPIMAGE_LIBRARY_DIR}" +# ) +# endforeach() +# +# # Copy the binary to AppDir +# add_custom_command ( TARGET ${TARGET} +# POST_BUILD +# COMMAND ${CMAKE_COMMAND} -E copy "$" "${APPIMAGE_BINARY_DIR}" +# ) +# +# # Do the actual packaging step with AppImageKit +# add_custom_command ( TARGET ${TARGET} +# POST_BUILD +# COMMAND "${APPIMAGE_ASSISTANT_PROGRAM}" "${APPIMAGE_INTERMEDIATE_DIR}" "${APPIMAGE_FINAL_NAME}" +# ) +# +# install ( +# FILES +# "${APPIMAGE_FINAL_NAME}" +# +# DESTINATION +# "${CMAKE_PACKAGED_OUTPUT_PREFIX}/linux-appimage" +# +# PERMISSIONS +# OWNER_READ OWNER_WRITE OWNER_EXECUTE +# ) +# endmacro() diff --git a/packaging/linux.cmake b/packaging/linux.cmake index 1a9c60a7..5c161361 100644 --- a/packaging/linux.cmake +++ b/packaging/linux.cmake @@ -10,5 +10,17 @@ add_custom_command( WORKING_DIRECTORY ${CMAKE_BINARY_DIR} VERBATIM ) +# +# add_custom_command( +# TARGET packaging POST_BUILD +# COMMAND ${PYTHON_EXECUTABLE} setup_osx.py py2app +# COMMENT "Running py2app" +# WORKING_DIRECTORY ${CMAKE_BINARY_DIR} +# ) +# +# install(DIRECTORY ${CMAKE_BINARY_DIR}/dist/Cura.app DESTINATION "." USE_SOURCE_PERMISSIONS) +# +# set(CPACK_GENERATOR "DragNDrop") + # # From 7df432c37a4121f164cd2b47f12f2cde0ac183f5 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 21 Jul 2016 21:18:16 +0200 Subject: [PATCH 014/101] Add a simple build platform detection file --- CMakeLists.txt | 2 +- cmake/BuildPlatformDetection.cmake | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 cmake/BuildPlatformDetection.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e2a9fa0..01e7ef4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ include(ExternalProject) include(GNUInstallDirs) # find_package(CuraBuildEnvironment) -# include(CuraBuildPlatformDetection) +include(BuildPlatformDetection) include(GetFromEnvironmentOrCache) include(SetProjectDependencies) diff --git a/cmake/BuildPlatformDetection.cmake b/cmake/BuildPlatformDetection.cmake new file mode 100644 index 00000000..1acf4ef3 --- /dev/null +++ b/cmake/BuildPlatformDetection.cmake @@ -0,0 +1,13 @@ + +if(APPLE) + set(BUILD_OS_OSX ON) +elseif(WIN32) + set(BUILD_OS_WINDOWS ON) + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(BUILD_OS_WIN64 ON) + else() + set(BUILD_OS_WIN32 ON) + endif() +elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + set(BUILD_OS_LINUX ON) +endif() From beba423ca5aedb961e281b2c708edc4bc748e9b7 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 21 Jul 2016 21:18:41 +0200 Subject: [PATCH 015/101] Add project files for Doodle3d and Post Processing plugins --- projects/Cura-Doodle3D.cmake | 8 ++++++++ projects/Cura-PostProcessing.cmake | 8 ++++++++ 2 files changed, 16 insertions(+) create mode 100644 projects/Cura-Doodle3D.cmake create mode 100644 projects/Cura-PostProcessing.cmake diff --git a/projects/Cura-Doodle3D.cmake b/projects/Cura-Doodle3D.cmake new file mode 100644 index 00000000..95638b79 --- /dev/null +++ b/projects/Cura-Doodle3D.cmake @@ -0,0 +1,8 @@ + +ExternalProject_Add(Cura-Doodle3D + GIT_REPOSITORY https://github.com/Doodle3D/Doodle3D-cura-plugin + GIT_TAG origin/master + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} +) + +SetProjectDependencies(TARGET Cura-Doodle3D DEPENDS Cura) diff --git a/projects/Cura-PostProcessing.cmake b/projects/Cura-PostProcessing.cmake new file mode 100644 index 00000000..b0e208db --- /dev/null +++ b/projects/Cura-PostProcessing.cmake @@ -0,0 +1,8 @@ + +ExternalProject_Add(Cura-PostProcessing + GIT_REPOSITORY https://github.com/nallath/PostProcessingPlugin + GIT_TAG origin/${TAG_OR_BRANCH} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} +) + +SetProjectDependencies(TARGET Cura-PostProcessing DEPENDS Cura) From 6fa51a59d8f1d7af9810e744959053175aaef15b Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 21 Jul 2016 21:21:41 +0200 Subject: [PATCH 016/101] Add a placeholder signing file for OSX --- signing/osx.cmake | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 signing/osx.cmake diff --git a/signing/osx.cmake b/signing/osx.cmake new file mode 100644 index 00000000..60ad6b25 --- /dev/null +++ b/signing/osx.cmake @@ -0,0 +1,6 @@ + +# add_custom_command( +# TARGET signing +# COMMAND +# WORKING_DIRECTORY ${CMAKE_BINARY_DIR} +# ) From 49f3d53b07fad4a58707541aa230d6777c137840 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 21 Jul 2016 21:22:03 +0200 Subject: [PATCH 017/101] Fix setting Cura version --- CMakeLists.txt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 01e7ef4b..cc403933 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,8 +19,6 @@ if(SIGN_PACKAGE) set(BUILD_PACKAGE ON) endif() -set(BUILD_OS_LINUX TRUE) - set(EXTERNALPROJECT_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/inst) GetFromEnvironmentOrCache(TAG_OR_BRANCH "master" STRING "The name of the tag or branch to build") @@ -32,9 +30,9 @@ GetFromEnvironmentOrCache(CURA_VERSION_MINOR "0" STRING "Cura Minor Version") GetFromEnvironmentOrCache(CURA_VERSION_PATCH "0" STRING "Cura Patch Version") GetFromEnvironmentOrCache(CURA_VERSION_EXTRA "${TAG_OR_BRANCH}" STRING "Cura Extra Version Information") -set(CURA_VERSION "${CURA_MAJOR_VERSION}.${CURA_MINOR_VERSION}.${CURA_PATCH_VERSION}") -if(NOT "${CURA_EXTRA_VERSION}" STREQUAL "") - set(CURA_VERSION "${CURA_VERSION}-${CURA_EXTRA_VERSION}") +set(CURA_VERSION "${CURA_VERSION_MAJOR}.${CURA_VERSION_MINOR}.${CURA_VERSION_PATCH}") +if(NOT "${CURA_VERSION_EXTRA}" STREQUAL "") + set(CURA_VERSION "${CURA_VERSION}-${CURA_VERSION_EXTRA}") endif() # Build projects step From 4109e996dd87a1ca0c54a5b1f1027e461b675096 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 21 Jul 2016 21:22:39 +0200 Subject: [PATCH 018/101] Require cx_Freeze 5.0 Since 4.3 dumps all library files into the root dir --- packaging/linux.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packaging/linux.cmake b/packaging/linux.cmake index 5c161361..f8e1ed81 100644 --- a/packaging/linux.cmake +++ b/packaging/linux.cmake @@ -1,4 +1,4 @@ -find_package(cx_Freeze 4.3 REQUIRED) +find_package(cx_Freeze 5.0 REQUIRED) # find_package(AppImageKit REQUIRED) configure_file(${CMAKE_CURRENT_LIST_DIR}/setup_linux.py.in setup.py @ONLY) @@ -8,7 +8,6 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/package COMMAND ${PYTHON_EXECUTABLE} setup.py build WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - VERBATIM ) # # add_custom_command( From d1ad4495520ec4d1447699912a22e666c19bc327 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 21 Jul 2016 21:22:57 +0200 Subject: [PATCH 019/101] Fix up OSX project file to use cx_Freeze --- packaging/osx.cmake | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/packaging/osx.cmake b/packaging/osx.cmake index 1bd25ec3..037e7a47 100644 --- a/packaging/osx.cmake +++ b/packaging/osx.cmake @@ -1,29 +1,16 @@ -find_package(cx_freeze 4.3 REQUIRED) +find_package(cx_freeze 5.0 REQUIRED) -configure_file(setup_osx.py.in setup_osx.py @ONLY) +configure_file(${CMAKE_CURRENT_LIST_DIR}/setup_osx.py.in setup.py @ONLY) -add_custom_target(build_app ALL) -add_dependencies(build_app cura-binary-data) - -foreach(repo ${EXTRA_REPOSITORIES}) - separate_arguments(items UNIX_COMMAND "${repo}") - list(GET items 0 name) - add_dependencies(build_app ${name}) -endforeach() - -add_custom_command( - TARGET build_app PRE_LINK - COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/dist - COMMENT "Cleaning old dist/ directory" - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} -) add_custom_command( - TARGET build_app POST_BUILD - COMMAND ${PYTHON_EXECUTABLE} setup_osx.py py2app - COMMENT "Running py2app" + TARGET packaging POST_BUILD + COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/package + COMMAND ${PYTHON_EXECUTABLE} setup.py build WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) -install(DIRECTORY ${CMAKE_BINARY_DIR}/dist/Cura.app DESTINATION "." USE_SOURCE_PERMISSIONS) +install(DIRECTORY ${CMAKE_BINARY_DIR}/package/Cura.app DESTINATION "." USE_SOURCE_PERMISSIONS) set(CPACK_GENERATOR "DragNDrop") + +add_dependencies(signing package) From 373ffb739c215c4fdfaec085a93e9d75db7405e0 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 21 Jul 2016 21:27:11 +0200 Subject: [PATCH 020/101] Add a placeholder signing file for Linux --- signing/linux.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/signing/linux.cmake b/signing/linux.cmake index 8b137891..9c81a072 100644 --- a/signing/linux.cmake +++ b/signing/linux.cmake @@ -1 +1,9 @@ +# add_custom_command( +# TARGET signing POST_BUILD +# COMMAND ${PYTHON_EXECUTABLE} setup.py build +# WORKING_DIRECTORY ${CMAKE_BINARY_DIR} +# VERBATIM +# ) + + From beafda4a04595bfe69705dbe536f8c6e516c9787 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 21 Jul 2016 21:29:01 +0200 Subject: [PATCH 021/101] Use cx_freeze's library detection to detect and include dependencies This way we do not need to manually copy all those libraries --- packaging/setup_linux.py.in | 51 +++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/packaging/setup_linux.py.in b/packaging/setup_linux.py.in index f10b4b3b..cddefb89 100644 --- a/packaging/setup_linux.py.in +++ b/packaging/setup_linux.py.in @@ -11,13 +11,11 @@ def load_scipy(finder, module): hooks.load_scipy = load_scipy def load_pyqt5_qtquick(finder, module): - name, QtCore = hooks._qt_implementation(module) - - finder.IncludeModule("%s.QtCore" % name) - finder.IncludeModule("%s.QtGui" % name) - finder.IncludeModule("%s.QtQml" % name) - finder.IncludeModule("%s.QtNetwork" % name) - finder.IncludeModule("%s._QOpenGLFunctions_2_0" % name) + finder.IncludeModule("PyQt5.QtCore") + finder.IncludeModule("PyQt5.QtGui") + finder.IncludeModule("PyQt5.QtQml") + finder.IncludeModule("PyQt5.QtNetwork") + finder.IncludeModule("PyQt5._QOpenGLFunctions_2_0") hooks.load_PyQt5_QtQuick = load_pyqt5_qtquick @@ -28,7 +26,7 @@ search_path.insert(2, "@CMAKE_INSTALL_PREFIX@/lib/python3/dist-packages/") # Dependencies are automatically detected, but it might need # fine tuning. build_options = { - "build_exe": "package/cx_freeze", + "build_exe": "package/", "path": search_path, "packages": [ "xml.etree", @@ -42,6 +40,43 @@ build_options = { ("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/python3/dist-packages/UM/Qt/qml/UM", "qml/UM"), ("@EXTERNALPROJECT_INSTALL_PREFIX@/share/cura/resources", "resources"), ("@EXTERNALPROJECT_INSTALL_PREFIX@/share/uranium/resources", "resources") + ], + "optimize": 2, + "bin_path_includes": [ + "/lib", + "/lib64", + "/usr/lib", + "/usr/lib64", + ], + "bin_excludes": [ + "linux-vdso.so.1", + "libpthread.so.0", + "libdl.so.2", + "librt.so.1", + "libstdc++.so.6", + "libm.so.6", + "libgcc_s.so.1", + "libc.so.6", + "ld-linux-x86-64.so.2", + "libz.so.1", + "libgcc_s.so.1", + "libglib-2.0", + "librt.so.1", + "libcap.so.2", + "libGL.so.1", + "libglapi.so.0", + "libXext.so.6", + "libXdamage.so.1", + "libXfixes.so.3", + "libX11-xcb.so.1", + "libX11.so.6", + "libxcb-glx.so.0", + "libxcb-dri2.so.0", + "libxcb.so.1", + "libXxf86vm.so.1", + "libdrm.so.2", + "libexpat.so.1", + "libXau.so.6" ] } From 9443ba78789720a021b78c5d7fd2bf17fa93556e Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Fri, 22 Jul 2016 18:53:34 +0200 Subject: [PATCH 022/101] Remove obsolete files --- cura | 3 --- cura.desktop | 15 ----------- qpyqmlobject.cpp.patch | 13 --------- qpyqmlobject.h.patch | 2 -- ubuntu-15.04-build-script.sh | 51 ------------------------------------ 5 files changed, 84 deletions(-) delete mode 100755 cura delete mode 100755 cura.desktop delete mode 100644 qpyqmlobject.cpp.patch delete mode 100644 qpyqmlobject.h.patch delete mode 100755 ubuntu-15.04-build-script.sh diff --git a/cura b/cura deleted file mode 100755 index e0bc96ca..00000000 --- a/cura +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -LD_LIBRARY_PATH=/opt/cura/lib PYTHONPATH=/opt/cura/lib/python3/dist-packages QT_PLUGIN_PATH=/opt/cura/lib/plugins QML2_IMPORT_PATH=/opt/cura/lib/qml QT_QPA_FONTDIR=/opt/cura/lib/fonts python3.4 /opt/cura/bin/cura "$@" diff --git a/cura.desktop b/cura.desktop deleted file mode 100755 index e093f84c..00000000 --- a/cura.desktop +++ /dev/null @@ -1,15 +0,0 @@ -[Desktop Entry] -Version=1 -Name=Cura -Name[de]=Cura -GenericName=3D Printing Software -GenericName[de]=3D-Druck-Software -Comment=Cura converts 3D models into paths for a 3D printer. It prepares your print for maximum accuracy, minimum printing time and good reliability with many extra features that make your print come out great. -Exec=/usr/bin/cura %F -TryExec=/usr/bin/cura -Icon=/opt/cura/share/cura/resources/images/cura-icon.png -Terminal=false -Type=Application -MimeType=application/sla;application/vnd.ms-3mfdocument;application/prs.wavefront-obj;image/bmp;image/gif;image/jpeg;image/png -Categories=Graphics; -Keywords=3D;Printing; diff --git a/qpyqmlobject.cpp.patch b/qpyqmlobject.cpp.patch deleted file mode 100644 index 6c14edd2..00000000 --- a/qpyqmlobject.cpp.patch +++ /dev/null @@ -1,13 +0,0 @@ -70,81d69 -< // Called when QML has disconnected to a signal of the proxied object. -< void QPyQmlObjectProxy::disconnectNotify(const QMetaMethod &sig) -< { -< QByteArray signal_sig = signalSignature(sig); -< -< // The signal has actually been disconnected from the proxy, so do the same -< // from the proxied object to the proxy. -< QObject::disconnect(proxied, signal_sig.constData(), this, -< signal_sig.constData()); -< } -< -< diff --git a/qpyqmlobject.h.patch b/qpyqmlobject.h.patch deleted file mode 100644 index 26ec924e..00000000 --- a/qpyqmlobject.h.patch +++ /dev/null @@ -1,2 +0,0 @@ -127d126 -< void disconnectNotify(const QMetaMethod &signal); diff --git a/ubuntu-15.04-build-script.sh b/ubuntu-15.04-build-script.sh deleted file mode 100755 index 260fde09..00000000 --- a/ubuntu-15.04-build-script.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# This is a script which get the latest git repo and build them. -# -# Tested under ubuntu 15.04, lower versions don't have PyQT 5.2.1 which is required by cura - -cd ~ -mkdir -p dev && cd dev - -sudo apt-get install -y git cmake cmake-gui autoconf libtool python3-setuptools curl python3-pyqt5.* python3-numpy qml-module-qtquick-controls -git clone https://github.com/Ultimaker/Cura.git -git clone https://github.com/Ultimaker/Uranium.git -git clone https://github.com/Ultimaker/CuraEngine.git -git clone https://github.com/Ultimaker/libArcus -git clone https://github.com/Ultimaker/protobuf.git - -cd protobuf -./autogen.sh -./configure -make -j4 -sudo make install -sudo ldconfig -cd python -python3 setup.py build -sudo python3 setup.py install -cd ../.. - -cd libArcus -mkdir build && cd build -cmake .. -DPYTHON_SITE_PACKAGES_DIR=/usr/lib/python3.4/dist-packages -make -j4 -sudo make install -cd ../../ - -cd CuraEngine -mkdir build && cd build -cmake .. -make -j4 -cd ../../ - -cd Uranium -mkdir build && cd build -cmake .. -DPYTHON_SITE_PACKAGES_DIR=/usr/lib/python3.4/dist-packages -DURANIUM_PLUGINS_DIR=/usr/lib/python3.4/dist-packages -sudo make install -cd ../.. - -ln -s $PWD/Uranium/resources/* Cura/resources/. -ln -s $PWD/Uranium/plugins/* Cura/plugins/. -mkdir bin -ln -s $PWD/CuraEngine/build/CuraEngine bin/CuraEngine -cd Cura -python3 cura_app.py From 798ace4c2c8c4f722f0958bf5fa5db5035488762 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Fri, 22 Jul 2016 18:54:12 +0200 Subject: [PATCH 023/101] Implement a simple version of FindAppImageKit.cmake Since we do not really need the complicated macro --- cmake/FindAppImageKit.cmake | 154 +----------------------------------- 1 file changed, 4 insertions(+), 150 deletions(-) diff --git a/cmake/FindAppImageKit.cmake b/cmake/FindAppImageKit.cmake index d8340f99..eedbf51d 100644 --- a/cmake/FindAppImageKit.cmake +++ b/cmake/FindAppImageKit.cmake @@ -1,154 +1,8 @@ -# set ( APPIMAGE_CONFIG_DIR "${CMAKE_SOURCE_DIR}" ) # Specifies where to find template files, in this case this same directory -# -# set ( APPIMAGE_ASSISTANT_PROGRAM CACHE FILEPATH "AppImageAssistant executable" ) -# set ( APPIMAGE_APPRUN_PROGRAM CACHE FILEPATH "AppImage AppRun executable" ) -# -# set ( APPIMAGE_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/deploy/linux-appimage" CACHE PATH "Where to put the AppDir items" ) -# set ( APPIMAGE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/package/linux-appimage" CACHE PATH "AppImage output directory" ) -# set ( APPIMAGE_FOLLOW_STANDARD OFF CACHE BOOL "Whether generator should follow the spec" ) -# -# set ( APPIMAGE_DEFAULT_ICON_FILE "${CMAKE_SOURCE_DIR}/icon.svg" CACHE FILEPATH "Default icon for AppImages" ) - -find_program(APPIMAGEKIT_ASSISTANT AppImageAssistant) - -# find_program(APPIMAGEKIT_APPRUN) +find_program(APPIMAGEKIT_ASSISTANT_EXECUTABLE AppImageAssistant) +find_program(APPIMAGEKIT_APPRUN_EXECUTABLE AppRun) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(AppImageKit REQUIRED_VARS APPIMAGEKIT_ASSISTANT VERSION_VAR ) - -mark_as_advanced(APPIMAKEKIT_ASSISTANT APPIMAGEKIT_APPRUN) +find_package_handle_standard_args(AppImageKit REQUIRED_VARS APPIMAGEKIT_ASSISTANT_EXECUTABLE APPIMAGEKIT_APPRUN_EXECUTABLE) -# macro( APPIMAGE_PACKAGE TARGET APPIMAGE_TITLE DATA LIBRARIES LIBRARY_FILES ) -# string ( TOLOWER "${APPIMAGE_TITLE}" APPIMAGE_INTERNALNAME ) -# string ( MAKE_C_IDENTIFIER "${APPIMAGE_INTERNALNAME}" APPIMAGE_INTERNALNAME ) -# -# # Some prerequisites -# # TITLE here is used as the name of the final AppImage as well as the desktop entry's name -# set ( APPIMAGE_TITLE "${APPIMAGE_TITLE}" ) -# set ( APPIMAGE_INTERNALNAME "${APPIMAGE_INTERNALNAME}" ) -# set ( APPIMAGE_LIBRARIES ) -# set ( APPIMAGE_DATA ) -# -# # Icon file to be used for the AppImage, only one in this case, preferrably SVG -# set ( APPIMAGE_ICON "${APPIMAGE_DEFAULT_ICON_FILE}" ) -# # We define a way to reference this icon based on where it is located -# set ( APPIMAGE_ICON_REF "${APPIMAGE_INTERNALNAME}.svg" ) -# -# # This helps the window manager to recognize the program even if it has no embedded or loaded icon -# set ( APPIMAGE_EXEC_WM ${TARGET} ) -# -# # Sets the launch variable in .desktop entry -# set ( APPIMAGE_EXEC ${TARGET} ) -# -# # This directory is used for temporary files, might get messy -# set ( APPIMAGE_CACHE_DIR "${APPIMAGE_WORKING_DIRECTORY}/${APPIMAGE_INTERNALNAME}_cache" ) -# # Where the AppDir is generated -# set ( APPIMAGE_INTERMEDIATE_DIR "${APPIMAGE_WORKING_DIRECTORY}/${APPIMAGE_INTERNALNAME}" ) -# set ( APPIMAGE_ICON_TARGET "${APPIMAGE_INTERMEDIATE_DIR}/${APPIMAGE_ICON_REF}" ) -# set ( APPIMAGE_BINARY_DIR "${APPIMAGE_INTERMEDIATE_DIR}/usr/bin" ) -# set ( APPIMAGE_ASSET_DIR "${APPIMAGE_INTERMEDIATE_DIR}/usr/share" ) -# set ( APPIMAGE_LIBRARY_DIR "${APPIMAGE_INTERMEDIATE_DIR}/usr/lib" ) -# set ( APPIMAGE_FINAL_NAME "${APPIMAGE_OUTPUT_DIRECTORY}/${APPIMAGE_TITLE}.AppImage" ) -# -# list ( APPEND APPIMAGE_LIBRARIES -# ${LIBRARIES} ) -# list ( APPEND APPIMAGE_DATA -# ${DATA} ) -# -# # Remove the previous AppImage file to avoid confusion when generating a new one -# add_custom_command ( TARGET ${TARGET} -# PRE_BUILD -# COMMAND ${CMAKE_COMMAND} -E remove "${APPIMAGE_FINAL_NAME}" -# ) -# -# # Create some necessary directory structure in AppDir -# add_custom_command ( TARGET ${TARGET} -# PRE_BUILD -# COMMAND ${CMAKE_COMMAND} -E make_directory "${APPIMAGE_OUTPUT_DIRECTORY}" -# ) -# add_custom_command ( TARGET ${TARGET} -# PRE_BUILD -# COMMAND ${CMAKE_COMMAND} -E make_directory "${APPIMAGE_BINARY_DIR}" -# ) -# add_custom_command ( TARGET ${TARGET} -# PRE_BUILD -# COMMAND ${CMAKE_COMMAND} -E make_directory "${APPIMAGE_CACHE_DIR}" -# ) -# add_custom_command ( TARGET ${TARGET} -# PRE_BUILD -# COMMAND ${CMAKE_COMMAND} -E make_directory "${APPIMAGE_LIBRARY_DIR}" -# ) -# add_custom_command ( TARGET ${TARGET} -# PRE_BUILD -# COMMAND ${CMAKE_COMMAND} -E make_directory "${APPIMAGE_ASSET_DIR}" -# ) -# -# # Copy and configure some data for the AppDir -# configure_file ( -# "${APPIMAGE_ICON}" -# "${APPIMAGE_ICON_TARGET}" -# COPYONLY -# ) -# configure_file ( -# "${APPIMAGE_ICON}" -# "${APPIMAGE_INTERMEDIATE_DIR}/.DirIcon" -# COPYONLY -# ) -# configure_file ( -# "${APPIMAGE_CONFIG_DIR}/application.desktop.in" -# "${APPIMAGE_INTERMEDIATE_DIR}/${APPIMAGE_INTERNALNAME}.desktop" -# @ONLY -# ) -# configure_file ( -# "${APPIMAGE_APPRUN_PROGRAM}" -# "${APPIMAGE_INTERMEDIATE_DIR}/AppRun" -# COPYONLY -# ) -# -# # Copy resources into AppDir -# foreach ( RESC ${DATA} ) -# add_custom_command ( TARGET ${TARGET} -# PRE_BUILD -# COMMAND ${CMAKE_COMMAND} -E copy_directory "${RESC}" "${APPIMAGE_ASSET_DIR}" -# ) -# endforeach() -# -# # Copy bundled libraries into AppDir -# foreach ( LIB ${LIBRARY_FILES} ) -# add_custom_command ( TARGET ${TARGET} -# PRE_BUILD -# COMMAND ${CMAKE_COMMAND} -E copy "${LIB}" "${APPIMAGE_LIBRARY_DIR}" -# ) -# endforeach() -# -# foreach ( LIB ${LIBRARIES} ) -# add_custom_command ( TARGET ${TARGET} -# PRE_BUILD -# COMMAND ${CMAKE_COMMAND} -E copy "$" "${APPIMAGE_LIBRARY_DIR}" -# ) -# endforeach() -# -# # Copy the binary to AppDir -# add_custom_command ( TARGET ${TARGET} -# POST_BUILD -# COMMAND ${CMAKE_COMMAND} -E copy "$" "${APPIMAGE_BINARY_DIR}" -# ) -# -# # Do the actual packaging step with AppImageKit -# add_custom_command ( TARGET ${TARGET} -# POST_BUILD -# COMMAND "${APPIMAGE_ASSISTANT_PROGRAM}" "${APPIMAGE_INTERMEDIATE_DIR}" "${APPIMAGE_FINAL_NAME}" -# ) -# -# install ( -# FILES -# "${APPIMAGE_FINAL_NAME}" -# -# DESTINATION -# "${CMAKE_PACKAGED_OUTPUT_PREFIX}/linux-appimage" -# -# PERMISSIONS -# OWNER_READ OWNER_WRITE OWNER_EXECUTE -# ) -# endmacro() +mark_as_advanced(APPIMAKEKIT_ASSISTANT_EXECUTABLE APPIMAGEKIT_APPRUN_EXECUTABLE) From 55c818f39507ccde6d5539a404e2c8c626e69f78 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Fri, 22 Jul 2016 18:54:46 +0200 Subject: [PATCH 024/101] Properly setup Linux packaging to generate a correct AppImage --- packaging/cura-icon.png | Bin 0 -> 2710 bytes packaging/cura.desktop | 14 +++++++++ packaging/cura.sh | 3 ++ packaging/linux.cmake | 56 +++++++++++++++++++++++++----------- packaging/setup_linux.py.in | 2 +- 5 files changed, 58 insertions(+), 17 deletions(-) create mode 100644 packaging/cura-icon.png create mode 100755 packaging/cura.desktop create mode 100755 packaging/cura.sh diff --git a/packaging/cura-icon.png b/packaging/cura-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..8fd6f4169100dfed65c69ab9a36e2ad9e911a33d GIT binary patch literal 2710 zcmV;H3TgF;P)aB^>EX>4U6ba`-PAVE-2F#rH~oK?uN4S+BV0Kwinzix*IVP;kNWm4kT>&J|M^&EkL*}eUsxAk~Vz* zFjjzYTlywPdiKiq86yPBAQ26p`8@?X23J^(l+#sa1SH4EH z32;LAcFfm^76Cp8Ul7$%zvV+pEN?@^j1AvBd>0^+OkHckHy2+8h$K_j3T*f$M5>b_#!|g z(cUbCu;G^h$_0qFbzU`vyTmb<`Xl>WdgE{u~<@MBmt_4IB>BUHIs}N>& z`%^*z=1mMTzrKo3O$;(4;?fuiP#bgz=*#=Gd}DV{c?u9sq!)v?O$cgLHRxPuiUeq$ z7UG8KVJ@k!qM=&*dY4g=_oTMEixwc7NH0csTLt>VUpS?j<+GzSPYW?2SRSF9LQw)l z+d38@y{!T!sBX|$STr@niVI^bnrios6w8q^z2 z6PX!x*|u;JGovX};? z)KUGo;*`rPluRv@k{v<_E#U*)eo-ygPq&jhrQrX1fKW2EFaXc$y7B=oX{h3^PZ;%H zsiOHnfY6rq1pz5{=nOyT2p*hQM^NMI+3|)0!{G~_6+%qZ*_c~rMVVi3pY=jy*ktbYu%08T?QHoqvKstqVeg)(ZfD=4l~j z#r&D@Ih6Bwd~YAW+MneeP0OxK#)xUQTh8<6>QB6zWz9d2lFAl*DZdiXEysIO8}{qAmi^%sja0YU*mjiQa5|LwJN{KcY8fGP)~3T6QF5)Sm+ zx&C6&CV(phRSK4V_2)gZcKk0IZ2~w#%{%yl9QtP|4s8N>5+$>C0fBKxzLXQ%1jtLt zaRn=3!mdNu8c;Oa1Q_%nqoD701xyZ=ZY^P@p-q5XLDH*eG2{hy=Wx+z>;WV_gK7l$ zwB1WkG+L*EI~6^@UopAb?j|Y{tpe;-G=q0Rjm!LcyOX#Wv@hM$pjCi;#jC0Yf@79@KVF5_C-80NOw zb|@GN+Lwj@@x1}1>p@87Y%NtnIXg`pAG-wy#-AtaB z59O4W8FK|sUEaW|IkomZ!3by<03fkHtGvvBfR%G<`NQHVw9JeUQMmoAk}%@A>9?H& zr27lL91wAFU698=ThG3}JiqH4;Q0ds{O4Gn_xcN3_vM>{h$d6N7I35PhOC@Z%c?o0 zIf}S1FF80+;Bd~PH}5H%iztSG5Ip=wFV7uNdow&5By=0m0{}e!b{}6mKUR`s;A5^J z7IT?x$VXf~)2@C994$uN0|0d8JT|}CtGgLmC`f%>kTC)PJoa{I@=mw1BTuNp3I)^L6$t<#m<9j-x`inR`<2U?|c7?vJe2EJzL=Borl=;Mz7Yn z`*KFYeJ6$wWh4MV&Xe5x+EJGLsf$6-nxE@p#Vb9$ zWv7luL`t#dbm2pp3IIb}%bwVqVZrYY@Xg&lwnsPvQi?U1)~0*U^#8`Z4lb5VUh<25 z8J>J6!)24I`BFU0qNyRfM*xtBwPy<-DnNkuDafIr;l-{T;ecRnU69KrRdZ=W6(6s0 ziAP#0R08YuET@u8h)QpLEE_p|s89h;X3&##_7{}xMm8BK<+@Bu{GQSN zeA(UvT24huxh~T>;|F8;9V1*ixl++R%iUUN2p_BfWru|Inb!D9RpnU$$_NSTGcEDERF-K4 zC=>h$AM8^=Ss(=uWR|H9A8Zd`Jj3DN=~wwy0E3ZIZ16LDumTv1lww1swdoGO>#+hD zh(v5GMfhL^Fb;{>m}zPHeyQrSPXPwu3GrZdS?R(D+XEQGaQL^Ex?U@Q0eDhw(h)vb z0kq>uxhdN^<9oX5w*qLygNJm65B4Td8=m0d?6UZGb+^Oz02&w$|2w+d0ak#L<4GPd zC48^~loU_$NVYZpZQboS5i3B6@L;oP;e!>RBzUkn+Y(=)yB(*)J_Y!UC-`Z0nVI2( z?E!pcIQ(zvZpYbh0Q=eNKHy35sOjMYxDs&`WVh~yR1#9~RJNtb`0xS#2Wr;}be&zM Q{r~^~07*qoM6N<$f}h&|E&u=k literal 0 HcmV?d00001 diff --git a/packaging/cura.desktop b/packaging/cura.desktop new file mode 100755 index 00000000..f7ca1ed3 --- /dev/null +++ b/packaging/cura.desktop @@ -0,0 +1,14 @@ +[Desktop Entry] +Version=1 +Name=Cura +Name[de]=Cura +GenericName=3D Printing Software +GenericName[de]=3D-Druck-Software +Comment=Cura converts 3D models into paths for a 3D printer. It prepares your print for maximum accuracy, minimum printing time and good reliability with many extra features that make your print come out great. +Exec=cura.sh +Icon=cura-icon.png +Terminal=false +Type=Application +MimeType=application/sla;application/vnd.ms-3mfdocument;application/prs.wavefront-obj;image/bmp;image/gif;image/jpeg;image/png +Categories=Graphics; +Keywords=3D;Printing; diff --git a/packaging/cura.sh b/packaging/cura.sh new file mode 100755 index 00000000..77bebae8 --- /dev/null +++ b/packaging/cura.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +cura diff --git a/packaging/linux.cmake b/packaging/linux.cmake index f8e1ed81..79cb08bb 100644 --- a/packaging/linux.cmake +++ b/packaging/linux.cmake @@ -1,25 +1,49 @@ find_package(cx_Freeze 5.0 REQUIRED) -# find_package(AppImageKit REQUIRED) +find_package(AppImageKit REQUIRED) configure_file(${CMAKE_CURRENT_LIST_DIR}/setup_linux.py.in setup.py @ONLY) add_custom_command( - TARGET packaging POST_BUILD + TARGET packaging PRE_BUILD COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/package + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMENT "Cleaning old package directory..." +) + +add_custom_command( + TARGET packaging PRE_BUILD COMMAND ${PYTHON_EXECUTABLE} setup.py build WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMENT "Running cx_Freeze to generate executable..." +) + +set(PACKAGE_DIR ${CMAKE_BINARY_DIR}/package) + +add_custom_command( + TARGET packaging PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy cura.desktop cura-icon.png ${PACKAGE_DIR} + COMMENT "Copying icon and desktop file..." + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} +) + +add_custom_command( + TARGET packaging PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy cura.sh ${PACKAGE_DIR}/usr/bin/ + COMMENT "Copying shell script..." + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} +) + +add_custom_command( + TARGET packaging PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${APPIMAGEKIT_APPRUN_EXECUTABLE} ${PACKAGE_DIR} + COMMENT "Copying AppRun executable..." +) + +set(APPIMAGE_FILENAME "Cura-${CURA_VERSION}.AppImage") + +add_custom_command( + TARGET packaging POST_BUILD + COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/${APPIMAGE_FILENAME} + COMMAND ${APPIMAGEKIT_ASSISTANT_EXECUTABLE} ${CMAKE_BINARY_DIR}/package ${APPIMAGE_FILENAME} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) -# -# add_custom_command( -# TARGET packaging POST_BUILD -# COMMAND ${PYTHON_EXECUTABLE} setup_osx.py py2app -# COMMENT "Running py2app" -# WORKING_DIRECTORY ${CMAKE_BINARY_DIR} -# ) -# -# install(DIRECTORY ${CMAKE_BINARY_DIR}/dist/Cura.app DESTINATION "." USE_SOURCE_PERMISSIONS) -# -# set(CPACK_GENERATOR "DragNDrop") - -# -# diff --git a/packaging/setup_linux.py.in b/packaging/setup_linux.py.in index cddefb89..f3e6acb1 100644 --- a/packaging/setup_linux.py.in +++ b/packaging/setup_linux.py.in @@ -26,7 +26,7 @@ search_path.insert(2, "@CMAKE_INSTALL_PREFIX@/lib/python3/dist-packages/") # Dependencies are automatically detected, but it might need # fine tuning. build_options = { - "build_exe": "package/", + "build_exe": "package/usr/bin", "path": search_path, "packages": [ "xml.etree", From b4f6f3ef3b5135437fe191c7cbf3adc935bb5801 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Fri, 22 Jul 2016 18:55:12 +0200 Subject: [PATCH 025/101] Add GPG signing and SHA-1 sum generation for Linux --- cmake/FindGPG.cmake | 7 +++++++ cmake/FindSHA1Sum.cmake | 7 +++++++ signing/linux.cmake | 21 +++++++++++++++------ 3 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 cmake/FindGPG.cmake create mode 100644 cmake/FindSHA1Sum.cmake diff --git a/cmake/FindGPG.cmake b/cmake/FindGPG.cmake new file mode 100644 index 00000000..e6244117 --- /dev/null +++ b/cmake/FindGPG.cmake @@ -0,0 +1,7 @@ + +find_program(GPG_EXECUTABLE gpg) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GPG REQUIRED_VARS GPG_EXECUTABLE) + +mark_as_advanced(GPG_EXECUTABLE) diff --git a/cmake/FindSHA1Sum.cmake b/cmake/FindSHA1Sum.cmake new file mode 100644 index 00000000..d4706768 --- /dev/null +++ b/cmake/FindSHA1Sum.cmake @@ -0,0 +1,7 @@ + +find_program(SHA1SUM_EXECUTABLE sha1sum) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(SHA1Sum REQUIRED_VARS SHA1SUM_EXECUTABLE) + +mark_as_advanced(SHA1SUM_EXECUTABLE) diff --git a/signing/linux.cmake b/signing/linux.cmake index 9c81a072..5c3e5aa2 100644 --- a/signing/linux.cmake +++ b/signing/linux.cmake @@ -1,9 +1,18 @@ +find_package(GPG REQUIRED) +find_package(SHA1Sum REQUIRED) -# add_custom_command( -# TARGET signing POST_BUILD -# COMMAND ${PYTHON_EXECUTABLE} setup.py build -# WORKING_DIRECTORY ${CMAKE_BINARY_DIR} -# VERBATIM -# ) +set(PACKAGE_FILE "Cura-${CURA_VERSION}.AppImage") +add_custom_command( + TARGET signing PRE_BUILD + COMMAND ${GPG_EXECUTABLE} --yes --armor --detach-sig ${PACKAGE_FILE} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMENT "Generating signature..." +) +add_custom_command( + TARGET signing PRE_BUILD + COMMAND ${SHA1SUM_EXECUTABLE} ${PACKAGE_FILE} > ${PACKAGE_FILE}.sha1.txt + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMENT "Generating SHA-1 sum..." +) From a049be6559eff517c240cfe25cd16fdbceffd37d Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 25 Jul 2016 08:50:54 +0200 Subject: [PATCH 026/101] Initialize BUILD_* to OFF --- cmake/BuildPlatformDetection.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/BuildPlatformDetection.cmake b/cmake/BuildPlatformDetection.cmake index 1acf4ef3..b74366f0 100644 --- a/cmake/BuildPlatformDetection.cmake +++ b/cmake/BuildPlatformDetection.cmake @@ -1,3 +1,8 @@ +set(BUILD_OS_OSX OFF) +set(BUILD_OS_LINUX OFF) +set(BUILD_OS_WINDOWS OFF) +set(BUILD_OS_WIN32 OFF) +set(BUILD_OS_WIN64 OFF) if(APPLE) set(BUILD_OS_OSX ON) From acf2c6efdaa35f26135f18af328d14b6303d1ed3 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 26 Jul 2016 18:52:02 +0200 Subject: [PATCH 027/101] Use the right variable name to check if Python was found --- cmake/FindPythonPackage.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/FindPythonPackage.cmake b/cmake/FindPythonPackage.cmake index ca705ad0..0613b4a5 100644 --- a/cmake/FindPythonPackage.cmake +++ b/cmake/FindPythonPackage.cmake @@ -23,7 +23,7 @@ function(FindPythonPackage) set(_VERSION_PROPERTY "__version__") endif() - if(NOT PythonInterp_FOUND) + if(NOT PYTHONINTERP_FOUND) if(_REQUIRED) message(FATAL_ERROR "Could not find Python interpreter for required dependency ${_MODULE_NAME}") else() @@ -32,7 +32,7 @@ function(FindPythonPackage) endif() endif() - if(PythonInterp_FOUND) + if(PYTHONINTERP_FOUND) execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import ${_MODULE_NAME}; print(${_MODULE_NAME}.__file__, ${_MODULE_NAME}.${_VERSION_PROPERTY})" RESULT_VARIABLE _process_status From 755b6ff6da5a64519ff843cd1c04029e828473ac Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 26 Jul 2016 18:52:33 +0200 Subject: [PATCH 028/101] Ensure we set CMAKE_PREFIX_PATH to the right path for OSX to find the right Python --- projects/Cura-Doodle3D.cmake | 2 +- projects/Cura-PostProcessing.cmake | 2 +- projects/Cura.cmake | 2 +- projects/Uranium.cmake | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/Cura-Doodle3D.cmake b/projects/Cura-Doodle3D.cmake index 95638b79..85290039 100644 --- a/projects/Cura-Doodle3D.cmake +++ b/projects/Cura-Doodle3D.cmake @@ -2,7 +2,7 @@ ExternalProject_Add(Cura-Doodle3D GIT_REPOSITORY https://github.com/Doodle3D/Doodle3D-cura-plugin GIT_TAG origin/master - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${CMAKE_INSTALL_PREFIX} ) SetProjectDependencies(TARGET Cura-Doodle3D DEPENDS Cura) diff --git a/projects/Cura-PostProcessing.cmake b/projects/Cura-PostProcessing.cmake index b0e208db..8c095841 100644 --- a/projects/Cura-PostProcessing.cmake +++ b/projects/Cura-PostProcessing.cmake @@ -2,7 +2,7 @@ ExternalProject_Add(Cura-PostProcessing GIT_REPOSITORY https://github.com/nallath/PostProcessingPlugin GIT_TAG origin/${TAG_OR_BRANCH} - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${CMAKE_INSTALL_PREFIX} ) SetProjectDependencies(TARGET Cura-PostProcessing DEPENDS Cura) diff --git a/projects/Cura.cmake b/projects/Cura.cmake index 3ee6b132..1e1e04d8 100644 --- a/projects/Cura.cmake +++ b/projects/Cura.cmake @@ -1,7 +1,7 @@ ExternalProject_Add(Cura GIT_REPOSITORY https://github.com/ultimaker/Cura GIT_TAG origin/${TAG_OR_BRANCH} - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DURANIUM_SCRIPTS_DIR= -DCURA_VERSION=${CURA_VERSION} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${CMAKE_INSTALL_PREFIX} -DURANIUM_SCRIPTS_DIR= -DCURA_VERSION=${CURA_VERSION} ) SetProjectDependencies(TARGET Cura DEPENDS Uranium CuraEngine) diff --git a/projects/Uranium.cmake b/projects/Uranium.cmake index edb6255e..0adf3699 100644 --- a/projects/Uranium.cmake +++ b/projects/Uranium.cmake @@ -6,7 +6,7 @@ find_package(SciPy 0.17 REQUIRED) ExternalProject_Add(Uranium GIT_REPOSITORY https://github.com/ultimaker/Uranium GIT_TAG origin/${TAG_OR_BRANCH} - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${CMAKE_INSTALL_PREFIX} ) SetProjectDependencies(TARGET Uranium) From 5e677b952e335898efd1f3fbb3a57b822bb5606b Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 26 Jul 2016 18:54:14 +0200 Subject: [PATCH 029/101] Implement packaging for OSX with cx_Freeze --- packaging/osx.cmake | 11 +-- packaging/setup_osx.py.in | 162 ++++++++++++-------------------------- 2 files changed, 55 insertions(+), 118 deletions(-) diff --git a/packaging/osx.cmake b/packaging/osx.cmake index 037e7a47..cb7d8b80 100644 --- a/packaging/osx.cmake +++ b/packaging/osx.cmake @@ -1,16 +1,11 @@ find_package(cx_freeze 5.0 REQUIRED) +file(WRITE ${CMAKE_BINARY_DIR}/qt.conf "# Required for Qt to work properly") configure_file(${CMAKE_CURRENT_LIST_DIR}/setup_osx.py.in setup.py @ONLY) add_custom_command( TARGET packaging POST_BUILD - COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/package - COMMAND ${PYTHON_EXECUTABLE} setup.py build + COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/build + COMMAND ${PYTHON_EXECUTABLE} setup.py bdist_dmg WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) - -install(DIRECTORY ${CMAKE_BINARY_DIR}/package/Cura.app DESTINATION "." USE_SOURCE_PERMISSIONS) - -set(CPACK_GENERATOR "DragNDrop") - -add_dependencies(signing package) diff --git a/packaging/setup_osx.py.in b/packaging/setup_osx.py.in index 174c577d..12aef660 100644 --- a/packaging/setup_osx.py.in +++ b/packaging/setup_osx.py.in @@ -1,125 +1,67 @@ -# Copyright (c) 2015 Ultimaker B.V. -# Uranium is released under the terms of the AGPLv3 or higher. -# -# This is a setup.py script generated by py2applet -# -# Usage: -# python setup.py py2app +import sys +import os.path -from setuptools import setup +from cx_Freeze import setup, Executable, hooks -import UM -import cura -import os -import glob -import shutil +def load_scipy(finder, module): + finder.IncludePackage("scipy._lib") + finder.IncludePackage("scipy.misc") + finder.IncludePackage("scipy.sparse.csgraph._validation") -PLIST = { - "CFBundleDocumentTypes": [ - { - "CFBundleTypeExtensions": [ - "*" - ], - "CFBundleTypeRole": "Viewer", - "CFBundleTypeName": "Model Files" - } - ] -} +hooks.load_scipy = load_scipy -OPTIONS = { - "argv_emulation": False, - "includes": [ - "sip", - "ctypes", - "UM", - "cura", - "PyQt5.QtNetwork", - "PyQt5._QOpenGLFunctions_2_0", - "serial", - "Arcus", - "xml.etree", - "xml.etree.ElementTree", - "zeroconf", +def load_pyqt5_qtquick(finder, module): + finder.IncludeModule("PyQt5.QtCore") + finder.IncludeModule("PyQt5.QtGui") + finder.IncludeModule("PyQt5.QtQml") + finder.IncludeModule("PyQt5.QtNetwork") + finder.IncludeModule("PyQt5._QOpenGLFunctions_2_0") + +hooks.load_PyQt5_QtQuick = load_pyqt5_qtquick + +search_path = sys.path.copy() +search_path.insert(1, "@EXTERNALPROJECT_INSTALL_PREFIX@/lib/python3.5/site-packages/") +search_path.insert(2, "@CMAKE_INSTALL_PREFIX@/lib/python3.5/site-packages/") + +# Dependencies are automatically detected, but it might need +# fine tuning. +build_options = { +# "build_exe": "package", + "path": search_path, + "packages": [ + "xml.etree", "uuid", + "UM", + "cura" ], - "resources": [ - "inst/lib/plugins", - "inst/lib/qml", - "inst/lib/cura", - "inst/lib/uranium", - "inst/share/cura", - "inst/share/uranium", - "inst/lib/python3.4/site-packages/UM/Qt/qml", + "include_files": [ + ("@EXTERNALPROJECT_INSTALL_PREFIX@/bin/CuraEngine", ""), + ("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/cura", "plugins"), + ("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/uranium", "plugins"), + ("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/python3.5/site-packages/UM/Qt/qml/UM", "qml/UM"), + ("@EXTERNALPROJECT_INSTALL_PREFIX@/share/cura/resources", "resources"), + ("@EXTERNALPROJECT_INSTALL_PREFIX@/share/uranium/resources", "resources"), + ("@CMAKE_INSTALL_PREFIX@/lib/qml/Qt", "qml/Qt"), + ("@CMAKE_INSTALL_PREFIX@/lib/qml/QtQml", "qml/QtQml"), + ("@CMAKE_INSTALL_PREFIX@/lib/qml/QtQuick", "qml/QtQuick"), + ("@CMAKE_INSTALL_PREFIX@/lib/qml/QtQuick.2", "qml/QtQuick.2"), + ("@CMAKE_BINARY_DIR@/qt.conf", ""), ], - "iconfile": "@CMAKE_SOURCE_DIR@/cura.icns", - "plist": PLIST + "excludes": [ ] } -# Extend options.includes to include all files from the UM package. -for dirpath, dirnames, filenames in os.walk(os.path.dirname(UM.__file__)): - if "__" in dirpath: - continue - module_path = dirpath.replace(os.path.dirname(UM.__file__), "UM") - module_path = module_path.split(os.path.sep) - module_name = ".".join(module_path) - if os.path.isfile(dirpath + "/__init__.py"): - OPTIONS["includes"] += [module_name] - for filename in filenames: - if "__" in filename or not filename.endswith(".py"): - continue - OPTIONS["includes"] += [module_name + "." + os.path.splitext(filename)[0]] - -for dirpath, dirnames, filenames in os.walk(os.path.dirname(cura.__file__)): - if "__" in dirpath: - continue - module_path = dirpath.replace(os.path.dirname(cura.__file__), "cura") - module_path = module_path.split(os.path.sep) - module_name = ".".join(module_path) - if os.path.isfile(dirpath + "/__init__.py"): - OPTIONS["includes"] += [module_name] - for filename in filenames: - if "__" in filename or not filename.endswith(".py"): - continue - OPTIONS["includes"] += [module_name + "." + os.path.splitext(filename)[0]] +executables = [ + Executable("@EXTERNALPROJECT_INSTALL_PREFIX@/bin/cura_app.py", targetName = "cura") +] setup( name="Cura", - app=["inst/bin/cura_app.py"], - version="@CURA_MAJOR_VERSION@.@CURA_MINOR_VERSION@.@CURA_PATCH_VERSION@", - author="Ultimaker", + version = "@CURA_VERSION_MAJOR@.@CURA_VERSION_MINOR@.@CURA_VERSION_PATCH@", + description = "3D Printing Software", + author = "Ultimaker B.V.", url="http://software.ultimaker.com/", license="GNU AFFERO GENERAL PUBLIC LICENSE (AGPL)", - options={"py2app": OPTIONS}, - setup_requires=['py2app'], + + options = {"build_exe": build_options}, + executables = executables ) - -# Copy the backend executable -print("Copying CuraEngine to Contents/MacOS") -shutil.copy("inst/bin/CuraEngine", "dist/Cura.app/Contents/MacOS/CuraEngine") - -# Remove all *_debug.x.dylib files since we do not need them but py2app copies -# them anyway. -for path, dirs, files in os.walk("dist/Cura.app/Contents"): - for file in files: - if "debug" in file: - print("Removing {0}".format(file)) - os.remove(os.path.join(path, file)) - -# Py2App does not handle @rpath properly and fails to find the required libraries. -# So we need to copy it manually. -shutil.copy("inst/lib/libQt5Core.5.dylib", "dist/Cura.app/Contents/Frameworks/libQt5Core.5.dylib") -shutil.copy("inst/lib/libQt5Gui.5.dylib", "dist/Cura.app/Contents/Frameworks/libQt5Gui.5.dylib") -shutil.copy("inst/lib/libQt5MacExtras.5.dylib", "dist/Cura.app/Contents/Frameworks/libQt5MacExtras.5.dylib") -shutil.copy("inst/lib/libQt5Network.5.dylib", "dist/Cura.app/Contents/Frameworks/libQt5Network.5.dylib") -shutil.copy("inst/lib/libQt5OpenGL.5.dylib", "dist/Cura.app/Contents/Frameworks/libQt5OpenGL.5.dylib") -shutil.copy("inst/lib/libQt5Qml.5.dylib", "dist/Cura.app/Contents/Frameworks/libQt5Qml.5.dylib") -shutil.copy("inst/lib/libQt5Quick.5.dylib", "dist/Cura.app/Contents/Frameworks/libQt5Quick.5.dylib") -shutil.copy("inst/lib/libQt5QuickWidgets.5.dylib", "dist/Cura.app/Contents/Frameworks/libQt5QuickWidgets.5.dylib") -shutil.copy("inst/lib/libQt5Svg.5.dylib", "dist/Cura.app/Contents/Frameworks/libQt5Svg.5.dylib") -shutil.copy("inst/lib/libQt5Widgets.5.dylib", "dist/Cura.app/Contents/Frameworks/libQt5Widgets.5.dylib") -shutil.copy("inst/lib/libQt5Xml.5.dylib", "dist/Cura.app/Contents/Frameworks/libQt5Xml.5.dylib") -shutil.copy("inst/lib/libQt5DBus.5.dylib", "dist/Cura.app/Contents/Frameworks/libQt5DBus.5.dylib") -shutil.copy("inst/lib/libQt5PrintSupport.5.dylib", "dist/Cura.app/Contents/Frameworks/libQt5PrintSupport.5.dylib") - -# Ensure we set the right @rpath value. -os.system("install_name_tool -add_rpath @executable_path/../Frameworks dist/Cura.app/Contents/MacOS/Cura") From a0a6e625ce39884c57052e01ba24e87bc9109486 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 28 Jul 2016 14:45:53 +0200 Subject: [PATCH 030/101] Move cura.icns to packaging/ --- cura.icns => packaging/cura.icns | Bin 1 file changed, 0 insertions(+), 0 deletions(-) rename cura.icns => packaging/cura.icns (100%) diff --git a/cura.icns b/packaging/cura.icns similarity index 100% rename from cura.icns rename to packaging/cura.icns From e4ddc7f25acdd5eb05d4c9984114bbf836175b0f Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 28 Jul 2016 14:46:14 +0200 Subject: [PATCH 031/101] Remove commented code --- CMakeLists.txt | 552 ------------------------------------------------- 1 file changed, 552 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cc403933..b7739e7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,555 +79,3 @@ if(SIGN_PACKAGE) message(STATUS "Do not know how to sign the executable for the current platform! You will need to perform signing manually.") endif() endif() - -# -# -# message(STATUS "Building Cura ${CURA_VERSION}") -# -# if(BUILD_OS_WIN32) -# # To deal with stupid setuptools not creating install directories -# file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/inst/lib/python3.4/site-packages) -# endif() -# -# if(BUILD_PYTHON) -# if(APPLE) -# # See http://bugs.python.org/issue21381 -# # The interpreter crashes when MACOSX_DEPLOYMENT_TARGET=10.7 due to the increased stack size. -# set(patch_command sed -i".bak" "8704,8704d" /configure) -# endif() -# -# ExternalProject_Add(Python -# URL https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tgz -# PATCH_COMMAND ${patch_command} -# CONFIGURE_COMMAND ./configure --prefix=${EXTERNALPROJECT_INSTALL_PREFIX} --enable-shared --with-threads --without-pymalloc -# BUILD_IN_SOURCE 1 -# ) -# -# set(PYTHON_EXECUTABLE ${EXTERNALPROJECT_INSTALL_PREFIX}/bin/python3) -# set(PYTHON_VERSION_MAJOR 3) -# set(PYTHON_VERSION_MINOR 4) -# else() -# find_package(PythonInterp 3.4.0 REQUIRED) -# add_custom_target(Python) -# endif() -# -# if(BUILD_QT) -# set(qt_url http://download.qt.io/official_releases/qt/5.5/5.5.1/single/qt-everywhere-opensource-src-5.5.1.tar.gz) -# set(qt_md5 59f0216819152b77536cf660b015d784) -# -# # Qt uses different sources for Windows -# if(BUILD_OS_WINDOWS) -# set(qt_url http://download.qt.io/official_releases/qt/5.5/5.5.1/single/qt-everywhere-opensource-src-5.5.1.zip) -# set(qt_md5 d071cdaa1b8f34fb49f6deac94039c2c) -# endif() -# -# set(qt_options -# -release -# -prefix ${EXTERNALPROJECT_INSTALL_PREFIX} -# -archdatadir ${EXTERNALPROJECT_INSTALL_PREFIX}/lib -# -datadir ${EXTERNALPROJECT_INSTALL_PREFIX}/share -# -opensource -# -confirm-license -# -nomake examples -# -nomake tests -# -nomake tools -# -no-cups -# -no-sql-db2 -# -no-sql-ibase -# -no-sql-mysql -# -no-sql-oci -# -no-sql-odbc -# -no-sql-psql -# -no-sql-sqlite -# -no-sql-sqlite2 -# -no-sql-tds -# -skip qtconnectivity -# -skip qtdoc -# -skip qtenginio -# -skip qtlocation -# -skip qtmultimedia -# -skip qtquick1 -# -skip qtscript -# -skip qtsensors -# -skip qtwebchannel -# -skip qtwebengine -# -skip qtwebkit -# -skip qtwebsockets -# -skip qtandroidextras -# -skip qtactiveqt -# -skip qttools -# -skip qtxmlpatterns -# -skip qt3d -# -skip qtcanvas3d -# -skip qtserialport -# -skip qtwayland -# -skip qtwebkit-examples -# ) -# -# if(BUILD_OS_OSX) -# list(APPEND qt_options -no-framework) -# elseif(BUILD_OS_WINDOWS) -# list(APPEND qt_options -opengl desktop) -# elseif(BUILD_OS_LINUX) -# list(APPEND qt_options -no-rpath -qt-xcb) -# endif() -# -# ExternalProject_Add(Qt -# URL ${qt_url} -# URL_MD5 ${qt_md5} -# CONFIGURE_COMMAND ./configure ${qt_options} -# BUILD_IN_SOURCE 1 -# ) -# else() -# add_custom_target(Qt) -# endif() -# -# if(BUILD_SIP) -# set(sip_command "") -# if(BUILD_OS_WINDOWS) -# set(sip_command -# ${PYTHON_EXECUTABLE} -# configure.py -# --platform win32-g++ -# --bindir=${EXTERNALPROJECT_INSTALL_PREFIX}/bin -# --destdir=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/python3.4/site-packages -# --incdir=${EXTERNALPROJECT_INSTALL_PREFIX}/include -# --sipdir=${EXTERNALPROJECT_INSTALL_PREFIX}/share/sip -# "CFLAGS+=${CMAKE_C_FLAGS}" -# "CXXFLAGS+=${CMAKE_CXX_FLAGS}" -# ) -# elseif(BUILD_OS_LINUX) -# set(sip_command -# ${PYTHON_EXECUTABLE} -# configure.py -# --bindir=${EXTERNALPROJECT_INSTALL_PREFIX}/bin -# --destdir=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/python3/dist-packages -# --incdir=${EXTERNALPROJECT_INSTALL_PREFIX}/include -# --sipdir=${EXTERNALPROJECT_INSTALL_PREFIX}/share/sip -# ) -# elseif(BUILD_OS_OSX) -# set(sip_command ${PYTHON_EXECUTABLE} configure.py --sysroot=${EXTERNALPROJECT_INSTALL_PREFIX}) -# endif() -# -# ExternalProject_Add(Sip -# DEPENDS Python -# URL http://downloads.sourceforge.net/project/pyqt/sip/sip-4.17/sip-4.17.zip -# CONFIGURE_COMMAND ${sip_command} -# BUILD_IN_SOURCE 1 -# ) -# else() -# add_custom_target(Sip) -# endif() -# -# if(BUILD_PYQT) -# set(pyqt_command "") -# if(BUILD_OS_WINDOWS) -# set(pyqt_command -# ${PYTHON_EXECUTABLE} configure.py -# --sip ${EXTERNALPROJECT_INSTALL_PREFIX}/bin/sip.exe -# --confirm-license -# --spec win32-g++ -# --destdir ${EXTERNALPROJECT_INSTALL_PREFIX}/lib/python3.4/site-packages -# --bindir ${EXTERNALPROJECT_INSTALL_PREFIX}/bin -# --sipdir ${EXTERNALPROJECT_INSTALL_PREFIX}/share/sip -# "CFLAGS+=${CMAKE_C_FLAGS}" -# "CXXFLAGS+=${CMAKE_CXX_FLAGS}" -# ) -# elseif(BUILD_OS_LINUX) -# set(pyqt_command -# ${PYTHON_EXECUTABLE} configure.py -# --sip ${EXTERNALPROJECT_INSTALL_PREFIX}/bin/sip -# --qmake ${EXTERNALPROJECT_INSTALL_PREFIX}/bin/qmake -# --confirm-license -# --destdir ${EXTERNALPROJECT_INSTALL_PREFIX}/lib/python3/dist-packages -# --bindir ${EXTERNALPROJECT_INSTALL_PREFIX}/bin -# --sipdir ${EXTERNALPROJECT_INSTALL_PREFIX}/share/sip -# ) -# elseif(BUILD_OS_OSX) -# set(pyqt_command -# ${PYTHON_EXECUTABLE} configure.py -# --sysroot ${EXTERNALPROJECT_INSTALL_PREFIX} -# --qmake ${EXTERNALPROJECT_INSTALL_PREFIX}/bin/qmake -# --sip ${EXTERNALPROJECT_INSTALL_PREFIX}/bin/sip -# --confirm-license -# ) -# endif() -# -# # This patches the PyQt 5.4.2 source code to remove the "disconnectNotify" method from QPyQmlObject. -# # This fixes a deadlock that could randomly occur when deleting QML items. -# # This workaround should be removed as soon as a new stable release of PyQt is available that includes the fix. -# set(pyqt_patch -# patch qpy/QtQml/qpyqmlobject.cpp ${CMAKE_SOURCE_DIR}/qpyqmlobject.cpp.patch && patch qpy/QtQml/qpyqmlobject.h ${CMAKE_SOURCE_DIR}/qpyqmlobject.h.patch -# ) -# -# ExternalProject_Add(PyQt -# DEPENDS Python Qt Sip -# URL http://downloads.sourceforge.net/project/pyqt/PyQt5/PyQt-5.4.2/PyQt-gpl-5.4.2.tar.gz -# PATCH_COMMAND ${pyqt_patch} -# CONFIGURE_COMMAND ${pyqt_command} -# BUILD_IN_SOURCE 1 -# ) -# else() -# add_custom_target(PyQt) -# endif() -# -# if(BUILD_OS_WINDOWS) -# # Because setuptools is stupid and will interpret "C:/..." as a relative path -# string(REPLACE "/" "\\" native_prefix ${EXTERNALPROJECT_INSTALL_PREFIX}) -# set(python_install -# --install-lib=${native_prefix}\\lib\\python3.4\\site-packages -# --install-data=${native_prefix}\\share -# --install-scripts=${native_prefix}\\bin -# ) -# elseif(BUILD_OS_LINUX) -# set(python_install -# --root=${EXTERNALPROJECT_INSTALL_PREFIX} -# --install-lib=lib/python3/dist-packages -# ) -# endif() -# -# if((BUILD_NUMPY OR BUILD_SCIPY) AND BUILD_OS_LINUX) -# # Fortran compiler is needed for OpenBLAS, but it does no check whether it is available. -# enable_language (Fortran) -# set(openblas_options DYNAMIC_ARCH=1 NO_STATIC=1) -# ExternalProject_Add(OpenBLAS -# URL https://github.com/xianyi/OpenBLAS/archive/v0.2.15.tar.gz -# CONFIGURE_COMMAND "" -# BUILD_COMMAND make ${openblas_options} -# INSTALL_COMMAND make PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} ${openblas_options} install -# BUILD_IN_SOURCE 1 -# ) -# else() -# add_custom_target(OpenBLAS) -# endif() -# -# if(BUILD_NUMPY) -# if(BUILD_OS_LINUX) -# # Inform numpy about using OpenBLAS -# set(build_numpy "OPENBLAS=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/libopenblas.so" ${PYTHON_EXECUTABLE} setup.py build) -# set(install_numpy "OPENBLAS=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/libopenblas.so" ${PYTHON_EXECUTABLE} setup.py install ${python_install}) -# else() -# set(build_numpy ${PYTHON_EXECUTABLE} setup.py build) -# set(install_numpy ${PYTHON_EXECUTABLE} setup.py install ${python_install}) -# endif() -# -# ExternalProject_Add(Numpy -# DEPENDS Python OpenBLAS -# URL http://downloads.sourceforge.net/project/numpy/NumPy/1.9.2/numpy-1.9.2.tar.gz -# URL_MD5 a1ed53432dbcd256398898d35bc8e645 -# CONFIGURE_COMMAND "" -# BUILD_COMMAND ${build_numpy} -# INSTALL_COMMAND ${install_numpy} -# BUILD_IN_SOURCE 1 -# ) -# endif() -# -# if(BUILD_SCIPY) -# if(BUILD_OS_LINUX) -# # Inform scipy about using OpenBLAS -# set(build_scipy "OPENBLAS=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/libopenblas.so" "PYTHONPATH=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/python3/dist-packages/" "LD_LIBRARY_PATH=${EXTERNALPROJECT_INSTALL_PREFIX}/lib" ${PYTHON_EXECUTABLE} setup.py build) -# set(install_scipy "OPENBLAS=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/libopenblas.so" "PYTHONPATH=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/python3/dist-packages/" "LD_LIBRARY_PATH=${EXTERNALPROJECT_INSTALL_PREFIX}/lib" ${PYTHON_EXECUTABLE} setup.py install ${python_install}) -# else() -# set(build_scipy ${PYTHON_EXECUTABLE} setup.py build) -# set(install_scipy ${PYTHON_EXECUTABLE} setup.py install ${python_install}) -# endif() -# -# ExternalProject_Add(Scipy -# DEPENDS Python Numpy -# URL http://downloads.sourceforge.net/project/scipy/scipy/0.16.1/scipy-0.16.1.tar.gz -# CONFIGURE_COMMAND "" -# BUILD_COMMAND ${build_scipy} -# INSTALL_COMMAND ${install_scipy} -# BUILD_IN_SOURCE 1 -# ) -# endif() -# -# if(BUILD_PYSERIAL) -# ExternalProject_Add(PySerial -# DEPENDS Python -# URL https://pypi.python.org/packages/source/p/pyserial/pyserial-2.7.tar.gz -# URL_MD5 794506184df83ef2290de0d18803dd11 -# CONFIGURE_COMMAND "" -# BUILD_COMMAND ${PYTHON_EXECUTABLE} setup.py build -# INSTALL_COMMAND ${PYTHON_EXECUTABLE} setup.py install ${python_install} -# BUILD_IN_SOURCE 1 -# ) -# endif() -# -# if(BUILD_NUMPY_STL) -# ExternalProject_Add(NumpySTL -# DEPENDS Python -# URL https://github.com/WoLpH/numpy-stl/archive/v1.9.0.tar.gz -# URL_MD5 cda2531edecff4468a4bbe78c6a2833b -# CONFIGURE_COMMAND "" -# BUILD_COMMAND "PYTHONPATH=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/python3/dist-packages/" ${PYTHON_EXECUTABLE} setup.py build -# INSTALL_COMMAND "PYTHONPATH=${EXTERNALPROJECT_INSTALL_PREFIX}/lib/python3/dist-packages/" ${PYTHON_EXECUTABLE} setup.py install ${python_install} -# BUILD_IN_SOURCE 1 -# ) -# endif() -# -# if(BUILD_ZEROCONF) -# ExternalProject_Add(PythonNetifaces -# DEPENDS Python -# URL https://pypi.python.org/packages/18/fa/dd13d4910aea339c0bb87d2b3838d8fd923c11869b1f6e741dbd0ff3bc00/netifaces-0.10.4.tar.gz -# CONFIGURE_COMMAND "" -# BUILD_COMMAND ${PYTHON_EXECUTABLE} setup.py build -# INSTALL_COMMAND ${PYTHON_EXECUTABLE} setup.py install ${python_install} -# BUILD_IN_SOURCE 1 -# ) -# -# ExternalProject_Add(PythonZeroconf -# DEPENDS PythonNetifaces -# URL https://github.com/jstasiak/python-zeroconf/archive/0.17.5.tar.gz -# CONFIGURE_COMMAND "" -# BUILD_COMMAND ${PYTHON_EXECUTABLE} setup.py build -# INSTALL_COMMAND ${PYTHON_EXECUTABLE} setup.py install ${python_install} -# BUILD_IN_SOURCE 1 -# ) -# endif() -# -# if(BUILD_OS_OSX) -# set(protobuf_cxx_flags "-fPIC -std=c++11 -stdlib=libc++") -# else() -# set(protobuf_cxx_flags "-fPIC -std=c++11") -# endif() -# -# ExternalProject_Add(Protobuf -# URL https://github.com/google/protobuf/archive/v3.0.0-beta-2.tar.gz -# CONFIGURE_COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCMAKE_INSTALL_LIBDIR=lib -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_CXX_FLAGS=${protobuf_cxx_flags} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -G ${CMAKE_GENERATOR} ../Protobuf/cmake -# ) -# -# if(BUILD_OS_WIN64) -# # Due to problems building Python modules on Win64 we currently need to disable building Arcus. -# set(ARCUS_EXTRA_ARGS -DBUILD_PYTHON=OFF) -# endif() -# -# ExternalProject_Add(Arcus -# DEPENDS Python Protobuf Sip -# GIT_REPOSITORY https://github.com/ultimaker/libArcus -# GIT_TAG origin/${TAG_OR_BRANCH} -# CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DBUILD_EXAMPLES=OFF -DBUILD_STATIC=ON -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} ${ARCUS_EXTRA_ARGS} -# ) -# -# ExternalProject_Add(CuraEngine -# DEPENDS Arcus -# GIT_REPOSITORY https://github.com/ultimaker/CuraEngine -# GIT_TAG origin/${TAG_OR_BRANCH} -# CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCURA_ENGINE_VERSION=${CURA_VERSION} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -# ) -# -# ExternalProject_Add(Uranium -# DEPENDS PyQt Arcus -# GIT_REPOSITORY https://github.com/ultimaker/Uranium -# GIT_TAG origin/${TAG_OR_BRANCH} -# CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -# ) -# -# ExternalProject_Add(Cura -# DEPENDS Uranium CuraEngine -# GIT_REPOSITORY https://github.com/ultimaker/Cura -# GIT_TAG origin/${TAG_OR_BRANCH} -# CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DURANIUM_SCRIPTS_DIR= -DCURA_VERSION=${CURA_VERSION} -# ) -# -# ExternalProject_Add(Cura-PostProcessing -# DEPENDS Cura -# GIT_REPOSITORY https://github.com/nallath/PostProcessingPlugin -# GIT_TAG origin/master -# CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -# ) -# -# ExternalProject_Add(cura-binary-data -# DEPENDS Cura -# GIT_REPOSITORY https://github.com/ultimaker/cura-binary-data -# GIT_TAG origin/${TAG_OR_BRANCH} -# CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -# ) -# -# ExternalProject_Add(Cura-Doodle3D -# DEPENDS Cura -# GIT_REPOSITORY https://github.com/Doodle3D/Doodle3D-cura-plugin -# GIT_TAG origin/master -# CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -# ) -# -# foreach(repo ${EXTRA_REPOSITORIES}) -# separate_arguments(items UNIX_COMMAND "${repo}") -# list(GET items 0 name) -# list(GET items 1 repo) -# list(REMOVE_AT items 0 1) -# -# set(cmake "") -# foreach(item ${items}) -# list(APPEND cmake ${item}) -# endforeach() -# -# ExternalProject_Add(${name} -# GIT_REPOSITORY ${repo} -# GIT_TAG origin/master -# CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} ${cmake} -# ) -# endforeach() -# -# if(BUILD_OS_OSX) -# ExternalProject_Add(Py2App -# DEPENDS Python -# URL https://pypi.python.org/packages/source/p/py2app/py2app-0.9.tar.gz -# CONFIGURE_COMMAND "" -# BUILD_COMMAND ${PYTHON_EXECUTABLE} setup.py build -# INSTALL_COMMAND ${PYTHON_EXECUTABLE} setup.py install -# BUILD_IN_SOURCE 1 -# ) -# elseif(BUILD_OS_WINDOWS) -# # Currently, py2exe can not be built with MinGW since the code apparently uses -# # a lot of MSVC-isms. So instead, install py2exe in your Python installation and -# # use that. -# # ExternalProject_Add(Py2Exe -# # DEPENDS Python -# # URL https://pypi.python.org/packages/source/p/py2exe/py2exe-0.9.2.0.zip -# # CONFIGURE_COMMAND "" -# # BUILD_COMMAND ${PYTHON_EXECUTABLE} setup.py build -# # INSTALL_COMMAND ${PYTHON_EXECUTABLE} setup.py install ${python_install} -# # BUILD_IN_SOURCE 1 -# # ) -# endif() -# -# if(BUILD_OS_OSX) -# configure_file(setup_osx.py.in setup_osx.py @ONLY) -# -# add_custom_target(build_app ALL) -# add_dependencies(build_app cura-binary-data) -# -# foreach(repo ${EXTRA_REPOSITORIES}) -# separate_arguments(items UNIX_COMMAND "${repo}") -# list(GET items 0 name) -# add_dependencies(build_app ${name}) -# endforeach() -# -# add_custom_command( -# TARGET build_app PRE_LINK -# COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/dist -# COMMENT "Cleaning old dist/ directory" -# WORKING_DIRECTORY ${CMAKE_BINARY_DIR} -# ) -# add_custom_command( -# TARGET build_app POST_BUILD -# COMMAND ${PYTHON_EXECUTABLE} setup_osx.py py2app -# COMMENT "Running py2app" -# WORKING_DIRECTORY ${CMAKE_BINARY_DIR} -# ) -# -# install(DIRECTORY ${CMAKE_BINARY_DIR}/dist/Cura.app DESTINATION "." USE_SOURCE_PERMISSIONS) -# -# set(CPACK_GENERATOR "DragNDrop") -# elseif(BUILD_OS_WINDOWS) -# get_filename_component(compiler_dir ${CMAKE_CXX_COMPILER} DIRECTORY) -# configure_file(setup_win32.py.in setup_win32.py @ONLY) -# -# add_custom_target(build_exe ALL) -# add_dependencies(build_exe cura-binary-data) -# -# foreach(repo ${EXTRA_REPOSITORIES}) -# separate_arguments(items UNIX_COMMAND "${repo}") -# list(GET items 0 name) -# add_dependencies(build_exe ${name}) -# endforeach() -# -# add_custom_command( -# TARGET build_exe PRE_LINK -# COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/dist -# COMMENT "Cleaning old dist/ directory" -# WORKING_DIRECTORY ${CMAKE_BINARY_DIR} -# ) -# add_custom_command( -# TARGET build_exe POST_BUILD -# COMMAND ${PYTHON_EXECUTABLE} setup_win32.py py2exe -# COMMENT "Running py2exe" -# WORKING_DIRECTORY ${CMAKE_BINARY_DIR} -# ) -# -# install(DIRECTORY ${CMAKE_BINARY_DIR}/dist/ DESTINATION "." USE_SOURCE_PERMISSIONS COMPONENT "cura") -# -# if(BUILD_OS_WIN32) -# install(FILES ${EXTERNALPROJECT_INSTALL_PREFIX}/vcredist_x32.exe DESTINATION "." COMPONENT "vcredist") -# else() -# install(FILES ${EXTERNALPROJECT_INSTALL_PREFIX}/vcredist_x64.exe DESTINATION "." COMPONENT "vcredist") -# endif() -# -# install(DIRECTORY ${EXTERNALPROJECT_INSTALL_PREFIX}/arduino DESTINATION "." COMPONENT "arduino") -# -# include(CPackComponent) -# cpack_add_component(cura DISPLAY_NAME "Cura Executable and Data Files" REQUIRED) -# cpack_add_component(vcredist DISPLAY_NAME "Install Visual Studio 2010 Redistributable") -# cpack_add_component(arduino DISPLAY_NAME "Install Arduino Drivers") -# -# set(CPACK_GENERATOR "NSIS") -# elseif(BUILD_OS_LINUX) -# set(CPACK_GENERATOR "DEB") -# -# set(CPACK_INSTALL_CMAKE_PROJECTS "") -# -# set(CPACK_INSTALLED_DIRECTORIES -# "${CMAKE_BINARY_DIR}/inst/bin;/opt/cura/bin" -# "${CMAKE_BINARY_DIR}/inst/lib;/opt/cura/lib" -# "${CMAKE_BINARY_DIR}/inst/share;/opt/cura/share" -# ) -# -# set(package_dir "_CPack_Packages/Linux/${CPACK_GENERATOR}/Cura-${CURA_VERSION}-Linux/") -# set(CPACK_INSTALL_COMMANDS -# "${CMAKE_COMMAND} -E make_directory ${package_dir}/usr/bin" -# "${CMAKE_COMMAND} -E make_directory ${package_dir}/usr/share/applications" -# "${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/cura ${package_dir}/usr/bin/" -# "${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/cura.desktop ${package_dir}/usr/share/applications/" -# "${CMAKE_COMMAND} -E copy /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.20 ${package_dir}/opt/cura/lib/libstdc++.so.6" -# ) -# endif() -# -# set(CPACK_PACKAGE_NAME "Cura") -# set(CPACK_PACKAGE_VENDOR "Ultimaker") -# set(CPACK_PACKAGE_VERSION_MAJOR ${CURA_MAJOR_VERSION}) -# set(CPACK_PACKAGE_VERSION_MINOR ${CURA_MINOR_VERSION}) -# set(CPACK_PACKAGE_VERSION_PATCH ${CURA_PATCH_VERSION}) -# set(CPACK_PACKAGE_VERSION ${CURA_VERSION}) -# set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Cura 3D Printing Software") -# set(CPACK_PACKAGE_CONTACT "Arjen Hiemstra ") -# if(NOT BUILD_OS_OSX) -# set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE) -# endif() -# set(CPACK_PACKAGE_EXECUTABLES Cura "Cura ${CURA_MAJOR_VERSION}.${CURA_MINOR_VERSION}.${CURA_PATCH_VERSION}") -# set(CPACK_PACKAGE_INSTALL_DIRECTORY "Cura ${CURA_MAJOR_VERSION}.${CURA_MINOR_VERSION}") -# -# set(RPM_REQUIRES -# "python3 >= 3.4.0" -# "python3-qt5 >= 5.4.0" -# "python3-numpy >= 1.9.0" -# "qt5-qtquickcontrols >= 5.4.0" -# ) -# string(REPLACE ";" "," RPM_REQUIRES "${RPM_REQUIRES}") -# set(CPACK_RPM_PACKAGE_REQUIRES ${RPM_REQUIRES}) -# set(CPACK_RPM_PACKAGE_RELOCATABLE OFF) -# -# set(DEB_DEPENDS -# "python3 (>= 3.4.0)" -# "libgfortran3" -# ) -# string(REPLACE ";" "," DEB_DEPENDS "${DEB_DEPENDS}") -# set(CPACK_DEBIAN_PACKAGE_DEPENDS ${DEB_DEPENDS}) -# set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE amd64) -# # Set the right epoch so Debian knows this is a more recent version -# set(CPACK_DEBIAN_PACKAGE_VERSION "2:${CPACK_PACKAGE_VERSION}") -# -# set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) -# set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".") -# set(CPACK_NSIS_MUI_FINISHPAGE_RUN "Cura.exe") -# set(CPACK_NSIS_MENU_LINKS -# "https://ultimaker.com/en/support/software" "Cura Online Documentation" -# "https://github.com/ultimaker/cura" "Cura Development Resources" -# ) -# if(BUILD_OS_WIN32) -# set(CPACK_NSIS_PACKAGE_ARCHITECTURE "32") -# else() -# set(CPACK_NSIS_PACKAGE_ARCHITECTURE "64") -# endif() -# -# include(CPack) From f3cb21c4fb5f97b550cb656ec36e50d206f6c358 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 28 Jul 2016 14:46:36 +0200 Subject: [PATCH 032/101] Finish up creating an app bundle for OSX --- packaging/Info.plist.in | 32 ++++++++++++++++++++++++++++++++ packaging/osx.cmake | 3 ++- packaging/setup_osx.py.in | 8 +++++++- 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 packaging/Info.plist.in diff --git a/packaging/Info.plist.in b/packaging/Info.plist.in new file mode 100644 index 00000000..5a95bd09 --- /dev/null +++ b/packaging/Info.plist.in @@ -0,0 +1,32 @@ + + + + + CFBundleIdentifier + nl.ultimaker.cura + CFBundleName + Cura + CFBundleVersion + @CURA_VERSION@ + CFBundleDevelopmentRegion + English + CFBundleExecutable + cura + CFBundleIconFile + icon.icns + + CFBundleDocumentTypes + + + CFBundleTypeRole + Viewer + CFBundleTypeExtensions + + * + + CFBundleTypeName + Model Files + + + + diff --git a/packaging/osx.cmake b/packaging/osx.cmake index cb7d8b80..c9f035a2 100644 --- a/packaging/osx.cmake +++ b/packaging/osx.cmake @@ -2,10 +2,11 @@ find_package(cx_freeze 5.0 REQUIRED) file(WRITE ${CMAKE_BINARY_DIR}/qt.conf "# Required for Qt to work properly") configure_file(${CMAKE_CURRENT_LIST_DIR}/setup_osx.py.in setup.py @ONLY) +configure_file(${CMAKE_CURRENT_LIST_DIR}/Info.plist.in Info.plist @ONLY) add_custom_command( TARGET packaging POST_BUILD COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/build - COMMAND ${PYTHON_EXECUTABLE} setup.py bdist_dmg + COMMAND ${PYTHON_EXECUTABLE} setup.py bdist_mac WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) diff --git a/packaging/setup_osx.py.in b/packaging/setup_osx.py.in index 12aef660..1fc53f1a 100644 --- a/packaging/setup_osx.py.in +++ b/packaging/setup_osx.py.in @@ -50,6 +50,12 @@ build_options = { "excludes": [ ] } +bdist_mac_options = { + "iconfile": "@CMAKE_SOURCE_DIR@/packaging/cura.icns", + "custom_info_plist": "@CMAKE_BINARY_DIR@/Info.plist", + "bundle_name": "Cura" +} + executables = [ Executable("@EXTERNALPROJECT_INSTALL_PREFIX@/bin/cura_app.py", targetName = "cura") ] @@ -62,6 +68,6 @@ setup( url="http://software.ultimaker.com/", license="GNU AFFERO GENERAL PUBLIC LICENSE (AGPL)", - options = {"build_exe": build_options}, + options = {"build_exe": build_options, "bdist_mac": bdist_mac_options }, executables = executables ) From b1b52ed558532dc7af0bf0d0007039da11ae14d2 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 28 Jul 2016 14:46:59 +0200 Subject: [PATCH 033/101] Create a .dmg in the signing step We need to sign all executables in the bundle before packaging. This allows us to do that. --- signing/osx.cmake | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/signing/osx.cmake b/signing/osx.cmake index 60ad6b25..c4c34f4f 100644 --- a/signing/osx.cmake +++ b/signing/osx.cmake @@ -1,6 +1,22 @@ +set(OSX_CODESIGN_IDENTITY "Mac Developer" CACHE STRING "Identity to use for code signing") # add_custom_command( # TARGET signing # COMMAND # WORKING_DIRECTORY ${CMAKE_BINARY_DIR} # ) + +install(DIRECTORY ${CMAKE_BINARY_DIR}/build/Cura.app DESTINATION "." USE_SOURCE_PERMISSIONS) + +set(CPACK_PACKAGE_NAME "Cura") +set(CPACK_PACKAGE_VENDOR "Ultimaker") +set(CPACK_PACKAGE_VERSION_MAJOR ${CURA_MAJOR_VERSION}) +set(CPACK_PACKAGE_VERSION_MINOR ${CURA_MINOR_VERSION}) +set(CPACK_PACKAGE_VERSION_PATCH ${CURA_PATCH_VERSION}) +set(CPACK_PACKAGE_VERSION ${CURA_VERSION}) +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Cura 3D Printing Software") +set(CPACK_PACKAGE_CONTACT "Arjen Hiemstra ") + +set(CPACK_GENERATOR "DragNDrop") + +include(CPack) From 057df46cab96079f0945c00669e222d1cdc3fbdf Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 11 Aug 2016 10:21:45 +0200 Subject: [PATCH 034/101] Make signing on OSX work properly --- signing/fix_codesign_issues.sh | 13 +++++++++++++ signing/osx.cmake | 16 +++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) create mode 100755 signing/fix_codesign_issues.sh diff --git a/signing/fix_codesign_issues.sh b/signing/fix_codesign_issues.sh new file mode 100755 index 00000000..25333b47 --- /dev/null +++ b/signing/fix_codesign_issues.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +pushd Cura.app/Contents/MacOS + +dirs=`find . -type d -depth 1` + +for dir in $dirs; do + filename=`basename $dir` + mv "$dir" "../Resources/" + ln -s "../Resources/$filename" . +done + +popd diff --git a/signing/osx.cmake b/signing/osx.cmake index c4c34f4f..fd8b6ea2 100644 --- a/signing/osx.cmake +++ b/signing/osx.cmake @@ -1,10 +1,16 @@ set(OSX_CODESIGN_IDENTITY "Mac Developer" CACHE STRING "Identity to use for code signing") -# add_custom_command( -# TARGET signing -# COMMAND -# WORKING_DIRECTORY ${CMAKE_BINARY_DIR} -# ) +add_custom_command( + TARGET signing PRE_BUILD + COMMAND ${CMAKE_CURRENT_LIST_DIR}/fix_codesign_issues.sh + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/build +) + +add_custom_command( + TARGET signing PRE_BUILD + COMMAND codesign -s ${OSX_CODESIGN_IDENTITY} --deep Cura.app + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/build +) install(DIRECTORY ${CMAKE_BINARY_DIR}/build/Cura.app DESTINATION "." USE_SOURCE_PERMISSIONS) From 13ffa3de533246078ca7a4cbefa1e269fe776176 Mon Sep 17 00:00:00 2001 From: jack Date: Mon, 22 Aug 2016 15:11:58 +0200 Subject: [PATCH 035/101] escape char in CMakeLists.txt --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b7739e7a..69110b59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ endif() set(EXTERNALPROJECT_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/inst) GetFromEnvironmentOrCache(TAG_OR_BRANCH "master" STRING "The name of the tag or branch to build") -GetFromEnvironmentOrCache(EXTRA_REPOSITORIES "" STRING "Extra repositories to install. Expected to have a CMake based build system. Format is ( ;)*") +GetFromEnvironmentOrCache(EXTRA_REPOSITORIES "" STRING "Extra repositories to install. Expected to have a CMake based build system. Format is ( \;)*") # Create the version-related variables GetFromEnvironmentOrCache(CURA_VERSION_MAJOR "0" STRING "Cura Major Version") From 71602f2f9fc65177b0ff5d17b34ea41af8ecdab9 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 5 Sep 2016 15:02:45 +0200 Subject: [PATCH 036/101] Code style: Whitespace around binary operators Contributes to issue CURA-879. --- packaging/setup_osx.py.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packaging/setup_osx.py.in b/packaging/setup_osx.py.in index 1fc53f1a..1fe46710 100644 --- a/packaging/setup_osx.py.in +++ b/packaging/setup_osx.py.in @@ -61,12 +61,12 @@ executables = [ ] setup( - name="Cura", + name = "Cura", version = "@CURA_VERSION_MAJOR@.@CURA_VERSION_MINOR@.@CURA_VERSION_PATCH@", description = "3D Printing Software", author = "Ultimaker B.V.", - url="http://software.ultimaker.com/", - license="GNU AFFERO GENERAL PUBLIC LICENSE (AGPL)", + url = "http://software.ultimaker.com/", + license = "GNU AFFERO GENERAL PUBLIC LICENSE (AGPL)", options = {"build_exe": build_options, "bdist_mac": bdist_mac_options }, executables = executables From 34386631481f93f9e7f9dd2cd2fa3646a3bbcd06 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 6 Sep 2016 17:29:36 +0200 Subject: [PATCH 037/101] Use CMAKE_PREFIX_PATH to determine locations from the build environment This fixes dependency lookups in built projects --- packaging/setup_osx.py.in | 10 +++++----- projects/Cura-PostProcessing.cmake | 2 +- projects/Cura.cmake | 2 +- projects/CuraEngine.cmake | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packaging/setup_osx.py.in b/packaging/setup_osx.py.in index 1fe46710..45d935de 100644 --- a/packaging/setup_osx.py.in +++ b/packaging/setup_osx.py.in @@ -21,7 +21,7 @@ hooks.load_PyQt5_QtQuick = load_pyqt5_qtquick search_path = sys.path.copy() search_path.insert(1, "@EXTERNALPROJECT_INSTALL_PREFIX@/lib/python3.5/site-packages/") -search_path.insert(2, "@CMAKE_INSTALL_PREFIX@/lib/python3.5/site-packages/") +search_path.insert(2, "@CMAKE_PREFIX_PATH@/lib/python3.5/site-packages/") # Dependencies are automatically detected, but it might need # fine tuning. @@ -41,10 +41,10 @@ build_options = { ("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/python3.5/site-packages/UM/Qt/qml/UM", "qml/UM"), ("@EXTERNALPROJECT_INSTALL_PREFIX@/share/cura/resources", "resources"), ("@EXTERNALPROJECT_INSTALL_PREFIX@/share/uranium/resources", "resources"), - ("@CMAKE_INSTALL_PREFIX@/lib/qml/Qt", "qml/Qt"), - ("@CMAKE_INSTALL_PREFIX@/lib/qml/QtQml", "qml/QtQml"), - ("@CMAKE_INSTALL_PREFIX@/lib/qml/QtQuick", "qml/QtQuick"), - ("@CMAKE_INSTALL_PREFIX@/lib/qml/QtQuick.2", "qml/QtQuick.2"), + ("@CMAKE_PREFIX_PATH@/lib/qml/Qt", "qml/Qt"), + ("@CMAKE_PREFIX_PATH@/lib/qml/QtQml", "qml/QtQml"), + ("@CMAKE_PREFIX_PATH@/lib/qml/QtQuick", "qml/QtQuick"), + ("@CMAKE_PREFIX_PATH@/lib/qml/QtQuick.2", "qml/QtQuick.2"), ("@CMAKE_BINARY_DIR@/qt.conf", ""), ], "excludes": [ ] diff --git a/projects/Cura-PostProcessing.cmake b/projects/Cura-PostProcessing.cmake index 8c095841..7c5742e5 100644 --- a/projects/Cura-PostProcessing.cmake +++ b/projects/Cura-PostProcessing.cmake @@ -2,7 +2,7 @@ ExternalProject_Add(Cura-PostProcessing GIT_REPOSITORY https://github.com/nallath/PostProcessingPlugin GIT_TAG origin/${TAG_OR_BRANCH} - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${CMAKE_INSTALL_PREFIX} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} ) SetProjectDependencies(TARGET Cura-PostProcessing DEPENDS Cura) diff --git a/projects/Cura.cmake b/projects/Cura.cmake index 1e1e04d8..5a82a79e 100644 --- a/projects/Cura.cmake +++ b/projects/Cura.cmake @@ -1,7 +1,7 @@ ExternalProject_Add(Cura GIT_REPOSITORY https://github.com/ultimaker/Cura GIT_TAG origin/${TAG_OR_BRANCH} - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${CMAKE_INSTALL_PREFIX} -DURANIUM_SCRIPTS_DIR= -DCURA_VERSION=${CURA_VERSION} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DURANIUM_SCRIPTS_DIR= -DCURA_VERSION=${CURA_VERSION} ) SetProjectDependencies(TARGET Cura DEPENDS Uranium CuraEngine) diff --git a/projects/CuraEngine.cmake b/projects/CuraEngine.cmake index 5092e7b0..5c98db09 100644 --- a/projects/CuraEngine.cmake +++ b/projects/CuraEngine.cmake @@ -3,7 +3,7 @@ find_package(Arcus 1.1 REQUIRED) ExternalProject_Add(CuraEngine GIT_REPOSITORY https://github.com/ultimaker/CuraEngine GIT_TAG origin/${TAG_OR_BRANCH} - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCURA_ENGINE_VERSION=${CURA_VERSION} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_PREFIX_PATH=${CMAKE_INSTALL_PREFIX} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCURA_ENGINE_VERSION=${CURA_VERSION} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} ) SetProjectDependencies(TARGET CuraEngine) From 0ffac1751f6bd7e933d954c7d037567c1d0127c1 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 6 Sep 2016 17:40:59 +0200 Subject: [PATCH 038/101] Fix prefix_path for uranium --- projects/Uranium.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/Uranium.cmake b/projects/Uranium.cmake index 0adf3699..1a45adb8 100644 --- a/projects/Uranium.cmake +++ b/projects/Uranium.cmake @@ -6,7 +6,7 @@ find_package(SciPy 0.17 REQUIRED) ExternalProject_Add(Uranium GIT_REPOSITORY https://github.com/ultimaker/Uranium GIT_TAG origin/${TAG_OR_BRANCH} - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${CMAKE_INSTALL_PREFIX} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} ) SetProjectDependencies(TARGET Uranium) From 225ded76fc56d38d50379f3ead2527ea2e9f81a4 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Wed, 7 Sep 2016 13:49:38 +0200 Subject: [PATCH 039/101] Fix prefix path for Doodle3D plugin --- projects/Cura-Doodle3D.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/Cura-Doodle3D.cmake b/projects/Cura-Doodle3D.cmake index 85290039..7c0ca905 100644 --- a/projects/Cura-Doodle3D.cmake +++ b/projects/Cura-Doodle3D.cmake @@ -2,7 +2,7 @@ ExternalProject_Add(Cura-Doodle3D GIT_REPOSITORY https://github.com/Doodle3D/Doodle3D-cura-plugin GIT_TAG origin/master - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${CMAKE_INSTALL_PREFIX} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} ) SetProjectDependencies(TARGET Cura-Doodle3D DEPENDS Cura) From e50325dad99fe747fdcad2ff1dd83394bf450dd2 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 12 Sep 2016 11:46:02 +0200 Subject: [PATCH 040/101] Remove qt.conf on OSX since it is not needed after all and causes signing to fail --- packaging/osx.cmake | 1 - packaging/setup_osx.py.in | 1 - 2 files changed, 2 deletions(-) diff --git a/packaging/osx.cmake b/packaging/osx.cmake index c9f035a2..3ed8dab3 100644 --- a/packaging/osx.cmake +++ b/packaging/osx.cmake @@ -1,6 +1,5 @@ find_package(cx_freeze 5.0 REQUIRED) -file(WRITE ${CMAKE_BINARY_DIR}/qt.conf "# Required for Qt to work properly") configure_file(${CMAKE_CURRENT_LIST_DIR}/setup_osx.py.in setup.py @ONLY) configure_file(${CMAKE_CURRENT_LIST_DIR}/Info.plist.in Info.plist @ONLY) diff --git a/packaging/setup_osx.py.in b/packaging/setup_osx.py.in index 45d935de..5bb75ce9 100644 --- a/packaging/setup_osx.py.in +++ b/packaging/setup_osx.py.in @@ -45,7 +45,6 @@ build_options = { ("@CMAKE_PREFIX_PATH@/lib/qml/QtQml", "qml/QtQml"), ("@CMAKE_PREFIX_PATH@/lib/qml/QtQuick", "qml/QtQuick"), ("@CMAKE_PREFIX_PATH@/lib/qml/QtQuick.2", "qml/QtQuick.2"), - ("@CMAKE_BINARY_DIR@/qt.conf", ""), ], "excludes": [ ] } From 3cfabddfb7324dcdbda3dc04dd30409d34255a21 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 12 Sep 2016 13:29:09 +0200 Subject: [PATCH 041/101] Fix OSX Plist file so signing on OSX 10.11 works properly --- packaging/Info.plist.in | 59 ++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 24 deletions(-) diff --git a/packaging/Info.plist.in b/packaging/Info.plist.in index 5a95bd09..3873b049 100644 --- a/packaging/Info.plist.in +++ b/packaging/Info.plist.in @@ -2,31 +2,42 @@ - CFBundleIdentifier - nl.ultimaker.cura + CFBundleIdentifier + nl.ultimaker.cura CFBundleName - Cura - CFBundleVersion - @CURA_VERSION@ - CFBundleDevelopmentRegion - English - CFBundleExecutable - cura - CFBundleIconFile - icon.icns - + Cura + CFBundleDisplayName + Cura + CFBundleVersion + @CURA_VERSION@ + CFBundleDevelopmentRegion + English + CFBundleExecutable + cura + CFBundleIconFile + icon.icns + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleShortVersionString + @CURA_VERSION_MAJOR@.@CURA_VERSION_MINOR@ + NSPrincipalClass + NSApplication + CFBundleSignature + ???? CFBundleDocumentTypes - - - CFBundleTypeRole - Viewer - CFBundleTypeExtensions - - * - - CFBundleTypeName - Model Files - - + + + CFBundleTypeRole + Viewer + CFBundleTypeExtensions + + * + + CFBundleTypeName + Model Files + + From 941f3dc124d41f27c70e37af9280d73432afda92 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 12 Sep 2016 16:06:52 +0200 Subject: [PATCH 042/101] Add functionality to include project files from a separate directory. This replaces EXTRA_REPOSITORIES from the original cura-build. --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 69110b59..c606b830 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,8 @@ GetFromEnvironmentOrCache(CURA_VERSION_MINOR "0" STRING "Cura Minor Version") GetFromEnvironmentOrCache(CURA_VERSION_PATCH "0" STRING "Cura Patch Version") GetFromEnvironmentOrCache(CURA_VERSION_EXTRA "${TAG_OR_BRANCH}" STRING "Cura Extra Version Information") +GetFromEnvironmentOrCache(CURA_EXTRA_PROJECTS_DIR "" STRING "Directory where extra projects to build are located.") + set(CURA_VERSION "${CURA_VERSION_MAJOR}.${CURA_VERSION_MINOR}.${CURA_VERSION_PATCH}") if(NOT "${CURA_VERSION_EXTRA}" STREQUAL "") set(CURA_VERSION "${CURA_VERSION}-${CURA_VERSION_EXTRA}") @@ -39,6 +41,11 @@ endif() add_custom_target(projects ALL COMMENT "Building Projects...") file(GLOB _projects projects/*.cmake) +if(NOT CURA_EXTRA_PROJECTS_DIR STREQUAL "") + file(GLOB _extra_projects ${CURA_EXTRA_PROJECTS_DIR}/*.cmake) + list(APPEND _projects ${_extra_projects}) +endif() + foreach(_project ${_projects}) # Go through all files in projects/ and include them. The project files should define # targets for the actual projects. In addition, these files are expected to define any From 7a5c6af79c48c95cbcbcf1220408237db72c1db7 Mon Sep 17 00:00:00 2001 From: awhiemstra Date: Thu, 22 Sep 2016 13:51:29 +0200 Subject: [PATCH 043/101] Add missing modules to OSX setup file Since they are needed for plugins but cx_freeze does not find them. Contributes to CURA-879 --- packaging/setup_osx.py.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packaging/setup_osx.py.in b/packaging/setup_osx.py.in index 5bb75ce9..78326530 100644 --- a/packaging/setup_osx.py.in +++ b/packaging/setup_osx.py.in @@ -31,6 +31,8 @@ build_options = { "packages": [ "xml.etree", "uuid", + "serial", + "zeroconf", "UM", "cura" ], From a5c4c5daf4d2f3cddaa5273df46769dc84f84027 Mon Sep 17 00:00:00 2001 From: awhiemstra Date: Thu, 22 Sep 2016 14:21:50 +0200 Subject: [PATCH 044/101] Add "packaging" module that some other module is complaining about Contributes to CURA-879 --- packaging/setup_osx.py.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packaging/setup_osx.py.in b/packaging/setup_osx.py.in index 78326530..2e5543c9 100644 --- a/packaging/setup_osx.py.in +++ b/packaging/setup_osx.py.in @@ -34,7 +34,8 @@ build_options = { "serial", "zeroconf", "UM", - "cura" + "cura", + "pkg_resources._vendor.packaging", ], "include_files": [ ("@EXTERNALPROJECT_INSTALL_PREFIX@/bin/CuraEngine", ""), From bd41f31300a2a4e30f80c04c5bda79fc85b0a8df Mon Sep 17 00:00:00 2001 From: awhiemstra Date: Thu, 22 Sep 2016 15:16:48 +0200 Subject: [PATCH 045/101] Include entire pkg_resources since just packaging does not seems enough Contributes to CURA-879 --- packaging/setup_osx.py.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/setup_osx.py.in b/packaging/setup_osx.py.in index 2e5543c9..a03e9842 100644 --- a/packaging/setup_osx.py.in +++ b/packaging/setup_osx.py.in @@ -35,7 +35,7 @@ build_options = { "zeroconf", "UM", "cura", - "pkg_resources._vendor.packaging", + "pkg_resources", ], "include_files": [ ("@EXTERNALPROJECT_INSTALL_PREFIX@/bin/CuraEngine", ""), From 36e2005eb14f867cd6623dc105b000246dbb7e3f Mon Sep 17 00:00:00 2001 From: awhiemstra Date: Thu, 22 Sep 2016 17:26:37 +0200 Subject: [PATCH 046/101] Remove pkg_resources again from packages It turns out it was not needed after all, instead several modules needed a proper installation. Contributes to CURA-879 --- packaging/setup_osx.py.in | 1 - 1 file changed, 1 deletion(-) diff --git a/packaging/setup_osx.py.in b/packaging/setup_osx.py.in index a03e9842..26c5dd4d 100644 --- a/packaging/setup_osx.py.in +++ b/packaging/setup_osx.py.in @@ -35,7 +35,6 @@ build_options = { "zeroconf", "UM", "cura", - "pkg_resources", ], "include_files": [ ("@EXTERNALPROJECT_INSTALL_PREFIX@/bin/CuraEngine", ""), From 9745b3429c0686387f3549215a322524c14f8467 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 27 Sep 2016 10:18:09 +0200 Subject: [PATCH 047/101] Add fdm_materials as an extra project Contributes to CURA-2136 --- projects/fdm_materials.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/fdm_materials.cmake diff --git a/projects/fdm_materials.cmake b/projects/fdm_materials.cmake new file mode 100644 index 00000000..81df491f --- /dev/null +++ b/projects/fdm_materials.cmake @@ -0,0 +1,8 @@ + +ExternalProject_Add(fdm_materials + GIT_REPOSITORY https://github.com/ultimaker/fdm_materials + GIT_TAG origin/${TAG_OR_BRANCH} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} +) + +SetProjectDependencies(TARGET fdm_materials DEPENDS Cura) From c54671f1b8f960e66046f6663dadf426ff4088cf Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 27 Sep 2016 10:24:10 +0200 Subject: [PATCH 048/101] Append to CMAKE_MODULE_PATH instead of replacing it --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c606b830..8809e216 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ project(cura-build) cmake_minimum_required(VERSION 2.8.12) -set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) include(ExternalProject) include(GNUInstallDirs) From 39b0d12c17f80abff5be62179b515de96b7513c2 Mon Sep 17 00:00:00 2001 From: awhiemstra Date: Tue, 27 Sep 2016 17:05:41 +0200 Subject: [PATCH 049/101] Force master for fdm_materials for now Since we have no other branches --- projects/fdm_materials.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/fdm_materials.cmake b/projects/fdm_materials.cmake index 81df491f..94684f9d 100644 --- a/projects/fdm_materials.cmake +++ b/projects/fdm_materials.cmake @@ -1,7 +1,7 @@ ExternalProject_Add(fdm_materials GIT_REPOSITORY https://github.com/ultimaker/fdm_materials - GIT_TAG origin/${TAG_OR_BRANCH} + GIT_TAG origin/master CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} ) From 3da4bd22201c58399a1c0747e6f767cf1708e031 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 17 Oct 2016 11:18:11 +0200 Subject: [PATCH 050/101] Fix copy command for Linux desktop file/icon Since cmake -E copy does not actually take multiple arguments --- packaging/linux.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packaging/linux.cmake b/packaging/linux.cmake index 79cb08bb..8e977ffd 100644 --- a/packaging/linux.cmake +++ b/packaging/linux.cmake @@ -21,7 +21,14 @@ set(PACKAGE_DIR ${CMAKE_BINARY_DIR}/package) add_custom_command( TARGET packaging PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy cura.desktop cura-icon.png ${PACKAGE_DIR} + COMMAND ${CMAKE_COMMAND} -E copy cura.desktop ${PACKAGE_DIR} + COMMENT "Copying icon and desktop file..." + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} +) + +add_custom_command( + TARGET packaging PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy cura-icon.png ${PACKAGE_DIR} COMMENT "Copying icon and desktop file..." WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} ) From 551a7d46338ee63fad3641c30415e56abd23c3a5 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 17 Oct 2016 13:01:31 +0200 Subject: [PATCH 051/101] Properly include Qt and QML plugins --- packaging/cura.sh | 8 +++++++- packaging/setup_linux.py.in | 22 +++++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/packaging/cura.sh b/packaging/cura.sh index 77bebae8..9b492ec7 100755 --- a/packaging/cura.sh +++ b/packaging/cura.sh @@ -1,3 +1,9 @@ #!/bin/sh -cura +scriptdir=$(dirname $0) + +export QT_PLUGIN_PATH=$scriptdir/qt/plugins +export QML2_IMPORT_PATH=$scriptdir/qt/qml +export QT_QPA_FONTDIR=$scriptdir/qt/fonts + +cura $@ diff --git a/packaging/setup_linux.py.in b/packaging/setup_linux.py.in index f3e6acb1..50712977 100644 --- a/packaging/setup_linux.py.in +++ b/packaging/setup_linux.py.in @@ -10,6 +10,11 @@ def load_scipy(finder, module): hooks.load_scipy = load_scipy +def load_pyqt5_qtgui(finder, module): + finder.IncludeModule("PyQt5.QtCore") + +hooks.load_PyQt5_QtGui = load_pyqt5_qtgui + def load_pyqt5_qtquick(finder, module): finder.IncludeModule("PyQt5.QtCore") finder.IncludeModule("PyQt5.QtGui") @@ -40,6 +45,9 @@ build_options = { ("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/python3/dist-packages/UM/Qt/qml/UM", "qml/UM"), ("@EXTERNALPROJECT_INSTALL_PREFIX@/share/cura/resources", "resources"), ("@EXTERNALPROJECT_INSTALL_PREFIX@/share/uranium/resources", "resources") + ("@CMAKE_PREFIX_PATH@/lib/plugins", "qt/plugins") + ("@CMAKE_PREFIX_PATH@/lib/qml", "qt/qml") + ("@CMAKE_PREFIX_PATH@/lib/fonts", "qt/fonts") ], "optimize": 2, "bin_path_includes": [ @@ -76,7 +84,19 @@ build_options = { "libXxf86vm.so.1", "libdrm.so.2", "libexpat.so.1", - "libXau.so.6" + "libXau.so.6", + "libcrypto.so.10", + "libglib-2.0.so.0", + "libgssapi_krb5.so.", + "libgthread-2.0.so.0", + "libk5crypto.so.3", + "libkeyutils.so.1", + "libkrb5.so.3", + "libkrb5support.so.0", + "libresolv.so.2", + "libssl.so.10", + "libutil.so.1", + "libXrender.so.1", ] } From 357e8aa25c9ea57d2c8410cc95e8ec8488486bba Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 17 Oct 2016 13:09:36 +0200 Subject: [PATCH 052/101] Add missing commas --- packaging/setup_linux.py.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packaging/setup_linux.py.in b/packaging/setup_linux.py.in index 50712977..869158b2 100644 --- a/packaging/setup_linux.py.in +++ b/packaging/setup_linux.py.in @@ -44,10 +44,10 @@ build_options = { ("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/uranium", "plugins"), ("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/python3/dist-packages/UM/Qt/qml/UM", "qml/UM"), ("@EXTERNALPROJECT_INSTALL_PREFIX@/share/cura/resources", "resources"), - ("@EXTERNALPROJECT_INSTALL_PREFIX@/share/uranium/resources", "resources") - ("@CMAKE_PREFIX_PATH@/lib/plugins", "qt/plugins") - ("@CMAKE_PREFIX_PATH@/lib/qml", "qt/qml") - ("@CMAKE_PREFIX_PATH@/lib/fonts", "qt/fonts") + ("@EXTERNALPROJECT_INSTALL_PREFIX@/share/uranium/resources", "resources"), + ("@CMAKE_PREFIX_PATH@/lib/plugins", "qt/plugins"), + ("@CMAKE_PREFIX_PATH@/lib/qml", "qt/qml"), + ("@CMAKE_PREFIX_PATH@/lib/fonts", "qt/fonts"), ], "optimize": 2, "bin_path_includes": [ From f0bb01a51c979f866d34a41332317a661130b550 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 17 Oct 2016 13:28:12 +0200 Subject: [PATCH 053/101] Add missing serial/zeroconf and do not exclude libssl --- packaging/setup_linux.py.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packaging/setup_linux.py.in b/packaging/setup_linux.py.in index 869158b2..4952a670 100644 --- a/packaging/setup_linux.py.in +++ b/packaging/setup_linux.py.in @@ -37,7 +37,9 @@ build_options = { "xml.etree", "uuid", "UM", - "cura" + "cura", + "zeroconf", + "serial", ], "include_files": [ ("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/cura", "plugins"), @@ -94,7 +96,6 @@ build_options = { "libkrb5.so.3", "libkrb5support.so.0", "libresolv.so.2", - "libssl.so.10", "libutil.so.1", "libXrender.so.1", ] From d12fa8eed66b6f157f1c03d33c8f8ea93538b72a Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 17 Oct 2016 13:36:16 +0200 Subject: [PATCH 054/101] Include CuraEngine when building an executable from Python files --- packaging/setup_linux.py.in | 1 + 1 file changed, 1 insertion(+) diff --git a/packaging/setup_linux.py.in b/packaging/setup_linux.py.in index 4952a670..074a05f9 100644 --- a/packaging/setup_linux.py.in +++ b/packaging/setup_linux.py.in @@ -42,6 +42,7 @@ build_options = { "serial", ], "include_files": [ + ("@EXTERNALPROJECT_INSTALL_PREFIX@/bin/CuraEngine", "") ("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/cura", "plugins"), ("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/uranium", "plugins"), ("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/python3/dist-packages/UM/Qt/qml/UM", "qml/UM"), From f1db025aca61940e85a92a55b9a47051f2d96b42 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 17 Oct 2016 13:38:01 +0200 Subject: [PATCH 055/101] Add missing comma --- packaging/setup_linux.py.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/setup_linux.py.in b/packaging/setup_linux.py.in index 074a05f9..15000f37 100644 --- a/packaging/setup_linux.py.in +++ b/packaging/setup_linux.py.in @@ -42,7 +42,7 @@ build_options = { "serial", ], "include_files": [ - ("@EXTERNALPROJECT_INSTALL_PREFIX@/bin/CuraEngine", "") + ("@EXTERNALPROJECT_INSTALL_PREFIX@/bin/CuraEngine", ""), ("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/cura", "plugins"), ("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/uranium", "plugins"), ("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/python3/dist-packages/UM/Qt/qml/UM", "qml/UM"), From d0ccef3570b5e0fd29d72a3788d02e8bd896be67 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 17 Oct 2016 14:08:26 +0200 Subject: [PATCH 056/101] Add LD_LIBRARY_PATH to startup script so CuraEngine starts --- packaging/cura.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/packaging/cura.sh b/packaging/cura.sh index 9b492ec7..947bf6bf 100755 --- a/packaging/cura.sh +++ b/packaging/cura.sh @@ -2,6 +2,7 @@ scriptdir=$(dirname $0) +export LD_LIBRARY_PATH=$scriptdir export QT_PLUGIN_PATH=$scriptdir/qt/plugins export QML2_IMPORT_PATH=$scriptdir/qt/qml export QT_QPA_FONTDIR=$scriptdir/qt/fonts From cb5adc74902a6dfa8e4a6d2d06cf9cf47e54a8c2 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 20 Oct 2016 10:27:19 +0200 Subject: [PATCH 057/101] Add missing numpy-stl package Since it is used by a plugin cx_Freeze does not find it --- packaging/setup_linux.py.in | 1 + packaging/setup_osx.py.in | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packaging/setup_linux.py.in b/packaging/setup_linux.py.in index 15000f37..90a24520 100644 --- a/packaging/setup_linux.py.in +++ b/packaging/setup_linux.py.in @@ -40,6 +40,7 @@ build_options = { "cura", "zeroconf", "serial", + "stl", ], "include_files": [ ("@EXTERNALPROJECT_INSTALL_PREFIX@/bin/CuraEngine", ""), diff --git a/packaging/setup_osx.py.in b/packaging/setup_osx.py.in index 26c5dd4d..ba7a3f58 100644 --- a/packaging/setup_osx.py.in +++ b/packaging/setup_osx.py.in @@ -16,7 +16,7 @@ def load_pyqt5_qtquick(finder, module): finder.IncludeModule("PyQt5.QtQml") finder.IncludeModule("PyQt5.QtNetwork") finder.IncludeModule("PyQt5._QOpenGLFunctions_2_0") - + hooks.load_PyQt5_QtQuick = load_pyqt5_qtquick search_path = sys.path.copy() @@ -35,6 +35,7 @@ build_options = { "zeroconf", "UM", "cura", + "stl", ], "include_files": [ ("@EXTERNALPROJECT_INSTALL_PREFIX@/bin/CuraEngine", ""), @@ -68,7 +69,7 @@ setup( author = "Ultimaker B.V.", url = "http://software.ultimaker.com/", license = "GNU AFFERO GENERAL PUBLIC LICENSE (AGPL)", - + options = {"build_exe": build_options, "bdist_mac": bdist_mac_options }, executables = executables ) From 062cdc72fdfd8b3b7ef89c38e51cf4131d8dd86f Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 20 Oct 2016 10:27:55 +0200 Subject: [PATCH 058/101] Add UM3NetworkPrinting plugin --- projects/Cura-UM3NetworkPrinting.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/Cura-UM3NetworkPrinting.cmake diff --git a/projects/Cura-UM3NetworkPrinting.cmake b/projects/Cura-UM3NetworkPrinting.cmake new file mode 100644 index 00000000..bd4751ea --- /dev/null +++ b/projects/Cura-UM3NetworkPrinting.cmake @@ -0,0 +1,8 @@ + +ExternalProject_Add(Cura-UM3NetworkPrinting + GIT_REPOSITORY https://github.com/Ultimaker/UM3NetworkPrintingPlugin + GIT_TAG origin/${TAG_OR_BRANCH} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} +) + +SetProjectDependencies(TARGET Cura-UM3NetworkPrinting DEPENDS Cura) From d26bcdcea6454bcf1886ded9bc6c9b684a1f9da8 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 20 Oct 2016 10:37:21 +0200 Subject: [PATCH 059/101] Use the right branch for fdm_materials --- projects/fdm_materials.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/fdm_materials.cmake b/projects/fdm_materials.cmake index 94684f9d..81df491f 100644 --- a/projects/fdm_materials.cmake +++ b/projects/fdm_materials.cmake @@ -1,7 +1,7 @@ ExternalProject_Add(fdm_materials GIT_REPOSITORY https://github.com/ultimaker/fdm_materials - GIT_TAG origin/master + GIT_TAG origin/${TAG_OR_BRANCH} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} ) From 4bbf6d7e39a85d245e452a72105b27ba2d3d6abb Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 20 Oct 2016 10:50:37 +0200 Subject: [PATCH 060/101] Remove libcrypto.so.10 from the excluded libraries Since it is called differently on other platforms --- packaging/setup_linux.py.in | 1 - 1 file changed, 1 deletion(-) diff --git a/packaging/setup_linux.py.in b/packaging/setup_linux.py.in index 90a24520..835ef422 100644 --- a/packaging/setup_linux.py.in +++ b/packaging/setup_linux.py.in @@ -89,7 +89,6 @@ build_options = { "libdrm.so.2", "libexpat.so.1", "libXau.so.6", - "libcrypto.so.10", "libglib-2.0.so.0", "libgssapi_krb5.so.", "libgthread-2.0.so.0", From fad9d5d59e85979fdce1ed3eab1dcdd6ce1dd406 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 20 Oct 2016 13:18:33 +0200 Subject: [PATCH 061/101] Add two more libraries to the list of excluded libraries on Linux Since they prevent SliceInfo from working properly --- packaging/setup_linux.py.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packaging/setup_linux.py.in b/packaging/setup_linux.py.in index 835ef422..ca16599b 100644 --- a/packaging/setup_linux.py.in +++ b/packaging/setup_linux.py.in @@ -99,6 +99,8 @@ build_options = { "libresolv.so.2", "libutil.so.1", "libXrender.so.1", + "libcom_err.so.2", + "libgssapi_krb5.so.2", ] } From 3994fb1e7b555a8f2842f4dacd542b4cb08d654a Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 24 Oct 2016 15:23:01 +0200 Subject: [PATCH 062/101] Add QT_XKB_CONFIG_ROOT export to the start script Otherwise keyboard input does not seem to work --- packaging/cura.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packaging/cura.sh b/packaging/cura.sh index 947bf6bf..5dd4a394 100755 --- a/packaging/cura.sh +++ b/packaging/cura.sh @@ -5,6 +5,7 @@ scriptdir=$(dirname $0) export LD_LIBRARY_PATH=$scriptdir export QT_PLUGIN_PATH=$scriptdir/qt/plugins export QML2_IMPORT_PATH=$scriptdir/qt/qml -export QT_QPA_FONTDIR=$scriptdir/qt/fonts +export QT_QPA_FONTDIR=/usr/share/fonts +export QT_XKB_CONFIG_ROOT=/usr/share/X11/xkb cura $@ From c01de6866d86fd1806958677194080c1c739f9b6 Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Tue, 25 Oct 2016 10:16:05 +0200 Subject: [PATCH 063/101] CMake: Making it a NONE-type project cura-build itself is not a C/C++ project, like set as default in CMake. Contributes to CURA-2150 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8809e216..c32998ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -project(cura-build) +project(cura-build NONE) cmake_minimum_required(VERSION 2.8.12) From b41c36cbe4a9088d7c9ade0a182d171f50609c37 Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Wed, 26 Oct 2016 00:23:42 +0200 Subject: [PATCH 064/101] CuraEngine: Appending generator and add Protobuf hack 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 --- projects/CuraEngine.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/projects/CuraEngine.cmake b/projects/CuraEngine.cmake index 5c98db09..27274a25 100644 --- a/projects/CuraEngine.cmake +++ b/projects/CuraEngine.cmake @@ -1,9 +1,15 @@ +if(BUILD_OS_WINDOWS) + set(Protobuf_LIBRARY_RELEASE ${CMAKE_PREFIX_PATH}/bin/libprotobuf.dll ) + set(Protobuf_LITE_LIBRARY_RELEASE ${CMAKE_PREFIX_PATH}/bin/libprotobuf-lite.dll ) + set(Protobuf_PROTOC_LIBRARY_RELEASE ${CMAKE_PREFIX_PATH}/bin/libprotoc.dll ) +endif() + find_package(Arcus 1.1 REQUIRED) ExternalProject_Add(CuraEngine GIT_REPOSITORY https://github.com/ultimaker/CuraEngine GIT_TAG origin/${TAG_OR_BRANCH} - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCURA_ENGINE_VERSION=${CURA_VERSION} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCURA_ENGINE_VERSION=${CURA_VERSION} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -G ${CMAKE_GENERATOR} ) SetProjectDependencies(TARGET CuraEngine) From c4d2b22a916d8f211c531c5da603a1bc1a5ca8e4 Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Wed, 26 Oct 2016 00:25:55 +0200 Subject: [PATCH 065/101] Uranium: Only ask for Qt5 on non-Windows OSs Contributes to CURA-2150 --- projects/Uranium.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/Uranium.cmake b/projects/Uranium.cmake index 1a45adb8..2686a5cf 100644 --- a/projects/Uranium.cmake +++ b/projects/Uranium.cmake @@ -1,5 +1,9 @@ find_package(PythonInterp 3.5.0 REQUIRED) -find_package(Qt5 5.6.0 REQUIRED Core Qml Quick Widgets) +if(NOT BUILD_OS_WINDOWS) + # Only ask for Qt5 where it is actually built via cura-build-environment. + # On Windows we are using PyQt5 to provide our libraries prebuilt. + find_package(Qt5 5.6.0 REQUIRED Core Qml Quick Widgets) +endif() find_package(PyQt 5.6 REQUIRED) find_package(SciPy 0.17 REQUIRED) From b1321af8ae641a787ed2924df27ba82d4baa239a Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Wed, 26 Oct 2016 15:08:43 +0200 Subject: [PATCH 066/101] CuraEngine: Updating workaround for static build Also added a comment why it is needed. Contributes to CURA-2150 --- projects/CuraEngine.cmake | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/projects/CuraEngine.cmake b/projects/CuraEngine.cmake index 27274a25..a810fdf8 100644 --- a/projects/CuraEngine.cmake +++ b/projects/CuraEngine.cmake @@ -1,7 +1,9 @@ if(BUILD_OS_WINDOWS) - set(Protobuf_LIBRARY_RELEASE ${CMAKE_PREFIX_PATH}/bin/libprotobuf.dll ) - set(Protobuf_LITE_LIBRARY_RELEASE ${CMAKE_PREFIX_PATH}/bin/libprotobuf-lite.dll ) - set(Protobuf_PROTOC_LIBRARY_RELEASE ${CMAKE_PREFIX_PATH}/bin/libprotoc.dll ) + # Helping CMake on Windows to find Protobuf... + # Otherwise it claims there is no Protobuf, but there is! + set(Protobuf_LIBRARY_RELEASE ${CMAKE_PREFIX_PATH}/lib/libprotobuf.a ) + set(Protobuf_LITE_LIBRARY_RELEASE ${CMAKE_PREFIX_PATH}/lib/libprotobuf-lite.a ) + set(Protobuf_PROTOC_LIBRARY_RELEASE ${CMAKE_PREFIX_PATH}/lib/libprotoc.a ) endif() find_package(Arcus 1.1 REQUIRED) From 5dd810c452fdf5b5b461ad9f33b05c44b57617a2 Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Thu, 27 Oct 2016 17:40:08 +0200 Subject: [PATCH 067/101] Batch: Updating env* scripts for Python 3.5 Contributes to CURA-2150 --- env_win32.bat | 2 +- env_win64.bat | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/env_win32.bat b/env_win32.bat index 78c5311d..09db45e1 100644 --- a/env_win32.bat +++ b/env_win32.bat @@ -1,2 +1,2 @@ -set PYTHONPATH=%cd%\inst\lib\python3.4\site-packages +set PYTHONPATH=%cd%\inst\lib\python3.5\site-packages set PATH=%cd%\inst\bin;%PATH% \ No newline at end of file diff --git a/env_win64.bat b/env_win64.bat index 90d4aaeb..c14b3f19 100644 --- a/env_win64.bat +++ b/env_win64.bat @@ -1,4 +1,4 @@ -set PYTHONPATH=%cd%\inst\lib\python3.4\site-packages +set PYTHONPATH=%cd%\inst\lib\python3.5\site-packages set PATH=%cd%\inst\bin;%PATH% set CFLAGS=-m64 set CXXFLAGS=-m64 From b13c568388356ee3ec816fcbc2eecbe9e60dc90b Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Thu, 27 Oct 2016 18:21:58 +0200 Subject: [PATCH 068/101] NSIS: Merging FileAssociation from diverged master Contributes to CURA-2150 --- NSIS/FileAssociation.nsh | 192 +++++++++++++++++++++++++++++++++++++++ cmake/NSIS.template.in | 23 +++-- 2 files changed, 205 insertions(+), 10 deletions(-) create mode 100644 NSIS/FileAssociation.nsh diff --git a/NSIS/FileAssociation.nsh b/NSIS/FileAssociation.nsh new file mode 100644 index 00000000..f635dffb --- /dev/null +++ b/NSIS/FileAssociation.nsh @@ -0,0 +1,192 @@ +/* +_____________________________________________________________________________ + + File Association +_____________________________________________________________________________ + + Based on code taken from http://nsis.sourceforge.net/File_Association + + Usage in script: + 1. !include "FileAssociation.nsh" + 2. [Section|Function] + ${FileAssociationFunction} "Param1" "Param2" "..." $var + [SectionEnd|FunctionEnd] + + FileAssociationFunction=[RegisterExtension|UnRegisterExtension] + +_____________________________________________________________________________ + + ${RegisterExtension} "[executable]" "[extension]" "[description]" + +"[executable]" ; executable which opens the file format + ; +"[extension]" ; extension, which represents the file format to open + ; +"[description]" ; description for the extension. This will be display in Windows Explorer. + ; + + + ${UnRegisterExtension} "[extension]" "[description]" + +"[extension]" ; extension, which represents the file format to open + ; +"[description]" ; description for the extension. This will be display in Windows Explorer. + ; + +_____________________________________________________________________________ + + Macros +_____________________________________________________________________________ + + Change log window verbosity (default: 3=no script) + + Example: + !include "FileAssociation.nsh" + !insertmacro RegisterExtension + ${FileAssociation_VERBOSE} 4 # all verbosity + !insertmacro UnRegisterExtension + ${FileAssociation_VERBOSE} 3 # no script +*/ + + +!ifndef FileAssociation_INCLUDED +!define FileAssociation_INCLUDED + +!include Util.nsh + +!verbose push +!verbose 3 +!ifndef _FileAssociation_VERBOSE + !define _FileAssociation_VERBOSE 3 +!endif +!verbose ${_FileAssociation_VERBOSE} +!define FileAssociation_VERBOSE `!insertmacro FileAssociation_VERBOSE` +!verbose pop + +!macro FileAssociation_VERBOSE _VERBOSE + !verbose push + !verbose 3 + !undef _FileAssociation_VERBOSE + !define _FileAssociation_VERBOSE ${_VERBOSE} + !verbose pop +!macroend + + + +!macro RegisterExtensionCall _EXECUTABLE _EXTENSION _DESCRIPTION + !verbose push + !verbose ${_FileAssociation_VERBOSE} + Push `${_DESCRIPTION}` + Push `${_EXTENSION}` + Push `${_EXECUTABLE}` + ${CallArtificialFunction} RegisterExtension_ + !verbose pop +!macroend + +!macro UnRegisterExtensionCall _EXTENSION _DESCRIPTION + !verbose push + !verbose ${_FileAssociation_VERBOSE} + Push `${_EXTENSION}` + Push `${_DESCRIPTION}` + ${CallArtificialFunction} UnRegisterExtension_ + !verbose pop +!macroend + + + +!define RegisterExtension `!insertmacro RegisterExtensionCall` +!define un.RegisterExtension `!insertmacro RegisterExtensionCall` + +!macro RegisterExtension +!macroend + +!macro un.RegisterExtension +!macroend + +!macro RegisterExtension_ + !verbose push + !verbose ${_FileAssociation_VERBOSE} + + Exch $R2 ;exe + Exch + Exch $R1 ;ext + Exch + Exch 2 + Exch $R0 ;desc + Exch 2 + Push $0 + Push $1 + + ReadRegStr $1 HKCR $R1 "" ; read current file association + StrCmp "$1" "" NoBackup ; is it empty + StrCmp "$1" "$R0" NoBackup ; is it our own + WriteRegStr HKCR $R1 "backup_val" "$1" ; backup current value +NoBackup: + WriteRegStr HKCR $R1 "" "$R0" ; set our file association + + ReadRegStr $0 HKCR $R0 "" + StrCmp $0 "" 0 Skip + WriteRegStr HKCR "$R0" "" "$R0" + WriteRegStr HKCR "$R0\shell" "" "open" + WriteRegStr HKCR "$R0\DefaultIcon" "" "$R2,0" +Skip: + WriteRegStr HKCR "$R0\shell\open\command" "" '"$R2" "%1"' + +; Uncomment if you want a "Edit with XY" entry +; WriteRegStr HKCR "$R0\shell\edit" "" "Edit $R0" +; WriteRegStr HKCR "$R0\shell\edit\command" "" '"$R2" "%1"' + + Pop $1 + Pop $0 + Pop $R2 + Pop $R1 + Pop $R0 + + !verbose pop +!macroend + + + +!define UnRegisterExtension `!insertmacro UnRegisterExtensionCall` +!define un.UnRegisterExtension `!insertmacro UnRegisterExtensionCall` + +!macro UnRegisterExtension +!macroend + +!macro un.UnRegisterExtension +!macroend + +!macro UnRegisterExtension_ + !verbose push + !verbose ${_FileAssociation_VERBOSE} + + Exch $R1 ;desc + Exch + Exch $R0 ;ext + Exch + Push $0 + Push $1 + + ReadRegStr $1 HKCR $R0 "" + StrCmp $1 $R1 0 NoOwn ; only do this if we own it + ReadRegStr $1 HKCR $R0 "backup_val" + StrCmp $1 "" 0 Restore ; if backup="" then delete the whole key + DeleteRegKey HKCR $R0 + Goto NoOwn + +Restore: + WriteRegStr HKCR $R0 "" $1 + DeleteRegValue HKCR $R0 "backup_val" + DeleteRegKey HKCR $R1 ;Delete key with association name settings + +NoOwn: + + Pop $1 + Pop $0 + Pop $R1 + Pop $R0 + + !verbose pop +!macroend + +!endif # !FileAssociation_INCLUDED \ No newline at end of file diff --git a/cmake/NSIS.template.in b/cmake/NSIS.template.in index 6c7d4315..22807540 100644 --- a/cmake/NSIS.template.in +++ b/cmake/NSIS.template.in @@ -539,20 +539,18 @@ FunctionEnd ; Component sections @CPACK_NSIS_COMPONENT_SECTIONS@ +!include "FileAssociation.nsh" + Section "Open STL files with Cura" - WriteRegStr HKCR .stl "" "STL Model File" - DeleteRegValue HKCR .stl "Content Type" - WriteRegStr HKCR "Cura STL model file\DefaultIcon" "" "$INSTDIR\Cura.exe,0" - WriteRegStr HKCR "Cura STL model file\shell" "" "open" - WriteRegStr HKCR "Cura STL model file\shell\open\command" "" '"$INSTDIR\Cura.exe" "%1"' + ${RegisterExtension} "$INSTDIR\Cura.exe" ".stl" "Cura.model.STL" SectionEnd Section /o "Open OBJ files with Cura" - WriteRegStr HKCR .obj "" "Wavefront OBJ Model File" - DeleteRegValue HKCR .obj "Content Type" - WriteRegStr HKCR "Cura OBJ model file\DefaultIcon" "" "$INSTDIR\Cura.exe,0" - WriteRegStr HKCR "Cura OBJ model file\shell" "" "open" - WriteRegStr HKCR "Cura OBJ model file\shell\open\command" "" '"$INSTDIR\Cura.exe" "%1"' + ${RegisterExtension} "$INSTDIR\Cura.exe" ".obj" "Cura.model.OBJ" +SectionEnd + +Section /o "Open 3MF files with Cura" + ${RegisterExtension} "$INSTDIR\Cura.exe" ".3mf" "Cura.model.3MF" SectionEnd ;-------------------------------- @@ -860,6 +858,11 @@ Section "Uninstall" Delete "$INSTDIR\AddRemove.exe" !endif + ;Unregister file assiciations + ${UnRegisterExtension} ".stl" "Cura.model.STL" + ${UnRegisterExtension} ".obj" "Cura.model.OBJ" + ${UnRegisterExtension} ".3mf" "Cura.model.3MF" + ;Remove the uninstaller itself. Delete "$INSTDIR\Uninstall.exe" DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" From c5d0005bcb89b3373fb65209624fa4a99cbaadbe Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Thu, 27 Oct 2016 18:53:06 +0200 Subject: [PATCH 069/101] README.md: Updating list of Windows dependencies Contributes to CURA-2150 --- README.md | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 673fbbb0..9400a67b 100644 --- a/README.md +++ b/README.md @@ -24,15 +24,30 @@ On Windows, the following dependencies are needed for building: * **git for windows** (https://git-for-windows.github.io/) The `git` command should be available on your `%PATH%`. Make sure that the `cmd` directory in the git for windows installation directory is on the `%PATH%` and *not* its `bin` directory, otherwise mingw32 will complain about `sh.exe` being on the path. * **CMake** (http://www.cmake.org/) Once CMake is installed make sure it is available on your `%PATH%`. Check this by running `cmake --version` in the Windows console. -* **MinGW-W64** >= 4.9.04 (http://mingw-w64.org/doku.php) Once installed, its `bin` directory should be available on your `%PATH%`. Test this by running `mingw32-make --version` in the Windows console. -* **Python** 3.4 (http://python.org/, note that using Python 3.5 is currently untested on Windows) -* **NumPy** from http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy - make sure to get the NON-MKL version! -* **SciPy** from http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy +* **MinGW-W64** >= 5.3.0 (http://mingw-w64.org/doku.php) Once installed, its `bin` directory should be available on your `%PATH%`. Test this by running `mingw32-make --version` in the Windows console. +* **Python** 3.5 (http://python.org/, note that the version "3.5" is hardcoded across this project) +* **NumPy** (http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy) + You'll need to download a .whl from this site for Python 3.5 and install it via `pip install .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 .whl`. +* **Protobuf** (https://pypi.python.org/pypi/protobuf/3.1.0.post1) + It can be easyly installed via `pip3 install protobuf` +* **PySerial** from https://pypi.python.org/pypi/pyserial/3.2.1 + It can be easyly installed via `pip3 install pyserial` +* **PyQt5** from https://pypi.python.org/pypi/PyQt5/5.7 + It can be easyly installed via `pip3 install PyQt5` +* **SIP** from https://pypi.python.org/pypi/SIP/4.18.1 + It can be easyly installed via `pip3 install sip` +* **Zeroconf** from https://pypi.python.org/pypi/zeroconf/0.17.6 + It can be easyly installed via `pip3 install zeroconf` +* **NumPy-STL** from https://pypi.python.org/pypi/numpy-stl/2.0.0 + It can be easyly installed via `pip3 install numpy-stl` * **Microsoft Visual Studio 2015 (community edition)**: Install Programming languages: Visual c++ (all), Python Tools for Visual Studio (Nov 2015) Windows & Web Development: Universal Windows App Development Tools (Tools 1.2 & windows 10 SDK-10/0/10586; Windows 10 SDK -10.0.10240) -* **Py2Exe** (https://pypi.python.org/pypi/py2exe/0.9.2.0/#downloads) The easiest way to install this is to run the command `pip install py2exe`. The executable `build_exe.exe` should now be in your `/Scripts` directory. You may have to add `/Scripts` to you `%PATH%`. -* **NSIS 3** (http://nsis.sourceforge.net/Main_Page) for creating the installer +* **cx_Freeze** (https://pypi.python.org/pypi/cx_Freeze) + The easiest way to install this is to use a wheel (*.whl file) and install it via `pip install .whl`. You may have to add `/Scripts` to you `%PATH%`. (Last tested version was: cx_Freeze-5.0-cp35-cp35m-win_amd64.whl) +* **NSIS 3** (http://nsis.sourceforge.net/Main_Page) for creating the installer. Additional NSIS scripts are shipped with this project. Make sure these dependencies are available from your path. From ecc99cc8bee83789f8c405ecf38a15e5fc23759a Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Thu, 27 Oct 2016 19:04:14 +0200 Subject: [PATCH 070/101] CMake: Making sure CMAKE_PREFIX_PATH is absolute 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 --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c32998ec..a360e526 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,12 @@ if(SIGN_PACKAGE) set(BUILD_PACKAGE ON) endif() +# This should care that our CMAKE_PREFIX_PATH is absolute at the end... +get_filename_component(CMAKE_PREFIX_PATH + ${CMAKE_PREFIX_PATH} + ABSOLUTE + CACHE FORCE) + set(EXTERNALPROJECT_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/inst) GetFromEnvironmentOrCache(TAG_OR_BRANCH "master" STRING "The name of the tag or branch to build") From 10f416b776672245e5128588fddd82801dbb9b78 Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Thu, 27 Oct 2016 19:06:36 +0200 Subject: [PATCH 071/101] Windows: Updating setup_win32.py.in script 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 --- packaging/setup_win32.py.in | 213 ++++++++++++++---------------------- 1 file changed, 80 insertions(+), 133 deletions(-) diff --git a/packaging/setup_win32.py.in b/packaging/setup_win32.py.in index 76d7c0af..e3b753fb 100644 --- a/packaging/setup_win32.py.in +++ b/packaging/setup_win32.py.in @@ -1,141 +1,88 @@ -# Copyright (c) 2015 Ultimaker B.V. -# Cura is released under the terms of the AGPLv3 or higher. +# Needed build-ins +import sys +import os.path -from distutils.core import setup -import py2exe -import UM -import UM.Qt -import cura -import os -import re -import shutil -import site -import Arcus -import scipy +# Importing preinstalled modules to get their paths +import PyQt5 import numpy -import numpy.core -import stl -import stl.mesh - -# work around the limitation that shutil.copytree does not allow the target directory to exist -def copytree(src, dst, symlinks=False, ignore=None): - if not os.path.exists(dst): - os.makedirs(dst) - for item in os.listdir(src): - s = os.path.join(src, item) - d = os.path.join(dst, item) - if os.path.isdir(s): - copytree(s, d, symlinks, ignore) - else: - shutil.copy2(s, d) - -def findSubPackages(root_package_path, package_name): - includes = [] - for dirpath, dirnames, filenames in os.walk(os.path.dirname(root_package_path)): - if "__" in dirpath: - continue - - if "tests" in dirnames: - dirnames.remove("tests") - - module_path = dirpath.replace(os.path.dirname(root_package_path), package_name) - module_path = module_path.split(os.path.sep) - module_name = ".".join(module_path) - if os.path.isfile(dirpath + "/__init__.py"): - includes.append(module_name) - for filename in filenames: - if "__" not in filename and os.path.splitext(filename)[1] in [".py", ".pyd"]: - includes.append(module_name + "." + os.path.splitext(filename)[0]) - return includes - -includes = [ - "sip", - "ctypes", - "uuid", - "UM", - "PyQt5.QtNetwork", - "PyQt5._QOpenGLFunctions_2_0", - "serial", - "Arcus", - "xml.etree", - "xml.etree.ElementTree", - "cura", - "cura.OneAtATimeIterator", - "zeroconf" -] - -# Include all the UM modules in the includes. As py2exe fails to properly find all the dependencies due to the plugin architecture. -includes += findSubPackages(UM.__file__, "UM") -includes += findSubPackages(cura.__file__, "cura") -includes += findSubPackages(scipy.__file__, "scipy") -includes += findSubPackages(stl.__file__, "stl") - -# Filter out the known bad apples. -includes = [x for x in includes if x not in [ - "scipy.interpolate.interpnd_info", - "scipy.misc.pilutil", - "scipy.special.generate_ufuncs", - "scipy.special._testutils", - "scipy.linalg._testutils", - "scipy._lib._testutils"]] - -print("Removing previous distribution package") -shutil.rmtree("dist", True) - -setup( - name="Cura", - version="@CURA_MAJOR_VERSION@.@CURA_MINOR_VERSION@.@CURA_PATCH_VERSION@", - author="Ultimaker", - author_email="a.hiemstra@ultimaker.com", - url="http://software.ultimaker.com/", - license="GNU AFFERO GENERAL PUBLIC LICENSE (AGPL)", - scripts=["inst/bin/cura_app.py"], - windows=[{"script": "inst/bin/cura_app.py", "dest_name": "Cura", "icon_resources": [(1, "@CMAKE_SOURCE_DIR@/cura.ico")]}], - #console=[{"script": "cura_app.py"}], - options={"py2exe": {"skip_archive": False, "includes": includes}} -) - -print("Copying Cura plugins.") -copytree("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/uranium/plugins", "dist/plugins", ignore = shutil.ignore_patterns("OBJWriter", "MLPWriter", "MLPReader")) -copytree("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/cura/plugins", "dist/plugins") - -print("Copying resources.") -copytree("@EXTERNALPROJECT_INSTALL_PREFIX@/share/uranium/resources", "dist/resources") -copytree("@EXTERNALPROJECT_INSTALL_PREFIX@/share/cura/resources", "dist/resources") - -print("Coping Uranium QML.") -copytree("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/python3.4/site-packages/UM/Qt/qml/UM", "dist/qml/UM") - -qt_lib_dir = None -qt_bin_dir = None -if os.path.exists("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/plugins"): - qt_lib_dir = "@EXTERNALPROJECT_INSTALL_PREFIX@/lib" - qt_bin_dir = "@EXTERNALPROJECT_INSTALL_PREFIX@/bin" -else: - import PyQt5.QtCore - qt_lib_dir = os.path.dirname(PyQt5.QtCore.__file__) - qt_bin_dir = os.path.dirname(PyQt5.QtCore.__file__) - -print("Copying Qt5 plugins") -copytree(os.path.join(qt_lib_dir, "plugins"), "dist/PyQt5/plugins") -print("Copying QtQuick plugins") -copytree(os.path.join(qt_lib_dir, "qml"), "dist/qml") -print("Copying Qt5 svg library") -shutil.copy(os.path.join(qt_bin_dir, "Qt5Svg.dll"), "dist/Qt5Svg.dll") +from cx_Freeze import setup, Executable, hooks + +def load_scipy(finder, module): + finder.IncludePackage("scipy._lib") + finder.IncludePackage("scipy.misc") + finder.IncludePackage("scipy.sparse.csgraph._validation") + +hooks.load_scipy = load_scipy + +def load_pyqt5_qtquick(finder, module): + finder.IncludeModule("PyQt5.QtCore") + finder.IncludeModule("PyQt5.QtGui") + finder.IncludeModule("PyQt5.QtQml") + finder.IncludeModule("PyQt5.QtNetwork") + finder.IncludeModule("PyQt5._QOpenGLFunctions_2_0") + +hooks.load_PyQt5_QtQuick = load_pyqt5_qtquick + +search_path = sys.path.copy() +search_path.insert(1, "@EXTERNALPROJECT_INSTALL_PREFIX@/lib/python3.5/site-packages/") +search_path.insert(2, "@CMAKE_PREFIX_PATH@/lib/python3.5/site-packages/") + +# Dependencies are automatically detected, but it might need +# fine tuning. +build_options = { + "build_exe": "package", + "path": search_path, + "packages": [ + "xml.etree", + "uuid", + "serial", + "zeroconf", + "UM", + "cura", + "stl", + ], + "include_files": [ + ("@EXTERNALPROJECT_INSTALL_PREFIX@/bin/CuraEngine.exe", ""), + ("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/cura", "plugins"), + ("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/uranium", "plugins"), + ("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/python3.5/site-packages/UM/Qt/qml/UM", "qml/UM"), + ("@EXTERNALPROJECT_INSTALL_PREFIX@/share/cura/resources", "resources"), + ("@EXTERNALPROJECT_INSTALL_PREFIX@/share/uranium/resources", "resources"), + # Preinstalled PyQt5 installation + (PyQt5.__path__[0] + "/Qt/qml/Qt", "qml/Qt"), + (PyQt5.__path__[0] + "/Qt/qml/QtQml", "qml/QtQml"), + (PyQt5.__path__[0] + "/Qt/qml/QtQuick", "qml/QtQuick"), + (PyQt5.__path__[0] + "/Qt/qml/QtQuick.2", "qml/QtQuick.2"), + ], + "excludes": [ ] +} + +# Extra libraries for numpy.core* print("Copy numpy DLLs") numpy_core_dir = os.path.dirname(numpy.core.__file__) for item in os.listdir(numpy_core_dir): if item.endswith(".dll"): - shutil.copy(os.path.join(numpy_core_dir, item), os.path.join("dist", item)) - -print("Copy CuraEngine") -shutil.copy("@EXTERNALPROJECT_INSTALL_PREFIX@/bin/CuraEngine.exe", "dist/CuraEngine.exe") -shutil.copy("@compiler_dir@/libstdc++-6.dll", "dist/libstdc++-6.dll") -shutil.copy("@compiler_dir@/libwinpthread-1.dll", "dist/libwinpthread-1.dll") -try: - shutil.copy("@compiler_dir@/libgcc_s_seh-1.dll", "dist/libgcc_s_seh-1.dll") -except FileNotFoundError: - shutil.copy("@compiler_dir@/libgcc_s_dw2-1.dll", "dist/libgcc_s_dw2-1.dll") + dll_abspath = os.path.join(numpy_core_dir, item) + print("Appending MKL library: " + dll_abspath) + build_options["include_files"].append((dll_abspath, ""),) + +executables = [ + Executable(script="@EXTERNALPROJECT_INSTALL_PREFIX@/bin/cura_app.py", + base="Win32GUI", + targetName = "Cura.exe", + icon="@CMAKE_SOURCE_DIR@/cura.ico" + ) +] -os.rename("dist/cura_app.exe", "dist/Cura.exe") +setup( + name = "Cura", + version = "@CURA_VERSION_MAJOR@.@CURA_VERSION_MINOR@.@CURA_VERSION_PATCH@", + description = "3D Printing Software", + author = "Ultimaker B.V.", + url = "http://software.ultimaker.com/", + license = "GNU AFFERO GENERAL PUBLIC LICENSE (AGPL)", + + options = {"build_exe": build_options}, + executables = executables +) From 0b96ed49f6bdb1b85c3a80b6d762032fb1eda8f0 Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Thu, 27 Oct 2016 19:08:19 +0200 Subject: [PATCH 072/101] gitignore: Adding Eclipse+PyDev --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 0fff7f18..53595c86 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,7 @@ build resources/i18n/en resources/i18n/x-test .DS_Store + +# Eclipse+PyDev +.project +.pydevproject From 2f2862a09d9588a4dc56e4b8640bfff484043cb2 Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Thu, 27 Oct 2016 19:09:27 +0200 Subject: [PATCH 073/101] gitignore: Remove ignoring deb files We don't build deb's anymore.. --- .gitignore | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 53595c86..101d5d4f 100644 --- a/.gitignore +++ b/.gitignore @@ -9,9 +9,7 @@ _CPack_Packages/ cmake_install.cmake /inst/ -# CMake - Debian -*.deb - +# Various files *.pyc *kdev* __pycache__ From e777e2e287150097e14ec6cf571199e983640958 Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Thu, 27 Oct 2016 19:14:06 +0200 Subject: [PATCH 074/101] packaging: Adding initial script for Windows 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 --- packaging/windows.cmake | 56 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 packaging/windows.cmake diff --git a/packaging/windows.cmake b/packaging/windows.cmake new file mode 100644 index 00000000..327630a1 --- /dev/null +++ b/packaging/windows.cmake @@ -0,0 +1,56 @@ +set(CPACK_GENERATOR "NSIS") +find_package(cx_freeze 5.0 REQUIRED) + +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) + +# 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}") +else() + set(NSIS_SCRIPT_COPY_PATH "${CMAKE_BINARY_DIR}/_CPack_Packages/win64/${CPACK_GENERATOR}") +endif() + +add_custom_command( + TARGET build_bundle POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/${CPACK_GENERATOR} ${NSIS_SCRIPT_COPY_PATH} + COMMENT "Copying NSIS scripts" + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} +) + +add_custom_command( + TARGET build_bundle PRE_LINK + COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/package + COMMENT "Cleaning old build/ directory" + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} +) + +add_custom_command( + TARGET build_bundle POST_BUILD + COMMAND ${PYTHON_EXECUTABLE} setup.py build_exe + COMMENT "Running cx_Freeze" + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} +) + +install(DIRECTORY ${CMAKE_BINARY_DIR}/package/ + DESTINATION "." + USE_SOURCE_PERMISSIONS + COMPONENT "cura" +) + +if(BUILD_OS_WIN32) + install(FILES ${EXTERNALPROJECT_INSTALL_PREFIX}/vcredist_x32.exe + DESTINATION "." + COMPONENT "vcredist" + ) +else() + install(FILES ${EXTERNALPROJECT_INSTALL_PREFIX}/vcredist_x64.exe + DESTINATION "." + COMPONENT "vcredist" + ) +endif() + +install(DIRECTORY ${EXTERNALPROJECT_INSTALL_PREFIX}/arduino DESTINATION "." COMPONENT "arduino") From abdb75b2eaddc15428e74f85ad91c2ea61fa31bd Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Thu, 27 Oct 2016 19:19:36 +0200 Subject: [PATCH 075/101] signing: Adding initial script for Windows 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 --- signing/windows.cmake | 77 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 signing/windows.cmake diff --git a/signing/windows.cmake b/signing/windows.cmake new file mode 100644 index 00000000..a1cd5ec9 --- /dev/null +++ b/signing/windows.cmake @@ -0,0 +1,77 @@ +# Signing the Installer and Cura.exe with "signtool.exe" +# Location on my desktop: +# -> C:\Program Files (x86)\Windows Kits\10\bin\x86\signtool.exe +# * Manual: https://msdn.microsoft.com/de-de/library/8s9b9yaz(v=vs.110).aspx + +set(WINDOWS_IDENTITIY_PFX_FILE "THE_PFX_FILE_IS_MISSING_HERE!" CACHE STRING "PFX file, which represents the identity of the developer.") +set(WINDOWS_IDENTITIY_PFX_PASSWORD "" CACHE STRING "Password, which unlocks the PFX file (optional)") + +set(signtool_OPTIONS "/fd SHA256 /a /f ${WINDOWS_IDENTITIY_PFX_FILE} /f /p ${WINDOWS_IDENTITIY_PFX_PASSWORD}") + +if(${WINDOWS_IDENTITIY_PFX_PASSWORD}) + set(signtool_OPTIONS ${signtool_OPTIONS} "/p ${WINDOWS_IDENTITIY_PFX_PASSWORD}") +endif() + +include(CPackComponent) + +cpack_add_component(cura DISPLAY_NAME "Cura Executable and Data Files" REQUIRED) +cpack_add_component(vcredist DISPLAY_NAME "Install Visual Studio 2010 Redistributable") +cpack_add_component(arduino DISPLAY_NAME "Install Arduino Drivers") + +set(CPACK_PACKAGE_NAME "Cura") +set(CPACK_PACKAGE_VENDOR "Ultimaker") +set(CPACK_PACKAGE_VERSION_MAJOR ${CURA_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${CURA_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${CURA_VERSION_PATCH}) +set(CPACK_PACKAGE_VERSION ${CURA_VERSION}) +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Cura 3D Printing Software") +set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE) +set(CPACK_PACKAGE_CONTACT "Arjen Hiemstra ") + +set(CPACK_PACKAGE_EXECUTABLES Cura "Cura ${CURA_VERSION_MAJOR}.${CURA_VERSION_MINOR}.${CURA_VERSION_PATCH}") +set(CPACK_PACKAGE_INSTALL_DIRECTORY "Cura ${CURA_VERSION_MAJOR}.${CURA_VERSION_MINOR}") + +set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) +set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".") +set(CPACK_NSIS_MUI_FINISHPAGE_RUN "Cura.exe") +set(CPACK_NSIS_MENU_LINKS + "https://ultimaker.com/en/support/software" "Cura Online Documentation" + "https://github.com/ultimaker/cura" "Cura Development Resources" +) +if(BUILD_OS_WIN32) + set(CPACK_NSIS_PACKAGE_ARCHITECTURE "32") +else() + set(CPACK_NSIS_PACKAGE_ARCHITECTURE "64") +endif() + +set(CPACK_NSIS_PACKAGE_NAME ${CPACK_PACKAGE_NAME}) + +include(CPack) + +if(EXISTS WINDOWS_IDENTITIY_PFX_FILE) + message(STATUS "Signing executables with: " ${WINDOWS_IDENTITIY_PFX_FILE}) + if(${WINDOWS_IDENTITIY_PFX_PASSWORD}) + message(WARNING "USE WITH CAUTION: Password for the PFX file has been set!") + endif() + + # Signing Cura.exe + add_custom_command( + TARGET signing PRE_BUILD + COMMAND signtool sign ${signtool_OPTIONS} ${CMAKE_BINARY_DIR}/package/Cura.exe + ## Other optional options: + # /tr timestampServerUrl + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/build + ) + + # Signing the installer + add_custom_command( + TARGET package POST_BUILD + COMMAND signtool sign ${signtool_OPTIONS} ${CMAKE_BINARY_DIR}/${CPACK_PACKAGE_FILE_NAME}.exe + ## Other optional options: + # /tr timestampServerUrl + ## NOTE: IN CASE CPACK_PACKAGE_FILE_NAME DOESN'T WORK: ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CURA_MINOR_VERSION}.${CURA_PATCH_VERSION}-${CURA_VERSION}-win32.exe + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/build + ) +else() + message(WARNING "Could not find the PFX file. Skipping signing...") +endif() \ No newline at end of file From b74c60298fdf9ed80a3d6d75440f8eabf4b8a723 Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Thu, 27 Oct 2016 19:47:12 +0200 Subject: [PATCH 076/101] README.md: Merging old environment_split instructions --- README.md | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 9400a67b..ffbbe04f 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ For 64-bit builds: * PyQt 5.4 (https://riverbankcomputing.com/software/pyqt/download5, Building PyQt currently fails using MinGW 64-bit) * Install protobuf.wheel found in cura-build-binaries (TODO: create cura-build-binaries repo) -* Create empty __init__.py in c:\Python34\Lib\site-packages\google (TODO: make it part of the proto.wheel installation) +* Create empty ```__init__.py``` in c:\Python34\Lib\site-packages\google (TODO: make it part of the proto.wheel installation) ```shell REM 32-bit @@ -94,35 +94,11 @@ Before make package - copy arduino to cura-build/ ## Ubuntu/Linux -cura-build can build Ubuntu/Debian packages of Cura. - -Dependencies: - -* python3 (>= 3.4.0) -* python3-dev (>= 3.4.0) -* python3-pyqt5 (>= 5.4.0) -* python3-pyqt5.qtopengl (>= 5.4.0) -* python3-pyqt5.qtquick (>= 5.4.0) -* python3-pyqt5.qtsvg (>= 5.4.0) -* python3-numpy (>= 1.8.0) -* python3-serial (>= 2.6) -* python3-opengl (>= 3.0) -* python3-setuptools -* python3-dev -* qml-module-qtquick2 (>= 5.4.0) -* qml-module-qtquick-window2 (>= 5.4.0) -* qml-module-qtquick-layouts (>= 5.4.0) -* qml-module-qtquick-dialogs (>= 5.4.0) -* qml-module-qtquick-controls (>= 5.4.0) -* zlib1g -* build-essential -* cmake -* gfortran +cura-build can build AppImage packages of Cura. To build, make sure these dependencies are installed, then clone this repository and run the following commands from your clone: ```shell -sudo apt-get install gfortran python3 python3-dev python3-pyqt5 python3-pyqt5.qtopengl python3-pyqt5.qtquick python3-pyqt5.qtsvg python3-numpy python3-serial python3-opengl python3-setuptools qml-module-qtquick2 qml-module-qtquick-window2 qml-module-qtquick-layouts qml-module-qtquick-dialogs qml-module-qtquick-controls gfortran git clone http://github.com/Ultimaker/cura-build.git cd cura-build ``` @@ -134,6 +110,7 @@ cmake .. make make package ``` + ## CentOS/Linux cura-build can build CentOS/RHEL packages of Cura. From 33372d80fbffff9c04cdc319d5d617fe9491742c Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Thu, 27 Oct 2016 19:54:14 +0200 Subject: [PATCH 077/101] Adding old ExtraRepository.cmake script Useful when it is needed to add private sources into the build. --- projects/ExtraRepository.cmake | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 projects/ExtraRepository.cmake diff --git a/projects/ExtraRepository.cmake b/projects/ExtraRepository.cmake new file mode 100644 index 00000000..87e62362 --- /dev/null +++ b/projects/ExtraRepository.cmake @@ -0,0 +1,33 @@ +foreach(extra_repository ${EXTRA_REPOSITORIES}) + string(REPLACE " " ";" extra_repository ${extra_repository}) + list(LENGTH extra_repository extra_repository_length) + math(EXPR extra_repository_length "${extra_repository_length}-1") + + if(extra_repository_length LESS 2) + message(FATAL_ERROR "The entry you have passed is too short: ${extra_repository_length}") + endif() + + list(GET extra_repository 0 extra_repository_name) + list(GET extra_repository 1 extra_repository_url) + list(GET extra_repository 2 extra_repository_cmake_opts) + + if(extra_repository_length GREATER 2) + foreach(extra_repository_length_current RANGE 3 ${extra_repository_length}) + list(GET extra_repository ${extra_repository_length_current} extra_repository_cmake_opts_next) + set(extra_repository_cmake_opts "${extra_repository_cmake_opts} ${extra_repository_cmake_opts_next}") + endforeach() + endif() + + message(STATUS "Adding extra repository called: ${extra_repository_name}") + message(STATUS " ... with GIT-URL: ${extra_repository_url}") + message(STATUS " ... and CMake options: ${extra_repository_cmake_opts}") + + ExternalProject_Add(${extra_repository_name} + GIT_REPOSITORY ${extra_repository_url} + GIT_TAG origin/master + CMAKE_ARGS ${extra_repository_cmake_opts} + ) + + SetProjectDependencies(TARGET ${extra_repository_name} DEPENDS Cura) + +endforeach() From 08788ed41400ed2f8647a5c49c680c61bb44a5e6 Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Tue, 1 Nov 2016 21:41:07 +0100 Subject: [PATCH 078/101] signing: Windows: Fixes on signtool.exe usage 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 --- signing/windows.cmake | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/signing/windows.cmake b/signing/windows.cmake index a1cd5ec9..541727c1 100644 --- a/signing/windows.cmake +++ b/signing/windows.cmake @@ -6,10 +6,12 @@ set(WINDOWS_IDENTITIY_PFX_FILE "THE_PFX_FILE_IS_MISSING_HERE!" CACHE STRING "PFX file, which represents the identity of the developer.") set(WINDOWS_IDENTITIY_PFX_PASSWORD "" CACHE STRING "Password, which unlocks the PFX file (optional)") -set(signtool_OPTIONS "/fd SHA256 /a /f ${WINDOWS_IDENTITIY_PFX_FILE} /f /p ${WINDOWS_IDENTITIY_PFX_PASSWORD}") +set(signtool_OPTIONS /fd SHA256 /a /f ${WINDOWS_IDENTITIY_PFX_FILE}) -if(${WINDOWS_IDENTITIY_PFX_PASSWORD}) - set(signtool_OPTIONS ${signtool_OPTIONS} "/p ${WINDOWS_IDENTITIY_PFX_PASSWORD}") +if(NOT ${WINDOWS_IDENTITIY_PFX_PASSWORD} EQUAL "") + set(signtool_OPTIONS ${signtool_OPTIONS} /p ${WINDOWS_IDENTITIY_PFX_PASSWORD}) +else() + message(FATAL_ERROR "You can't sign your executables without passing your password here!") # Sadly... endif() include(CPackComponent) @@ -48,7 +50,7 @@ set(CPACK_NSIS_PACKAGE_NAME ${CPACK_PACKAGE_NAME}) include(CPack) -if(EXISTS WINDOWS_IDENTITIY_PFX_FILE) +if(EXISTS ${WINDOWS_IDENTITIY_PFX_FILE}) message(STATUS "Signing executables with: " ${WINDOWS_IDENTITIY_PFX_FILE}) if(${WINDOWS_IDENTITIY_PFX_PASSWORD}) message(WARNING "USE WITH CAUTION: Password for the PFX file has been set!") @@ -57,21 +59,35 @@ if(EXISTS WINDOWS_IDENTITIY_PFX_FILE) # Signing Cura.exe add_custom_command( TARGET signing PRE_BUILD - COMMAND signtool sign ${signtool_OPTIONS} ${CMAKE_BINARY_DIR}/package/Cura.exe + COMMAND signtool sign ${signtool_OPTIONS} Cura.exe + ## Other optional options: + # /tr timestampServerUrl + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/package + ) + + # Signing CuraEngine.exe + add_custom_command( + TARGET signing PRE_BUILD + COMMAND signtool sign ${signtool_OPTIONS} CuraEngine.exe ## Other optional options: # /tr timestampServerUrl - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/build + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/package ) # Signing the installer + add_custom_target(sign_installer) # Sadly "TARGET package POST_BUILD" can't be used in the following add_custom_command() + if(${BUILD_OS_WIN32}) + set(CURA_INSTALLER_NAME ${CPACK_NSIS_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-win32.exe) + else() + set(CURA_INSTALLER_NAME ${CPACK_NSIS_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-win64.exe) + endif() add_custom_command( - TARGET package POST_BUILD - COMMAND signtool sign ${signtool_OPTIONS} ${CMAKE_BINARY_DIR}/${CPACK_PACKAGE_FILE_NAME}.exe + TARGET sign_installer + COMMAND signtool sign ${signtool_OPTIONS} ${CURA_INSTALLER_NAME} ## Other optional options: # /tr timestampServerUrl - ## NOTE: IN CASE CPACK_PACKAGE_FILE_NAME DOESN'T WORK: ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CURA_MINOR_VERSION}.${CURA_PATCH_VERSION}-${CURA_VERSION}-win32.exe - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/build + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) else() - message(WARNING "Could not find the PFX file. Skipping signing...") + message(FATAL_ERROR "Could not find the PFX file. Can not sign the executables!") endif() \ No newline at end of file From f34d553ef5c7612d9bde34c113c4190121182263 Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Fri, 11 Nov 2016 15:06:55 +0100 Subject: [PATCH 079/101] README: Remove dependency on Protobuf's python binding We only need the protobuf compiler to generate our Arcus binding. No need for the protobuf Python module. Contributes to CURA-2150 --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index ffbbe04f..8da42d7e 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,6 @@ On Windows, the following dependencies are needed for building: You'll need to download a .whl from this site for Python 3.5 and install it via `pip install .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 .whl`. -* **Protobuf** (https://pypi.python.org/pypi/protobuf/3.1.0.post1) - It can be easyly installed via `pip3 install protobuf` * **PySerial** from https://pypi.python.org/pypi/pyserial/3.2.1 It can be easyly installed via `pip3 install pyserial` * **PyQt5** from https://pypi.python.org/pypi/PyQt5/5.7 From 292f18bf845db2d34fe07e95a2644ab7cb8b3182 Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Fri, 11 Nov 2016 15:09:47 +0100 Subject: [PATCH 080/101] Windows: Making unsigned builds non-fatal Contributes to CURA-2150 --- signing/windows.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/signing/windows.cmake b/signing/windows.cmake index 541727c1..7668281b 100644 --- a/signing/windows.cmake +++ b/signing/windows.cmake @@ -89,5 +89,5 @@ if(EXISTS ${WINDOWS_IDENTITIY_PFX_FILE}) WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) else() - message(FATAL_ERROR "Could not find the PFX file. Can not sign the executables!") + message(WARNING "Could not find the PFX file. Can not sign the executables!") endif() \ No newline at end of file From 464603eb65c14ae9fda118caf7e424970e35b4f0 Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Fri, 11 Nov 2016 15:14:46 +0100 Subject: [PATCH 081/101] NSIS: Adding X3D association Contributes to CURA-2150 --- cmake/NSIS.template.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/NSIS.template.in b/cmake/NSIS.template.in index 22807540..ad9507c8 100644 --- a/cmake/NSIS.template.in +++ b/cmake/NSIS.template.in @@ -553,6 +553,10 @@ Section /o "Open 3MF files with Cura" ${RegisterExtension} "$INSTDIR\Cura.exe" ".3mf" "Cura.model.3MF" SectionEnd +Section /o "Open X3D files with Cura" + ${RegisterExtension} "$INSTDIR\Cura.exe" ".x3d" "Cura.model.X3D" +SectionEnd + ;-------------------------------- ; Define some macro setting for the gui @CPACK_NSIS_INSTALLER_MUI_ICON_CODE@ @@ -862,6 +866,7 @@ Section "Uninstall" ${UnRegisterExtension} ".stl" "Cura.model.STL" ${UnRegisterExtension} ".obj" "Cura.model.OBJ" ${UnRegisterExtension} ".3mf" "Cura.model.3MF" + ${UnRegisterExtension} ".x3d" "Cura.model.X3D" ;Remove the uninstaller itself. Delete "$INSTDIR\Uninstall.exe" From 4f50035b653bd60a7980ec080ad26e681f9ac3ab Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Fri, 11 Nov 2016 15:16:46 +0100 Subject: [PATCH 082/101] NSIS: Sorting file association by alphabet Contributes to CURA-2150 --- cmake/NSIS.template.in | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmake/NSIS.template.in b/cmake/NSIS.template.in index ad9507c8..27781644 100644 --- a/cmake/NSIS.template.in +++ b/cmake/NSIS.template.in @@ -541,16 +541,16 @@ FunctionEnd !include "FileAssociation.nsh" -Section "Open STL files with Cura" - ${RegisterExtension} "$INSTDIR\Cura.exe" ".stl" "Cura.model.STL" +Section /o "Open 3MF files with Cura" + ${RegisterExtension} "$INSTDIR\Cura.exe" ".3mf" "Cura.model.3MF" SectionEnd Section /o "Open OBJ files with Cura" ${RegisterExtension} "$INSTDIR\Cura.exe" ".obj" "Cura.model.OBJ" SectionEnd -Section /o "Open 3MF files with Cura" - ${RegisterExtension} "$INSTDIR\Cura.exe" ".3mf" "Cura.model.3MF" +Section "Open STL files with Cura" + ${RegisterExtension} "$INSTDIR\Cura.exe" ".stl" "Cura.model.STL" SectionEnd Section /o "Open X3D files with Cura" @@ -863,9 +863,9 @@ Section "Uninstall" !endif ;Unregister file assiciations - ${UnRegisterExtension} ".stl" "Cura.model.STL" - ${UnRegisterExtension} ".obj" "Cura.model.OBJ" ${UnRegisterExtension} ".3mf" "Cura.model.3MF" + ${UnRegisterExtension} ".obj" "Cura.model.OBJ" + ${UnRegisterExtension} ".stl" "Cura.model.STL" ${UnRegisterExtension} ".x3d" "Cura.model.X3D" ;Remove the uninstaller itself. From d2a8d3c306f0a2f6918da1c60ad02ace90be0ec9 Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Fri, 11 Nov 2016 16:02:13 +0100 Subject: [PATCH 083/101] Windows: setup.py.in: Remove superfluous lines In Py2Exe we had to care about adding additional libraries for NumPy. Now cx_Freeze does this job for us. Contributes to CURA-2150 --- packaging/setup_win32.py.in | 9 --------- 1 file changed, 9 deletions(-) diff --git a/packaging/setup_win32.py.in b/packaging/setup_win32.py.in index e3b753fb..81733a1f 100644 --- a/packaging/setup_win32.py.in +++ b/packaging/setup_win32.py.in @@ -58,15 +58,6 @@ build_options = { "excludes": [ ] } -# Extra libraries for numpy.core* -print("Copy numpy DLLs") -numpy_core_dir = os.path.dirname(numpy.core.__file__) -for item in os.listdir(numpy_core_dir): - if item.endswith(".dll"): - dll_abspath = os.path.join(numpy_core_dir, item) - print("Appending MKL library: " + dll_abspath) - build_options["include_files"].append((dll_abspath, ""),) - executables = [ Executable(script="@EXTERNALPROJECT_INSTALL_PREFIX@/bin/cura_app.py", base="Win32GUI", From 71ed5b397cbde36ec0ed8e4900e5b89433267be1 Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Fri, 11 Nov 2016 16:12:30 +0100 Subject: [PATCH 084/101] Packaging: Windows: Depend on projects Discussion: https://github.com/Ultimaker/cura-build/pull/89#discussion_r86791566 Contributes to CURA-2150 --- packaging/windows.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/windows.cmake b/packaging/windows.cmake index 327630a1..9991069f 100644 --- a/packaging/windows.cmake +++ b/packaging/windows.cmake @@ -4,7 +4,7 @@ find_package(cx_freeze 5.0 REQUIRED) 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) +add_dependencies(build_bundle projects) # 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... From dc02432c575b3f6500b56216ce91e499fd629b6d Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Fri, 11 Nov 2016 18:07:29 +0100 Subject: [PATCH 085/101] Windows: Moving NSIS instructions to packaging 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 --- packaging/windows.cmake | 69 ++++++++++++++++++++++++++++++----------- signing/windows.cmake | 36 --------------------- 2 files changed, 51 insertions(+), 54 deletions(-) diff --git a/packaging/windows.cmake b/packaging/windows.cmake index 9991069f..f41e3d4a 100644 --- a/packaging/windows.cmake +++ b/packaging/windows.cmake @@ -1,4 +1,3 @@ -set(CPACK_GENERATOR "NSIS") find_package(cx_freeze 5.0 REQUIRED) configure_file(${CMAKE_CURRENT_LIST_DIR}/setup_win32.py.in setup.py @ONLY) @@ -6,25 +5,10 @@ add_custom_target(build_bundle) add_dependencies(packaging build_bundle) add_dependencies(build_bundle projects) -# 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}") -else() - set(NSIS_SCRIPT_COPY_PATH "${CMAKE_BINARY_DIR}/_CPack_Packages/win64/${CPACK_GENERATOR}") -endif() - -add_custom_command( - TARGET build_bundle POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/${CPACK_GENERATOR} ${NSIS_SCRIPT_COPY_PATH} - COMMENT "Copying NSIS scripts" - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} -) - add_custom_command( TARGET build_bundle PRE_LINK COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/package - COMMENT "Cleaning old build/ directory" + COMMENT "Cleaning old package/ directory" WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) @@ -35,6 +19,11 @@ add_custom_command( WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) +install(DIRECTORY ${EXTERNALPROJECT_INSTALL_PREFIX}/arduino + DESTINATION "." + COMPONENT "arduino" +) + install(DIRECTORY ${CMAKE_BINARY_DIR}/package/ DESTINATION "." USE_SOURCE_PERMISSIONS @@ -53,4 +42,48 @@ else() ) endif() -install(DIRECTORY ${EXTERNALPROJECT_INSTALL_PREFIX}/arduino DESTINATION "." COMPONENT "arduino") +include(CPackComponent) + +cpack_add_component(cura DISPLAY_NAME "Cura Executable and Data Files" REQUIRED) +cpack_add_component(vcredist DISPLAY_NAME "Install Visual Studio 2010 Redistributable") +cpack_add_component(arduino DISPLAY_NAME "Install Arduino Drivers") + +set(CPACK_GENERATOR "NSIS") +set(CPACK_PACKAGE_NAME "Cura") +set(CPACK_PACKAGE_VENDOR "Ultimaker") +set(CPACK_PACKAGE_VERSION_MAJOR ${CURA_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${CURA_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${CURA_VERSION_PATCH}) +set(CPACK_PACKAGE_VERSION ${CURA_VERSION}) +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Cura 3D Printing Software") +set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE) +set(CPACK_PACKAGE_CONTACT "Arjen Hiemstra ") + +set(CPACK_PACKAGE_EXECUTABLES Cura "Cura ${CURA_VERSION_MAJOR}.${CURA_VERSION_MINOR}.${CURA_VERSION_PATCH}") +set(CPACK_PACKAGE_INSTALL_DIRECTORY "Cura ${CURA_VERSION_MAJOR}.${CURA_VERSION_MINOR}") + +# CPackNSIS +set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) +set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".") +set(CPACK_NSIS_INSTALL_ROOT ${CMAKE_BINARY_DIR}/package_nsis) +set(CPACK_NSIS_MUI_FINISHPAGE_RUN "Cura.exe") +set(CPACK_NSIS_MENU_LINKS + "https://ultimaker.com/en/support/software" "Cura Online Documentation" + "https://github.com/ultimaker/cura" "Cura Development Resources" +) +if(BUILD_OS_WIN32) + set(CPACK_NSIS_PACKAGE_ARCHITECTURE "32") +else() + set(CPACK_NSIS_PACKAGE_ARCHITECTURE "64") +endif() + +set(CPACK_NSIS_PACKAGE_NAME ${CPACK_PACKAGE_NAME}) + +include(CPack) + +add_custom_command( + TARGET build_bundle POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/NSIS ${CMAKE_BINARY_DIR}/_CPack_Packages/${CPACK_SYSTEM_NAME}/NSIS + COMMENT "Copying NSIS scripts" + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} +) \ No newline at end of file diff --git a/signing/windows.cmake b/signing/windows.cmake index 7668281b..35822daf 100644 --- a/signing/windows.cmake +++ b/signing/windows.cmake @@ -14,42 +14,6 @@ else() message(FATAL_ERROR "You can't sign your executables without passing your password here!") # Sadly... endif() -include(CPackComponent) - -cpack_add_component(cura DISPLAY_NAME "Cura Executable and Data Files" REQUIRED) -cpack_add_component(vcredist DISPLAY_NAME "Install Visual Studio 2010 Redistributable") -cpack_add_component(arduino DISPLAY_NAME "Install Arduino Drivers") - -set(CPACK_PACKAGE_NAME "Cura") -set(CPACK_PACKAGE_VENDOR "Ultimaker") -set(CPACK_PACKAGE_VERSION_MAJOR ${CURA_VERSION_MAJOR}) -set(CPACK_PACKAGE_VERSION_MINOR ${CURA_VERSION_MINOR}) -set(CPACK_PACKAGE_VERSION_PATCH ${CURA_VERSION_PATCH}) -set(CPACK_PACKAGE_VERSION ${CURA_VERSION}) -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Cura 3D Printing Software") -set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE) -set(CPACK_PACKAGE_CONTACT "Arjen Hiemstra ") - -set(CPACK_PACKAGE_EXECUTABLES Cura "Cura ${CURA_VERSION_MAJOR}.${CURA_VERSION_MINOR}.${CURA_VERSION_PATCH}") -set(CPACK_PACKAGE_INSTALL_DIRECTORY "Cura ${CURA_VERSION_MAJOR}.${CURA_VERSION_MINOR}") - -set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) -set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".") -set(CPACK_NSIS_MUI_FINISHPAGE_RUN "Cura.exe") -set(CPACK_NSIS_MENU_LINKS - "https://ultimaker.com/en/support/software" "Cura Online Documentation" - "https://github.com/ultimaker/cura" "Cura Development Resources" -) -if(BUILD_OS_WIN32) - set(CPACK_NSIS_PACKAGE_ARCHITECTURE "32") -else() - set(CPACK_NSIS_PACKAGE_ARCHITECTURE "64") -endif() - -set(CPACK_NSIS_PACKAGE_NAME ${CPACK_PACKAGE_NAME}) - -include(CPack) - if(EXISTS ${WINDOWS_IDENTITIY_PFX_FILE}) message(STATUS "Signing executables with: " ${WINDOWS_IDENTITIY_PFX_FILE}) if(${WINDOWS_IDENTITIY_PFX_PASSWORD}) From 2d2a18bfda399a18cb76fbe2f3a14ffe63dfdff9 Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Fri, 11 Nov 2016 18:18:52 +0100 Subject: [PATCH 086/101] Windows: Adding additional notes Contributes to CURA-2150 --- packaging/windows.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packaging/windows.cmake b/packaging/windows.cmake index f41e3d4a..f14d64f8 100644 --- a/packaging/windows.cmake +++ b/packaging/windows.cmake @@ -71,6 +71,9 @@ set(CPACK_NSIS_MENU_LINKS "https://ultimaker.com/en/support/software" "Cura Online Documentation" "https://github.com/ultimaker/cura" "Cura Development Resources" ) + +# Needed to call the correct vcredist_x["32", "64"] executable +# TODO: Use a variable, which is already known. For example CPACK_SYSTEM_NAME -> "win32" if(BUILD_OS_WIN32) set(CPACK_NSIS_PACKAGE_ARCHITECTURE "32") else() @@ -83,6 +86,7 @@ include(CPack) add_custom_command( TARGET build_bundle POST_BUILD + # NOTE: Needs testing here, whether CPACK_SYSTEM_NAME is working good for 64bit builds, too. COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/NSIS ${CMAKE_BINARY_DIR}/_CPack_Packages/${CPACK_SYSTEM_NAME}/NSIS COMMENT "Copying NSIS scripts" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} From f76f5df13988b17ec4a056dd25fecfbc8f0909f4 Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Fri, 11 Nov 2016 18:29:04 +0100 Subject: [PATCH 087/101] Windows: Adding FindSigntool and using it Contributes to CURA-2150 --- cmake/FindSigntool.cmake | 7 +++++++ signing/windows.cmake | 8 +++++--- 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 cmake/FindSigntool.cmake diff --git a/cmake/FindSigntool.cmake b/cmake/FindSigntool.cmake new file mode 100644 index 00000000..d7fb62c9 --- /dev/null +++ b/cmake/FindSigntool.cmake @@ -0,0 +1,7 @@ + +find_program(SIGNTOOL_EXECUTABLE signtool.exe) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Signtool REQUIRED_VARS SIGNTOOL_EXECUTABLE) + +mark_as_advanced(SIGNTOOL_EXECUTABLE) \ No newline at end of file diff --git a/signing/windows.cmake b/signing/windows.cmake index 35822daf..ab9dc62c 100644 --- a/signing/windows.cmake +++ b/signing/windows.cmake @@ -3,6 +3,8 @@ # -> C:\Program Files (x86)\Windows Kits\10\bin\x86\signtool.exe # * Manual: https://msdn.microsoft.com/de-de/library/8s9b9yaz(v=vs.110).aspx +find_package(Signtool REQUIRED) + set(WINDOWS_IDENTITIY_PFX_FILE "THE_PFX_FILE_IS_MISSING_HERE!" CACHE STRING "PFX file, which represents the identity of the developer.") set(WINDOWS_IDENTITIY_PFX_PASSWORD "" CACHE STRING "Password, which unlocks the PFX file (optional)") @@ -23,7 +25,7 @@ if(EXISTS ${WINDOWS_IDENTITIY_PFX_FILE}) # Signing Cura.exe add_custom_command( TARGET signing PRE_BUILD - COMMAND signtool sign ${signtool_OPTIONS} Cura.exe + COMMAND ${SIGNTOOL_EXECUTABLE} sign ${signtool_OPTIONS} Cura.exe ## Other optional options: # /tr timestampServerUrl WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/package @@ -32,7 +34,7 @@ if(EXISTS ${WINDOWS_IDENTITIY_PFX_FILE}) # Signing CuraEngine.exe add_custom_command( TARGET signing PRE_BUILD - COMMAND signtool sign ${signtool_OPTIONS} CuraEngine.exe + COMMAND ${SIGNTOOL_EXECUTABLE} sign ${signtool_OPTIONS} CuraEngine.exe ## Other optional options: # /tr timestampServerUrl WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/package @@ -47,7 +49,7 @@ if(EXISTS ${WINDOWS_IDENTITIY_PFX_FILE}) endif() add_custom_command( TARGET sign_installer - COMMAND signtool sign ${signtool_OPTIONS} ${CURA_INSTALLER_NAME} + COMMAND ${SIGNTOOL_EXECUTABLE} sign ${signtool_OPTIONS} ${CURA_INSTALLER_NAME} ## Other optional options: # /tr timestampServerUrl WORKING_DIRECTORY ${CMAKE_BINARY_DIR} From f657c12e88b1b25196f10b92afee681c3fe73c63 Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Fri, 11 Nov 2016 18:31:03 +0100 Subject: [PATCH 088/101] Windows: Renaming sign_installer to signing_installer Contributes to CURA-2150 --- signing/windows.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/signing/windows.cmake b/signing/windows.cmake index ab9dc62c..b4faaa38 100644 --- a/signing/windows.cmake +++ b/signing/windows.cmake @@ -48,7 +48,7 @@ if(EXISTS ${WINDOWS_IDENTITIY_PFX_FILE}) set(CURA_INSTALLER_NAME ${CPACK_NSIS_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-win64.exe) endif() add_custom_command( - TARGET sign_installer + TARGET signing_installer COMMAND ${SIGNTOOL_EXECUTABLE} sign ${signtool_OPTIONS} ${CURA_INSTALLER_NAME} ## Other optional options: # /tr timestampServerUrl From f57fd4a0ea636bf1fc20c38bd4c1f8b3ddd76ec9 Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Fri, 11 Nov 2016 18:45:01 +0100 Subject: [PATCH 089/101] Windows: Using CPACK_SYSTEM_NAME Added a TODO to check whether CPACK_SYSTEM_NAME is "win64", like expected. Contributes to CURA-2150 --- signing/windows.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/signing/windows.cmake b/signing/windows.cmake index b4faaa38..1f1c15c0 100644 --- a/signing/windows.cmake +++ b/signing/windows.cmake @@ -43,8 +43,9 @@ if(EXISTS ${WINDOWS_IDENTITIY_PFX_FILE}) # Signing the installer add_custom_target(sign_installer) # Sadly "TARGET package POST_BUILD" can't be used in the following add_custom_command() if(${BUILD_OS_WIN32}) - set(CURA_INSTALLER_NAME ${CPACK_NSIS_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-win32.exe) + set(CURA_INSTALLER_NAME ${CPACK_NSIS_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}.exe) else() + # TODO: Verify whether ${CPACK_SYSTEM_NAME} is "win64", when doing 64bit builds. set(CURA_INSTALLER_NAME ${CPACK_NSIS_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-win64.exe) endif() add_custom_command( From 4ddccc41a4b13e8c992d5593b55d0fdf3336ceaa Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Fri, 11 Nov 2016 18:49:02 +0100 Subject: [PATCH 090/101] Windows: Correcting typo Contributes to CURA-2150 --- signing/windows.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/signing/windows.cmake b/signing/windows.cmake index 1f1c15c0..6945807e 100644 --- a/signing/windows.cmake +++ b/signing/windows.cmake @@ -41,7 +41,7 @@ if(EXISTS ${WINDOWS_IDENTITIY_PFX_FILE}) ) # Signing the installer - add_custom_target(sign_installer) # Sadly "TARGET package POST_BUILD" can't be used in the following add_custom_command() + add_custom_target(signing-installer) # Sadly "TARGET package POST_BUILD" can't be used in the following add_custom_command() if(${BUILD_OS_WIN32}) set(CURA_INSTALLER_NAME ${CPACK_NSIS_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}.exe) else() @@ -49,7 +49,7 @@ if(EXISTS ${WINDOWS_IDENTITIY_PFX_FILE}) set(CURA_INSTALLER_NAME ${CPACK_NSIS_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-win64.exe) endif() add_custom_command( - TARGET signing_installer + TARGET signing-installer COMMAND ${SIGNTOOL_EXECUTABLE} sign ${signtool_OPTIONS} ${CURA_INSTALLER_NAME} ## Other optional options: # /tr timestampServerUrl From c9a01fb75ec5fd4a175799b5ab71e1eced3bbf93 Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Tue, 15 Nov 2016 09:13:29 +0100 Subject: [PATCH 091/101] NSIS: Removing orphaned variable 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 --- packaging/windows.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packaging/windows.cmake b/packaging/windows.cmake index f14d64f8..6e139199 100644 --- a/packaging/windows.cmake +++ b/packaging/windows.cmake @@ -65,7 +65,6 @@ set(CPACK_PACKAGE_INSTALL_DIRECTORY "Cura ${CURA_VERSION_MAJOR}.${CURA_VERSION_M # CPackNSIS set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".") -set(CPACK_NSIS_INSTALL_ROOT ${CMAKE_BINARY_DIR}/package_nsis) set(CPACK_NSIS_MUI_FINISHPAGE_RUN "Cura.exe") set(CPACK_NSIS_MENU_LINKS "https://ultimaker.com/en/support/software" "Cura Online Documentation" @@ -90,4 +89,4 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/NSIS ${CMAKE_BINARY_DIR}/_CPack_Packages/${CPACK_SYSTEM_NAME}/NSIS COMMENT "Copying NSIS scripts" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} -) \ No newline at end of file +) From 6b632534beeb9399e9c50566df445586739b77d8 Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Wed, 16 Nov 2016 15:25:52 +0100 Subject: [PATCH 092/101] Revert "Windows: setup.py.in: Remove superfluous lines" These lines are necessary to get a working Cura installation! This reverts commit d2a8d3c306f0a2f6918da1c60ad02ace90be0ec9. --- packaging/setup_win32.py.in | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packaging/setup_win32.py.in b/packaging/setup_win32.py.in index 81733a1f..e3b753fb 100644 --- a/packaging/setup_win32.py.in +++ b/packaging/setup_win32.py.in @@ -58,6 +58,15 @@ build_options = { "excludes": [ ] } +# Extra libraries for numpy.core* +print("Copy numpy DLLs") +numpy_core_dir = os.path.dirname(numpy.core.__file__) +for item in os.listdir(numpy_core_dir): + if item.endswith(".dll"): + dll_abspath = os.path.join(numpy_core_dir, item) + print("Appending MKL library: " + dll_abspath) + build_options["include_files"].append((dll_abspath, ""),) + executables = [ Executable(script="@EXTERNALPROJECT_INSTALL_PREFIX@/bin/cura_app.py", base="Win32GUI", From 57346fa8f91150ebfbb292faa8767bb05d51004d Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Wed, 16 Nov 2016 18:14:55 +0100 Subject: [PATCH 093/101] Windows: Correctly install plugins directory 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 --- packaging/setup_win32.py.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/setup_win32.py.in b/packaging/setup_win32.py.in index e3b753fb..d03196b9 100644 --- a/packaging/setup_win32.py.in +++ b/packaging/setup_win32.py.in @@ -44,8 +44,8 @@ build_options = { ], "include_files": [ ("@EXTERNALPROJECT_INSTALL_PREFIX@/bin/CuraEngine.exe", ""), - ("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/cura", "plugins"), - ("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/uranium", "plugins"), + ("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/cura/plugins", ""), + ("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/uranium/plugins", ""), ("@EXTERNALPROJECT_INSTALL_PREFIX@/lib/python3.5/site-packages/UM/Qt/qml/UM", "qml/UM"), ("@EXTERNALPROJECT_INSTALL_PREFIX@/share/cura/resources", "resources"), ("@EXTERNALPROJECT_INSTALL_PREFIX@/share/uranium/resources", "resources"), From 6c3c3051671ec9d0fd1069b3d157c3d0d31ce7b8 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Wed, 30 Nov 2016 00:50:35 +0100 Subject: [PATCH 094/101] Remove numpy-stl from Linux build Seems it is rather broken at the moment --- packaging/setup_linux.py.in | 1 - 1 file changed, 1 deletion(-) diff --git a/packaging/setup_linux.py.in b/packaging/setup_linux.py.in index ca16599b..44914a0a 100644 --- a/packaging/setup_linux.py.in +++ b/packaging/setup_linux.py.in @@ -40,7 +40,6 @@ build_options = { "cura", "zeroconf", "serial", - "stl", ], "include_files": [ ("@EXTERNALPROJECT_INSTALL_PREFIX@/bin/CuraEngine", ""), From 5ca3316efbb0bf79b33a58e84091d07797978b67 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Wed, 30 Nov 2016 01:32:21 +0100 Subject: [PATCH 095/101] Remove "fonts" dir from installed files Since apparently it is no longer installed by Qt. --- packaging/setup_linux.py.in | 1 - 1 file changed, 1 deletion(-) diff --git a/packaging/setup_linux.py.in b/packaging/setup_linux.py.in index 44914a0a..2bae6bb5 100644 --- a/packaging/setup_linux.py.in +++ b/packaging/setup_linux.py.in @@ -50,7 +50,6 @@ build_options = { ("@EXTERNALPROJECT_INSTALL_PREFIX@/share/uranium/resources", "resources"), ("@CMAKE_PREFIX_PATH@/lib/plugins", "qt/plugins"), ("@CMAKE_PREFIX_PATH@/lib/qml", "qt/qml"), - ("@CMAKE_PREFIX_PATH@/lib/fonts", "qt/fonts"), ], "optimize": 2, "bin_path_includes": [ From 7c4eb0fc09f40a56f0ae384a2367185b27fbf2c4 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Wed, 30 Nov 2016 01:32:52 +0100 Subject: [PATCH 096/101] Make sure to call cx_Freeze with LD_LIBRARY_PATH set Otherwise it won't be able to find certain libraries --- packaging/linux.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/linux.cmake b/packaging/linux.cmake index 8e977ffd..6c7aee4c 100644 --- a/packaging/linux.cmake +++ b/packaging/linux.cmake @@ -12,7 +12,7 @@ add_custom_command( add_custom_command( TARGET packaging PRE_BUILD - COMMAND ${PYTHON_EXECUTABLE} setup.py build + COMMAND LD_LIBRARY_PATH=${CMAKE_PREFIX_PATH}/lib ${PYTHON_EXECUTABLE} setup.py build WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMENT "Running cx_Freeze to generate executable..." ) From 8483f9dd88b88a770fe7303b153d007a571f59a7 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Wed, 30 Nov 2016 01:42:04 +0100 Subject: [PATCH 097/101] Revert "Remove numpy-stl from Linux build" This reverts commit 6c3c3051671ec9d0fd1069b3d157c3d0d31ce7b8. Apperently, it was just missing some libraries somewhere. With the other changes included things work properly again. --- packaging/setup_linux.py.in | 1 + 1 file changed, 1 insertion(+) diff --git a/packaging/setup_linux.py.in b/packaging/setup_linux.py.in index 2bae6bb5..e1b1ff9d 100644 --- a/packaging/setup_linux.py.in +++ b/packaging/setup_linux.py.in @@ -40,6 +40,7 @@ build_options = { "cura", "zeroconf", "serial", + "stl", ], "include_files": [ ("@EXTERNALPROJECT_INSTALL_PREFIX@/bin/CuraEngine", ""), From d5c038dacc9d8dc4ee43d289c2441795ea25dc17 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Wed, 30 Nov 2016 17:03:47 +0100 Subject: [PATCH 098/101] Disable numpy-stl again Apparently the test files I have here that I thought were ascii STL were not really ascii STL. It still crashes with ascii STL so I disabled numpy-stl again. Fixes CURA-2974 --- packaging/setup_linux.py.in | 1 - 1 file changed, 1 deletion(-) diff --git a/packaging/setup_linux.py.in b/packaging/setup_linux.py.in index e1b1ff9d..2bae6bb5 100644 --- a/packaging/setup_linux.py.in +++ b/packaging/setup_linux.py.in @@ -40,7 +40,6 @@ build_options = { "cura", "zeroconf", "serial", - "stl", ], "include_files": [ ("@EXTERNALPROJECT_INSTALL_PREFIX@/bin/CuraEngine", ""), From 5a6ce239aadbfe3f0b29492fcc9583c70337a6ac Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 15 Dec 2016 15:47:54 +0100 Subject: [PATCH 099/101] Remove UM3 Network Printing project file since it has been merged Contributes to CURA-2947 --- projects/Cura-UM3NetworkPrinting.cmake | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 projects/Cura-UM3NetworkPrinting.cmake diff --git a/projects/Cura-UM3NetworkPrinting.cmake b/projects/Cura-UM3NetworkPrinting.cmake deleted file mode 100644 index bd4751ea..00000000 --- a/projects/Cura-UM3NetworkPrinting.cmake +++ /dev/null @@ -1,8 +0,0 @@ - -ExternalProject_Add(Cura-UM3NetworkPrinting - GIT_REPOSITORY https://github.com/Ultimaker/UM3NetworkPrintingPlugin - GIT_TAG origin/${TAG_OR_BRANCH} - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -) - -SetProjectDependencies(TARGET Cura-UM3NetworkPrinting DEPENDS Cura) From 79ac548cc221e23f979939f673fbe53c58fe532b Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 13 Feb 2017 15:50:09 +0100 Subject: [PATCH 100/101] Add an option to enable Cura's debug mode It was added at the end of 2.4 but we did not expose it so far Contributes to CURA-2787 --- projects/Cura.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/Cura.cmake b/projects/Cura.cmake index 5a82a79e..d02897c5 100644 --- a/projects/Cura.cmake +++ b/projects/Cura.cmake @@ -1,7 +1,9 @@ +option(CURA_ENABLE_DEBUGMODE "Enable crash handler and other debug options in Cura" OFF) + ExternalProject_Add(Cura GIT_REPOSITORY https://github.com/ultimaker/Cura GIT_TAG origin/${TAG_OR_BRANCH} - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DURANIUM_SCRIPTS_DIR= -DCURA_VERSION=${CURA_VERSION} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALPROJECT_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DURANIUM_SCRIPTS_DIR= -DCURA_VERSION=${CURA_VERSION} -DCURA_DEBUG=${CURA_ENABLE_DEBUGMODE} ) SetProjectDependencies(TARGET Cura DEPENDS Uranium CuraEngine) From d5270b67789835f3cb58bdfcef75c189600d401f Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 16 Feb 2017 12:47:37 +0100 Subject: [PATCH 101/101] Add missing QOpenGLFunction_4_1_Core to build Since we now want OpenGL 4.1 for the new layer view --- packaging/setup_linux.py.in | 1 + packaging/setup_osx.py.in | 1 + 2 files changed, 2 insertions(+) diff --git a/packaging/setup_linux.py.in b/packaging/setup_linux.py.in index 2bae6bb5..7e7c0de9 100644 --- a/packaging/setup_linux.py.in +++ b/packaging/setup_linux.py.in @@ -21,6 +21,7 @@ def load_pyqt5_qtquick(finder, module): finder.IncludeModule("PyQt5.QtQml") finder.IncludeModule("PyQt5.QtNetwork") finder.IncludeModule("PyQt5._QOpenGLFunctions_2_0") + finder.IncludeModule("PyQt5._QOpenGLFunctions_4_1_Core") hooks.load_PyQt5_QtQuick = load_pyqt5_qtquick diff --git a/packaging/setup_osx.py.in b/packaging/setup_osx.py.in index ba7a3f58..d147b0db 100644 --- a/packaging/setup_osx.py.in +++ b/packaging/setup_osx.py.in @@ -16,6 +16,7 @@ def load_pyqt5_qtquick(finder, module): finder.IncludeModule("PyQt5.QtQml") finder.IncludeModule("PyQt5.QtNetwork") finder.IncludeModule("PyQt5._QOpenGLFunctions_2_0") + finder.IncludeModule("PyQt5._QOpenGLFunctions_4_1_Core") hooks.load_PyQt5_QtQuick = load_pyqt5_qtquick