Skip to content

Conversation

karmux
Copy link
Contributor

@karmux karmux commented Jan 20, 2017

Fixes #3245.

Copy link
Member

@jasp00 jasp00 left a comment

Choose a reason for hiding this comment

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

Not sure if this is necessary. If so, you should fix it.

@@ -7,8 +7,8 @@
# WINE_DEFINITIONS - Compiler switches required for using wine
#

FIND_PATH(WINE_INCLUDE_DIR windows/windows.h PATH_SUFFIXES wine)
FIND_LIBRARY(WINE_LIBRARY NAMES wine PATH_SUFFIXES wine i386-linux-gnu/wine)
FIND_PATH(WINE_INCLUDE_DIR windows/windows.h PATHS /opt/wine-devel/include /opt/wine-staging/include PATH_SUFFIXES wine)
Copy link
Member

Choose a reason for hiding this comment

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

I would argue what official means, since the official packages in Debian and Ubuntu are the wine-development packages. The expected way is to configure with CMAKE_PREFIX_PATH rather than use PATHS, but I guess this does no harm.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've now written this part using CMAKE_PREFIX_PATH.

SET(EXTRA_FLAGS ${EXTRA_FLAGS} -nodefaultlibs /usr/lib/i386/wine/libwinecrt0.a -luser32 -lkernel32 -lgdi32)
ENDIF()
# Development
IF("${WINEBUILD_OUTPUT}" MATCHES "/opt/wine-devel/lib64/wine/libwinecrt0.a.*")
Copy link
Member

@jasp00 jasp00 Jan 22, 2017

Choose a reason for hiding this comment

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

I question this workaround for a recent system, specially for a package from WineHQ. There is no way currently to mix 64-bit and 32-bit objects, so this scenario is not possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm confused by this comment. What I did is just added a 2 paths to look for libwinecrt0.a.
In addition to /usr/lib/x86_64-linux-gnu/wine/ and /usr/lib/lib64/wine/ it now looks also into /opt/wine-devel/lib64/wine/ and /opt/wine-staging/lib64/wine/. I didn't introduce any new mixing of 32bit and 64bit.

Copy link
Member

Choose a reason for hiding this comment

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

This workaround is currently here because some people do not know they have to install 32-bit Wine and do not understand the linker error. If you install the package from WineHQ, you have 64-bit and 32-bit Wine, so you cannot get this error because 32-bit is selected. Did you actually run into this problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I remove those lines, I can't compile with Wine devel or staging.

Copy link
Member

Choose a reason for hiding this comment

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

Fine, it can be fixed later.

-I/opt/wine-devel/include
-L/opt/wine-devel/lib
-I/opt/wine-staging/include
-I/opt/wine-staging/lib
Copy link
Member

Choose a reason for hiding this comment

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

This breaks if you have multiple versions of Wine. You should include directories depending on the detected configuration. On the other hand, the expected way is to configure with WINE_CXX_FLAGS.

Do you mean -L/opt/wine-staging/lib?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's a typo, should be -L.

Copy link
Member

Choose a reason for hiding this comment

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

I agree with @jasp00 here... isn't there a way to assume this in FindWine.cmake once FIND_LIBRARY returns?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've made a new changeset that detects if devel or stable is installed and includes directories of only one wine version.

Copy link
Member

@jasp00 jasp00 left a comment

Choose a reason for hiding this comment

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

Workaround can be fixed later. You should not override preferences.

SET(EXTRA_FLAGS ${EXTRA_FLAGS} -nodefaultlibs /usr/lib/i386/wine/libwinecrt0.a -luser32 -lkernel32 -lgdi32)
ENDIF()
# Development
IF("${WINEBUILD_OUTPUT}" MATCHES "/opt/wine-devel/lib64/wine/libwinecrt0.a.*")
Copy link
Member

Choose a reason for hiding this comment

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

Fine, it can be fixed later.

@@ -7,12 +7,14 @@
# WINE_DEFINITIONS - Compiler switches required for using wine
#

SET(CMAKE_PREFIX_PATH /opt/wine-devel;/opt/wine-staging)
Copy link
Member

Choose a reason for hiding this comment

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

You are overriding user's preference. You should include the current value.

# Staging
IF(EXISTS "/opt/wine-staging/lib64/libwine.so")
SET(WINE_INCLUDES_AND_LIBS -I/opt/wine-staging/include -L/opt/wine-staging/lib)
ENDIF()
Copy link
Member

Choose a reason for hiding this comment

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

Overriding again. You should use WINE_INCLUDE_DIR and WINE_LIBRARY.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

