Skip to content
Permalink
Browse files

Support 64-bit compilation

Update cmake files to support 64-bit compilation.
Add variables to easily switch between 32-bit and 64-bit compilation
Update msvc_build.bat to support both 32-bit and 64-bit compilation
Optimize msvc_build.bat to avoi excessive output
Update AppVeyor build scripts so that default compilation is 64-bit now
Make default configuration built from opening MuseScore directory 64-bit
RelWithDebInfo. All other configurations are up to msvc_build.bat
script.
Qt libs which are used for building are placed in msvc2017_64 folder.

These changes require new structure of the dependencies folder.
  • Loading branch information...
anatoly-os committed Aug 21, 2018
1 parent be5ebbc commit f90018b857db7058422091f787b30e80b7f8cd90
@@ -36,8 +36,6 @@ vtest/Thumbnails
vtest/Pictures
.vs
dependencies
/msvc.build.debug
/msvc.install

# Downloaded files during build process
MS_General.sf3
@@ -48,5 +46,4 @@ MuseScore_General-License.md
MuseScore_General-changelog.txt
VERSION
/mscore/data/mscore.aps
/msvc.build.release
/msvc.build.relwithdebinfo
/msvc.*
@@ -122,6 +122,7 @@ option(BUILD_WEBEBENGINE "Built in webengine support" ON)
option(BUILD_PCH "Build using precompiled headers." ON)
option(BUILD_FOR_WINSTORE "Build for the Windows Store." OFF)
option(COVERAGE "Build with instrumentation to record code coverage." OFF)
option(BUILD_64 "Build 64 bit version of editor" ON)

if (APPLE)
set (CMAKE_CXX_COMPILER clang++)
@@ -174,6 +175,9 @@ if (APPLE)
SET(CMAKE_INSTALL_RPATH "${QT_INSTALL_PREFIX}/lib")
else (APPLE)
if (MSVC)
if (BUILD_64 STREQUAL "ON")
set(USE_SSE FALSE)
endif(BUILD_64 STREQUAL "ON")
# Set compiler options for VS2017 toolchain.
# Note: /D_CRT_SECURE_NO WARNINGS disables warnings when using "non-secure" library functions like sscanf...
set(CMAKE_CXX_FLAGS "/MP /DWIN32 /D_WINDOWS /GR /EHsc /D_UNICODE /DUNICODE /D_CRT_SECURE_NO_WARNINGS /execution-charset:utf-8")
@@ -182,8 +186,8 @@ else (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE")
endif (USE_SSE)
set(CMAKE_CXX_FLAGS_DEBUG "/MDd /permissive- /std:c++14 /W4 /Zi /Ob0 /Od /RTC1")
set(CMAKE_CXX_FLAGS_RELEASE "/MD /permissive- /std:c++14 /W4 /O2 /Ob2 -DNDEBUG -DQT_NO_DEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD /permissive- /std:c++14 /W4 /Zi /O2 /Ob1 -DNDEBUG -DQT_NO_DEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "/MD /permissive- /std:c++14 /W4 /O2 /Ob2 /DNDEBUG /DQT_NO_DEBUG /DQT_NO_DEBUG_OUTPUT")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD /permissive- /std:c++14 /W4 /Zi /O2 /Ob1 /DNDEBUG /DQT_NO_DEBUG")
else (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
if (MINGW)
@@ -362,6 +366,14 @@ endif (BUILD_PULSEAUDIO)
## LAME
##

if (BUILD_64 STREQUAL "ON")
SET (ARCH_TYPE "_x64")
SET (DEPENDENCIES_DIR "${PROJECT_SOURCE_DIR}/dependencies/libx64")
else (BUILD_64 STREQUAL "ON")
SET (ARCH_TYPE "_x86")
SET (DEPENDENCIES_DIR "${PROJECT_SOURCE_DIR}/dependencies/libx86")
endif (BUILD_64 STREQUAL "ON")

if (APPLE OR MINGW)
if (BUILD_LAME)
include (FindLame)
@@ -438,9 +450,8 @@ if (BUILD_PORTAUDIO)
set ( USE_PORTAUDIO 1 )
if (MSVC)
include(FindPortAudio)
add_library(portaudio1 SHARED IMPORTED)
message(STATUS ${PORTAUDIO_LIBRARY})
set_target_properties(portaudio1 PROPERTIES IMPORTED_IMPLIB ${PROJECT_SOURCE_DIR}/dependencies/libx86/portaudio.lib)
add_library(portaudiodll SHARED IMPORTED)
set_target_properties(portaudiodll PROPERTIES IMPORTED_IMPLIB ${PORTAUDIO_LIBRARY})
endif(MSVC)
else (MINGW OR MSVC)
PKGCONFIG1 (portaudio-2.0 19 PORTAUDIO_INCDIR PORTAUDIO_LIBDIR PORTAUDIO_LIB PORTAUDIO_CPP)
@@ -511,20 +522,20 @@ else(APPLE)
set(SNDFILE_LIB sndfile-1)
if (MSVC)
include(FindVorbis)
add_library(vorbis1 SHARED IMPORTED)
set_target_properties(vorbis1 PROPERTIES IMPORTED_IMPLIB ${VORBIS_LIBRARY})
add_library(vorbisdll SHARED IMPORTED)
set_target_properties(vorbisdll PROPERTIES IMPORTED_IMPLIB ${VORBIS_LIBRARY})

include(FindSndFile)
add_library(sndfile1 SHARED IMPORTED)
set_target_properties(sndfile1 PROPERTIES IMPORTED_IMPLIB ${SNDFILE_LIBRARY})
add_library(sndfiledll SHARED IMPORTED)
set_target_properties(sndfiledll PROPERTIES IMPORTED_IMPLIB ${SNDFILE_LIBRARY})

include(FindVorbisfile)
add_library(vorbisfile1 SHARED IMPORTED)
set_target_properties(vorbisfile1 PROPERTIES IMPORTED_IMPLIB ${VORBISFILE_LIBRARY})
add_library(vorbisfiledll SHARED IMPORTED)
set_target_properties(vorbisfiledll PROPERTIES IMPORTED_IMPLIB ${VORBISFILE_LIBRARY})

include(FindOgg)
add_library(ogg1 SHARED IMPORTED)
set_target_properties(ogg1 PROPERTIES IMPORTED_IMPLIB ${OGG_LIBRARY})
add_library(oggdll SHARED IMPORTED)
set_target_properties(oggdll PROPERTIES IMPORTED_IMPLIB ${OGG_LIBRARY})
endif(MSVC)
else (MINGW OR MSVC)
set(SNDFILE_LIB sndfile)
@@ -2,116 +2,33 @@
// See https://go.microsoft.com//fwlink//?linkid=834763 for more information about this file.
"configurations": [
{
"name": "x86-Debug",
"generator": "Visual Studio 15 2017",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x86" ],
"buildRoot": "${projectDir}\\msvc.build.debug", // "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"installRoot": "${projectDir}\\msvc.install", // "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
"cmakeCommandArgs": "-Wno-deprecated -LA",
"variables": [
{
"name": "CMAKE_BUILD_TYPE",
"value": "DEBUG"
},
{
"name": "BUILD_FOR_WINSTORE",
"value": "OFF"
},
{
"name": "CMAKE_PREFIX_PATH",
"value": "${env.PATH};${projectDir}\\dependencies"
},
{
"name": "CMAKE_LIBRARY_PATH",
"value": "${projectDir}\\dependencies\\libx86;${projectDir}\\dependencies\\zlib\\x86\\static\\Release"
}
],
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
},
{
"name": "x86-Release",
"generator": "Visual Studio 15 2017",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [ "msvc_x86" ],
"buildRoot": "${projectDir}\\msvc.build.release", // "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"installRoot": "${projectDir}\\msvc.install", // "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
"cmakeCommandArgs": "-Wno-deprecated",
"variables": [
{
"name": "CMAKE_BUILD_TYPE",
"value": "RELEASE"
},
{
"name": "BUILD_FOR_WINSTORE",
"value": "OFF"
},
{
"name": "CMAKE_PREFIX_PATH",
"value": "${env.PATH};${projectDir}\\dependencies"
},
{
"name": "CMAKE_LIBRARY_PATH",
"value": "${projectDir}\\dependencies\\libx86;${projectDir}\\dependencies\\zlib\\x86\\static\\Release"
}
],
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
},
{
"name": "x64-Debug",
"name": "x64-RelWithDebInfo",
"generator": "Visual Studio 15 2017 Win64",
"configurationType": "Debug",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\msvc.build.debug64", // "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"installRoot": "${projectDir}\\msvc.install", // "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
"buildRoot": "${projectDir}\\msvc.build_x64", // "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"installRoot": "${projectDir}\\msvc.install_x64", // "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
"cmakeCommandArgs": "-Wno-deprecated",
"variables": [
{
"name": "CMAKE_BUILD_TYPE",
"value": "DEBUG"
"value": "RELWITHDEBINFO"
},
{
"name": "BUILD_FOR_WINSTORE",
"value": "OFF"
},
{
"name": "CMAKE_PREFIX_PATH",
"value": "${env.PATH};${projectDir}\\dependencies"
},
{
"name": "CMAKE_LIBRARY_PATH",
"value": "${projectDir}\\dependencies\\libx64;${projectDir}\\dependencies\\zlib\\x64\\static\\Release"
}
],
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
},
{
"name": "x64-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\msvc.build.release64", // "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"installRoot": "${projectDir}\\msvc.install", // "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
"cmakeCommandArgs": "-Wno-deprecated",
"variables": [
{
"name": "CMAKE_BUILD_TYPE",
"value": "RELEASE"
},
{
"name": "BUILD_FOR_WINSTORE",
"value": "OFF"
"name": "BUILD_64",
"value": "ON"
},
{
"name": "CMAKE_PREFIX_PATH",
"value": "${env.PATH};${projectDir}\\dependencies"
},
{
"name": "CMAKE_LIBRARY_PATH",
"value": "${projectDir}\\dependencies\\libx64;${projectDir}\\dependencies\\zlib\\x64\\static\\Release"
"value": "${projectDir}\\dependencies\\libx64"
}
],
"buildCommandArgs": "-v",
@@ -1,7 +1,7 @@
find_path(LAMEMSVC_INCLUDE_DIR lame.h PATHS ${PROJECT_SOURCE_DIR}/dependencies/include/lame;)

find_library(LAMEMSVC_LIBRARY NAMES lame_enc PATHS ${PROJECT_SOURCE_DIR}/dependencies/libx86 NO_DEFAULT_PATH)

set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
find_library(LAMEMSVC_LIBRARY NAMES lame_enc${ARCH_TYPE} PATHS ${DEPENDENCIES_DIR} NO_DEFAULT_PATH)
if (MINGW)
set(LAMEMSVC_INCLUDE_DIR "")
set(LAMEMSVC_LIBRARY "")
@@ -1,6 +1,7 @@
find_path(OGG_INCLUDE_DIR ogg.h PATHS ${PROJECT_SOURCE_DIR}/dependencies/include/ogg;)

find_library(OGG_LIBRARY NAMES ogg PATHS ${PROJECT_SOURCE_DIR}/dependencies/libx86 NO_DEFAULT_PATH)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
find_library(OGG_LIBRARY NAMES libogg${ARCH_TYPE} PATHS ${DEPENDENCIES_DIR} NO_DEFAULT_PATH)

if (MINGW)
set(OGG_INCLUDE_DIR "")
@@ -1,6 +1,7 @@
find_path(PORTAUDIO_INCLUDE_DIR portaudio.h PATHS ${PROJECT_SOURCE_DIR}/dependencies/include;)

find_library(PORTAUDIO_LIBRARY NAMES portaudio PATHS ${PROJECT_SOURCE_DIR}/dependencies/libx86 NO_DEFAULT_PATH)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
find_library(PORTAUDIO_LIBRARY NAMES portaudio${ARCH_TYPE} PATHS ${DEPENDENCIES_DIR} NO_DEFAULT_PATH)

if (MINGW)
set(PORTAUDIO_INCLUDE_DIR "")
@@ -1,6 +1,7 @@
find_path(SNDFILE_INCLUDE_DIR sndfile.h PATHS ${PROJECT_SOURCE_DIR}/dependencies/include;)

find_library(SNDFILE_LIBRARY NAMES sndfile-1 PATHS ${PROJECT_SOURCE_DIR}/dependencies/libx86 NO_DEFAULT_PATH)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
find_library(SNDFILE_LIBRARY NAMES libsndfile-1${ARCH_TYPE} PATHS ${DEPENDENCIES_DIR} NO_DEFAULT_PATH)

if (MINGW)
set(SNDFILE_INCLUDE_DIR "")
@@ -1,3 +1,3 @@
add_library(zlibstat STATIC IMPORTED)
set_target_properties(zlibstat PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/dependencies/zlib/x86/static/debug/zlibstat.lib)
set_target_properties(zlibstat PROPERTIES IMPORTED_LOCATION ${DEPENDENCIES_DIR}/zlibstat${ARCH_TYPE}.lib)

@@ -1,6 +1,7 @@
find_path(VORBIS_INCLUDE_DIR vorbisenc.h PATHS ${PROJECT_SOURCE_DIR}/dependencies/include/vorbis;)

find_library(VORBIS_LIBRARY NAMES vorbis PATHS ${PROJECT_SOURCE_DIR}/dependencies/libx86 NO_DEFAULT_PATH)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
find_library(VORBIS_LIBRARY NAMES libvorbis${ARCH_TYPE} PATHS ${DEPENDENCIES_DIR} NO_DEFAULT_PATH)

if (MINGW)
set(VORBIS_INCLUDE_DIR "")
@@ -1,6 +1,7 @@
find_path(VORBISFILE_INCLUDE_DIR vorbisfile.h PATHS ${PROJECT_SOURCE_DIR}/dependencies/include/vorbis;)

find_library(VORBISFILE_LIBRARY NAMES vorbisfile PATHS ${PROJECT_SOURCE_DIR}/dependencies/libx86 NO_DEFAULT_PATH)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
find_library(VORBISFILE_LIBRARY NAMES libvorbisfile${ARCH_TYPE} PATHS ${DEPENDENCIES_DIR} NO_DEFAULT_PATH)

if (MINGW)
set(VORBISFILE_INCLUDE_DIR "")
@@ -12,16 +12,16 @@ IF "%UNSTABLE%" == "" (
echo "Stable: Build MSI package"
:: sign dlls and exe files
CD C:\MuseScore
SET dSource=msvc.install
SET dSource=msvc.install_x64
for /f "delims=" %%f in ('dir /a-d /b /s "%dSource%\*.dll" "%dSource%\*.exe"') do (
echo "Signing %%f"
"C:\Program Files (x86)\Windows Kits\8.1\bin\x64\signtool.exe" sign /f "C:\MuseScore\build\appveyor\resources\musescore.p12" /t http://timestamp.verisign.com/scripts/timstamp.dll /p "%CERTIFICATE_PASSWORD%" "%%f"
)

call C:\MuseScore\msvc_build.bat package %APPVEYOR_BUILD_NUMBER%
call C:\MuseScore\msvc_build.bat package 64 %APPVEYOR_BUILD_NUMBER%

:: find the MSI file without the hardcoded version
for /r %%i in (msvc.build.release\*.msi) do ( SET FILEPATH=%%i )
for /r %%i in (msvc.build_x64\*.msi) do ( SET FILEPATH=%%i )
echo on
echo %FILEPATH%
echo off
@@ -13,7 +13,7 @@ XCOPY ccache "C:\ccache" /E /I /Y
CD C:\MuseScore
mkdir dependencies
cd dependencies
IF NOT EXIST dependencies.zip ( START " " /wait "C:\cygwin64\bin\wget.exe" --no-check-certificate "https://musescore.org/sites/musescore.org/files/2018-05/dependencies.zip" -O dependencies.zip )
IF NOT EXIST dependencies.zip ( START " " /wait "C:\cygwin64\bin\wget.exe" --no-check-certificate "https://s3.amazonaws.com/utils.musescore.org/dependencies.7z" -O dependencies.zip )
START " " /wait "7z" x -y dependencies.zip > nul
CD include
CD C:\MuseScore
@@ -27,13 +27,13 @@ python build/add-mc-keys.py %MC_CONSUMER_KEY% %MC_CONSUMER_SECRET%
)

:: get revision number
SET PATH=C:\Qt\5.9\msvc2015\bin;%PATH%
SET PATH=C:\Qt\5.9\msvc2017_64\bin;%PATH%
call C:\MuseScore\msvc_build.bat revision
::git rev-parse --short=7 HEAD > mscore/revision.h
SET /p MSversion=<mscore\revision.h

:: CMake refuses to generate MinGW Makefiles if sh.exe is in the PATH (C:\Program Files\Git\usr\bin)
SET PATH=C:\Qt\5.9\msvc2015\bin;C:\Program Files (x86)\CMake\bin;C:\Program Files\7-Zip;C:\ccache\bin;C:\Tools\curl\bin;%WIX%\bin;C:\Windows\system32;C:\Windows
SET PATH=C:\Qt\5.9\msvc2017_64\bin;C:\Program Files (x86)\CMake\bin;C:\Program Files\7-Zip;C:\ccache\bin;C:\Tools\curl\bin;%WIX%\bin;C:\Windows\system32;C:\Windows

:: set ccache dir
SET CCACHE_DIR=C:\ccache\cache
@@ -1,6 +1,3 @@
::mingw32-make -f Makefile.mingw release BUILD_NUMBER=%APPVEYOR_BUILD_NUMBER%
::mingw32-make -f Makefile.mingw install BUILD_NUMBER=%APPVEYOR_BUILD_NUMBER%

call C:\MuseScore\msvc_build.bat release %APPVEYOR_BUILD_NUMBER%
call C:\MuseScore\msvc_build.bat install %APPVEYOR_BUILD_NUMBER%
call C:\MuseScore\msvc_build.bat release 64 %APPVEYOR_BUILD_NUMBER%
call C:\MuseScore\msvc_build.bat install 64 %APPVEYOR_BUILD_NUMBER%

0 comments on commit f90018b

Please sign in to comment.
You can’t perform that action at this time.