Skip to content

Commit fc7cd8b

Browse files
committed
compile with msys2
1 parent cb55753 commit fc7cd8b

File tree

5 files changed

+291
-88
lines changed

5 files changed

+291
-88
lines changed

CMakeLists.txt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ project(mscore)
2323
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0)
2424

2525
set (CI $ENV{CI})
26-
if (CI)
26+
set (APPVEYOR $ENV{APPVEYOR})
27+
if (CI AND NOT APPVEYOR)
2728
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
2829
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
29-
endif (CI)
30+
endif (CI AND NOT APPVEYOR)
3031

3132
cmake_policy(SET CMP0003 NEW)
3233

@@ -370,11 +371,11 @@ if (APPLE)
370371
endif (SNDFILE_INCDIR)
371372
endif(HAS_AUDIOFILE)
372373
else(APPLE)
373-
if(MINGW)
374+
if(MINGW AND NOT MSYS)
374375
set(SNDFILE_LIB sndfile-1)
375-
else(MINGW)
376+
else(MINGW AND NOT MSYS)
376377
set(SNDFILE_LIB sndfile)
377-
endif(MINGW)
378+
endif(MINGW AND NOT MSYS)
378379
set(OGG_LIB ogg)
379380
set(VORBIS_LIB vorbis)
380381
endif(APPLE)
@@ -511,10 +512,13 @@ add_custom_command(
511512
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
512513
)
513514
if (MINGW)
514-
set(BUILD_PCH true)
515+
set(BUILD_PCH false)
515516
else (MINGW)
516517
set(BUILD_PCH true)
517518
endif(MINGW)
519+
if (APPVEYOR OR MSYS)
520+
set(BUILD_PCH true)
521+
endif(APPVEYOR OR MSYS)
518522

519523
precompiled_header(QT_INCLUDES all ${BUILD_PCH})
520524

Makefile.msys

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#=============================================================================
2+
# Mscore
3+
# Linux Music Score Editor
4+
# $Id:$
5+
#
6+
# Copyright (C) 2002-2007 by Werner Schweer and others
7+
#
8+
# This program is free software; you can redistribute it and/or modify
9+
# it under the terms of the GNU General Public License version 2.
10+
#
11+
# This program is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU General Public License
17+
# along with this program; if not, write to the Free Software
18+
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19+
#=============================================================================
20+
21+
22+
REVISION := `cat mscore/revision.h`
23+
VERSION = "3.0b-${REVISION}"
24+
CPUS = ${NUMBER_OF_PROCESSORS}
25+
26+
release:
27+
if test ! -d build.release; then mkdir build.release; fi; \
28+
cd build.release; \
29+
cmake -G "MSYS Makefiles" -DCMAKE_TOOLCHAIN_FILE=../build/mingw32.msys2.cmake -DCMAKE_INSTALL_PREFIX=../win32install -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_MAKE_PROGRAM=make.exe ..; \
30+
make lrelease; \
31+
make -j ${CPUS}; \
32+
33+
install:
34+
cd build.release; \
35+
make install;
36+
37+
revision:
38+
git rev-parse --short HEAD > mscore/revision.h
39+
40+
version:
41+
@echo ${VERSION}
42+
43+
#
44+
# clean out of source build
45+
#
46+
47+
clean:
48+
-rm -rf build.debug build.release win32install
49+
50+

appveyor.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,9 @@ clone_depth: 3 # clone entire repository history if not def
1313
# configuration: Release
1414
# build cache to preserve files/folders between builds
1515
cache:
16-
- dependencies.7z
17-
- C:\Qt\Tools\mingw491_32\lib
18-
- C:\Qt\Tools\mingw491_32\i686-w64-mingw32
19-
- C:\Program Files (x86)\Jack
20-
- C:\Qt\Tools\mingw491_32\libexec\gcc\i686-w64-mingw32\4.9.1\cc1plus.exe
21-
- C:\MuseScore\build.release\thirdparty
22-
- C:\ccache
16+
- dependencies.7z -> appveyor.yml
17+
- C:\Program Files (x86)\Jack -> appveyor.yml
18+
- C:\MuseScore\build.release\thirdparty -> appveyor.yml
2319
#cache:
2420
# - packages -> **\packages.config # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified
2521
# - projectA\libs
@@ -30,30 +26,34 @@ platform:
3026
- x86
3127
# build Configuration, i.e. Debug, Release, etc.
3228
configuration: Release
29+
# Update msys2
30+
install:
31+
- C:\msys64\usr\bin\bash -lc "pacman --needed --noconfirm -Sy pacman-mirrors"
32+
- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Sy"
33+
- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Sy make mingw-w64-i686-cmake mingw-w64-i686-lame mingw-w64-i686-libsndfile mingw-w64-i686-libvorbis mingw-w64-i686-portaudio mingw-w64-i686-qt5"
34+
# mingw-w64-i686-gcc mingw-w64-i686-cmake make
3335
# scripts to run before build
3436
before_build:
3537
- IF NOT EXIST dependencies.7z (
3638
start " " /wait "C:\MinGW\msys\1.0\bin\wget" --no-check-certificate "https://drive.google.com/uc?export=download&id=0BxjayMZiuupOSXF6a0ZDUG5rNDg" -O dependencies.7z &&
3739
start " " /wait "7z" x -y dependencies.7z > nul &&
3840
cd dependencies &&
39-
xcopy i686-w64-mingw32 "C:\Qt\Tools\mingw491_32\i686-w64-mingw32" /E &&
40-
xcopy lib "C:\Qt\Tools\mingw491_32\lib" /E &&
41-
xcopy Jack "C:\Program Files (x86)\Jack" /E /I &&
42-
xcopy ccache "C:\ccache" /E /I &&
43-
copy /y cc1plus.exe "C:\Qt\Tools\mingw491_32\libexec\gcc\i686-w64-mingw32\4.9.1\cc1plus.exe"
41+
xcopy Jack "C:\Program Files (x86)\Jack" /E /I
4442
)
4543
- cd C:\MuseScore
46-
- set PATH=C:\Qt\5.4\mingw491_32\bin;C:\Qt\Tools\mingw491_32\bin;%PATH%
47-
- mingw32-make -f Makefile.mingw revision
44+
- set PATH=C:\msys64\mingw32\bin;C:\msys64\usr\bin;C:\msys64\bin;%PATH%
45+
- set MSYSTEM=MINGW32
46+
- C:\msys64\usr\bin\bash -lc "cd /c/MuseScore && mingw32-make -f Makefile.msys revision"
4847
# CMake refuses to generate MinGW Makefiles if sh.exe is in the Path
49-
- set PATH=C:\Qt\5.4\mingw491_32\bin;C:\Qt\Tools\mingw491_32\bin;C:\Program Files (x86)\CMake\bin;C:\Program Files\7-Zip;C:\ccache\bin
50-
- set CCACHE_DIR=C:\ccache\cache
48+
# - set PATH=C:\Qt\5.4\mingw491_32\bin;C:\Qt\Tools\mingw491_32\bin;C:\Program Files (x86)\CMake\bin;C:\Program Files\7-Zip;C:\ccache\bin
49+
- set PATH=C:\msys64\mingw32\bin;C:\msys64\usr\bin;C:\msys64\bin;C:\Program Files\7-Zip
5150
- set /p MSversion=<mscore\revision.h
51+
# Ugly hack to prevent the error: add_library cannot create imported target "Qt5::Q...Factory" because another target with the same name already exists.
52+
- copy /y NUL C:\msys64\mingw32\lib\cmake\Qt5Qml\Qt5QmlConfigExtras.cmake
5253
# scripts to run *after* solution is built and *before* automatic packaging occurs (web apps, NuGet packages, Azure Cloud Services)
5354
#before_package:
5455
# scripts to run after build
5556
after_build:
56-
- ccache.exe -s
5757
- cmd: 7z a C:\MuseScore\MuseScoreTest%MSversion%.7z C:\MuseScore\win32install
5858
- cd C:\MuseScore
5959
artifacts:
@@ -71,4 +71,4 @@ deploy:
7171
override: true
7272
# to run your custom scripts instead of automatic MSBuild
7373
build_script:
74-
- mingw32-make -f Makefile.mingw release && mingw32-make -f Makefile.mingw install
74+
- C:\msys64\usr\bin\bash -lc "cd /c/MuseScore && mingw32-make -f Makefile.msys release && mingw32-make -f Makefile.msys install"

