QTfrontend/CMakeLists.txt
author sheepluva
Tue, 10 Nov 2015 17:45:14 +0100
branchsdl2transition
changeset 11360 7a7611adf715
parent 9703 966d180184b4
child 11362 ed5a6478e710
permissions -rw-r--r--
drop support for SDL 1.2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
555
0376fdcc6322 Get possible screen resolutions from SDL library
unc0rr
parents: 539
diff changeset
     1
# Configure for Qt4
6604
9cc612a24b43 this should lower compatibility with qt4.5 again, but i have no way to test it
koda
parents: 6441
diff changeset
     2
set(QT_MIN_VERSION "4.5.0")
6032
f89cab39053e my qt version needs this to work...
koda
parents: 5973
diff changeset
     3
include(CheckLibraryExists)
260
2208405af6c6 Minimal QT 4 version supported is 4.2.0
unc0rr
parents: 241
diff changeset
     4
502
bc178daca088 Fix build with CMake & gcc 4.1.2 on my system (treating #include <QtGui> as including directory)
unc0rr
parents: 495
diff changeset
     5
set(QT_USE_QTCORE TRUE)
bc178daca088 Fix build with CMake & gcc 4.1.2 on my system (treating #include <QtGui> as including directory)
unc0rr
parents: 495
diff changeset
     6
set(QT_USE_QTGUI TRUE)
494
503758a35c02 Use right way of finding and using Qt4 in CMake
unc0rr
parents: 477
diff changeset
     7
set(QT_USE_QTNETWORK TRUE)
2525
e6cdc0251cd1 remove the svg dependency
koda
parents: 2515
diff changeset
     8
set(QT_USE_QTSVG FALSE)
2428
6800f8aa0184 Huge Smaxx patch with some fixes by me:
unc0rr
parents: 2421
diff changeset
     9
set(QT_USE_QTXML FALSE)
6800f8aa0184 Huge Smaxx patch with some fixes by me:
unc0rr
parents: 2421
diff changeset
    10
set(QT_USE_QTOPENGL FALSE)
494
503758a35c02 Use right way of finding and using Qt4 in CMake
unc0rr
parents: 477
diff changeset
    11
set(QT_USE_QTMAIN TRUE)
503758a35c02 Use right way of finding and using Qt4 in CMake
unc0rr
parents: 477
diff changeset
    12
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    13
find_package(Qt4 REQUIRED)
8317
ec9f94ab2737 remove the CROSSAPPLE option until a better solution is found
koda
parents: 8316
diff changeset
    14
include(${QT_USE_FILE})
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    15
9519
b8b5c82eb61b fail early when an incompatible qt version is found
koda
parents: 9225
diff changeset
    16
if(APPLE AND
b8b5c82eb61b fail early when an incompatible qt version is found
koda
parents: 9225
diff changeset
    17
   ${QTVERSION} VERSION_GREATER "4.7.0" AND
b8b5c82eb61b fail early when an incompatible qt version is found
koda
parents: 9225
diff changeset
    18
   ${QTVERSION} VERSION_LESS "4.7.4")
b8b5c82eb61b fail early when an incompatible qt version is found
koda
parents: 9225
diff changeset
    19
    message(FATAL_ERROR "This version of QT is known *not* to work, please update or use a lower version")
b8b5c82eb61b fail early when an incompatible qt version is found
koda
parents: 9225
diff changeset
    20
endif()
b8b5c82eb61b fail early when an incompatible qt version is found
koda
parents: 9225
diff changeset
    21
11360
7a7611adf715 drop support for SDL 1.2
sheepluva
parents: 9703
diff changeset
    22
find_package(SDL2 REQUIRED)
7a7611adf715 drop support for SDL 1.2
sheepluva
parents: 9703
diff changeset
    23
find_package(SDL2_mixer REQUIRED) #audio in SDLInteraction
7a7611adf715 drop support for SDL 1.2
sheepluva
parents: 9703
diff changeset
    24
include_directories(${SDL2_INCLUDE_DIR})
7a7611adf715 drop support for SDL 1.2
sheepluva
parents: 9703
diff changeset
    25
include_directories(${SDL2MIXER_INCLUDE_DIR})
8666
1652c1d9adc8 rework ffmpeg/libav/videorec linking and their cmake discovery
koda
parents: 8659
diff changeset
    26
1652c1d9adc8 rework ffmpeg/libav/videorec linking and their cmake discovery
koda
parents: 8659
diff changeset
    27
if(${FFMPEG_FOUND})
1652c1d9adc8 rework ffmpeg/libav/videorec linking and their cmake discovery
koda
parents: 8659
diff changeset
    28
    add_definitions(-DVIDEOREC -D__STDC_CONSTANT_MACROS)
1652c1d9adc8 rework ffmpeg/libav/videorec linking and their cmake discovery
koda
parents: 8659
diff changeset
    29
    include_directories(${FFMPEG_INCLUDE_DIR})
1652c1d9adc8 rework ffmpeg/libav/videorec linking and their cmake discovery
koda
parents: 8659
diff changeset
    30
    list(APPEND HW_LINK_LIBS ${FFMPEG_LIBRARIES})
7817
6cc558a69b58 countless small optimisation for cmake, output messages are now coherent (mostly) and the options get fully respected (eg. skipping library search if not activated)
koda
parents: 7813
diff changeset
    31
endif()
555
0376fdcc6322 Get possible screen resolutions from SDL library
unc0rr
parents: 539
diff changeset
    32
8401
87410ae372f6 Server messages localization using Qt's l10n subsystem:
unc0rr
parents: 8383
diff changeset
    33
# server messages localization
87410ae372f6 Server messages localization using Qt's l10n subsystem:
unc0rr
parents: 8383
diff changeset
    34
file(GLOB ServerSources ${CMAKE_SOURCE_DIR}/gameServer/*.hs)
87410ae372f6 Server messages localization using Qt's l10n subsystem:
unc0rr
parents: 8383
diff changeset
    35
foreach(hsfile ${ServerSources})
87410ae372f6 Server messages localization using Qt's l10n subsystem:
unc0rr
parents: 8383
diff changeset
    36
    file(READ ${hsfile} hs)
87410ae372f6 Server messages localization using Qt's l10n subsystem:
unc0rr
parents: 8383
diff changeset
    37
    string(REGEX MATCHALL "loc *\"[^\n\"]+\"" locs ${hs})
87410ae372f6 Server messages localization using Qt's l10n subsystem:
unc0rr
parents: 8383
diff changeset
    38
    foreach(str ${locs})
87410ae372f6 Server messages localization using Qt's l10n subsystem:
unc0rr
parents: 8383
diff changeset
    39
        string(REGEX REPLACE "loc *\"([^\n\"]+)\"" "QT_TRANSLATE_NOOP(\"server\", \"\\1\")" s ${str})
87410ae372f6 Server messages localization using Qt's l10n subsystem:
unc0rr
parents: 8383
diff changeset
    40
        list(APPEND serverlocs ${s})
87410ae372f6 Server messages localization using Qt's l10n subsystem:
unc0rr
parents: 8383
diff changeset
    41
    endforeach(str)
87410ae372f6 Server messages localization using Qt's l10n subsystem:
unc0rr
parents: 8383
diff changeset
    42
endforeach(hsfile)
87410ae372f6 Server messages localization using Qt's l10n subsystem:
unc0rr
parents: 8383
diff changeset
    43
87410ae372f6 Server messages localization using Qt's l10n subsystem:
unc0rr
parents: 8383
diff changeset
    44
list(REMOVE_DUPLICATES serverlocs)
87410ae372f6 Server messages localization using Qt's l10n subsystem:
unc0rr
parents: 8383
diff changeset
    45
list(GET serverlocs 0 firstline)
87410ae372f6 Server messages localization using Qt's l10n subsystem:
unc0rr
parents: 8383
diff changeset
    46
list(REMOVE_AT serverlocs 0)
87410ae372f6 Server messages localization using Qt's l10n subsystem:
unc0rr
parents: 8383
diff changeset
    47
set(locsout "const char * serverMessages[] = {\n")
87410ae372f6 Server messages localization using Qt's l10n subsystem:
unc0rr
parents: 8383
diff changeset
    48
foreach(l ${serverlocs})
87410ae372f6 Server messages localization using Qt's l10n subsystem:
unc0rr
parents: 8383
diff changeset
    49
    list(APPEND locsout ${l} ",\n")
87410ae372f6 Server messages localization using Qt's l10n subsystem:
unc0rr
parents: 8383
diff changeset
    50
endforeach(l)
87410ae372f6 Server messages localization using Qt's l10n subsystem:
unc0rr
parents: 8383
diff changeset
    51
list(APPEND locsout ${firstline} "\n}\\;\n")
87410ae372f6 Server messages localization using Qt's l10n subsystem:
unc0rr
parents: 8383
diff changeset
    52
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/servermessages.h ${locsout})
87410ae372f6 Server messages localization using Qt's l10n subsystem:
unc0rr
parents: 8383
diff changeset
    53
8410
48a7986e46f8 fix out of source build
koda
parents: 8401
diff changeset
    54
include_directories(${CMAKE_CURRENT_BINARY_DIR})
48a7986e46f8 fix out of source build
koda
parents: 8401
diff changeset
    55
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
6061
15b4b485a1c5 this makes more sense
sheepluva
parents: 6060
diff changeset
    56
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/model)
6060
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
    57
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/net)
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
    58
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ui)
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
    59
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ui/dialog)
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
    60
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ui/page)
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
    61
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ui/widget)
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
    62
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/util)
8381
588a8e6e2041 move platform code around, based off a gci task by dag10
koda
parents: 8347
diff changeset
    63
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/util/platform)
8522
1853628ae285 use standard library prefix
koda
parents: 8475
diff changeset
    64
include_directories(${PHYSFS_INCLUDE_DIR})
8528
ffd71e99a4f0 and now compile and link properly
koda
parents: 8522
diff changeset
    65
include_directories(${PHYSLAYER_INCLUDE_DIR})
8522
1853628ae285 use standard library prefix
koda
parents: 8475
diff changeset
    66
1853628ae285 use standard library prefix
koda
parents: 8475
diff changeset
    67
1159
49c88f620e51 Various build system improvements
unc0rr
parents: 1043
diff changeset
    68
if(UNIX)
4520
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
    69
    # HACK: in freebsd cannot find iconv.h included via SDL.h
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
    70
    include_directories("/usr/local/include")
1159
49c88f620e51 Various build system improvements
unc0rr
parents: 1043
diff changeset
    71
endif(UNIX)
555
0376fdcc6322 Get possible screen resolutions from SDL library
unc0rr
parents: 539
diff changeset
    72
8316
89232b2fa1d6 cmake rework, cleanup a lot of redundant sections, separate library and binary install location, unify osx and win handling of the data directory (tested on win, lin and mac)
koda
parents: 8315
diff changeset
    73
#only the cocoa version of qt supports building 64 bit apps
89232b2fa1d6 cmake rework, cleanup a lot of redundant sections, separate library and binary install location, unify osx and win handling of the data directory (tested on win, lin and mac)
koda
parents: 8315
diff changeset
    74
if(APPLE AND (CMAKE_OSX_ARCHITECTURES MATCHES "x86_64*") AND (NOT QT_MAC_USE_COCOA))
89232b2fa1d6 cmake rework, cleanup a lot of redundant sections, separate library and binary install location, unify osx and win handling of the data directory (tested on win, lin and mac)
koda
parents: 8315
diff changeset
    75
    message(FATAL_ERROR "Building the 64 bit version of Hedgewars *requires* the Cocoa variant of QT on Mac OS X")
89232b2fa1d6 cmake rework, cleanup a lot of redundant sections, separate library and binary install location, unify osx and win handling of the data directory (tested on win, lin and mac)
koda
parents: 8315
diff changeset
    76
endif()
89232b2fa1d6 cmake rework, cleanup a lot of redundant sections, separate library and binary install location, unify osx and win handling of the data directory (tested on win, lin and mac)
koda
parents: 8315
diff changeset
    77
#endif()
89232b2fa1d6 cmake rework, cleanup a lot of redundant sections, separate library and binary install location, unify osx and win handling of the data directory (tested on win, lin and mac)
koda
parents: 8315
diff changeset
    78
2219
07f5345ecae7 additional variable (BUNDLE) to make a standalone Mac application
koda
parents: 2218
diff changeset
    79
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/hwconsts.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/hwconsts.cpp)
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    80
6061
15b4b485a1c5 this makes more sense
sheepluva
parents: 6060
diff changeset
    81
file(GLOB NetCpp net/*.cpp)
15b4b485a1c5 this makes more sense
sheepluva
parents: 6060
diff changeset
    82
file(GLOB ModelCpp model/*.cpp)
15b4b485a1c5 this makes more sense
sheepluva
parents: 6060
diff changeset
    83
file(GLOB_RECURSE UIcpp ui/*.cpp)
15b4b485a1c5 this makes more sense
sheepluva
parents: 6060
diff changeset
    84
file(GLOB UtilCpp util/*.cpp)
6060
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
    85
8347
716c05f19401 GCI2012: CMake List Append
Willie Zhu
parents: 8342
diff changeset
    86
list(APPEND hwfr_src
6061
15b4b485a1c5 this makes more sense
sheepluva
parents: 6060
diff changeset
    87
    ${ModelCpp}
6060
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
    88
    ${NetCpp}
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
    89
    ${UIcpp}
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
    90
    ${UtilCpp}
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
    91
    achievements.cpp
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
    92
    binds.cpp
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
    93
    drawmapscene.cpp
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
    94
    game.cpp
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
    95
    gameuiconfig.cpp
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
    96
    HWApplication.cpp
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
    97
    hwform.cpp
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
    98
    main.cpp
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
    99
    team.cpp
7201
dc17ffdf0702 The first campaign commit with a lot of changes...
belphegorr <szabibibi@gmail.com>
parents: 6931
diff changeset
   100
    campaign.cpp
6060
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
   101
    ui_hwform.cpp
4520
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
   102
    ${CMAKE_CURRENT_BINARY_DIR}/hwconsts.cpp
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
   103
    )
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   104
2821
67815ee123d7 Frontend:
smxx
parents: 2663
diff changeset
   105
#xfire integration
67815ee123d7 Frontend:
smxx
parents: 2663
diff changeset
   106
if(WIN32)
8381
588a8e6e2041 move platform code around, based off a gci task by dag10
koda
parents: 8347
diff changeset
   107
    list(APPEND hwfr_src util/platform/xfire.cpp util/platform/xfiregameclient.cpp)
2821
67815ee123d7 Frontend:
smxx
parents: 2663
diff changeset
   108
endif(WIN32)
67815ee123d7 Frontend:
smxx
parents: 2663
diff changeset
   109
880
f9efe907828f Add win32 resource compilation under mingw (used sim-im srcs as example)
unc0rr
parents: 781
diff changeset
   110
if(MINGW)
4520
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
   111
    # resource compilation for mingw
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
   112
    add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/hedgewars_rc.o
8283
af97cdbb7713 cmake verbosity/documentation/cleanup/formatting
koda
parents: 8279
diff changeset
   113
                       COMMAND windres -I ${CMAKE_CURRENT_SOURCE_DIR}
af97cdbb7713 cmake verbosity/documentation/cleanup/formatting
koda
parents: 8279
diff changeset
   114
                               -i ${CMAKE_CURRENT_SOURCE_DIR}/hedgewars.rc
af97cdbb7713 cmake verbosity/documentation/cleanup/formatting
koda
parents: 8279
diff changeset
   115
                               -o ${CMAKE_CURRENT_BINARY_DIR}/hedgewars_rc.o)
8347
716c05f19401 GCI2012: CMake List Append
Willie Zhu
parents: 8342
diff changeset
   116
    list(APPEND hwfr_src ${CMAKE_CURRENT_BINARY_DIR}/hedgewars_rc.o)
880
f9efe907828f Add win32 resource compilation under mingw (used sim-im srcs as example)
unc0rr
parents: 781
diff changeset
   117
else(MINGW)
8347
716c05f19401 GCI2012: CMake List Append
Willie Zhu
parents: 8342
diff changeset
   118
    list(APPEND hwfr_src hedgewars.rc)
880
f9efe907828f Add win32 resource compilation under mingw (used sim-im srcs as example)
unc0rr
parents: 781
diff changeset
   119
endif(MINGW)
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   120
6061
15b4b485a1c5 this makes more sense
sheepluva
parents: 6060
diff changeset
   121
file(GLOB ModelHdr model/*.h)
15b4b485a1c5 this makes more sense
sheepluva
parents: 6060
diff changeset
   122
file(GLOB NetHdr net/*.h)
15b4b485a1c5 this makes more sense
sheepluva
parents: 6060
diff changeset
   123
file(GLOB_RECURSE UIhdr ui/*.h)
15b4b485a1c5 this makes more sense
sheepluva
parents: 6060
diff changeset
   124
file(GLOB UtilHdr util/*.h)
6060
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
   125
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
   126
4520
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
   127
set(hwfr_moc_hdrs
6061
15b4b485a1c5 this makes more sense
sheepluva
parents: 6060
diff changeset
   128
    ${ModelHdr}
6060
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
   129
    ${NetHdr}
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
   130
    ${UIhdr}
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
   131
    drawmapscene.h
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
   132
    game.h
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
   133
    gameuiconfig.h
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
   134
    HWApplication.h
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
   135
    hwform.h
6223
cc3eb9b7230f It doesn't make much sense to make checks like 'if(game)' if you never set game to 0. Using smart pointers instead. Does it fix segfaults? Probably.
unc0rr
parents: 6204
diff changeset
   136
    team.h
6931
86c951cd0f3f make DataManager a QObject with reload() slot that emits signal updated()
sheepluva
parents: 6604
diff changeset
   137
    util/DataManager.h
7897
5e7c0810f365 libav name refactor
koda
parents: 7817
diff changeset
   138
    util/LibavInteraction.h
4520
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
   139
    )
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   140
4520
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
   141
set(hwfr_hdrs
6060
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
   142
    ${UtilHdr}
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
   143
    team.h
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
   144
    achievements.h
4520
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
   145
    binds.h
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
   146
    ui_hwform.h
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
   147
    hwconsts.h
6060
fdfc01419815 I started to move stuff around, c'mon, hate on meee. PS: if your (clean) build is broken - let me know)
sheepluva
parents: 6038
diff changeset
   148
    sdlkeys.h
7639
41e6de947531 * don't build moc for campaign.h
sheepluva
parents: 7628
diff changeset
   149
    campaign.h
8401
87410ae372f6 Server messages localization using Qt's l10n subsystem:
unc0rr
parents: 8383
diff changeset
   150
    ${CMAKE_CURRENT_BINARY_DIR}/servermessages.h
4520
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
   151
    )
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   152
2218
59a9bebc4988 -Smaxx' solution for compiling frontend with static libs in windows
koda
parents: 2212
diff changeset
   153
set(hwfr_rez hedgewars.qrc)
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   154
8316
89232b2fa1d6 cmake rework, cleanup a lot of redundant sections, separate library and binary install location, unify osx and win handling of the data directory (tested on win, lin and mac)
koda
parents: 8315
diff changeset
   155
if(${BUILD_ENGINE_LIBRARY})
8314
7faceaca67d4 can change library name and compile it on windows again
koda
parents: 8312
diff changeset
   156
    add_definitions(-DHWLIBRARY=1)
7faceaca67d4 can change library name and compile it on windows again
koda
parents: 8312
diff changeset
   157
    set(hwlibname "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}hwengine${CMAKE_SHARED_LIBRARY_SUFFIX}")
8347
716c05f19401 GCI2012: CMake List Append
Willie Zhu
parents: 8342
diff changeset
   158
    list(APPEND HW_LINK_LIBS ${hwlibname})
8310
a98c349bc06b minor adjustments to libengine, moc is correctly created as definitions are set before calling it, params are better numbered and we don't subclass qthread but rather use moveToThread()
koda
parents: 8283
diff changeset
   159
endif()
a98c349bc06b minor adjustments to libengine, moc is correctly created as definitions are set before calling it, params are better numbered and we don't subclass qthread but rather use moveToThread()
koda
parents: 8283
diff changeset
   160
2641
b08cafb86797 some tweaks in the mac compilation system
koda
parents: 2525
diff changeset
   161
qt4_add_resources(hwfr_rez_src ${hwfr_rez})
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   162
2641
b08cafb86797 some tweaks in the mac compilation system
koda
parents: 2525
diff changeset
   163
qt4_wrap_cpp(hwfr_moc_srcs ${hwfr_moc_hdrs})
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   164
2652
67d0344aea9f still updates for mac compilation
koda
parents: 2641
diff changeset
   165
8317
ec9f94ab2737 remove the CROSSAPPLE option until a better solution is found
koda
parents: 8316
diff changeset
   166
if(APPLE)
8279
c03d64969112 less linking needed, raise minimum_osx_version when videorec is enabled
koda
parents: 8223
diff changeset
   167
    find_library(iokit_framework NAMES IOKit)
8347
716c05f19401 GCI2012: CMake List Append
Willie Zhu
parents: 8342
diff changeset
   168
    list(APPEND HW_LINK_LIBS ${iokit_framework})
8381
588a8e6e2041 move platform code around, based off a gci task by dag10
koda
parents: 8347
diff changeset
   169
    list(APPEND hwfr_src util/platform/CocoaInitializer.mm
588a8e6e2041 move platform code around, based off a gci task by dag10
koda
parents: 8347
diff changeset
   170
                         util/platform/InstallController.cpp
588a8e6e2041 move platform code around, based off a gci task by dag10
koda
parents: 8347
diff changeset
   171
                         util/platform/M3Panel.mm
588a8e6e2041 move platform code around, based off a gci task by dag10
koda
parents: 8347
diff changeset
   172
                         util/platform/M3InstallController.m
588a8e6e2041 move platform code around, based off a gci task by dag10
koda
parents: 8347
diff changeset
   173
                         util/platform/NSWorkspace_RBAdditions.m
588a8e6e2041 move platform code around, based off a gci task by dag10
koda
parents: 8347
diff changeset
   174
                         )
8688
88a6114a318c even more wrapping with find_package_or_disable_msg
koda
parents: 8686
diff changeset
   175
    include(${CMAKE_MODULE_PATH}/utils.cmake)
88a6114a318c even more wrapping with find_package_or_disable_msg
koda
parents: 8686
diff changeset
   176
    find_package_or_disable_msg(Sparkle NOAUTOUPDATE "Autoupdater will not be built.")
88a6114a318c even more wrapping with find_package_or_disable_msg
koda
parents: 8686
diff changeset
   177
    if(SPARKLE_FOUND)
8686
d303da4568b7 introduce find_package_or_fail/disable to group together similar cmake code
koda
parents: 8666
diff changeset
   178
        add_definitions(-DSPARKLE_ENABLED)
d303da4568b7 introduce find_package_or_fail/disable to group together similar cmake code
koda
parents: 8666
diff changeset
   179
        list(APPEND hwfr_src util/platform/AutoUpdater.cpp
d303da4568b7 introduce find_package_or_fail/disable to group together similar cmake code
koda
parents: 8666
diff changeset
   180
                             util/platform/SparkleAutoUpdater.mm)
d303da4568b7 introduce find_package_or_fail/disable to group together similar cmake code
koda
parents: 8666
diff changeset
   181
        list(APPEND HW_LINK_LIBS ${SPARKLE_LIBRARY})
4520
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
   182
    endif()
2652
67d0344aea9f still updates for mac compilation
koda
parents: 2641
diff changeset
   183
endif()
67d0344aea9f still updates for mac compilation
koda
parents: 2641
diff changeset
   184
8104
09c38cdf380d show console on win when debugging to see frontend messages
koda
parents: 8083
diff changeset
   185
#when debugging, always prompt a console to see fronted messages
09c38cdf380d show console on win when debugging to see frontend messages
koda
parents: 8083
diff changeset
   186
#TODO: check it doesn't interfere on UNIX
09c38cdf380d show console on win when debugging to see frontend messages
koda
parents: 8083
diff changeset
   187
if(CMAKE_BUILD_TYPE MATCHES "RELEASE")
09c38cdf380d show console on win when debugging to see frontend messages
koda
parents: 8083
diff changeset
   188
    set(console_access "WIN32")
09c38cdf380d show console on win when debugging to see frontend messages
koda
parents: 8083
diff changeset
   189
endif(CMAKE_BUILD_TYPE MATCHES "RELEASE")
2652
67d0344aea9f still updates for mac compilation
koda
parents: 2641
diff changeset
   190
8104
09c38cdf380d show console on win when debugging to see frontend messages
koda
parents: 8083
diff changeset
   191
add_executable(hedgewars ${console_access}
4520
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
   192
    ${hwfr_src}
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
   193
    ${hwfr_moc_srcs}
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
   194
    ${hwfr_hdrs}
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
   195
    ${hwfr_rez_src}
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
   196
    )
2191
20c62f787a4d koda's OpenAL conversion:
unc0rr
parents: 2015
diff changeset
   197
8347
716c05f19401 GCI2012: CMake List Append
Willie Zhu
parents: 8342
diff changeset
   198
list(APPEND HW_LINK_LIBS
9225
d8d929f92633 use target name instead of the resulting library, use more macros around
koda
parents: 9198
diff changeset
   199
    physfs physlayer
4520
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
   200
    ${QT_LIBRARIES}
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
   201
    )
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   202
11360
7a7611adf715 drop support for SDL 1.2
sheepluva
parents: 9703
diff changeset
   203
list(APPEND HW_LINK_LIBS
7a7611adf715 drop support for SDL 1.2
sheepluva
parents: 9703
diff changeset
   204
    ${SDL2_LIBRARY}
7a7611adf715 drop support for SDL 1.2
sheepluva
parents: 9703
diff changeset
   205
    ${SDL2MIXER_LIBRARY}
7a7611adf715 drop support for SDL 1.2
sheepluva
parents: 9703
diff changeset
   206
    )
9701
7f6786625667 Frontend builds
unc0rr
parents: 9679
diff changeset
   207
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   208
if(WIN32 AND NOT UNIX)
4520
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
   209
    if(NOT SDL_LIBRARY)
8347
716c05f19401 GCI2012: CMake List Append
Willie Zhu
parents: 8342
diff changeset
   210
        list(APPEND HW_LINK_LIBS SDL)
4520
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
   211
    endif()
555
0376fdcc6322 Get possible screen resolutions from SDL library
unc0rr
parents: 539
diff changeset
   212
8347
716c05f19401 GCI2012: CMake List Append
Willie Zhu
parents: 8342
diff changeset
   213
    list(APPEND HW_LINK_LIBS
4520
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
   214
        ole32
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
   215
        oleaut32
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
   216
        winspool
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
   217
        uuid
e7882bd1a894 Allow to draw maps in frontend and play them (only locally, some bugs to fix)
unc0rr
parents: 4410
diff changeset
   218
        )
2663
d53918cd22bb random updates for 10.6 and iphone builds
koda
parents: 2652
diff changeset
   219
endif()
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   220
8317
ec9f94ab2737 remove the CROSSAPPLE option until a better solution is found
koda
parents: 8316
diff changeset
   221
target_link_libraries(hedgewars ${HW_LINK_LIBS})
2218
59a9bebc4988 -Smaxx' solution for compiling frontend with static libs in windows
koda
parents: 2212
diff changeset
   222
495
62c1c2b4414c - Fix most of the warnings in hwengine
unc0rr
parents: 494
diff changeset
   223
8316
89232b2fa1d6 cmake rework, cleanup a lot of redundant sections, separate library and binary install location, unify osx and win handling of the data directory (tested on win, lin and mac)
koda
parents: 8315
diff changeset
   224
install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hedgewars${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_binary_install_dir})
2218
59a9bebc4988 -Smaxx' solution for compiling frontend with static libs in windows
koda
parents: 2212
diff changeset
   225