MuseScore Compile instructions (Windows - MinGW)
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.
(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.
NSIS unicode is used to create the install package itself. It's not needed if you just want to develop.
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.
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 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
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.
- Get the library files for libVorbis and libOgg from: http://www.xiph.org/downloads
- Copy the directories:
include\vorbis
andinclude\ogg
intoC:\Qt\Tools\mingw491_32\i686-w64-mingw32\include
(Copy the entire directory so that you end up withC:\Qt\Tools\mingw491_32\i686-w64-mingw32\include\vorbis
andC:\Qt\Tools\mingw491_32\i686-w64-mingw32\include\ogg
) - Get the Vorbis Tools and copy
libogg.dll
,libvorbis.dll
andlibvorbisfile.dll
inC:\Qt\Tools\mingw491_32\lib
(You need to decompress the .7z file using 7 Zip)
Portaudio
- Get
portaudio.dll
from a previous MuseScore install (bin
directory) and copy toC:\Qt\Tools\mingw491_32\lib
- Get
portaudio.h
from the current version at http://www.portaudio.com/download.html and copy toC:\Qt\Tools\mingw491_32\i686-w64-mingw32\include
. You need to decompress the .tar.gz file using 7 Zip, as before.
JACK #这一个是最麻烦的,一直下不下来,也许是我网络的问题,最好好麻烦的下下来了。
- Download the Windows installer for JACK from http://jackaudio.org/downloads
- Install
- 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 inC:\Program Files\Jack
or inC:\Program Files (x86)\Jack
on a Windows 64-bit
libsndfile
- Windows binary available, choose Win32 http://www.mega-nerd.com/libsndfile
- Install and go to the installation directory. The installation process is required to be run in administration mode.
- Copy
include\sndfile.h
intoC:\Qt\Tools\mingw491_32\i686-w64-mingw32\include
- Copy
bin/libsndfile-1.dll
intoC:\Qt\Tools\mingw491_32\lib
LAME
- Download the current source files for LAME: http://lame.sourceforge.net/download.php
- You need to decompress the .tar.gz file using 7 Zip, as before
- Create a new folder in the
C:\Qt\Tools\mingw491_32\i686-w64-mingw32\include
directory calledlame
- Copy
include\lame.h
intoC:\Qt\Tools\mingw491_32\i686-w64-mingw32\include\lame
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:
- Build Location:
For the first Cmake run, it will offer a build directory such asMuseScore-build
, ifMuseScore
is your checkout directory. Change this to choose a build directory ofMuseScore/build.qtc
instead.
Please make sure the name of your build directory does not contain spaces. - Choose CMake Executable:
Browse to where you installed CMake (i.e. C:\Program Files (x86)\CMake\bin) - Run CMake:
Then input the following arguments for CMake:
-DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_TOOLCHAIN_FILE=build/mingw32.mingw.cmake -DCMAKE_INSTALL_PREFIX=../win32install
C:\Qt\Tools\mingw491_32\lib
in the PATH, so no further setting of environment variables should be required.[ignore]
lrelease
target.
install
under Targets.
%{sourceDir}\win32install\bin\MuseScore.exe
.
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!