QTfrontend/CMakeLists.txt
author unc0rr
Tue, 12 Aug 2008 08:48:44 +0000
changeset 1192 63b7961f68de
parent 1159 49c88f620e51
child 1196 3b8806ffa1b1
permissions -rw-r--r--
Add iconed groupbox class
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
260
2208405af6c6 Minimal QT 4 version supported is 4.2.0
unc0rr
parents: 241
diff changeset
     2
set(QT_MIN_VERSION "4.2.0")
2208405af6c6 Minimal QT 4 version supported is 4.2.0
unc0rr
parents: 241
diff changeset
     3
502
bc178daca088 Fix build with CMake & gcc 4.1.2 on my system (treating #include <QtGui> as including directory)
unc0rr
parents: 495
diff changeset
     4
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
     5
set(QT_USE_QTGUI TRUE)
494
503758a35c02 Use right way of finding and using Qt4 in CMake
unc0rr
parents: 477
diff changeset
     6
set(QT_USE_QTNETWORK TRUE)
503758a35c02 Use right way of finding and using Qt4 in CMake
unc0rr
parents: 477
diff changeset
     7
set(QT_USE_QTSVG TRUE)
495
62c1c2b4414c - Fix most of the warnings in hwengine
unc0rr
parents: 494
diff changeset
     8
set(QT_USE_QTXML TRUE)
494
503758a35c02 Use right way of finding and using Qt4 in CMake
unc0rr
parents: 477
diff changeset
     9
set(QT_USE_QTMAIN TRUE)
503758a35c02 Use right way of finding and using Qt4 in CMake
unc0rr
parents: 477
diff changeset
    10
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    11
find_package(Qt4 REQUIRED)
1159
49c88f620e51 Various build system improvements
unc0rr
parents: 1043
diff changeset
    12
include(${QT_USE_FILE})
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    13
555
0376fdcc6322 Get possible screen resolutions from SDL library
unc0rr
parents: 539
diff changeset
    14
# Configure for SDL
0376fdcc6322 Get possible screen resolutions from SDL library
unc0rr
parents: 539
diff changeset
    15
find_package(SDL REQUIRED)
0376fdcc6322 Get possible screen resolutions from SDL library
unc0rr
parents: 539
diff changeset
    16
707
0a00c16022ca Try to fix SDL problem
unc0rr
parents: 653
diff changeset
    17
include_directories(${SDL_INCLUDE_DIR})
1159
49c88f620e51 Various build system improvements
unc0rr
parents: 1043
diff changeset
    18
if(UNIX)
49c88f620e51 Various build system improvements
unc0rr
parents: 1043
diff changeset
    19
	include_directories("/usr/local/include") # HACK: in freebsd cannot find iconv.h included via SDL.h
49c88f620e51 Various build system improvements
unc0rr
parents: 1043
diff changeset
    20
endif(UNIX)
555
0376fdcc6322 Get possible screen resolutions from SDL library
unc0rr
parents: 539
diff changeset
    21
0376fdcc6322 Get possible screen resolutions from SDL library
unc0rr
parents: 539
diff changeset
    22
# Done
494
503758a35c02 Use right way of finding and using Qt4 in CMake
unc0rr
parents: 477
diff changeset
    23
include_directories(.)
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    24
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    25
if(WIN32 AND NOT UNIX)
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    26
	set(HEDGEWARS_BINDIR ".")
267
bf7c1503f569 Engine gets Data path from frontend
unc0rr
parents: 266
diff changeset
    27
	set(HEDGEWARS_DATADIR "../share/")
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    28
else(WIN32 AND NOT UNIX)
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    29
	set(HEDGEWARS_BINDIR ${CMAKE_INSTALL_PREFIX})
266
53f46353d029 one else fix
displacer
parents: 265
diff changeset
    30
	if(DEFINED DATA_INSTALL_DIR)
265
bd06dcfa5bff DATADIR fixed
displacer
parents: 261
diff changeset
    31
		set(HEDGEWARS_DATADIR ${DATA_INSTALL_DIR})
266
53f46353d029 one else fix
displacer
parents: 265
diff changeset
    32
	else(DEFINED DATA_INSTALL_DIR)
265
bd06dcfa5bff DATADIR fixed
displacer
parents: 261
diff changeset
    33
		set(HEDGEWARS_DATADIR ${CMAKE_INSTALL_PREFIX}/share/)
266
53f46353d029 one else fix
displacer
parents: 265
diff changeset
    34
	endif(DEFINED DATA_INSTALL_DIR)
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    35
endif(WIN32 AND NOT UNIX)
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    36
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents: 555
diff changeset
    37
configure_file(${hedgewars_SOURCE_DIR}/QTfrontend/hwconsts.cpp.in 
781
4101f0f1c0b9 First steps to support out-of-source build
unc0rr
parents: 707
diff changeset
    38
	${CMAKE_CURRENT_BINARY_DIR}/hwconsts.cpp)
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    39
781
4101f0f1c0b9 First steps to support out-of-source build
unc0rr
parents: 707
diff changeset
    40
set(hwfr_src
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    41
	game.cpp
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    42
	main.cpp
781
4101f0f1c0b9 First steps to support out-of-source build
unc0rr
parents: 707
diff changeset
    43
	hwform.cpp
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    44
	team.cpp
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    45
	teamselect.cpp
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    46
	teamselhelper.cpp
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    47
	frameTeam.cpp
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    48
	vertScrollArea.cpp
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    49
	gameuiconfig.cpp
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    50
	ui_hwform.cpp
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    51
	gamecfgwidget.cpp
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    52
	pages.cpp
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    53
	SquareLabel.cpp
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    54
	hedgehogerWidget.cpp
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    55
	hwmap.cpp
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    56
	mapContainer.cpp
187
96c3154efee5 "About" page, not yet filled with content
unc0rr
parents: 184
diff changeset
    57
	tcpBase.cpp
239
f9adf3c73bed 'Proto' class to make things easier
unc0rr
parents: 224
diff changeset
    58
	about.cpp
297
279e10ec31b4 'Show FPS' and 'FPS limit' options
unc0rr
parents: 277
diff changeset
    59
	proto.cpp
314
83773ccf4f09 client/server net pre-alpha
displacer
parents: 297
diff changeset
    60
	fpsedit.cpp
83773ccf4f09 client/server net pre-alpha
displacer
parents: 297
diff changeset
    61
	netserver.cpp
420
6cdfc07dceed netserver and netonnectedclient splited to different files
displacer
parents: 412
diff changeset
    62
	netconnectedclient.cpp
412
2ddcc3e3e644 udp server detecting experimental version
displacer
parents: 314
diff changeset
    63
	newnetclient.cpp
2ddcc3e3e644 udp server detecting experimental version
displacer
parents: 314
diff changeset
    64
	netudpserver.cpp
461
105af110b0e6 chatWidget with layout
displacer
parents: 420
diff changeset
    65
	netudpwidget.cpp
633
9050a949db21 Half implement registration in servers list
unc0rr
parents: 632
diff changeset
    66
	netwwwserver.cpp
625
373353eaa742 Sample WWW server list class
unc0rr
parents: 624
diff changeset
    67
	netwwwwidget.cpp
633
9050a949db21 Half implement registration in servers list
unc0rr
parents: 632
diff changeset
    68
	netregister.cpp
632
5e09ae25729f Half implement possibility for different backends of servers list
unc0rr
parents: 625
diff changeset
    69
	netserverslist.cpp
539
6a9bf1852bbc Ability to choose which info is shown above hedgehogs
unc0rr
parents: 502
diff changeset
    70
	chatwidget.cpp
555
0376fdcc6322 Get possible screen resolutions from SDL library
unc0rr
parents: 539
diff changeset
    71
	binds.cpp
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents: 555
diff changeset
    72
	SDLs.cpp
94db15de0392 - Some changes to make build process clear
unc0rr
parents: 555
diff changeset
    73
	playrecordpage.cpp
781
4101f0f1c0b9 First steps to support out-of-source build
unc0rr
parents: 707
diff changeset
    74
	${CMAKE_CURRENT_BINARY_DIR}/hwconsts.cpp
612
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents: 597
diff changeset
    75
	selectWeapon.cpp
880
f9efe907828f Add win32 resource compilation under mingw (used sim-im srcs as example)
unc0rr
parents: 781
diff changeset
    76
	itemNum.cpp
653
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents: 633
diff changeset
    77
	input_ip.cpp
1192
63b7961f68de Add iconed groupbox class
unc0rr
parents: 1159
diff changeset
    78
	igbox.cpp
624
e7673b036db5 weaponItem added
displacer
parents: 612
diff changeset
    79
	weaponItem.cpp)
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    80
880
f9efe907828f Add win32 resource compilation under mingw (used sim-im srcs as example)
unc0rr
parents: 781
diff changeset
    81
if(MINGW)
f9efe907828f Add win32 resource compilation under mingw (used sim-im srcs as example)
unc0rr
parents: 781
diff changeset
    82
	# resource compilation for mingw
f9efe907828f Add win32 resource compilation under mingw (used sim-im srcs as example)
unc0rr
parents: 781
diff changeset
    83
	add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/hedgewars_rc.o
f9efe907828f Add win32 resource compilation under mingw (used sim-im srcs as example)
unc0rr
parents: 781
diff changeset
    84
	COMMAND windres -I ${CMAKE_CURRENT_SOURCE_DIR}
1039
27187008b12f Fix icon compilation in Windows
unc0rr
parents: 880
diff changeset
    85
	-i ${CMAKE_CURRENT_SOURCE_DIR}/hedgewars.rc
880
f9efe907828f Add win32 resource compilation under mingw (used sim-im srcs as example)
unc0rr
parents: 781
diff changeset
    86
	-o ${CMAKE_CURRENT_BINARY_DIR}/hedgewars_rc.o)
