Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Msvc/vst-rebase : msvc support #4352

Merged
merged 10 commits into from May 22, 2018
Merged

Msvc/vst-rebase : msvc support #4352

merged 10 commits into from May 22, 2018

Conversation

ghost
Copy link

@ghost ghost commented May 11, 2018

Here's some proposed changes to compile using MSVC. I think using vcpkg would be ideal since it has built in support for cmake (find_package where supported). And as an added bonus it's also works on linux (although I don't see a reason for using it there)

It obviously needs more testing, but this isn't the master branch so I think we're ok.

using vcpkg

install

git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat

installing libs 4 lmms

.\vcpkg.exe install fftw3 libsndfile libsamplerate qt5

cmake usage

cmake "-DCMAKE_TOOLCHAIN_FILE=<vcpkgdir>/scripts/buildsystems/vcpkg.cmake" <lmms src dir>

Azrael added 3 commits May 11, 2018 13:17
+locale: using path instead of individual files to reduce command line
size
+remotevstplugin: changed order return type & calling convention
(compiler error)
+lmmsobj: removed single quotes for command line defines
+added toolchain file
+added toolset
Copy link
Member

@lukas-w lukas-w left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two changes left to do to fix Linux compilation:

  1. In plugins/carlabase/carla.h, a #include "plugin_export.h" is missing
  2. In cmake/linux/package_linux.sh.in, RemoteVstPlugin.exe.so needs to be changed RemoteVstPlugin32.exe.so

Could you add these to your PR?

@@ -27,33 +27,27 @@ SET(EXTERNALPROJECT_CMAKE_ARGS
"-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
"-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}"
"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
"-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be moved to the MSVC-specific part. It conflicts with the toolchain file passed in line 70.

@@ -64,14 +64,22 @@ AudioSdl::AudioSdl( bool & _success_ful, Mixer* _mixer ) :
m_audioHandle.callback = sdlAudioCallback;
m_audioHandle.userdata = this;

SDL_AudioSpec actual;

SDL_AudioSpec actual;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, these SDL2 fixes appear to be redundant with those from #3947. I think it's best to drop a414255 from this PR to avoid conflicts.

IF(NOT SNDFILE_FOUND)
MESSAGE(FATAL_ERROR "LMMS requires libsndfile1 and libsndfile1-dev >= 1.0.18 - please install, remove CMakeCache.txt and try again!")
ENDIF()
IF(USING_VCPKG)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we'd hide these details in a FindSndFile.cmake script and only call FIND_PACKAGE(SndFile) here, but I guess that's out of scope for this PR so it's fine this way for now.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree.

I'm a bit relaxed about coding standards because this is only a proof of concept. If it works, I'll implement those changes. If it doesn't, I'll look for other package managers in windows (scoop?) and see if I can implement those.

Azrael added 4 commits May 12, 2018 09:40
+carla: exports header
+package_linux: corrected RemoteVstPlugin name
+vstbase: toolchain file conditional on MSVC
@ghost
Copy link
Author

ghost commented May 12, 2018

I've added the changes you requested and got most of the tests to pass but I don't know why the travis continuous integration is failing. I can't reproduce that error on my machine.

I removed the install of remotevstplugin64 because appimage was complaining about it. No idea if that's correct or not.

@ghost
Copy link
Author

ghost commented May 13, 2018

It's now possible to create an NSIS installer package using msvc.
If there are no major issues, I suggest we merge. I can keep on adding to this pull request, but if we merge this pr and also the fix for SDL then others should be able to get msvc running pretty quickly.

edit: I just remembered that in the initial install of vcpkg they have to compile qt5. So.. um... let's say they can get it running easily instead of quickly :)

@lukas-w
Copy link
Member

lukas-w commented May 14, 2018

It's now possible to create an NSIS installer package using msvc.

@justnope Although we're trying to get away from the hard-coded install paths in CMake (see #4345), this is a great addition! Thanks! 👍

Thank you for your hard work on this! It's great to see the Windows platform get some attention. I'll go through the changes again and leave some comments about minor code-style issues.

As far as I can see, RemoteVstPlugin64 and RemoteVstPlugin64.exe.so aren't installed or packaged on Linux yet. We can track this in another PR if you like.

# build 32 bit version of RemoteVstPlugin
IF(LMMS_BUILD_WIN32 AND NOT LMMS_BUILD_WIN64)
ADD_SUBDIRECTORY(RemoteVstPlugin)
INSTALL(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/../RemoteVstPlugin32.exe" "${CMAKE_CURRENT_BINARY_DIR}/../RemoteVstPlugin32.exe" DESTINATION "${PLUGIN_DIR}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has ${CMAKE_CURRENT_BINARY_DIR}/../RemoteVstPlugin32.exe twice.

"-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}"
"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
)

IF(MSVC)
LIST(APPEND EXTERNALPROJECT_CMAKE_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is only used in the ELSEIF(LMMS_BUILD_WIN64 AND MSVC) case, you can just move it down there, so that it reads from line 50:

ExternalProject_Add(RemoteVstPlugin32
	"${EXTERNALPROJECT_ARGS}"
	CMAKE_GENERATOR ${GENERATOR}
	CMAKE_GENERATOR_TOOLSET ${CMAKE_GENERATOR_TOOLSET}
	CMAKE_ARGS
		"${EXTERNALPROJECT_CMAKE_ARGS}"
		-DCMAKE_TOOLCHAIN_FILE="${CMAKE_TOOLCHAIN_FILE}"
		"-DCMAKE_PREFIX_PATH=${QT_32_PREFIX}"
)

CMAKE_ARGS
"${EXTERNALPROJECT_CMAKE_ARGS}"
"-DCMAKE_PREFIX_PATH=${QT_32_PREFIX}"
)
INSTALL(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/../RemoteVstPlugin32.exe" DESTINATION "${PLUGIN_DIR}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move these redundant INSTALL statements downwards after the ENDIF()? Something like this:

IF(TARGET RemoteVstPlugin32)
    IF(LMMS_BUILD_LINUX)
         INSTALL(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/../RemoteVstPlugin32" "${CMAKE_CURRENT_BINARY_DIR}/../RemoteVstPlugin32.exe.so" DESTINATION "${PLUGIN_DIR}")
    ELSEIF(LMMS_BUILD_WIN32)
        INSTALL(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/../RemoteVstPlugin32.exe" DESTINATION "${PLUGIN_DIR}")
    ENDIF()
ENDIF()

@ghost ghost mentioned this pull request May 14, 2018
@ghost
Copy link
Author

ghost commented May 15, 2018

I've tested msvc 2015 & 2017/32 & 64 bits. It all seems to work after implementing your code review suggestions (thanks btw).

It's definitely not finished as in merge into the master branch, but I think it should be safe enough to merge into msvc/vst-rebase.

TODO:
-Find out why sdl2.dll isn't copied into the build directory
-Create a junction (symbolic link in linux, windows symlinks have a slightly different meaning) in the build directory for the data dir (easier debugging if implemented in cmake).
-fluidsynth is present in vcpkg but not picked up, etc...

@ghost ghost closed this May 20, 2018
@lukas-w
Copy link
Member

lukas-w commented May 20, 2018

Why close this @justnope? Didn't have time to merge yet.

@lukas-w lukas-w reopened this May 20, 2018
@ghost
Copy link
Author

ghost commented May 20, 2018

I've made another branch from this branch msvc/ng. Last time I did this the things I pushed in the new branch also ended up in the PR which wasn't the intention.

I might have screwed up the git commands when that happened, but in any case if you see extra commits they are from the new branch.

@lukas-w
Copy link
Member

lukas-w commented May 22, 2018

@justnope Only commits you push to this branch will end up in the PR. I'll merge shortly. 👍

@lukas-w lukas-w merged commit d0ca0dc into LMMS:msvc/vst-rebase May 22, 2018
@@ -7,8 +7,10 @@
#include <memory>
#include <utility>

#if (__cplusplus >= 201402L)
#if (__cplusplus >= 201402L || _MSC_VER)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VS 2012(_MSC_VER == 1700) doesn't have std::make_unique while 2013 (_MSC_VER == 1800) has. This will cause compile errors when using VS 2012.

lukas-w pushed a commit that referenced this pull request Jun 7, 2018
* locale: using path instead of individual files to reduce command line size
* remotevstplugin: changed order return type & calling convention (compiler error)
* lmmsobj: removed single quotes for command line defines
* added vcpkg support & std::make_unique for MSVC
* carla: include exports header
* package_linux: corrected RemoteVstPlugin name
* vstbase: toolchain file conditional on MSVC
* Added install for remotevstplugin
* msvc: installer works with vcpkg

Remotevst 64bit install removed due to an ApImage problem
This was referenced Jun 11, 2018
lukas-w pushed a commit to lukas-w/lmms that referenced this pull request Jul 7, 2018
* locale: using path instead of individual files to reduce command line size
* remotevstplugin: changed order return type & calling convention (compiler error)
* lmmsobj: removed single quotes for command line defines
* added vcpkg support & std::make_unique for MSVC
* carla: include exports header
* package_linux: corrected RemoteVstPlugin name
* vstbase: toolchain file conditional on MSVC
* Added install for remotevstplugin
* msvc: installer works with vcpkg

Remotevst 64bit install removed due to an ApImage problem
sdasda7777 pushed a commit to sdasda7777/lmms that referenced this pull request Jun 28, 2022
* locale: using path instead of individual files to reduce command line size
* remotevstplugin: changed order return type & calling convention (compiler error)
* lmmsobj: removed single quotes for command line defines
* added vcpkg support & std::make_unique for MSVC
* carla: include exports header
* package_linux: corrected RemoteVstPlugin name
* vstbase: toolchain file conditional on MSVC
* Added install for remotevstplugin
* msvc: installer works with vcpkg

Remotevst 64bit install removed due to an ApImage problem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants