MuseScore 的编译

MuseScore Compile instructions (Windows - MinGW)  

 
Compile instructions (Windows - MinGW) - Git
#写在前面:最好是按照步骤来,不要想着自己折腾。
MinGW 4.9.1 and Qt 5.4
Download the Qt Online Installer for Windows.  #这个地反,不知道怎么回事,自己没有在线安装就是配置不对。最后只能选择在线安装。

NB There a number of Windows installers on this page - make sure it is the Online Installer you are downloading. MuseScore is known to work with 5.4.

Run the installer and install Qt in C:\Qt. You just need the Qt libraries for MinGW 4.9.1 and the MinGW 4.9.1 toolchain.

Qt-install.png

(optional) Add the following to your %PATH%

C:\Qt\Tools\mingw491_32\bin;C:\Qt\Tools\mingw491_32\lib
C:\Qt\5.4\mingw491_32\bin
C:\Qt\Tools\QtCreator\bin
CMake

Download the latest version of windows binaries for CMake. Choose the Windows (Win32 Installer) version. You need at least version 2.8.7. Versions up to 3.3.0 are known to work too. #建议用3.3.0

Install in the default location (probably C:\Program Files\CMake or C:\Program Files (x86)\CMake) and optionally put the bin subdirectory in your PATH.


Optional Tool: NSIS unicode #不用关心

NSIS unicode is used to create the install package itself. It's not needed if you just want to develop.


Optional Tool: doxygen #不用关心

doxygen is used to generate developer documentation from the source files. It is not needed to compile the program, but if you plan to develop the generated documentation can aid understanding the classes and class hierarchies.

Download the native windows doxygen installer from www.doxygen.org

Note: there have been reports that the cygwin doxygen package has issues generating MuseScore developer documentation, and so it is recommended to use the native windows doxygen instead.

Source Code

Get the source code from GitHub. If you need a Git client, you can try Git for Windows or the GitHub windows client.
git clone git://github.com/musescore/MuseScore.git #会用git的话,知道怎么弄,不懂Git的话,去学。推荐廖雪峰老师的git教程

If you plan to contribute to MuseScore, you can setup your own fork on GitHub and clone it instead. See the Git Workflow page.

Note: Directory names with spaces in them cause the build to fail; so avoid spaces in the name of your clone directory.

(optional but recommended) In your clone directory, copy the file build/git/hooks/post-checkout to the directory .git/hooks in order for mscore/revision.h to be maintained automatically by git. See build/git/hooks/README for details. Note that the .git directory is hidden.


Change default paths (optional) #不用关心

The following two steps should not be necessary if using the default paths given above for Qt and MinGW.
Change build\mingw32.mingw.cmake to suit your Qt and mingw install

set (CROSS C:/Qt/Tools/mingw491_32)
set (CROSSQT C:/Qt/5.4/mingw491_32)
%PATH% summary

You must have the following in your %PATH%:

  • C:\Program Files\CMake\bin (or wherever you installed CMake)
  • C:\Qt\Tools\mingw491_32\bin;C:\Qt\Tools\mingw491_32\lib (or wherever MinGW is installed for you)
  • C:\Qt\5.4\mingw491_32\bin (or wherever Qt is installed for you)
  • And if you want to launch QtCreator from the command line C:\Qt\Tools\QtCreator\bin

NOTE: You can add path elements to cmd shells via Computer / System Properties / Advanced System Settings / Environment Variables. However, the make process can be sensitive to the rest of the contents of your %PATH% as well. If you encounter issues like mingw32-make immediately terminating with error code 0xc00000fd, then try stripping your path down to only the above elements, plus perhaps C:\Windows and C:\Windows\System32. You might consider running the build from a batch file that temporarily sets your %PATH% to just the required elements.

A good approach to doing so is to create the following batch file in the "C:\Qt" folder:

C:\Qt\qt.bat