f9efe907828f Add win32 resource compilation under mingw (used sim-im srcs as example)
unc0rr
parents: 781
diff changeset
    87
	set(hwfr_src ${hwfr_src} ${CMAKE_CURRENT_BINARY_DIR}/hedgewars_rc.o)
f9efe907828f Add win32 resource compilation under mingw (used sim-im srcs as example)
unc0rr
parents: 781
diff changeset
    88
else(MINGW)
1042
a0ca4b3d2782 Fix resource compilation
unc0rr
parents: 1041
diff changeset
    89
	set(hwfr_src ${hwfr_src} hedgewars.rc)
880
f9efe907828f Add win32 resource compilation under mingw (used sim-im srcs as example)
unc0rr
parents: 781
diff changeset
    90
endif(MINGW)
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    91
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    92
set(hwfr_moc_hdrs
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    93
	game.h
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    94
	hwform.h
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    95
	teamselect.h
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    96
	teamselhelper.h
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    97
	frameTeam.h
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    98
	vertScrollArea.h
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
    99
	gameuiconfig.h
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   100
	gamecfgwidget.h
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   101
	pages.h
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   102
	SquareLabel.h
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   103
	hedgehogerWidget.h
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   104
	hwmap.h
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   105
	mapContainer.h
187
96c3154efee5 "About" page, not yet filled with content
unc0rr
parents: 184
diff changeset
   106
	tcpBase.h
208
a049157d673a Implement Knowledge Base for libs/compilers bugs
unc0rr
parents: 187
diff changeset
   107
	about.h
297
279e10ec31b4 'Show FPS' and 'FPS limit' options
unc0rr
parents: 277
diff changeset
   108
	proto.h
314
83773ccf4f09 client/server net pre-alpha
displacer
parents: 297
diff changeset
   109
	fpsedit.h
83773ccf4f09 client/server net pre-alpha
displacer
parents: 297
diff changeset
   110
	netserver.h
420
6cdfc07dceed netserver and netonnectedclient splited to different files
displacer
parents: 412
diff changeset
   111
	netconnectedclient.h
412
2ddcc3e3e644 udp server detecting experimental version
displacer
parents: 314
diff changeset
   112
	newnetclient.h
2ddcc3e3e644 udp server detecting experimental version
displacer
parents: 314
diff changeset
   113
	netudpserver.h
461
105af110b0e6 chatWidget with layout
displacer
parents: 420
diff changeset
   114
	netudpwidget.h
633
9050a949db21 Half implement registration in servers list
unc0rr
parents: 632
diff changeset
   115
	netwwwserver.h
625
373353eaa742 Sample WWW server list class
unc0rr
parents: 624
diff changeset
   116
	netwwwwidget.h
633
9050a949db21 Half implement registration in servers list
unc0rr
parents: 632
diff changeset
   117
	netregister.h
632
5e09ae25729f Half implement possibility for different backends of servers list
unc0rr
parents: 625
diff changeset
   118
	netserverslist.h
555
0376fdcc6322 Get possible screen resolutions from SDL library
unc0rr
parents: 539
diff changeset
   119
	chatwidget.h
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents: 555
diff changeset
   120
	SDLs.h
597
ec5f057ab268 kdevelop project add, initial weapons scheme button
displacer
parents: 592
diff changeset
   121
	playrecordpage.h
612
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents: 597
diff changeset
   122
	selectWeapon.h
880
f9efe907828f Add win32 resource compilation under mingw (used sim-im srcs as example)
unc0rr
parents: 781
diff changeset
   123
	itemNum.h
653
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents: 633
diff changeset
   124
	input_ip.h
1192
63b7961f68de Add iconed groupbox class
unc0rr
parents: 1159
diff changeset
   125
	igbox.h
624
e7673b036db5 weaponItem added
displacer
parents: 612
diff changeset
   126
	weaponItem.h)
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   127
477
2076a9dd2aaf moc warnings removed
displacer
parents: 461
diff changeset
   128
