溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

Cura源碼在Ubuntu15.04上如何編譯腳本

發(fā)布時(shí)間:2021-11-16 09:37:44 來(lái)源:億速云 閱讀:120 作者:小新 欄目:互聯(lián)網(wǎng)科技

這篇文章主要介紹Cura源碼在Ubuntu15.04上如何編譯腳本,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!

Cura是著名的3D打印切片和控制軟件。新的版本采用Qt和Python進(jìn)行了重構(gòu),界面變化也非常大,目前還在開(kāi)發(fā)中,運(yùn)行問(wèn)題還有不少。這里介紹如何從源代碼進(jìn)行Cura的編譯,可以搶先體驗(yàn)新版的界面設(shè)計(jì)和根據(jù)需要進(jìn)行訂制。

這個(gè)把相關(guān)的腳本都集成到一起了。做了幾個(gè)重要的改進(jìn),基本可以成功運(yùn)行了。

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

主要的改進(jìn)包括:

1、可以自動(dòng)判斷目錄,如沒(méi)有自動(dòng)創(chuàng)建,如有則進(jìn)行源碼更新。原腳本安裝后更新需要手工一步步進(jìn)行,很麻煩。

2、改變gtest的安裝源到github,原來(lái)的是從google下載,由于國(guó)內(nèi)訪問(wèn)不到會(huì)導(dǎo)致編譯出錯(cuò)。

3、合并 plugins目錄,將Uranium\plugins復(fù)制到Cura\plugins下,避免找不到插件的錯(cuò)誤。

注意:

1、進(jìn)libArcus將Cmakelists.txt里的add_subdirectory(examples)這一行注釋掉,要不編譯不過(guò)去。
2、目前CuraEngine編譯還有些問(wèn)題,無(wú)法執(zhí)行切片操作。

把下面的內(nèi)容保存到cura.sh,然后sudo chmod +x cura.sh添加執(zhí)行權(quán)限,然后./cura.sh就Ok了。需要的軟件會(huì)自動(dòng)下,時(shí)間較長(zhǎng),需要耐心等待。

#!/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 "============================================================================="

以上是“Cura源碼在Ubuntu15.04上如何編譯腳本”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注億速云行業(yè)資訊頻道!

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI