QTfrontend/CMakeLists.txt
changeset 4520 e7882bd1a894
parent 4410 f9e38ce1e813
child 4775 663aa9552bfc
child 4812 f924be23ffb4
equal deleted inserted replaced
4519:aee36896d46b 4520:e7882bd1a894
    21 
    21 
    22 include_directories(.)
    22 include_directories(.)
    23 include_directories(${SDL_INCLUDE_DIR})
    23 include_directories(${SDL_INCLUDE_DIR})
    24 include_directories(${SDLMIXER_INCLUDE_DIR})
    24 include_directories(${SDLMIXER_INCLUDE_DIR})
    25 if(UNIX)
    25 if(UNIX)
    26 	# HACK: in freebsd cannot find iconv.h included via SDL.h
    26     # HACK: in freebsd cannot find iconv.h included via SDL.h
    27 	include_directories("/usr/local/include")
    27     include_directories("/usr/local/include")
    28 endif(UNIX)
    28 endif(UNIX)
    29 
    29 
    30 
    30 
    31 if(WIN32 AND NOT UNIX)
    31 if(WIN32 AND NOT UNIX)
    32 	set(HEDGEWARS_BINDIR ".")
    32     set(HEDGEWARS_BINDIR ".")
    33 	set(HEDGEWARS_DATADIR "../share/")
    33     set(HEDGEWARS_DATADIR "../share/")
    34         add_definitions(-DUSE_XFIRE)
    34         add_definitions(-DUSE_XFIRE)
    35 else()
    35 else()
    36 	set(HEDGEWARS_BINDIR ${CMAKE_INSTALL_PREFIX})
    36     set(HEDGEWARS_BINDIR ${CMAKE_INSTALL_PREFIX})
    37 	if(DEFINED DATA_INSTALL_DIR)
    37     if(DEFINED DATA_INSTALL_DIR)
    38 		set(HEDGEWARS_DATADIR ${DATA_INSTALL_DIR})
    38         set(HEDGEWARS_DATADIR ${DATA_INSTALL_DIR})
    39 	else()
    39     else()
    40 		set(HEDGEWARS_DATADIR ${CMAKE_INSTALL_PREFIX}/share/)
    40         set(HEDGEWARS_DATADIR ${CMAKE_INSTALL_PREFIX}/share/)
    41 	endif()
    41     endif()
    42 endif()
    42 endif()
    43 
    43 
    44 
    44 
    45 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/hwconsts.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/hwconsts.cpp)
    45 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/hwconsts.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/hwconsts.cpp)
    46 
    46 
    47 set(	hwfr_src
    47 set(hwfr_src
    48 	game.cpp
    48     game.cpp
    49 	main.cpp
    49     main.cpp
    50 	hwform.cpp
    50     hwform.cpp
    51 	team.cpp
    51     team.cpp
    52 	namegen.cpp
    52     namegen.cpp
    53 	teamselect.cpp
    53     teamselect.cpp
    54 	teamselhelper.cpp
    54     teamselhelper.cpp
    55 	frameTeam.cpp
    55     frameTeam.cpp
    56 	vertScrollArea.cpp
    56     vertScrollArea.cpp
    57 	gameuiconfig.cpp
    57     gameuiconfig.cpp
    58 	ui_hwform.cpp
    58     ui_hwform.cpp
    59 	gamecfgwidget.cpp
    59     gamecfgwidget.cpp
    60 	pages.cpp
    60     pages.cpp
    61 	SquareLabel.cpp
    61     SquareLabel.cpp
    62 	hats.cpp
    62     hats.cpp
    63 	hedgehogerWidget.cpp
    63     hedgehogerWidget.cpp
    64 	hwmap.cpp
    64     hwmap.cpp
    65 	mapContainer.cpp
    65     mapContainer.cpp
    66 	tcpBase.cpp
    66     tcpBase.cpp
    67 	about.cpp
    67     about.cpp
    68 	proto.cpp
    68     proto.cpp
    69 	fpsedit.cpp
    69     fpsedit.cpp
    70 	netserver.cpp
    70     netserver.cpp
    71 	newnetclient.cpp
    71     newnetclient.cpp
    72 	netudpserver.cpp
    72     netudpserver.cpp
    73 	netudpwidget.cpp
    73     netudpwidget.cpp
    74 	netregister.cpp
    74     netregister.cpp
    75 	netserverslist.cpp
    75     netserverslist.cpp
    76 	chatwidget.cpp
    76     chatwidget.cpp
    77 	binds.cpp
    77     binds.cpp
    78 	SDLs.cpp
    78     SDLs.cpp
    79 	playrecordpage.cpp
    79     playrecordpage.cpp
    80 	${CMAKE_CURRENT_BINARY_DIR}/hwconsts.cpp
    80     ${CMAKE_CURRENT_BINARY_DIR}/hwconsts.cpp
    81 	selectWeapon.cpp
    81     selectWeapon.cpp
    82 	itemNum.cpp
    82     itemNum.cpp
    83 	input_ip.cpp
    83     input_ip.cpp
    84 	igbox.cpp
    84     igbox.cpp
    85 	weaponItem.cpp
    85     weaponItem.cpp
    86 	statsPage.cpp
    86     statsPage.cpp
    87 	misc.cpp
    87     misc.cpp
    88 	ammoSchemeModel.cpp
    88     ammoSchemeModel.cpp
    89 	togglebutton.cpp
    89     togglebutton.cpp
    90 	bgwidget.cpp
    90     bgwidget.cpp
    91 	achievements.cpp
    91     achievements.cpp
    92 	)
    92     qaspectratiolayout.cpp
       
    93     drawmapwidget.cpp
       
    94     drawmapscene.cpp
       
    95     )
    93 
    96 
    94 #xfire integration
    97 #xfire integration
    95 if(WIN32)
    98 if(WIN32)
    96 	set(hwfr_src ${hwfr_src} xfire.cpp ../misc/xfire/xfiregameclient.cpp)
    99     set(hwfr_src ${hwfr_src} xfire.cpp ../misc/xfire/xfiregameclient.cpp)
    97 endif(WIN32)
   100 endif(WIN32)
    98 
   101 
    99 if(MINGW)
   102 if(MINGW)
   100 	# resource compilation for mingw
   103     # resource compilation for mingw
   101 	add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/hedgewars_rc.o
   104     add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/hedgewars_rc.o
   102 	COMMAND windres -I ${CMAKE_CURRENT_SOURCE_DIR}
   105     COMMAND windres -I ${CMAKE_CURRENT_SOURCE_DIR}
   103 	-i ${CMAKE_CURRENT_SOURCE_DIR}/hedgewars.rc
   106     -i ${CMAKE_CURRENT_SOURCE_DIR}/hedgewars.rc
   104 	-o ${CMAKE_CURRENT_BINARY_DIR}/hedgewars_rc.o)
   107     -o ${CMAKE_CURRENT_BINARY_DIR}/hedgewars_rc.o)
   105 	set(hwfr_src ${hwfr_src} ${CMAKE_CURRENT_BINARY_DIR}/hedgewars_rc.o)
   108     set(hwfr_src ${hwfr_src} ${CMAKE_CURRENT_BINARY_DIR}/hedgewars_rc.o)
   106 else(MINGW)
   109 else(MINGW)
   107 	set(hwfr_src ${hwfr_src} hedgewars.rc)
   110     set(hwfr_src ${hwfr_src} hedgewars.rc)
   108 endif(MINGW)
   111 endif(MINGW)
   109 
   112 
   110 set(	hwfr_moc_hdrs
   113 set(hwfr_moc_hdrs
   111 	game.h
   114     game.h
   112 	hats.h
   115     hats.h
   113 	hwform.h
   116     hwform.h
   114 	teamselect.h
   117     teamselect.h
   115 	teamselhelper.h
   118     teamselhelper.h
   116 	frameTeam.h
   119     frameTeam.h
   117 	vertScrollArea.h
   120     vertScrollArea.h
   118 	gameuiconfig.h
   121     gameuiconfig.h
   119 	gamecfgwidget.h
   122     gamecfgwidget.h
   120 	pages.h
   123     pages.h
   121 	SquareLabel.h
   124     SquareLabel.h
   122 	hedgehogerWidget.h
   125     hedgehogerWidget.h
   123 	hwmap.h
   126     hwmap.h
   124 	mapContainer.h
   127     mapContainer.h
   125 	tcpBase.h
   128     tcpBase.h
   126 	about.h
   129     about.h
   127 	proto.h
   130     proto.h
   128 	fpsedit.h
   131     fpsedit.h
   129 	netserver.h
   132     netserver.h
   130 	newnetclient.h
   133     newnetclient.h
   131 	netudpserver.h
   134     netudpserver.h
   132 	netudpwidget.h
   135     netudpwidget.h
   133 	netregister.h
   136     netregister.h
   134 	netserverslist.h
   137     netserverslist.h
   135 	chatwidget.h
   138     chatwidget.h
   136 	SDLs.h
   139     SDLs.h
   137 	playrecordpage.h
   140     playrecordpage.h
   138 	selectWeapon.h
   141     selectWeapon.h
   139 	itemNum.h
   142     itemNum.h
   140 	input_ip.h
   143     input_ip.h
   141 	igbox.h
   144     igbox.h
   142 	weaponItem.h
   145     weaponItem.h
   143 	statsPage.h
   146     statsPage.h
   144 	misc.h
   147     misc.h
   145 	ammoSchemeModel.h
   148     ammoSchemeModel.h
   146 	togglebutton.h
   149     togglebutton.h
   147 	bgwidget.h
   150     bgwidget.h
   148 	)
   151     qaspectratiolayout.h
   149 
   152     drawmapwidget.h
   150 set(	hwfr_hdrs
   153     drawmapscene.h
   151 	binds.h
   154     )
   152 	ui_hwform.h
   155 
   153 	KB.h
   156 set(hwfr_hdrs
   154 	hwconsts.h
   157     binds.h
   155 	)
   158     ui_hwform.h
       
   159     KB.h
       
   160     hwconsts.h
       
   161     )
   156 
   162 
   157 set(hwfr_rez hedgewars.qrc)
   163 set(hwfr_rez hedgewars.qrc)
   158 
   164 
   159 qt4_add_resources(hwfr_rez_src ${hwfr_rez})
   165 qt4_add_resources(hwfr_rez_src ${hwfr_rez})
   160 
   166 
   161 qt4_wrap_cpp(hwfr_moc_srcs ${hwfr_moc_hdrs})
   167 qt4_wrap_cpp(hwfr_moc_srcs ${hwfr_moc_hdrs})
   162 
   168 
   163 
   169 
   164 if(APPLE)
   170 if(APPLE)
   165 	set(hwfr_src ${hwfr_src} InstallController.cpp CocoaInitializer.mm M3Panel.mm M3InstallController.m NSWorkspace_RBAdditions.m)
   171     set(hwfr_src ${hwfr_src} InstallController.cpp CocoaInitializer.mm M3Panel.mm M3InstallController.m NSWorkspace_RBAdditions.m)
   166 	set(HW_LINK_LIBS IOKit)
   172     set(HW_LINK_LIBS IOKit)
   167 
   173 
   168 	find_package(Sparkle)
   174     find_package(Sparkle)
   169 	if(SPARKLE_FOUND)
   175     if(SPARKLE_FOUND)
   170                 add_definitions(-DSPARKLE_ENABLED)
   176                 add_definitions(-DSPARKLE_ENABLED)
   171 		set(hwfr_src ${hwfr_src} AutoUpdater.cpp SparkleAutoUpdater.mm)
   177         set(hwfr_src ${hwfr_src} AutoUpdater.cpp SparkleAutoUpdater.mm)
   172                 set(HW_LINK_LIBS ${SPARKLE_LIBRARY} ${HW_LINK_LIBS})
   178                 set(HW_LINK_LIBS ${SPARKLE_LIBRARY} ${HW_LINK_LIBS})
   173 	endif()
   179     endif()
   174 endif()
   180 endif()
   175 
   181 
   176 
   182 
   177 add_executable(hedgewars WIN32
   183 add_executable(hedgewars WIN32
   178 	${hwfr_src}
   184     ${hwfr_src}
   179 	${hwfr_moc_srcs}
   185     ${hwfr_moc_srcs}
   180 	${hwfr_hdrs}
   186     ${hwfr_hdrs}
   181 	${hwfr_rez_src}
   187     ${hwfr_rez_src}
   182 	)
   188     )
   183 
   189 
   184 
   190 
   185 set(	HW_LINK_LIBS
   191 set(HW_LINK_LIBS
   186 	${QT_LIBRARIES}
   192     ${QT_LIBRARIES}
   187 	${SDL_LIBRARY}
   193     ${SDL_LIBRARY}
   188 	${SDLMIXER_LIBRARY}
   194     ${SDLMIXER_LIBRARY}
   189 	${HW_LINK_LIBS}
   195     ${HW_LINK_LIBS}
   190 	)
   196     )
   191 
   197 
   192 if(WIN32 AND NOT UNIX)
   198 if(WIN32 AND NOT UNIX)
   193 	if(NOT SDL_LIBRARY)
   199     if(NOT SDL_LIBRARY)
   194 		set(HW_LINK_LIBS ${HW_LINK_LIBS} SDL)
   200         set(HW_LINK_LIBS ${HW_LINK_LIBS} SDL)
   195 	endif()
   201     endif()
   196 
   202 
   197 	set(	HW_LINK_LIBS
   203     set(	HW_LINK_LIBS
   198 		${HW_LINK_LIBS}
   204         ${HW_LINK_LIBS}
   199 		ole32
   205         ole32
   200 		oleaut32
   206         oleaut32
   201 		winspool
   207         winspool
   202 		uuid
   208         uuid
   203 		)
   209         )
   204 endif()
   210 endif()
   205 
   211 
   206 
   212 
   207 target_link_libraries(hedgewars	${HW_LINK_LIBS})
   213 target_link_libraries(hedgewars	${HW_LINK_LIBS})
   208 
   214