set(hwfr_hdrs
2076a9dd2aaf moc warnings removed
displacer
parents: 461
diff changeset
   129
	binds.h
2076a9dd2aaf moc warnings removed
displacer
parents: 461
diff changeset
   130
	ui_hwform.h
2076a9dd2aaf moc warnings removed
displacer
parents: 461
diff changeset
   131
	predefteams.h
2076a9dd2aaf moc warnings removed
displacer
parents: 461
diff changeset
   132
	KB.h
579
94db15de0392 - Some changes to make build process clear
unc0rr
parents: 555
diff changeset
   133
	hwconsts.h
477
2076a9dd2aaf moc warnings removed
displacer
parents: 461
diff changeset
   134
)
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   135
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   136
set(hwfr_rez
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   137
	hedgewars.qrc)
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   138
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   139
qt4_add_resources(hwfr_rez_src
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   140
	${hwfr_rez})
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   141
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   142
qt4_wrap_cpp(hwfr_moc_srcs
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   143
	${hwfr_moc_hdrs})
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   144
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   145
add_executable(hedgewars WIN32
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   146
	${hwfr_src}
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   147
	${hwfr_moc_srcs}
477
2076a9dd2aaf moc warnings removed
displacer
parents: 461
diff changeset
   148
	${hwfr_hdrs}
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   149
	${hwfr_rez_src})
495
62c1c2b4414c - Fix most of the warnings in hwengine
unc0rr
parents: 494
diff changeset
   150
	
555
0376fdcc6322 Get possible screen resolutions from SDL library
unc0rr
parents: 539
diff changeset
   151
set(HW_LINK_LIBS 
0376fdcc6322 Get possible screen resolutions from SDL library
unc0rr
parents: 539
diff changeset
   152
	${QT_LIBRARIES}
0376fdcc6322 Get possible screen resolutions from SDL library
unc0rr
parents: 539
diff changeset
   153
	${SDL_LIBRARY}
0376fdcc6322 Get possible screen resolutions from SDL library
unc0rr
parents: 539
diff changeset
   154
	)
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   155
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   156
if(WIN32 AND NOT UNIX)
555
0376fdcc6322 Get possible screen resolutions from SDL library
unc0rr
parents: 539
diff changeset
   157
	if(NOT SDL_LIBRARY)
0376fdcc6322 Get possible screen resolutions from SDL library
unc0rr
parents: 539
diff changeset
   158
		set(HW_LINK_LIBS 
0376fdcc6322 Get possible screen resolutions from SDL library
unc0rr
parents: 539
diff changeset
   159
			${HW_LINK_LIBS}
0376fdcc6322 Get possible screen resolutions from SDL library
unc0rr
parents: 539
diff changeset
   160
			SDL
0376fdcc6322 Get possible screen resolutions from SDL library
unc0rr
parents: 539
diff changeset
   161
			)
0376fdcc6322 Get possible screen resolutions from SDL library
unc0rr
parents: 539
diff changeset
   162
	endif(NOT SDL_LIBRARY)
0376fdcc6322 Get possible screen resolutions from SDL library
unc0rr
parents: 539
diff changeset
   163
495
62c1c2b4414c - Fix most of the warnings in hwengine
unc0rr
parents: 494
diff changeset
   164
	set(HW_LINK_LIBS 
62c1c2b4414c - Fix most of the warnings in hwengine
unc0rr
parents: 494
diff changeset
   165
		${HW_LINK_LIBS}
62c1c2b4414c - Fix most of the warnings in hwengine
unc0rr
parents: 494
diff changeset
   166
		ole32
1043
ddc93eeaabe4 Qt 4.4 needs this in win32
unc0rr
parents: 1042
diff changeset
   167
		oleaut32
495
62c1c2b4414c - Fix most of the warnings in hwengine
unc0rr
parents: 494
diff changeset
   168
		winspool
555
0376fdcc6322 Get possible screen resolutions from SDL library
unc0rr
parents: 539
diff changeset
   169
		uuid
0376fdcc6322 Get possible screen resolutions from SDL library
unc0rr
parents: 539
diff changeset
   170
		)
495
62c1c2b4414c - Fix most of the warnings in hwengine
unc0rr
parents: 494
diff changeset
   171
endif(WIN32 AND NOT UNIX)
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 177
diff changeset
   172
781
4101f0f1c0b9 First steps to support out-of-source build
unc0rr
parents: 707
diff changeset
   173
target_link_libraries(hedgewars
495
62c1c2b4414c - Fix most of the warnings in hwengine
unc0rr
parents: 494
diff changeset
   174
	${HW_LINK_LIBS})
62c1c2b4414c - Fix most of the warnings in hwengine
unc0rr
parents: 494
diff changeset
   175
62c1c2b4414c - Fix most of the warnings in hwengine
unc0rr
parents: 494
diff changeset
   176
install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hedgewars${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION bin)