Re #721 Added support for building with QtCreator + MinGW 4.7 (using the 'MinGW Makefiles' CMake generator)

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@4928 30fe4595-0a0c-4342-8851-515496e4dcbd
This commit is contained in:
pouillot 2012-09-09 08:37:40 +00:00
parent 7b2cab3ae6
commit ebe537cb74
7 changed files with 333 additions and 172 deletions

View File

@ -6,17 +6,9 @@ PROJECT(speed-dreams-2)
INCLUDE(cmake/macros.cmake)
INCLUDE(cmake/checks.cmake)
# Special 3rd Party handling for MS compilers.
IF(MSVC)
INCLUDE(Find3rdPartyDependencies)
SD_FIND_3RDPARTY()
ENDIF(MSVC)
CHECK_HEADERS_H()
CHECK_FUNCTIONS()
CHECK_LIBRARIES()
CHECK_PLIB_LIBRARIES()
CHECK_PACKAGES()
# Determine version
SET(NEXT_LESSER_VERSION 0) # The next lesser version

View File

@ -277,36 +277,48 @@ Note that these instructions work under Windows XP 32 SP2/SP3 ; some tweaks wigh
0) Initial steps, common to all build methods
a. Install CMake v2.6+ http://www.cmake.org/cmake/resources/software.html
b. Download the official Speed Dreams tarballs from SF.net
http://sourceforge.net/projects/speed-dreams/files/2.0.0
(speed-dreams-src-<package>-<version>.tar.xz)
Note: See below if you want to do it from SVN, in order to get the latest changes ...
c. Extract their contents to your local disk (7Zip is an excellent tool for that),
all in the same target folder.
or the latest trunk from SVN for building with MinGW (was not ready for 2.0.0).
c. Extract their contents to your local disk all in the same target folder
(7Zip is an excellent tool for that http://www.7-zip.org/).
Warning: You need to extract all of the source packages in order to start building
(see above 2-a chapter for more).
1) Cmake and MinGW :
1) CMake and MinGW :
Notes:
* Tested with success with CMake 2.8.2 and 2.8.8 + MinGW 2012 April (gcc 4.7.0),
* Also worked well with the version of MinGW shipped with Nokia Qt Creator 2.4.1 (gcc 4.4.0)
(see below for slightly different install instructions).
(but needs a dedicated 3rd party binary package which has not been published).
* Be aware that there are 2 different ways of building with CMake and MinGW :
- through "MSYS Makefiles" CMake generator : you'll then run all the build commands
(cmake and make) from the MSYS shell, (sort of a minimal "Linux + bash" environment)
- through "MinGW Makefiles" CMake generator : it is not compatible with the MSYS way,
but it works from inside the QtCreator IDE.
d. Install MinGW and MSYS
d. Install MinGW (and optionaly MSYS)
Following the instructions of http://www.mingw.org/wiki/Getting_Started
(example here for the official release of 2012, April, featuring gcc 4.7.0) :
* Download and run the latest mingw-get-inst version from
* Download and run the latest mingw-get-inst version from
https://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/
=> mingw-get-inst-20120426.exe
* Select the directory where to install MinGW, remembering the advice
that the path to this directory should not contain any spaces.
=> C:\MinGW
* Select the minimal set of components to install :
* C++ compiler
* MSYS.
* C++ compiler (always)
* MSYS (if you don't plan to use QtCreator).
If you installed MSYS, then you might be interested in the following,
otherwise, skip it and go to e.
* Run MSYS, the MinGW Shell (bash) :
Start Menu / Programs / MinGW / MinGW Shell
@ -340,46 +352,90 @@ Note that these instructions work under Windows XP 32 SP2/SP3 ; some tweaks wigh
Note: The other newer versions from http://alleg.sourceforge.net/files didn't work for me.
Another solution (tested with success) :
* MinGW itself : You can use the one shipped with Nokia Qt Creator
(Release 2.4.1 worked for me)
* MSYS :
- download and install the latest 1.0.x through the MinGW installer
https://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/
- add a /mingw mount point to the fstab in order MSYS knows where MinGW is installed
(inside Qt Creator folders) :
ex: add a "c:/Qt/qtcreator-2.4.1/mingw /mingw" line to /etc/fstab
* Qt creator is a full-fledged IDE, making you able to :
- open your SD "project" (equivalent to a MSVC "solution")
by simply opening the master CMakeLists.txt in Qt Creator,
- run CMake after specifying the needed options (see below),
- make and install SD,
- and everything you expect from a modern IDE (MSVC 2005 is not one ;-)
all of the above through the GUI.
* But you'll have to build yourself your 3rd party package for this (older) GCC version
e. If you didn't install MSYS, you need to install QtCreator
* Download and install the latest version :
- the simplest way is to get the standalone version from
http://qt.nokia.com/downloads/downloads#qt-creator
- you can also get the much heavier full Qt SDK, from
http://qt.nokia.com/downloads (on-line or off-line installed, as you will)
which bundles QtCreator itself ... along with the Qt libraries and other dev. tools ...
which are not needed for building SD.
Note: It also ships a working MinGW, but probably not the version that we used
for building the "3rdParty" binary package for SD (MinGW 4.7.0) ;
so if you plan to use this version, be ready to build yourself (from sources)
your own "3rdParty" binary package for SD
(see http://sourceforge.net/projects/speed-dreams/files/3rd%20party/Sources/post-2.0.0/).
Last minute news : It seems that Nokia no more ships MinGW with it's QtCreator IDE,
but let you use the one you like ... see Nokia's HOWTO pages.
e. Download the "MinGW 4.7.0" release of the Speed Dreams "3rdParty" binary package from SF.net
http://sourceforge.net/projects/speed-dreams/files/3rd%20party
* Configure it for using your MinGW installation :
- start it,
- ... TODO.
f. Download the "MinGW 4.7.0" release of the Speed Dreams "3rdParty" binary package from SF.net
http://sourceforge.net/projects/speed-dreams/files/3rd%20party/MinGW%204.7.0/
(it contains necessary 3rd party libs compiled with/for MinGW 4.7.0)
f. Extract it to the /usr/local folder :
From the MinGW Shell :
$ cd /usr
$ tar xvfz .../3rdParty-2.1-win32-mingw470-g-O2.tar.gz
g. Install it in the right folder :
g. Run CMake to configure the build (here we assume CMake 2.8, but newer versions should work) :
* If you are using MSYS, extract it to the /usr/local folder from the MSYS shell :
$ cd /path/to/sd/sources/trunk
$ mkdir build
$ cd build
$ /c/Program\ Files/CMake\ 2.8/bin/cmake -G "MSYS Makefiles" -DOPTION_OFFICIAL_ONLY:BOOL=On -DCMAKE_PREFIX_PATH:STRING=/usr/local -DCMAKE_BUILD_TYPE:STRING=Release ..
$ make # -j2 or even -j4 if you own a dual/quad-core CPU
$ make install
$ cd /usr
$ tar xvfz .../3rdParty-2.1-win32-mingw470-g-O2.tar.gz
Note: This 'Release' build gives you -O3-optimised binaries.
* If you are using QtCreator, extract it into the "3rdParty" folder,
in the same folder as the one which contains your SD source tree :
- let's say (as an example) that your SD trunk source tree is inside the "sd" folder :
(so in this folder, you have the "trunk" folder, containing "src", "data", "credits.xml" and so on),
- open 3rdParty-2.1-win32-mingw470-g-O2.tar.gz in your favorite archive manager
(7zip is an excellent tool for this : http://www.7-zip.org/),
- extract the whole "local" folder into the "sd" folder,
- rename it to "3rdParty".
h. Run CMake to configure the build (here we assume CMake 2.8, but newer versions should work) :
* If you are using MSYS, in the MSYS shell :
$ cd /path/to/sd/sources/trunk
$ mkdir build
$ cd build
$ /c/Program\ Files/CMake\ 2.8/bin/cmake -G "MSYS Makefiles" -DOPTION_OFFICIAL_ONLY:BOOL=On -DCMAKE_PREFIX_PATH:STRING=/usr/local -DCMAKE_BUILD_TYPE:STRING=Release ..
* If you are using QtCreator (solution 1) :
- Start it, and File / Open the master CMakeLists.txt of Speed Dreams
(at the top of the source tree, next to the src and data folders)
- Then the CMake wizard opens up ; use :
. CMake arguments :
-DOPTION_OFFICIAL_ONLY:BOOL=On -DCMAKE_BUILD_TYPE:STRING=Release
. CMake generator : "MinGW generator"
Note: See II.2.c above for more about possible / useful CMake arguments.
- And finally click on the "Run cmake" button
* If you are using QtCreator (solution 2) :
You can also use standard CMake GUI to do this before opening the master CMakeLists.txt in QtCreator,
but you have to first add C:\MinGW\bin to your PATH environment variable
otherwise CMake GUI won't propose you the "MinGW generator", which is the one you have to use
("MSYS makefiles" does not work with QtCreator).
In QtCreator, provided you don't removed you CMakeCache.txt or the whole build folder,
you then won't need to specify any argument when re-running CMake.
i. Build and install
* If you are using MSYS, in the MSYS shell :
$ make # -j2 or even -j4 if you own a dual/quad-core CPU
$ make install
* If you are using QtCreator :
- Build / Make (TODO : more details)
Note: The 'Release' build gives you -O3-optimised binaries.
2) Cmake and MS VC++ 2005 (8) / 2008 (9) / 2010 (10) on Windows XP 32

View File

@ -6,6 +6,10 @@ INCLUDE(CheckIncludeFiles)
INCLUDE(CheckFunctionExists)
INCLUDE(CheckLibraryExists)
IF(WIN32)
INCLUDE(FindCustom3rdParty)
ENDIF(WIN32)
MACRO(CHECK_HEADERS_H)
CHECK_INCLUDE_FILES(inttypes.h HAVE_INTTYPES_H)
@ -32,29 +36,6 @@ MACRO(CHECK_FUNCTIONS)
ENDMACRO(CHECK_FUNCTIONS)
MACRO(CHECK_LIBRARIES)
IF(UNIX)
FIND_PACKAGE(X11)
CHECK_LIBRARY_EXISTS(m sin "" HAVE_LIBM)
CHECK_LIBRARY_EXISTS(Xext XShmCreateImage "${X11_LIBRARY_DIR}" HAVE_LIBXEXT)
CHECK_LIBRARY_EXISTS(ICE IceSetIOErrorHandler "${X11_LIBRARY_DIR}" HAVE_LIBICE)
CHECK_LIBRARY_EXISTS(SM SmsSetErrorHandler "${X11_LIBRARY_DIR}" HAVE_LIBSM)
CHECK_LIBRARY_EXISTS(Xt XtDisplay "${X11_LIBRARY_DIR}" HAVE_LIBXT)
CHECK_LIBRARY_EXISTS(Xi XOpenDevice "${X11_LIBRARY_DIR}" HAVE_LIBXI)
CHECK_LIBRARY_EXISTS(Xmu XmuSimpleErrorHandler "${X11_LIBRARY_DIR}" HAVE_LIBXMU)
CHECK_LIBRARY_EXISTS(Xxf86vm XF86VidModeSetViewPort "${X11_LIBRARY_DIR}" HAVE_LIBXXF86VM)
CHECK_LIBRARY_EXISTS(Xrender XRenderSetSubpixelOrder "${X11_LIBRARY_DIR}" HAVE_LIBXRENDER)
CHECK_LIBRARY_EXISTS(Xrandr XRRQueryVersion "${X11_LIBRARY_DIR}" HAVE_LIBXRANDR)
ENDIF(UNIX)
CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL)
ENDMACRO(CHECK_LIBRARIES)
MACRO(CHECK_PLIB_LIBRARIES)
FIND_PACKAGE(PLIB)
@ -113,8 +94,54 @@ MACRO(CHECK_PLIB_LIBRARIES)
ENDMACRO(CHECK_PLIB_LIBRARIES)
MACRO(CHECK_PACKAGES)
MACRO(CHECK_X11_LIBRARIES)
FIND_PACKAGE(X11)
CHECK_LIBRARY_EXISTS(m sin "" HAVE_LIBM)
CHECK_LIBRARY_EXISTS(Xext XShmCreateImage "${X11_LIBRARY_DIR}" HAVE_LIBXEXT)
CHECK_LIBRARY_EXISTS(ICE IceSetIOErrorHandler "${X11_LIBRARY_DIR}" HAVE_LIBICE)
CHECK_LIBRARY_EXISTS(SM SmsSetErrorHandler "${X11_LIBRARY_DIR}" HAVE_LIBSM)
CHECK_LIBRARY_EXISTS(Xt XtDisplay "${X11_LIBRARY_DIR}" HAVE_LIBXT)
CHECK_LIBRARY_EXISTS(Xi XOpenDevice "${X11_LIBRARY_DIR}" HAVE_LIBXI)
CHECK_LIBRARY_EXISTS(Xmu XmuSimpleErrorHandler "${X11_LIBRARY_DIR}" HAVE_LIBXMU)
CHECK_LIBRARY_EXISTS(Xxf86vm XF86VidModeSetViewPort "${X11_LIBRARY_DIR}" HAVE_LIBXXF86VM)
CHECK_LIBRARY_EXISTS(Xrender XRenderSetSubpixelOrder "${X11_LIBRARY_DIR}" HAVE_LIBXRENDER)
CHECK_LIBRARY_EXISTS(Xrandr XRRQueryVersion "${X11_LIBRARY_DIR}" HAVE_LIBXRANDR)
IF(X11_FOUND)
SET(HAVE_LIBX11 1)
MESSAGE(STATUS "Looking for libraries X11 - found")
ELSE(X11_FOUND)
MESSAGE(STATUS "Looking for libraries X11 - NOT found")
ENDIF(X11_FOUND)
ENDMACRO(CHECK_X11_LIBRARIES)
MACRO(CHECK_LIBRARIES)
# Special 3rd Party libraries location for most Windows builds.
IF(WIN32 AND OPTION_CUSTOM_3RDPARTY)
SD_FIND_CUSTOM_3RDPARTY()
ENDIF(WIN32 AND OPTION_CUSTOM_3RDPARTY)
# Now, find libraries as usual with CMake.
IF(UNIX)
# X11.
CHECK_X11_LIBRARIES()
# dl
CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL)
ENDIF(UNIX)
# PLib.
CHECK_PLIB_LIBRARIES()
# OpenAL
Find_Package(OpenAL)
IF(OPENAL_FOUND)
@ -124,6 +151,7 @@ MACRO(CHECK_PACKAGES)
MESSAGE(STATUS "Looking for library OpenAL - NOT found")
ENDIF(OPENAL_FOUND)
# ENet
Find_Package(ENET)
IF(ENET_FOUND)
@ -133,6 +161,7 @@ MACRO(CHECK_PACKAGES)
MESSAGE(STATUS "Looking for library ENET - NOT found")
ENDIF(ENET_FOUND)
# OpenGL
Find_Package(OpenGL)
IF(OPENGL_FOUND)
@ -149,15 +178,7 @@ MACRO(CHECK_PACKAGES)
MESSAGE(STATUS "Looking for library OpenGL/GLU - NOT found")
ENDIF(OPENGL_GLU_FOUND)
Find_Package(X11)
IF(X11_FOUND)
SET(HAVE_LIBX11 1)
MESSAGE(STATUS "Looking for libraries X11 - found")
ELSE(X11_FOUND)
MESSAGE(STATUS "Looking for libraries X11 - NOT found")
ENDIF(X11_FOUND)
# ZLIB
FIND_Package(ZLIB)
IF(ZLIB_FOUND)
@ -167,6 +188,7 @@ MACRO(CHECK_PACKAGES)
MESSAGE(STATUS "Looking for library Zlib - NOT found")
ENDIF(ZLIB_FOUND)
# PNG
Find_Package(PNG)
IF(PNG_FOUND)
@ -176,6 +198,7 @@ MACRO(CHECK_PACKAGES)
MESSAGE(STATUS "Looking for library PNG - NOT found")
ENDIF(PNG_FOUND)
# JPEG
Find_Package(JPEG)
IF(JPEG_FOUND)
@ -185,6 +208,7 @@ MACRO(CHECK_PACKAGES)
MESSAGE(STATUS "Looking for library JPEG - NOT found")
ENDIF(JPEG_FOUND)
# SDL
Find_Package(SDL)
IF(SDL_FOUND)
@ -194,6 +218,7 @@ MACRO(CHECK_PACKAGES)
MESSAGE(STATUS "Looking for library SDL - NOT found")
ENDIF(SDL_FOUND)
# Expat
IF(OPTION_3RDPARTY_EXPAT)
Find_Package(EXPAT)
@ -207,6 +232,7 @@ MACRO(CHECK_PACKAGES)
ENDIF(OPTION_3RDPARTY_EXPAT)
# SOLID
IF(OPTION_3RDPARTY_SOLID)
Find_Package(SOLID)
@ -220,5 +246,5 @@ MACRO(CHECK_PACKAGES)
ENDIF(OPTION_3RDPARTY_SOLID)
ENDMACRO(CHECK_PACKAGES)
ENDMACRO(CHECK_LIBRARIES)

View File

@ -837,10 +837,10 @@ MACRO(ADD_SDL_LIBRARY TARGET)
FIND_PACKAGE(SDL)
IF(SDL_FOUND)
TARGET_LINK_LIBRARIES(${TARGET} ${SDL_LIBRARY})
IF(SDLMAIN_LIBRARY)
TARGET_LINK_LIBRARIES(${TARGET} ${SDLMAIN_LIBRARY})
ENDIF(SDLMAIN_LIBRARY)
TARGET_LINK_LIBRARIES(${TARGET} ${SDL_LIBRARY})
ELSE(SDL_FOUND)
MESSAGE(FATAL_ERROR "Cannot find SDL library")
ENDIF(SDL_FOUND)
@ -1123,7 +1123,7 @@ MACRO(ADD_SD_COMPILE_OPTIONS)
ENDIF(HAVE_CONFIG_H)
# Pre-processor definitions (do it only once).
# Build options (do it only once).
IF(NOT _ALREADY_DONE)
# CMake options.
@ -1158,7 +1158,25 @@ MACRO(ADD_SD_COMPILE_OPTIONS)
SET(OPTION_AUTOVERSION true CACHE BOOL "Enable automatic computation of the version from SVN source tree")
# Compiler definitions.
# Custom 3rdParty location for some Windows builds (standard CMake Find<package> macros
# can't find it, so we needed another solution : see FindCustom3rdParty.cmake).
IF(MSVC)
SET(_OPTION_CUSTOM_3RDPARTY true) # Always needed for MSVC compilers.
ELSEIF(MINGW)
IF(CMAKE_GENERATOR STREQUAL "MSYS Makefiles")
# Not needed with "MSYS Makefiles" generator when using MinGW
# (3rd party libs assumed to be installed in standard location /usr/local).
SET(_OPTION_CUSTOM_3RDPARTY false)
ELSE(CMAKE_GENERATOR STREQUAL "MSYS Makefiles")
# Just as for MSVC builds : special location.
SET(_OPTION_CUSTOM_3RDPARTY true)
ENDIF(CMAKE_GENERATOR STREQUAL "MSYS Makefiles")
ENDIF(MSVC)
SET(OPTION_CUSTOM_3RDPARTY ${_OPTION_CUSTOM_3RDPARTY} CACHE BOOL "Set to ON to use 3rdParty prebuilt API located in <PROJECT_SOURCE_DIR>/../3rdparty")
MARK_AS_ADVANCED(OPTION_CUSTOM_3RDPARTY)
# Compiler definitions (needs more comments. Is it needed under Windows ?).
ADD_DEFINITIONS(-D_SVID_SOURCE -D_BSD_SOURCE -DSHM)
IF(MSVC)
@ -1398,31 +1416,38 @@ MACRO(SD_INSTALL_FILES)
SET(DATA_PATH "${DATA_PATH}/")
ENDIF()
# Execute xmlversion at install-time to do this registration job.
# In order to run xmlversion.exe in the build tree (see below), under Windows,
# we nearly always have to copy all dependencies next to it (tgf, txml or Expat, SDL, compiler run-time).
GET_TARGET_PROPERTY(TGF_LIB tgf LOCATION)
IF(MSVC)
IF(NOT OPTION_3RDPARTY_EXPAT)
GET_TARGET_PROPERTY(TXML_LIB txml LOCATION)
ELSE(NOT OPTION_3RDPARTY_EXPAT)
FIND_PACKAGE(EXPAT)
GET_FILENAME_COMPONENT(EXPAT_LIBPATH "${EXPAT_LIBRARY}" PATH)
GET_FILENAME_COMPONENT(EXPAT_LIBNAME "${EXPAT_LIBRARY}" NAME_WE)
SET(EXPAT_LIB ${EXPAT_LIBPATH}/../bin/${EXPAT_LIBNAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
ENDIF(NOT OPTION_3RDPARTY_EXPAT)
FIND_PACKAGE(SDL)
SET(SDL_LIBPATHNAME "${SDL_LIBRARY}")
IF(MINGW)
# Multiple lib specs fuss ... find the one
STRING(REGEX REPLACE ".*;([^;]+dll[^;]*);.*" "\\1" SDL_LIBPATHNAME "${SDL_LIBPATHNAME}")
ENDIF(MINGW)
GET_FILENAME_COMPONENT(SDL_LIBPATH "${SDL_LIBPATHNAME}" PATH)
GET_FILENAME_COMPONENT(SDL_LIBNAME "${SDL_LIBPATHNAME}" NAME_WE)
IF(MINGW)
STRING(REGEX REPLACE "lib(.*)" "\\1" SDL_LIBNAME "${SDL_LIBNAME}")
ENDIF(MINGW)
SET(SDL_LIB ${SDL_LIBPATH}/../bin/${SDL_LIBNAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
# When building with MSVC, in order to run xmlversion.exe in the build tree,
# we have to copy all dependencies next to it (tgf, txml or Expat, and SDL).
IF(NOT OPTION_3RDPARTY_EXPAT)
GET_TARGET_PROPERTY(TXML_LIB txml LOCATION)
ELSE(NOT OPTION_3RDPARTY_EXPAT)
FIND_PACKAGE(EXPAT)
GET_FILENAME_COMPONENT(EXPAT_LIBPATH "${EXPAT_LIBRARY}" PATH)
GET_FILENAME_COMPONENT(EXPAT_LIBNAME "${EXPAT_LIBRARY}" NAME_WE)
SET(EXPAT_LIB ${EXPAT_LIBPATH}/../bin/${CMAKE_SHARED_LIBRARY_PREFIX}${EXPAT_LIBNAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
ENDIF(NOT OPTION_3RDPARTY_EXPAT)
FIND_PACKAGE(SDL)
GET_FILENAME_COMPONENT(SDL_LIBPATH "${SDL_LIBRARY}" PATH)
GET_FILENAME_COMPONENT(SDL_LIBNAME "${SDL_LIBRARY}" NAME_WE)
SET(SDL_LIB ${SDL_LIBPATH}/../bin/${CMAKE_SHARED_LIBRARY_PREFIX}${SDL_LIBNAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
# Execute xmlversion at install-time to do the above mentioned registration job.
IF(MSVC)
INSTALL(CODE
"FILE(READ ${CMAKE_BINARY_DIR}/xmlversion_loc.txt XMLVERSION_EXE)
STRING(REPLACE \"$(OutDir)\" \"\${CMAKE_INSTALL_CONFIG_NAME}\" XMLVERSION_EXE \${XMLVERSION_EXE})
STRING(REPLACE \"$(ConfigurationName)\" \"\${CMAKE_INSTALL_CONFIG_NAME}\" XMLVERSION_EXE \${XMLVERSION_EXE})
STRING(REPLACE \"$(Configuration)\" \"\${CMAKE_INSTALL_CONFIG_NAME}\" XMLVERSION_EXE \${XMLVERSION_EXE})
GET_FILENAME_COMPONENT(XMLVERSION_DIR \${XMLVERSION_EXE} PATH)
SET(_LIBS_TO_INSTALL \"${SDL_LIB}\")
SET(OPTION_3RDPARTY_EXPAT ${OPTION_3RDPARTY_EXPAT})
IF(NOT OPTION_3RDPARTY_EXPAT)
@ -1439,7 +1464,9 @@ MACRO(SD_INSTALL_FILES)
STRING(REPLACE \"$(ConfigurationName)\" \"\${CMAKE_INSTALL_CONFIG_NAME}\" TGF_LIB \${TGF_LIB})
STRING(REPLACE \"$(Configuration)\" \"\${CMAKE_INSTALL_CONFIG_NAME}\" TGF_LIB \${TGF_LIB})
LIST(APPEND _LIBS_TO_INSTALL \${TGF_LIB})
FILE(INSTALL DESTINATION \${XMLVERSION_DIR} TYPE FILE FILES \${_LIBS_TO_INSTALL})
GET_FILENAME_COMPONENT(XMLVERSION_DIR \"\${XMLVERSION_EXE}\" PATH)
MESSAGE(STATUS \"xmlversion : Libs to install=\${_LIBS_TO_INSTALL}\")
FILE(INSTALL DESTINATION \"\${XMLVERSION_DIR}\" TYPE FILE FILES \${_LIBS_TO_INSTALL})
SET(SD_DATADIR_ABS \"${SD_DATADIR}\")
IF(NOT IS_ABSOLUTE \${SD_DATADIR_ABS})
GET_FILENAME_COMPONENT(SD_DATADIR_ABS \"\${CMAKE_INSTALL_PREFIX}/\${SD_DATADIR_ABS}\" ABSOLUTE)
@ -1456,13 +1483,26 @@ MACRO(SD_INSTALL_FILES)
INSTALL(CODE
"FILE(READ ${CMAKE_BINARY_DIR}/xmlversion_loc.txt XMLVERSION_EXE)
GET_FILENAME_COMPONENT(XMLVERSION_DIR \${XMLVERSION_EXE} PATH)
SET(MINGW ${MINGW})
IF(MINGW)
# When building with MinGW, in order to run xmlversion.exe in the build tree,
# we have to copy internal dependencies next to it (tgf).
SET(TGF_LIB ${TGF_LIB})
FILE(INSTALL DESTINATION \${XMLVERSION_DIR} TYPE FILE FILES \${TGF_LIB})
SET(_LIBS_TO_INSTALL \"${TGF_LIB}\")
SET(OPTION_3RDPARTY_EXPAT ${OPTION_3RDPARTY_EXPAT})
IF(NOT OPTION_3RDPARTY_EXPAT)
LIST(APPEND _LIBS_TO_INSTALL \"${TXML_LIB}\")
ENDIF(NOT OPTION_3RDPARTY_EXPAT)
# CMake configuration for MSYS Makefiles generator assumes that 3rd party dependencies are installed
# in standard Linux folders, hence in the PATH ; so no need to install next to xmlversion exe.
IF(NOT CMAKE_GENERATOR STREQUAL \"MSYS Makefiles\")
IF(OPTION_3RDPARTY_EXPAT)
LIST(APPEND _LIBS_TO_INSTALL \"${EXPAT_LIB}\")
ENDIF(OPTION_3RDPARTY_EXPAT)
LIST(APPEND _LIBS_TO_INSTALL \"${SDL_LIB}\")
GET_FILENAME_COMPONENT(_MINGW_BINDIR \"${CMAKE_CXX_COMPILER}\" PATH)
LIST(APPEND _LIBS_TO_INSTALL \"\${_MINGW_BINDIR}/libstdc++-6.dll\" \"\${_MINGW_BINDIR}/libgcc_s_dw2-1.dll\")
ENDIF(NOT CMAKE_GENERATOR STREQUAL \"MSYS Makefiles\")
GET_FILENAME_COMPONENT(XMLVERSION_DIR \"\${XMLVERSION_EXE}\" PATH)
MESSAGE(STATUS \"xmlversion : Libs to install=\${_LIBS_TO_INSTALL}\")
FILE(INSTALL DESTINATION \"\${XMLVERSION_DIR}\" TYPE FILE FILES \${_LIBS_TO_INSTALL})
ENDIF(MINGW)
SET(SD_DATADIR_ABS \"${SD_DATADIR}\")
IF(NOT IS_ABSOLUTE \${SD_DATADIR_ABS})
@ -1578,31 +1618,41 @@ MACRO(SD_INSTALL_DIRECTORIES)
SET(DEST_ALL "${DATA_PATH}/")
ENDIF()
# In order to run xmlversion.exe in the build tree (see below), under Windows,
# we nearly always have to copy all dependencies next to it (tgf, txml or Expat, SDL, compiler run-time).
GET_TARGET_PROPERTY(TGF_LIB tgf LOCATION)
IF(NOT OPTION_3RDPARTY_EXPAT)
GET_TARGET_PROPERTY(TXML_LIB txml LOCATION)
ELSE(NOT OPTION_3RDPARTY_EXPAT)
FIND_PACKAGE(EXPAT)
GET_FILENAME_COMPONENT(EXPAT_LIBPATH "${EXPAT_LIBRARY}" PATH)
GET_FILENAME_COMPONENT(EXPAT_LIBNAME "${EXPAT_LIBRARY}" NAME_WE)
IF(MINGW) # Multiple lib specs ... assume the 1st is the one.
STRING(REGEX REPLACE "(.*);.*" "\\1" EXPAT_LIBNAME ${EXPAT_LIBNAME})
ENDIF(MINGW)
SET(EXPAT_LIB ${EXPAT_LIBPATH}/../bin/${EXPAT_LIBNAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
ENDIF(NOT OPTION_3RDPARTY_EXPAT)
FIND_PACKAGE(SDL)
SET(SDL_LIBPATHNAME "${SDL_LIBRARY}")
IF(MINGW)
# Multiple lib specs fuss ... find the one
STRING(REGEX REPLACE ".*;([^;]+dll[^;]*);.*" "\\1" SDL_LIBPATHNAME "${SDL_LIBPATHNAME}")
ENDIF(MINGW)
GET_FILENAME_COMPONENT(SDL_LIBPATH "${SDL_LIBPATHNAME}" PATH)
GET_FILENAME_COMPONENT(SDL_LIBNAME "${SDL_LIBPATHNAME}" NAME_WE)
IF(MINGW)
STRING(REGEX REPLACE "lib(.*)" "\\1" SDL_LIBNAME "${SDL_LIBNAME}")
ENDIF(MINGW)
SET(SDL_LIB ${SDL_LIBPATH}/../bin/${SDL_LIBNAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
# Execute xmlversion at install-time to do this registration job.
IF(MSVC)
# When building with MSVC, in order to run xmlversion.exe in the build tree,
# we have to copy dependencies next to it (txml or Expat, and SDL).
IF(NOT OPTION_3RDPARTY_EXPAT)
GET_TARGET_PROPERTY(TXML_LIB txml LOCATION)
ELSE(NOT OPTION_3RDPARTY_EXPAT)
FIND_PACKAGE(EXPAT)
GET_FILENAME_COMPONENT(EXPAT_LIBPATH "${EXPAT_LIBRARY}" PATH)
GET_FILENAME_COMPONENT(EXPAT_LIBNAME "${EXPAT_LIBRARY}" NAME_WE)
SET(EXPAT_LIB ${EXPAT_LIBPATH}/../bin/${CMAKE_SHARED_LIBRARY_PREFIX}${EXPAT_LIBNAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
ENDIF(NOT OPTION_3RDPARTY_EXPAT)
GET_TARGET_PROPERTY(TGF_LIB tgf LOCATION)
FIND_PACKAGE(SDL)
GET_FILENAME_COMPONENT(SDL_LIBPATH "${SDL_LIBRARY}" PATH)
GET_FILENAME_COMPONENT(SDL_LIBNAME "${SDL_LIBRARY}" NAME_WE)
SET(SDL_LIB ${SDL_LIBPATH}/../bin/${CMAKE_SHARED_LIBRARY_PREFIX}${SDL_LIBNAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
INSTALL(CODE
"FILE(READ ${CMAKE_BINARY_DIR}/xmlversion_loc.txt XMLVERSION_EXE)
"FILE(READ \"${CMAKE_BINARY_DIR}/xmlversion_loc.txt\" XMLVERSION_EXE)
STRING(REPLACE \"$(OutDir)\" \"\${CMAKE_INSTALL_CONFIG_NAME}\" XMLVERSION_EXE \${XMLVERSION_EXE})
STRING(REPLACE \"$(ConfigurationName)\" \"\${CMAKE_INSTALL_CONFIG_NAME}\" XMLVERSION_EXE \${XMLVERSION_EXE})
STRING(REPLACE \"$(Configuration)\" \"\${CMAKE_INSTALL_CONFIG_NAME}\" XMLVERSION_EXE \${XMLVERSION_EXE})
GET_FILENAME_COMPONENT(XMLVERSION_DIR \${XMLVERSION_EXE} PATH)
SET(_LIBS_TO_INSTALL \"${SDL_LIB}\")
SET(OPTION_3RDPARTY_EXPAT ${OPTION_3RDPARTY_EXPAT})
IF(NOT OPTION_3RDPARTY_EXPAT)
@ -1619,18 +1669,19 @@ MACRO(SD_INSTALL_DIRECTORIES)
STRING(REPLACE \"$(ConfigurationName)\" \"\${CMAKE_INSTALL_CONFIG_NAME}\" TGF_LIB \${TGF_LIB})
STRING(REPLACE \"$(Configuration)\" \"\${CMAKE_INSTALL_CONFIG_NAME}\" TGF_LIB \${TGF_LIB})
LIST(APPEND _LIBS_TO_INSTALL \"\${TGF_LIB}\")
FILE(INSTALL DESTINATION \${XMLVERSION_DIR} TYPE FILE FILES \${_LIBS_TO_INSTALL})
MESSAGE(STATUS \"xmlversion : Libs to install=\${_LIBS_TO_INSTALL}\")
GET_FILENAME_COMPONENT(XMLVERSION_DIR \"\${XMLVERSION_EXE}\" PATH)
FILE(INSTALL DESTINATION \"\${XMLVERSION_DIR}\" TYPE FILE FILES \${_LIBS_TO_INSTALL})
SET(SD_DATADIR_ABS \"${SD_DATADIR}\")
IF(NOT IS_ABSOLUTE \${SD_DATADIR_ABS})
GET_FILENAME_COMPONENT(SD_DATADIR_ABS \"\${CMAKE_INSTALL_PREFIX}/\${SD_DATADIR_ABS}\" ABSOLUTE)
ENDIF()
FOREACH(DIRECTORY ${DIRECTORIES})
SET(GLOB_EXPRS)
FOREACH(PATTERN ${PATTERNS})
LIST(APPEND GLOB_EXPRS \"${PREFIX}\${DIRECTORY}/\${PATTERN}\")
ENDFOREACH()
FILE(GLOB_RECURSE FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}${POSTFIX} ${CMAKE_CURRENT_SOURCE_DIR}${POSTFIX}/\${GLOB_EXPRS})
FILE(GLOB_RECURSE FILES RELATIVE \"${CMAKE_CURRENT_SOURCE_DIR}${POSTFIX} ${CMAKE_CURRENT_SOURCE_DIR}${POSTFIX}/\${GLOB_EXPRS}\")
FOREACH(FILE \${FILES})
IF(NOT \"\${FILE}\" MATCHES \"\\\\.svn\")
EXECUTE_PROCESS(COMMAND \"\${XMLVERSION_EXE}\" \"\${SD_DATADIR_ABS}/version.xml\" \"${DEST_ALL}\${FILE}\" \"${USER_PATH}/\${FILE}\" \"\${SD_DATADIR_ABS}\" RESULT_VARIABLE XMLVERSTATUS)
@ -1644,7 +1695,28 @@ MACRO(SD_INSTALL_DIRECTORIES)
ELSE(MSVC)
INSTALL(CODE
"FILE(READ ${CMAKE_BINARY_DIR}/xmlversion_loc.txt XMLVERSION_EXE)
"FILE(READ \"${CMAKE_BINARY_DIR}/xmlversion_loc.txt\" XMLVERSION_EXE)
SET(MINGW ${MINGW})
IF(MINGW)
SET(_LIBS_TO_INSTALL \"${TGF_LIB}\")
SET(OPTION_3RDPARTY_EXPAT ${OPTION_3RDPARTY_EXPAT})
IF(NOT OPTION_3RDPARTY_EXPAT)
LIST(APPEND _LIBS_TO_INSTALL \"${TXML_LIB}\")
ENDIF(NOT OPTION_3RDPARTY_EXPAT)
# CMake configuration for MSYS Makefiles generator assumes that 3rd party dependencies are installed
# in standard Linux folders, hence in the PATH ; so no need to install next to xmlversion exe.
IF(NOT CMAKE_GENERATOR STREQUAL \"MSYS Makefiles\")
IF(OPTION_3RDPARTY_EXPAT)
LIST(APPEND _LIBS_TO_INSTALL \"${EXPAT_LIB}\")
ENDIF(OPTION_3RDPARTY_EXPAT)
LIST(APPEND _LIBS_TO_INSTALL \"${SDL_LIB}\")
GET_FILENAME_COMPONENT(_MINGW_BINDIR \"${CMAKE_CXX_COMPILER}\" PATH)
LIST(APPEND _LIBS_TO_INSTALL \"\${_MINGW_BINDIR}/libstdc++-6.dll\" \"\${_MINGW_BINDIR}/libgcc_s_dw2-1.dll\")
ENDIF(NOT CMAKE_GENERATOR STREQUAL \"MSYS Makefiles\")
MESSAGE(STATUS \"xmlversion : Libs to install=\${_LIBS_TO_INSTALL}\")
GET_FILENAME_COMPONENT(XMLVERSION_DIR \"\${XMLVERSION_EXE}\" PATH)
FILE(INSTALL DESTINATION \"\${XMLVERSION_DIR}\" TYPE FILE FILES \${_LIBS_TO_INSTALL})
ENDIF(MINGW)
SET(SD_DATADIR_ABS \"${SD_DATADIR}\")
IF(NOT IS_ABSOLUTE \${SD_DATADIR_ABS})
GET_FILENAME_COMPONENT(SD_DATADIR_ABS \"\${CMAKE_INSTALL_PREFIX}/\${SD_DATADIR_ABS}\" ABSOLUTE)
@ -1656,13 +1728,12 @@ MACRO(SD_INSTALL_DIRECTORIES)
ELSE(CUR_DESTDIR MATCHES \"[^/]\")
SET(CUR_DESTDIR_CORR \"\")
ENDIF(CUR_DESTDIR MATCHES \"[^/]\")
FOREACH(DIRECTORY ${DIRECTORIES})
SET(GLOB_EXPRS)
FOREACH(PATTERN ${PATTERNS})
LIST(APPEND GLOB_EXPRS \"${PREFIX}\${DIRECTORY}/\${PATTERN}\")
ENDFOREACH()
FILE(GLOB_RECURSE FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}${POSTFIX} ${CMAKE_CURRENT_SOURCE_DIR}${POSTFIX}/\${GLOB_EXPRS})
FILE(GLOB_RECURSE FILES RELATIVE \"${CMAKE_CURRENT_SOURCE_DIR}${POSTFIX} ${CMAKE_CURRENT_SOURCE_DIR}${POSTFIX}/\${GLOB_EXPRS}\")
FOREACH(FILE \${FILES})
IF(NOT \"\${FILE}\" MATCHES \"\\\\.svn\")
EXECUTE_PROCESS(COMMAND \"\${XMLVERSION_EXE}\" \"\${CUR_DESTDIR_CORR}\${SD_DATADIR_ABS}/version.xml\" \"${DEST_ALL}\${FILE}\" \"${USER_PATH}/\${FILE}\" \"\${CUR_DESTDIR_CORR}\${SD_DATADIR_ABS}\" RESULT_VARIABLE XMLVERSTATUS)

View File

@ -23,6 +23,11 @@ ADD_EXECUTABLE(${_TARGET_NAME} ${_SOURCES})
ADD_SDLIB_LIBRARY(${_TARGET_NAME} portability tgf tgfclient tgfdata raceengine)
# Needed when using the "MinGW Makefiles" CMake generator (but not with the "MSYS Makefiles" one !?)
IF(MINGW)
TARGET_LINK_LIBRARIES(${_TARGET_NAME} ${MINGW32_LIBRARY})
ENDIF(MINGW)
IF(UNIX)
SD_INSTALL_FILES(MAN man6 PREFIX ${SOURCE_DIR}/doc/man FILES ${_TARGET_NAME}.6)
ENDIF(UNIX)
@ -31,6 +36,6 @@ SD_INSTALL_FILES(BIN TARGETS ${_TARGET_NAME})
# Under Windows, install needed 3rd party DLLs close to Speed Dreams executable.
IF(WIN32)
INCLUDE(Find3rdPartyDependencies)
INCLUDE(FindCustom3rdParty)
SD_INSTALL_3RDPARTY()
ENDIF(WIN32)

View File

@ -1,36 +1,42 @@
INCLUDE(../../../cmake/macros.cmake)
PROJECT(menuview)
SET(_TARGET_NAME ${SD_TOOLS_EXECPREFIX}menuview)
SET(_SOURCES main.cpp previewmenu.cpp)
ADD_INTERFACE_INCLUDEDIR()
ADD_SDLIB_INCLUDEDIR(robottools tgf tgfclient math portability)
ADD_SDL_INCLUDEDIR()
ADD_PLIB_INCLUDEDIR()
#disable developer warning
IF(COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0003 NEW)
ENDIF(COMMAND CMAKE_POLICY)
ADD_EXECUTABLE(${_TARGET_NAME} ${_SOURCES})
ADD_SDLIB_LIBRARY(${_TARGET_NAME} portability robottools tgf tgfclient)
IF(OPENGL_FOUND)
TARGET_LINK_LIBRARIES(${_TARGET_NAME} ${OPENGL_LIBRARY})
ENDIF(OPENGL_FOUND)
ADD_PNG_LIBRARY(${_TARGET_NAME})
ADD_SDL_LIBRARY(${_TARGET_NAME})
ADD_PLIB_LIBRARY(${_TARGET_NAME} sg ssg ul)
ADD_DL_LIBRARY(${_TARGET_NAME})
IF(UNIX)
SD_INSTALL_FILES(MAN man6 PREFIX ${SOURCE_DIR}/doc/man FILES ${_TARGET_NAME}.6)
ENDIF(UNIX)
SD_INSTALL_FILES(BIN TARGETS ${_TARGET_NAME})
INCLUDE(../../../cmake/macros.cmake)
PROJECT(menuview)
SET(_TARGET_NAME ${SD_TOOLS_EXECPREFIX}menuview)
SET(_SOURCES main.cpp previewmenu.cpp)
ADD_INTERFACE_INCLUDEDIR()
ADD_SDLIB_INCLUDEDIR(robottools tgf tgfclient math portability)
ADD_SDL_INCLUDEDIR()
ADD_PLIB_INCLUDEDIR()
#disable developer warning
IF(COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0003 NEW)
ENDIF(COMMAND CMAKE_POLICY)
ADD_EXECUTABLE(${_TARGET_NAME} ${_SOURCES})
ADD_SDLIB_LIBRARY(${_TARGET_NAME} portability robottools tgf tgfclient)
IF(OPENGL_FOUND)
TARGET_LINK_LIBRARIES(${_TARGET_NAME} ${OPENGL_LIBRARY})
ENDIF(OPENGL_FOUND)
ADD_PNG_LIBRARY(${_TARGET_NAME})
ADD_SDL_LIBRARY(${_TARGET_NAME})
ADD_PLIB_LIBRARY(${_TARGET_NAME} sg ssg ul)
ADD_DL_LIBRARY(${_TARGET_NAME})
# Needed when using the "MinGW Makefiles" CMake generator (but not with the "MSYS Makefiles" one !?)
IF(MINGW)
TARGET_LINK_LIBRARIES(${_TARGET_NAME} ${MINGW32_LIBRARY})
ENDIF(MINGW)
IF(UNIX)
SD_INSTALL_FILES(MAN man6 PREFIX ${SOURCE_DIR}/doc/man FILES ${_TARGET_NAME}.6)
ENDIF(UNIX)
SD_INSTALL_FILES(BIN TARGETS ${_TARGET_NAME})

View File

@ -36,6 +36,11 @@ ADD_SDL_LIBRARY(${_TARGET_NAME})
ADD_PLIB_LIBRARY(${_TARGET_NAME} sg ssg ul)
ADD_DL_LIBRARY(${_TARGET_NAME})
# Needed when using the "MinGW Makefiles" CMake generator (but not with the "MSYS Makefiles" one !?)
IF(MINGW)
TARGET_LINK_LIBRARIES(${_TARGET_NAME} ${MINGW32_LIBRARY})
ENDIF(MINGW)
IF(UNIX)
SD_INSTALL_FILES(MAN man6 PREFIX ${SOURCE_DIR}/doc/man FILES ${_TARGET_NAME}.6)
ENDIF(UNIX)