WINE_INCLUDE_DIR gets value /opt/wine-devel/include/wine and wine/*.h headers cannot be found from there. Path needs to be /opt/wine-devel/include.

WINE_LIBRARY gets value /opt/wine-devel/lib/libwine.so and this cannot be linked. Path needs to be /opt/wine-devel/lib.

Copy link
Member

@tresf tresf Feb 22, 2017

Choose a reason for hiding this comment

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

WINE_LIBRARY gets value /opt/wine-devel/lib/libwine.so

@karmux @jasp00 can't we calculate it in FindWine.cmake then and call it something like WINE_LIBRARY_PATH ?

wine/*.h headers cannot be found from [wine/]

Sounds like a bug with FindWine.cmake, no?

Copy link
Member

Choose a reason for hiding this comment

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

WINE_INCLUDE_DIR gets value /opt/wine-devel/include/wine [...] Path needs to be /opt/wine-devel/include.

WINE_LIBRARY gets value /opt/wine-devel/lib/libwine.so [...] Path needs to be /opt/wine-devel/lib.

So? Use STRING().

ENDIF(LMMS_HOST_X86_64)

SET(WINE_CXX_FLAGS "" CACHE STRING "Extra flags passed to wineg++")

STRING(REPLACE "include/wine" "include" WINE_INCLUDE_DIR ${WINE_INCLUDE_DIR})
STRING(REPLACE "lib/libwine.so" "lib" WINE_LIBRARY ${WINE_LIBRARY})
Copy link
Member

Choose a reason for hiding this comment

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

You should output to new variables.

"-I\"${CMAKE_INSTALL_PREFIX}/include/wine/windows\""
"-I\"${CMAKE_INSTALL_PREFIX}/include\""
"-I\"${WINE_INCLUDE_DIR_REPLACED}\""
"-L\"${WINE_LIBRARY_REPLACED}\""
Copy link
Member

Choose a reason for hiding this comment

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

With _REPLACED, it looks like you are using an alternate directory and library. Do these variables name directories? Then you should use something like WINE_INCLUDE_BASE_DIR and WINE_LIBRARY_DIR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are correct. I'll fix it.

@jasp00
Copy link
Member

jasp00 commented Mar 31, 2017

Code looks good. @karmux, did you test Wine under /usr? If so, I will merge.

@karmux
Copy link
Contributor Author

karmux commented Apr 1, 2017

@jasp00 it compiles and runs with Wine under /usr.

@jasp00 jasp00 merged commit 0b43741 into LMMS:master Apr 1, 2017
@karmux karmux deleted the wine-devel branch April 1, 2017 12:36
tresf pushed a commit to tresf/lmms that referenced this pull request Apr 22, 2017
…S#3278)

* Added support for wine-devel packages.

* Added support for wine-staging packages.

* Staging extra flags.

* Dynamic Wine branch detection (stable, devel, staging).

* Using STRING() to correct WINE_INCLUDE_DIR and WINE_LIBRARY.

* Don't override CMAKE_PREFIX_PATH.

* REPLACE outputs new variables.

* Renamed variables.
tresf pushed a commit to tresf/lmms that referenced this pull request May 10, 2017
…S#3278)

* Added support for wine-devel packages.

* Added support for wine-staging packages.

* Staging extra flags.

* Dynamic Wine branch detection (stable, devel, staging).

* Using STRING() to correct WINE_INCLUDE_DIR and WINE_LIBRARY.

* Don't override CMAKE_PREFIX_PATH.

* REPLACE outputs new variables.

* Renamed variables.
liushuyu pushed a commit to liushuyu/lmms that referenced this pull request Jun 3, 2017
…S#3278)

* Added support for wine-devel packages.

* Added support for wine-staging packages.

* Staging extra flags.

* Dynamic Wine branch detection (stable, devel, staging).

* Using STRING() to correct WINE_INCLUDE_DIR and WINE_LIBRARY.

* Don't override CMAKE_PREFIX_PATH.

* REPLACE outputs new variables.

* Renamed variables.
liushuyu pushed a commit to liushuyu/lmms that referenced this pull request Jun 19, 2017
…S#3278)

* Added support for wine-devel packages.

* Added support for wine-staging packages.

* Staging extra flags.

* Dynamic Wine branch detection (stable, devel, staging).

* Using STRING() to correct WINE_INCLUDE_DIR and WINE_LIBRARY.

* Don't override CMAKE_PREFIX_PATH.

* REPLACE outputs new variables.

* Renamed variables.
PhysSong pushed a commit to PhysSong/lmms that referenced this pull request Jul 7, 2017
…S#3278)

* Added support for wine-devel packages.

* Added support for wine-staging packages.

* Staging extra flags.

* Dynamic Wine branch detection (stable, devel, staging).

* Using STRING() to correct WINE_INCLUDE_DIR and WINE_LIBRARY.

* Don't override CMAKE_PREFIX_PATH.

* REPLACE outputs new variables.

* Renamed variables.
PhysSong pushed a commit to PhysSong/lmms that referenced this pull request Jul 7, 2017
…S#3278)

* Added support for wine-devel packages.

* Added support for wine-staging packages.

* Staging extra flags.

* Dynamic Wine branch detection (stable, devel, staging).

* Using STRING() to correct WINE_INCLUDE_DIR and WINE_LIBRARY.

* Don't override CMAKE_PREFIX_PATH.

* REPLACE outputs new variables.

* Renamed variables.
PhysSong pushed a commit to PhysSong/lmms that referenced this pull request Jul 7, 2017
…S#3278)

* Added support for wine-devel packages.

* Added support for wine-staging packages.

* Staging extra flags.

* Dynamic Wine branch detection (stable, devel, staging).

* Using STRING() to correct WINE_INCLUDE_DIR and WINE_LIBRARY.

* Don't override CMAKE_PREFIX_PATH.

* REPLACE outputs new variables.

* Renamed variables.
PhysSong pushed a commit to PhysSong/lmms that referenced this pull request Jul 7, 2017
…S#3278)

* Added support for wine-devel packages.

* Added support for wine-staging packages.

* Staging extra flags.

* Dynamic Wine branch detection (stable, devel, staging).

* Using STRING() to correct WINE_INCLUDE_DIR and WINE_LIBRARY.

* Don't override CMAKE_PREFIX_PATH.

* REPLACE outputs new variables.

* Renamed variables.
sdasda7777 pushed a commit to sdasda7777/lmms that referenced this pull request Jun 28, 2022
…S#3278)

* Added support for wine-devel packages.

* Added support for wine-staging packages.

* Staging extra flags.

* Dynamic Wine branch detection (stable, devel, staging).

* Using STRING() to correct WINE_INCLUDE_DIR and WINE_LIBRARY.

* Don't override CMAKE_PREFIX_PATH.

* REPLACE outputs new variables.

* Renamed variables.
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.

3 participants