PDA

View Full Version : QMake doesnt do simple things in Windows



prchakal
23rd April 2012, 21:16
Hi,

I have created a project that will compile SFML in all platforms.

You can get project here:
https://github.com/prsolucoes/sfml-project

When you download, you will see that the .pro file have 3 builds (one for each platforms).
The mac version is OK. The linux version is not implemented yet.
And the windows version is what im trying finish now.
The project is compiled with success, the problem is when i try copy all dlls to destination path and
put the icon in .EXE file, like i do with mac final binary.
It doesnt work with or without shadown build. Can anyone download the project and try help me on windows?

Im using last qt sdk.

ChrisW67
23rd April 2012, 23:09
The project is compiled with success, the problem is when i try copy all dlls to destination path
Would you care to share what the problem is? Exactly what commands are executed? What are the error messages?
IIRC there have been issues with INSTALLS and generated copy commands on Windows. I don't know if there still are, or if any of these apply to you.


and put the icon in .EXE file, like i do with mac final binary.
Nothing in your PRO file even attempts this. You put the application icon into the Windows application using a Windows resource file (RC_FILE) and an icon in Windows ICO format. That information is in the Qt docs.

Here is the offending PRO file for those not willing to clone the git repo:


TEMPLATE = app
CONFIG += console
CONFIG -= qt

SOURCES += main.cpp

###############################################
# CONFIGURATION
###############################################

CONFIG_APP_NAME = sfml-project

macx {
CONFIG_PLATFORM_PATH = mac
CONFIG_ICON_EXTENSION = icns
}

win32 {
CONFIG_PLATFORM_PATH = win32
CONFIG_ICON_EXTENSION = png
}

unix:!macx {
CONFIG_PLATFORM_PATH = unix
CONFIG_ICON_EXTENSION = png
}

ICON = $${PWD}/resources/$${CONFIG_PLATFORM_PATH}/app.$${CONFIG_ICON_EXTENSION}
TARGET = $${CONFIG_APP_NAME}

###############################################
# SFML LIBRARY
###############################################

INCLUDEPATH += "$${PWD}/library/sfml/$${CONFIG_PLATFORM_PATH}/include"
LIBS += -L"$${PWD}/library/sfml/$${CONFIG_PLATFORM_PATH}/lib" \
-lsfml-system \
-lsfml-window \
-lsfml-graphics \
-lsfml-audio \
-lsfml-network

macx {
sfml-library.path = Contents/Frameworks
sfml-library.files = $${PWD}/library/sfml/$${CONFIG_PLATFORM_PATH}/lib/
QMAKE_BUNDLE_DATA += sfml-library
}

win32 {
sfml-library.path = $${DESTDIR}
sfml-library.files = $${PWD}/library/sfml/$${CONFIG_PLATFORM_PATH}/bin/
INSTALLS += sfml-library
#QMAKE_BUNDLE_DATA += sfml-library
#PRE_TARGETDEPS += $${PWD}/library/sfml/$${CONFIG_PLATFORM_PATH}/bin/*
#copyfiles.commands += copy /y $${PWD}\\library\\sfml\\$${CONFIG_PLATFORM_PATH}\\ bin\\sfml-system-2.dll debug
#QMAKE_EXTRA_TARGETS += copyfiles
}

unix:!macx {
# need implement
}

prchakal
24th April 2012, 01:53
Hi.

As you see in .pro file, i try many commands to copy DLLS, but the principal issue is that DESTDIR is empty.

I try this methods:



# method 1
sfml-library.path = $${DESTDIR}
sfml-library.files = $${PWD}/library/sfml/$${CONFIG_PLATFORM_PATH}/bin/
INSTALLS += sfml-library

# method 2+1
#QMAKE_BUNDLE_DATA += sfml-library

# method 3
#EXTRA_BINFILES += \
# $${PWD}/library/sfml/$${CONFIG_PLATFORM_PATH}/bin/sfml-system-2.dll
#EXTRA_BINFILES_WIN = $${EXTRA_BINFILES}
#EXTRA_BINFILES_WIN ~= s,/,\\,g
# DESTDIR_WIN = $${DESTDIR}
#DESTDIR_WIN ~= s,/,\\,g
#for(FILE,EXTRA_BINFILES_WIN){
# QMAKE_POST_LINK +=$$quote(cmd /c copy /y $${FILE} $${DESTDIR_WIN}$$escape_expand(\n\t))
#}

# method 4
#QMAKE_POST_LINK += copy /Y $${PWD}/library/sfml/$${CONFIG_PLATFORM_PATH}/bin/sfml-system-2.dll $${PWD}/debug

$${DESTDIR} is empty in all platforms and with or without shadown build.

There is a variable that represent output dir to .EXE file that works in all platforms?

ChrisW67
24th April 2012, 06:09
DESTDIR is yours to set. If you do not set it then you get the current working directory. You can get the same result with:


DESTDIR = .

if you absolutely have to have a value for DESTDIR.