@echo off
echo Setting up a MinGW/Qt only environment...
echo -- Set QTDIR to C:\Qt\5.4\mingw491_32
set QTDIR=C:\Qt\5.4\mingw491_32
echo -- Set PATH to %QTDIR%\bin
set PATH=%QTDIR%\bin
echo -- Adding C:\Program Files (x86)\CMake\bin
set PATH=%PATH%;C:\Program Files (x86)\CMake\bin
echo -- Adding C:\Qt\Tools\mingw491_32\bin;C:\Qt\Tools\mingw491_32\lib to PATH
set PATH=%PATH%;C:\Qt\Tools\mingw491_32\bin;C:\Qt\Tools\mingw491_32\lib
echo -- Adding to C:\Qt\Tools\QtCreator\bin
set PATH=%PATH%;C:\Qt\Tools\QtCreator\bin
echo -- Adding %SystemRoot%\System32 to PATH
set PATH=%PATH%;%SystemRoot%\System32
echo -- QMAKESPEC set to win32-g++
set QMAKESPEC=win32-g++
cd %USERPROFILE%
echo -- Set MAKEFLAGS to -j %NUMBER_OF_PRCESSORS%
set MAKEFLAGS=-j %NUMBER_OF_PROCESSORS%
rem un-rem the following line to start Qt Creator immediately
rem using /low makes sure you can still work with the PC
rem -lastsession gets you back where you left
rem start /low qtcreator -lastsession

Then create a shortcut to this batch file somewhere in the Programs menu. If starting QtCreator immediately, the shortcut can be set to "Start minimized".
Dependencies  #后面给的有压缩包和怎么放。

In addition to Qt, MuseScore depends on:

  • portaudio to access Windows audio
  • JACK to connect to JACK Server for MIDI and audio
  • libsndfile for wav/ogg/flac output
  • Ogg and Vorbis for support of ogg soundfonts
  • LAME for support for MP3 (only the header files)

I choose to put most of these dependencies directly in the MinGW include path. It's ugly but convenient. Either follow the below instructions or install just Jack and Freetype and for the rest take Qt-additions.zip and unpack it into C:\.

libVorbis, libVorbisFile, libOgg

The latest source also requires libraries for Vorbis and Ogg.

  1. Get the library files for libVorbis and libOgg from: http://www.xiph.org/downloads
  2. Copy the directories: include\vorbis and include\ogg into C:\Qt\Tools\mingw491_32\i686-w64-mingw32\include (Copy the entire directory so that you end up with C:\Qt\Tools\mingw491_32\i686-w64-mingw32\include\vorbis and C:\Qt\Tools\mingw491_32\i686-w64-mingw32\include\ogg)
  3. Get the Vorbis Tools and copy libogg.dll, libvorbis.dll and libvorbisfile.dll in C:\Qt\Tools\mingw491_32\lib (You need to decompress the .7z file using 7 Zip)
Portaudio
  1. Get portaudio.dll from a previous MuseScore install (bin directory) and copy to C:\Qt\Tools\mingw491_32\lib
  2. Get portaudio.h from the current version at http://www.portaudio.com/download.html and copy to C:\Qt\Tools\mingw491_32\i686-w64-mingw32\include. You need to decompress the .tar.gz file using 7 Zip, as before.
JACK #这一个是最麻烦的,一直下不下来,也许是我网络的问题,最好好麻烦的下下来了。
  1. Download the Windows installer for JACK from http://jackaudio.org/downloads
  2. Install
  3. The build process assumes you installed in a directory Jack in your program files directory. The name of the program files directory can vary depending on the version and language of Windows. The environment variable %ProgramFiles% or %ProgramFiles(x86)% is used to find the directory. On an English version of Windows this will result in looking in C:\Program Files\Jack or in C:\Program Files (x86)\Jack on a Windows 64-bit
libsndfile
  1. Windows binary available, choose Win32 http://www.mega-nerd.com/libsndfile
  2. Install and go to the installation directory. The installation process is required to be run in administration mode.
  3. Copy include\sndfile.h into C:\Qt\Tools\mingw491_32\i686-w64-mingw32\include
  4. Copy bin/libsndfile-1.dll into C:\Qt\Tools\mingw491_32\lib
