Cura源碼在Ubuntu15.04上編譯腳本(成功)

Cura是著名的3D打印切片和控制軟件。新的版本採用Qt和Python進行了重構,界面變化也很是大,目前還在開發中,運行問題還有很多。這裏介紹如何從源代碼進行Cura的編譯,能夠搶先體驗新版的界面設計和根據須要進行訂製。python

這個把相關的腳本都集成到一塊兒了。作了幾個重要的改進,基本能夠成功運行了。git

官方原腳本在這裏:https://github.com/Ultimaker/cura-buildgithub

主要的改進包括:shell

一、能夠自動判斷目錄,如沒有自動建立,若有則進行源碼更新。原腳本安裝後更新須要手工一步步進行,很麻煩。ubuntu

二、改變gtest的安裝源到github,原來的是從google下載,因爲國內訪問不到會致使編譯出錯。bash

三、合併 plugins目錄,將Uranium\plugins複製到Cura\plugins下,避免找不到插件的錯誤。app

注意:curl

一、進libArcus將Cmakelists.txt裏的add_subdirectory(examples)這一行註釋掉,要不編譯不過去。
二、目前CuraEngine編譯還有些問題,沒法執行切片操做。ui

把下面的內容保存到cura.sh,而後sudo chmod +x cura.sh添加執行權限,而後./cura.sh就Ok了。須要的軟件會自動下,時間較長,須要耐心等待。
google

#!/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 ~
if [ ! -d "dev" ]; then
    mkdir dev
fi
cd dev

sudo apt-get install -y git cmake cmake-gui autoconf libtool python3-setuptools curl python3-pyqt5.* python3-numpy qml-module-qtquick-controls

#protobuf.
#https://github.com/google/protobuf.git

echo "================================="
echo "Install Protobuf."
if [ ! -d "protobuf" ]; then
    git clone https://github.com/Ultimaker/protobuf.git
    cd protobuf
else
    cd protobuf
    git pull        
fi
echo "================================="
echo "get gtest."
if [ ! -d "gtest" ]; then
    git clone https://github.com/kgcd/gtest.git
else
    git pull
fi
echo "================================="
echo "get gmock."
if [ ! -d "gmock" ]; then
    git clone https://github.com/krzysztof-jusiak/gmock.git
else
    git pull        
fi
echo "Build Protobuf."
./autogen.sh
./configure --prefix=/usr
make -j4
sudo make install
sudo ldconfig
cd python
python3 setup.py build
sudo python3 setup.py install
cd ../..

echo "================================="
echo "Install libArcus."
if [ ! -d "libArcus" ]; then
    git clone https://github.com/Ultimaker/libArcus
    cd libArcus
else
    cd libArcus
    git pull        
fi
if [ ! -d "build" ]; then
  mkdir build
fi
cd build
#cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DPYTHON_SITE_PACKAGES_DIR=/usr/lib/python3.4/dist-packages
cmake .. -DPYTHON_SITE_PACKAGES_DIR=/usr/lib/python3.4/dist-packages
make -j4
sudo make install
cd ../../

echo "================================="
echo "Install CuraEngine."
if [ ! -d "CuraEngine" ]; then
    git clone https://github.com/Ultimaker/CuraEngine.git
    cd CuraEngine
else
    cd CuraEngine
    git pull        
fi
if [ ! -d "build" ]; then
  mkdir build
fi
cd build
#cmake .. -DCMAKE_INSTALL_PREFIX=/usr
cmake .. 
make -j4
sudo make install
cd ../../

echo "================================="
echo "Install Uranium."
if [ ! -d "Uranium" ]; then
    git clone https://github.com/Ultimaker/Uranium.git
    cd Uranium
else
    cd Uranium
    git pull        
fi
if [ ! -d "build" ]; then
  mkdir build
fi
cd build
#cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DPYTHON_SITE_PACKAGES_DIR=/usr/lib/python3.4/dist-packages -DURANIUM_PLUGINS_DIR=/usr/lib/python3.4/dist-packages
cmake .. -DPYTHON_SITE_PACKAGES_DIR=/usr/lib/python3.4/dist-packages -DURANIUM_PLUGINS_DIR=/usr/lib/python3.4/dist-packages
sudo make install
cd ../..

echo "================================="
echo "Install Cura."
if [ ! -d "Cura" ]; then
    git clone https://github.com/Ultimaker/Cura.git
    cd Cura
else
    cd Cura
    git pull        
fi
cd ..
echo "Build finished."

echo "============================================================================"
echo "Merge Resource into Cura/resources/"
cp -rv Uranium/resources/* Cura/resources/
echo "Merge Plugins into Cura/plugins/"
cp -rv Uranium/plugins/* Cura/plugins/
echo "Link:"$PWD"/CuraEngine/build/CuraEngine"
sudo ln -s $PWD/CuraEngine/build/CuraEngine /usr/bin/CuraEngine

echo "Starting Cura......"
cd Cura
python3 cura_app.py
echo "You need add to /etc/profile:export PYTHONPATH=/usr/lib/python3/dist-packages"
echo "============================================================================="
相關文章
相關標籤/搜索