build/mingw32.msys2.cmake

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#
2+
# toolchain file for windows on windows
3+
#
4+
5+
set (CMAKE_SYSTEM_NAME "Windows")
6+
7+
set (CROSS C:/msys64/mingw32)
8+
set (CROSSQT C:/msys64/mingw32)
9+
10+
set (CMAKE_C_COMPILER ${CROSS}/bin/gcc.exe)
11+
set (CMAKE_CXX_COMPILER ${CROSS}/bin/g++.exe)
12+
set (CMAKE_STRIP ${CROSS}/bin/strip.exe)
13+
set (CMAKE_FIND_ROOT_PATH ${CROSS})
14+
15+
set (QT_INCLUDE_DIR ${CROSSQT}/include)
16+
set (QT_QT_INCLUDE_DIR ${CROSSQT}/include/Qt)
17+
set (QT_QTCORE_INCLUDE_DIR ${CROSSQT}/include/QtCore)
18+
set (QT_QTXML_INCLUDE_DIR ${CROSSQT}/include/QtXml)
19+
set (QT_QTXMLPATTERNS_INCLUDE_DIR ${CROSSQT}/include/QtXmlPatterns)
20+
set (QT_QTGUI_INCLUDE_DIR ${CROSSQT}/include/QtGui)
21+
set (QT_QTNETWORK_INCLUDE_DIR ${CROSSQT}/include/QtNetwork)
22+
set (QT_QTUITOOLS_INCLUDE_DIR ${CROSSQT}/include/QtUiTools)
23+
set (QT_QTWEBENIGINE_INCLUDE_DIR ${CROSSQT}/include/QtWebEngine)
24+
set (QT_LIBRARY_DIR ${CROSSQT}/lib)
25+
26+
set (QT_MOC_EXECUTABLE "${CROSSQT}/bin/moc.exe")
27+
set (QT_UIC_EXECUTABLE "${CROSSQT}/bin/uic.exe")
28+
set (QT_RCC_EXECUTABLE "${CROSSQT}/bin/rcc")
29+
set (QT_QTCORE_LIBRARY "mops")
30+
31+
set (QT_WRC_EXECUTABLE ${CMAKE_CURRENT_LIST_DIR}/wrc.bat)
32+
set (QT_WINE_EXECUTABLE ${CMAKE_CURRENT_LIST_DIR}/wine.bat)
33+
34+
35+
set (QT_INCLUDES ${QT_INCLUDE_DIR} ${QT_QT_INCLUDE_DIR}
36+
${QT_QTCORE_INCLUDE_DIR} ${QT_QTXML_INCLUDE_DIR} ${QT_GUI_INCLUDE_DIR}
37+
${QT_QTNETWORK_INCLUDE_DIR} ${QT_QTWEBENIGINE_INCLUDE_DIR}
38+
${QT_QTXMLPATTERNS_INCLUDE_DIR}
39+
)
40+
set (QT_mingw_LIBRARIES
41+
Qt5Svg
42+
Qt5Gui
43+
Qt5Core
44+
Qt5Widgets
45+
Qt5Xml
46+
Qt5Network
47+
Qt5WebChannel
48+
# Qt5WebEngineWidgets
49+
# Qt5WebEngine
50+
Qt5XmlPatterns
51+
Qt5PrintSupport
52+
Qt5Quick
53+
Qt5QuickWidgets
54+
Qt5Qml
55+
Qt5Help
56+
)
57+
58+
# Qt3Support4
59+
60+
set (WIN32 ON)
61+
set (MINGW ON)
62+
set (MSYS ON)
63+
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS)
64+

0 commit comments

Comments
 (0)