LAME
  1. Download the current source files for LAME: http://lame.sourceforge.net/download.php
  2. You need to decompress the .tar.gz file using 7 Zip, as before
  3. Create a new folder in the C:\Qt\Tools\mingw491_32\i686-w64-mingw32\include directory called lame
  4. Copy include\lame.h into C:\Qt\Tools\mingw491_32\i686-w64-mingw32\include\lame
Compilation #不用关心

If you wish to use the QtCreator IDE, follow the instructions in section "Qt Creator IDE", below.

Open a command line, possibly using a batch file such as qt.bat given above.
Browse to the directory where you checked out musescore
Enter

mingw32-make -f Makefile.mingw release

or

mingw32-make -f Makefile.mingw debug

Note that the two options internally set different flags for the compiler. In debug mode the QT_DEBUG flag is used, so conditional code controlled by #ifdef QT_DEBUG is compiled. In release mode NDEBUG is set. Unless you are building a release, it is suggested that you use the "debug" option, like in the section on the Qt Creator IDE (below).

Be patient ... On my Vista laptop (Intel T7550) it takes more than one hour to build. Build times on Windows can be more than twice as long as build times on Ubuntu (using the same computer). Once the compilation finishes, the MuseScore executable can be found in build.release/mscore/MuseScore.exe or build.debug/mscore/MuseScore.exe. So long as C:\Qt\Tools\mingw48_32\lib is in the PATH, it should not be necessary to copy any DLLs. However, it has been found necessary to copy the complete directories iconengines and imageformats from %QTDIR%\plugins to the build.release/mscore or build.debug/mscore directory (resulting in, for example, build.debug/mscore/iconengines. This should be sufficient for most development work.

Note: You may need to go into the preferences, and fix the paths to have Windows-style slash characters (backslash), or you may see error messages about not being able to open files. [Is this a bug?]

If you need the language files, instrument list, templates, and the normal directory structure of a installed version of MuseScore then type:

mingw32-make -f Makefile.mingw install

or, for a debug build:

mingw32-make -f Makefile.mingw installdebug

Once install has finished look in the current directory for win32install/bin/MuseScore.exe. In this case there is no need to copy DLLs or the plugins directories, as they are already copied during the make process.

If you need developer documentation for MuseScore then after compiling, type:

cd build.release
mingw32-make doxy

The generated documentation can be viewed by opening win32build/Doc/html/index.html in a browser.

Qt Creator IDE #这个是重点,因为我用的就是这个IDE

Once you setup everything above, you can open Qt Creator, either by typing start qtcreator from within a command prompt started as above, or by creating a separate batch file with start qtcreator as the last command.

Go to File => Open File or Project....

Choose CmakeLists.txt file type and open the file CmakeLists.txt from your source directory.

Now it will take you through a pathwizard:

  1. Build Location:
    For the first Cmake run, it will offer a build directory such as MuseScore-build, if MuseScore is your checkout directory. Change this to choose a build directory of MuseScore/build.qtc instead.
    Please make sure the name of your build directory does not contain spaces.
  2. Choose CMake Executable:
    Browse to where you installed CMake (i.e. C:\Program Files (x86)\CMake\bin)
  3. Run CMake:
    Then input the following arguments for CMake:

    -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_TOOLCHAIN_FILE=build/mingw32.mingw.cmake -DCMAKE_INSTALL_PREFIX=../win32install

Result:
As for the manual build, the supplementary DLLs should be found via C:\Qt\Tools\mingw491_32\lib in the PATH, so no further setting of environment variables should be required.[ignore]
Before your first build or debug session, you will need to configure the Build, Deploy, and Run steps. Click Projects at left, then Build toward the top of the screen. Under Build Steps, expand the Details button and add a checkmark next to the lrelease target.
Then go back to the top of the screen and click Run. On this screen, you will first need to click Add Deploy Step. Select Make, then select install under Targets.
 
Finally, you will need to click the Add button under Run Configuration to add a custom executable, and set it to %{sourceDir}\win32install\bin\MuseScore.exe.
ERROR

To compile the debug build and start debugging go to Debug => Start debugging => Start debugging or simply click the debug icon. You have access to Qt help, completion, and debugging features!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值