No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. # framework flags
  2. # FRAMEWORK_SOUND
  3. # FRAMEWORK_GRAPHICS
  4. # FRAMEWORK_NET
  5. # FRAMEWORK_XML
  6. # FRAMEWORK_SQL
  7. # CMAKE_CURRENT_LIST_DIR cmake 2.6 compatibility
  8. if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6)
  9. get_filename_component(CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
  10. endif(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6)
  11. # add framework cmake modules
  12. set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake;${CMAKE_MODULE_PATH}")
  13. set(framework_LIBRARIES "")
  14. set(framework_DEFINITIONS "")
  15. set(framework_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/..")
  16. set(framework_SOURCES ${framework_SOURCES}
  17. ${CMAKE_CURRENT_LIST_DIR}/const.h
  18. ${CMAKE_CURRENT_LIST_DIR}/global.h
  19. ${CMAKE_CURRENT_LIST_DIR}/pch.h
  20. ${CMAKE_CURRENT_LIST_DIR}/luafunctions.cpp
  21. ${CMAKE_CURRENT_LIST_DIR}/util/color.cpp
  22. ${CMAKE_CURRENT_LIST_DIR}/util/color.h
  23. ${CMAKE_CURRENT_LIST_DIR}/util/crypt.cpp
  24. ${CMAKE_CURRENT_LIST_DIR}/util/crypt.h
  25. ${CMAKE_CURRENT_LIST_DIR}/util/databuffer.h
  26. ${CMAKE_CURRENT_LIST_DIR}/util/matrix.h
  27. ${CMAKE_CURRENT_LIST_DIR}/util/point.h
  28. ${CMAKE_CURRENT_LIST_DIR}/util/rect.h
  29. ${CMAKE_CURRENT_LIST_DIR}/util/size.h
  30. # stdext
  31. ${CMAKE_CURRENT_LIST_DIR}/stdext/any.h
  32. ${CMAKE_CURRENT_LIST_DIR}/stdext/boolean.h
  33. ${CMAKE_CURRENT_LIST_DIR}/stdext/cast.h
  34. ${CMAKE_CURRENT_LIST_DIR}/stdext/compiler.h
  35. ${CMAKE_CURRENT_LIST_DIR}/stdext/demangle.cpp
  36. ${CMAKE_CURRENT_LIST_DIR}/stdext/demangle.h
  37. ${CMAKE_CURRENT_LIST_DIR}/stdext/dumper.h
  38. ${CMAKE_CURRENT_LIST_DIR}/stdext/dynamic_storage.h
  39. ${CMAKE_CURRENT_LIST_DIR}/stdext/exception.h
  40. ${CMAKE_CURRENT_LIST_DIR}/stdext/format.h
  41. ${CMAKE_CURRENT_LIST_DIR}/stdext/math.cpp
  42. ${CMAKE_CURRENT_LIST_DIR}/stdext/math.h
  43. ${CMAKE_CURRENT_LIST_DIR}/stdext/net.cpp
  44. ${CMAKE_CURRENT_LIST_DIR}/stdext/net.h
  45. ${CMAKE_CURRENT_LIST_DIR}/stdext/packed_any.h
  46. ${CMAKE_CURRENT_LIST_DIR}/stdext/packed_storage.h
  47. ${CMAKE_CURRENT_LIST_DIR}/stdext/packed_vector.h
  48. ${CMAKE_CURRENT_LIST_DIR}/stdext/shared_object.h
  49. ${CMAKE_CURRENT_LIST_DIR}/stdext/shared_ptr.h
  50. ${CMAKE_CURRENT_LIST_DIR}/stdext/stdext.h
  51. ${CMAKE_CURRENT_LIST_DIR}/stdext/string.cpp
  52. ${CMAKE_CURRENT_LIST_DIR}/stdext/string.h
  53. ${CMAKE_CURRENT_LIST_DIR}/stdext/time.cpp
  54. ${CMAKE_CURRENT_LIST_DIR}/stdext/time.h
  55. ${CMAKE_CURRENT_LIST_DIR}/stdext/traits.h
  56. ${CMAKE_CURRENT_LIST_DIR}/stdext/types.h
  57. # core
  58. ${CMAKE_CURRENT_LIST_DIR}/core/application.cpp
  59. ${CMAKE_CURRENT_LIST_DIR}/core/application.h
  60. ${CMAKE_CURRENT_LIST_DIR}/core/adaptativeframecounter.cpp
  61. ${CMAKE_CURRENT_LIST_DIR}/core/adaptativeframecounter.h
  62. ${CMAKE_CURRENT_LIST_DIR}/core/asyncdispatcher.cpp
  63. ${CMAKE_CURRENT_LIST_DIR}/core/asyncdispatcher.h
  64. ${CMAKE_CURRENT_LIST_DIR}/core/binarytree.cpp
  65. ${CMAKE_CURRENT_LIST_DIR}/core/binarytree.h
  66. ${CMAKE_CURRENT_LIST_DIR}/core/clock.cpp
  67. ${CMAKE_CURRENT_LIST_DIR}/core/clock.h
  68. ${CMAKE_CURRENT_LIST_DIR}/core/config.cpp
  69. ${CMAKE_CURRENT_LIST_DIR}/core/config.h
  70. ${CMAKE_CURRENT_LIST_DIR}/core/configmanager.cpp
  71. ${CMAKE_CURRENT_LIST_DIR}/core/configmanager.h
  72. ${CMAKE_CURRENT_LIST_DIR}/core/declarations.h
  73. ${CMAKE_CURRENT_LIST_DIR}/core/event.cpp
  74. ${CMAKE_CURRENT_LIST_DIR}/core/event.h
  75. ${CMAKE_CURRENT_LIST_DIR}/core/eventdispatcher.cpp
  76. ${CMAKE_CURRENT_LIST_DIR}/core/eventdispatcher.h
  77. ${CMAKE_CURRENT_LIST_DIR}/core/filestream.cpp
  78. ${CMAKE_CURRENT_LIST_DIR}/core/filestream.h
  79. ${CMAKE_CURRENT_LIST_DIR}/core/inputevent.h
  80. ${CMAKE_CURRENT_LIST_DIR}/core/logger.cpp
  81. ${CMAKE_CURRENT_LIST_DIR}/core/logger.h
  82. ${CMAKE_CURRENT_LIST_DIR}/core/module.cpp
  83. ${CMAKE_CURRENT_LIST_DIR}/core/module.h
  84. ${CMAKE_CURRENT_LIST_DIR}/core/modulemanager.cpp
  85. ${CMAKE_CURRENT_LIST_DIR}/core/modulemanager.h
  86. ${CMAKE_CURRENT_LIST_DIR}/core/resourcemanager.cpp
  87. ${CMAKE_CURRENT_LIST_DIR}/core/resourcemanager.h
  88. ${CMAKE_CURRENT_LIST_DIR}/core/scheduledevent.cpp
  89. ${CMAKE_CURRENT_LIST_DIR}/core/scheduledevent.h
  90. ${CMAKE_CURRENT_LIST_DIR}/core/timer.cpp
  91. ${CMAKE_CURRENT_LIST_DIR}/core/timer.h
  92. # luaengine
  93. ${CMAKE_CURRENT_LIST_DIR}/luaengine/declarations.h
  94. ${CMAKE_CURRENT_LIST_DIR}/luaengine/luabinder.h
  95. ${CMAKE_CURRENT_LIST_DIR}/luaengine/luaexception.cpp
  96. ${CMAKE_CURRENT_LIST_DIR}/luaengine/luaexception.h
  97. ${CMAKE_CURRENT_LIST_DIR}/luaengine/luainterface.cpp
  98. ${CMAKE_CURRENT_LIST_DIR}/luaengine/luainterface.h
  99. ${CMAKE_CURRENT_LIST_DIR}/luaengine/luaobject.cpp
  100. ${CMAKE_CURRENT_LIST_DIR}/luaengine/luaobject.h
  101. ${CMAKE_CURRENT_LIST_DIR}/luaengine/luavaluecasts.cpp
  102. ${CMAKE_CURRENT_LIST_DIR}/luaengine/luavaluecasts.h
  103. ${CMAKE_CURRENT_LIST_DIR}/luaengine/lbitlib.cpp
  104. ${CMAKE_CURRENT_LIST_DIR}/luaengine/lbitlib.h
  105. # otml
  106. ${CMAKE_CURRENT_LIST_DIR}/otml/declarations.h
  107. ${CMAKE_CURRENT_LIST_DIR}/otml/otmldocument.cpp
  108. ${CMAKE_CURRENT_LIST_DIR}/otml/otmldocument.h
  109. ${CMAKE_CURRENT_LIST_DIR}/otml/otmlemitter.cpp
  110. ${CMAKE_CURRENT_LIST_DIR}/otml/otmlemitter.h
  111. ${CMAKE_CURRENT_LIST_DIR}/otml/otmlexception.cpp
  112. ${CMAKE_CURRENT_LIST_DIR}/otml/otmlexception.h
  113. ${CMAKE_CURRENT_LIST_DIR}/otml/otml.h
  114. ${CMAKE_CURRENT_LIST_DIR}/otml/otmlnode.cpp
  115. ${CMAKE_CURRENT_LIST_DIR}/otml/otmlnode.h
  116. ${CMAKE_CURRENT_LIST_DIR}/otml/otmlparser.cpp
  117. ${CMAKE_CURRENT_LIST_DIR}/otml/otmlparser.h
  118. # crash handler
  119. ${CMAKE_CURRENT_LIST_DIR}/platform/crashhandler.h
  120. ${CMAKE_CURRENT_LIST_DIR}/platform/unixcrashhandler.cpp
  121. ${CMAKE_CURRENT_LIST_DIR}/platform/win32crashhandler.cpp
  122. ${CMAKE_CURRENT_LIST_DIR}/platform/win32platform.cpp
  123. ${CMAKE_CURRENT_LIST_DIR}/platform/unixplatform.cpp
  124. ${CMAKE_CURRENT_LIST_DIR}/platform/platform.cpp
  125. ${CMAKE_CURRENT_LIST_DIR}/platform/platform.h
  126. )
  127. set_source_files_properties(${CMAKE_CURRENT_LIST_DIR}/luafunctions.cpp
  128. PROPERTIES LANGUAGE CXX COMPILE_FLAGS "-g0 -Os")
  129. # some build options
  130. option(LUAJIT "Use lua jit" OFF)
  131. if(NOT APPLE)
  132. option(CRASH_HANDLER "Generate crash reports" ON)
  133. option(USE_STATIC_LIBS "Don't use shared libraries (dlls)" ON)
  134. option(USE_LIBCPP "Use the new libc++ library instead of stdc++" OFF)
  135. option(USE_LTO "Use link time optimizations" OFF)
  136. else()
  137. set(CRASH_HANDLER OFF)
  138. set(USE_STATIC_LIBS OFF)
  139. set(USE_LIBCPP ON)
  140. endif()
  141. set(BUILD_COMMIT "devel" CACHE "Git commit string (intended for releases)" STRING)
  142. set(BUILD_REVISION "0" CACHE "Git revision string (intended for releases)" STRING)
  143. # default build type
  144. if(NOT CMAKE_BUILD_TYPE)
  145. set(CMAKE_BUILD_TYPE "RelWithDebInfo")
  146. endif()
  147. include(FindCXX11)
  148. # gcc compile flags
  149. set(WARNS_FLAGS "-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-unused-result")
  150. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNS_FLAGS} ${ARCH_FLAGS} ${CPP2011_FLAGS} -pipe")
  151. set(CMAKE_CXX_FLAGS_COMPILESPEED "-O0")
  152. set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
  153. set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O1 -g -fno-omit-frame-pointer")
  154. set(CMAKE_CXX_FLAGS_RELEASE "-O2")
  155. set(CMAKE_CXX_FLAGS_PERFORMANCE "-Ofast -march=native")
  156. if(USE_LTO)
  157. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fwhole-program -flto")
  158. if(WIN32)
  159. set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -Wl,-O1,--gc-sections,--sort-common,--relax")
  160. else()
  161. set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -Wl,-O1,--gc-sections,--sort-common,--relax,-z,relro")
  162. endif()
  163. endif()
  164. # process options
  165. if(USE_STATIC_LIBS)
  166. if(NOT APPLE)
  167. set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -static-libgcc -static-libstdc++")
  168. endif()
  169. message(STATUS "Link to static libraries: ON")
  170. else()
  171. message(STATUS "Link to static libraries: OFF")
  172. endif()
  173. message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
  174. add_definitions(-D"BUILD_TYPE=\\\"${CMAKE_BUILD_TYPE}\\\"")
  175. message(STATUS "Build commit: ${BUILD_COMMIT}")
  176. add_definitions(-D"BUILD_COMMIT=\\\"${BUILD_COMMIT}\\\"")
  177. message(STATUS "Build revision: ${BUILD_REVISION}")
  178. add_definitions(-D"BUILD_REVISION=\\\"${BUILD_REVISION}\\\"")
  179. # find boost
  180. set(REQUIRED_BOOST_COMPONENTS system thread filesystem)
  181. if(WIN32)
  182. set(Boost_THREADAPI win32)
  183. set(framework_DEFINITIONS ${framework_DEFINITIONS} -DBOOST_THREAD_USE_LIB) # fix boost thread linkage
  184. endif()
  185. set(Boost_USE_MULTITHREADED ON)
  186. set(Boost_USE_STATIC_LIBS ${USE_STATIC_LIBS})
  187. find_package(Boost 1.48.0 COMPONENTS ${REQUIRED_BOOST_COMPONENTS} REQUIRED)
  188. #find lua
  189. if(LUAJIT)
  190. find_package(LuaJIT REQUIRED)
  191. set(LUA_INCLUDE_DIR ${LUAJIT_INCLUDE_DIR})
  192. set(LUA_LIBRARY ${LUAJIT_LIBRARY})
  193. if(APPLE)
  194. set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -pagezero_size 10000 -image_base 100000000")
  195. endif()
  196. else()
  197. find_package(Lua REQUIRED)
  198. endif()
  199. message(STATUS "LuaJIT: " ${LUAJIT})
  200. find_package(PhysFS REQUIRED)
  201. find_package(OpenSSL REQUIRED)
  202. find_package(ZLIB REQUIRED)
  203. set(framework_LIBRARIES ${framework_LIBRARIES}
  204. ${Boost_LIBRARIES}
  205. ${LUA_LIBRARY}
  206. ${PHYSFS_LIBRARY}
  207. ${OPENSSL_LIBRARIES}
  208. ${ZLIB_LIBRARY}
  209. )
  210. set(framework_INCLUDE_DIRS ${framework_INCLUDE_DIRS}
  211. ${Boost_INCLUDE_DIRS}
  212. ${LUA_INCLUDE_DIR}
  213. ${PHYSFS_INCLUDE_DIR}
  214. ${OPENSSL_INCLUDE_DIR}
  215. ${framework_INCLUDE_DIRS}
  216. )
  217. if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
  218. message(STATUS "Debug information: ON")
  219. else()
  220. message(STATUS "Debug information: OFF")
  221. if(NOT CMAKE_BUILD_TYPE STREQUAL "CompileSpeed")
  222. set(framework_DEFINITIONS ${framework_DEFINITIONS} -DNDEBUG) # NDEBUG disable asserts
  223. endif()
  224. if(NOT APPLE)
  225. set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -Wl,-s") # strip all debug information
  226. set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -Wl,--as-needed") # only link needed libraries
  227. endif()
  228. endif()
  229. if(CRASH_HANDLER)
  230. set(framework_DEFINITIONS ${framework_DEFINITIONS} -DCRASH_HANDLER)
  231. message(STATUS "Crash handler: ON")
  232. if(WIN32)
  233. set(framework_LIBRARIES ${framework_LIBRARIES} imagehlp)
  234. endif()
  235. else()
  236. message(STATUS "Crash handler: OFF")
  237. endif()
  238. if(USE_LIBCPP)
  239. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -Wno-deprecated-declarations")
  240. endif()
  241. if(WIN32)
  242. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mthreads")
  243. set(framework_DEFINITIONS ${framework_DEFINITIONS} -D_WIN32_WINNT=0x0501 -DWIN32)
  244. #set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -Wl,--large-address-aware") # strip all debug information
  245. set(SYSTEM_LIBRARIES "")
  246. else()
  247. if(APPLE)
  248. set(framework_DEFINITIONS ${framework_DEFINITIONS} -D_REENTRANT) # enable thread safe code
  249. set(SYSTEM_LIBRARIES "")
  250. else()
  251. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
  252. set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -rdynamic -Wl,-rpath,./libs") # rdynamic is needed by backtrace.h used in crash handler
  253. set(SYSTEM_LIBRARIES dl rt)
  254. endif()
  255. endif()
  256. set(framework_LIBRARIES ${framework_LIBRARIES} ${SYSTEM_LIBRARIES})
  257. if(FRAMEWORK_THREAD_SAFE)
  258. set(framework_DEFINITIONS ${framework_DEFINITIONS} -DTHREAD_SAFE)
  259. endif()
  260. if(FRAMEWORK_GRAPHICS)
  261. set(OPENGLES "OFF" CACHE "Use OpenGL ES 1.0 or 2.0 (for mobiles devices)" STRING)
  262. if(OPENGLES STREQUAL "2.0")
  263. find_package(OpenGLES2 REQUIRED)
  264. find_package(EGL REQUIRED)
  265. set(framework_DEFINITIONS ${framework_DEFINITIONS} -DOPENGL_ES=2)
  266. set(framework_INCLUDE_DIRS ${framework_INCLUDE_DIRS} ${EGL_INCLUDE_DIR} ${OPENGLES2_INCLUDE_DIR})
  267. set(framework_LIBRARIES ${framework_LIBRARIES} ${EGL_LIBRARY} ${OPENGLES2_LIBRARY})
  268. ELSEif(OPENGLES STREQUAL "1.0")
  269. find_package(OpenGLES1 REQUIRED)
  270. find_package(EGL REQUIRED)
  271. set(framework_DEFINITIONS ${framework_DEFINITIONS} -DOPENGL_ES=1)
  272. set(framework_INCLUDE_DIRS ${framework_INCLUDE_DIRS} ${EGL_INCLUDE_DIR} ${OPENGLES1_INCLUDE_DIR})
  273. set(framework_LIBRARIES ${framework_LIBRARIES} ${EGL_LIBRARY} ${OPENGLES1_LIBRARY})
  274. else()
  275. ## TODO: CMake Documentation says that this is not the right
  276. # Thing for Mac OS X, but it works for now.
  277. if(APPLE)
  278. include_directories(/usr/X11R6/include/)
  279. link_directories(/usr/X11R6/lib/)
  280. SET(OPENGL_LIBRARIES GL)
  281. else()
  282. find_package(OpenGL REQUIRED)
  283. endif()
  284. find_package(GLEW REQUIRED)
  285. set(framework_LIBRARIES ${framework_LIBRARIES} ${GLEW_LIBRARY} ${OPENGL_LIBRARIES})
  286. endif()
  287. message(STATUS "OpenGL ES: " ${OPENGLES})
  288. if(WIN32)
  289. option(WINDOWS_CONSOLE "Enables console window on Windows platform" OFF)
  290. if(WINDOWS_CONSOLE)
  291. message(STATUS "Windows console: ON")
  292. else()
  293. set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -mwindows")
  294. message(STATUS "Windows console: OFF")
  295. endif()
  296. # native dx9 support while its under development
  297. option(DIRECTX "Use DX9 support" OFF)
  298. if(DIRECTX)
  299. find_package(DirectX REQUIRED)
  300. set(framework_DEFINITIONS ${framework_DEFINITIONS} -DDIRECTX)
  301. set(framework_INCLUDE_DIRS ${framework_INCLUDE_DIRS} ${DirectX_INCLUDE_DIR})
  302. set(framework_LIBRARIES ${framework_LIBRARIES} ${DirectX_LIBRARY} ${DirectX_LIBRARIES})
  303. set(framework_SOURCES ${framework_SOURCES}
  304. ${CMAKE_CURRENT_LIST_DIR}/graphics/dx/painterdx9.cpp
  305. ${CMAKE_CURRENT_LIST_DIR}/graphics/dx/painterdx9.h
  306. )
  307. endif()
  308. else()
  309. set(framework_LIBRARIES ${framework_LIBRARIES} X11)
  310. endif()
  311. set(framework_SOURCES ${framework_SOURCES}
  312. ${CMAKE_CURRENT_LIST_DIR}/graphics/animatedtexture.cpp
  313. ${CMAKE_CURRENT_LIST_DIR}/graphics/animatedtexture.h
  314. ${CMAKE_CURRENT_LIST_DIR}/graphics/cachedtext.cpp
  315. ${CMAKE_CURRENT_LIST_DIR}/graphics/cachedtext.h
  316. ${CMAKE_CURRENT_LIST_DIR}/graphics/coordsbuffer.cpp
  317. ${CMAKE_CURRENT_LIST_DIR}/graphics/coordsbuffer.h
  318. ${CMAKE_CURRENT_LIST_DIR}/graphics/declarations.h
  319. ${CMAKE_CURRENT_LIST_DIR}/graphics/bitmapfont.cpp
  320. ${CMAKE_CURRENT_LIST_DIR}/graphics/bitmapfont.h
  321. ${CMAKE_CURRENT_LIST_DIR}/graphics/fontmanager.cpp
  322. ${CMAKE_CURRENT_LIST_DIR}/graphics/fontmanager.h
  323. ${CMAKE_CURRENT_LIST_DIR}/graphics/framebuffer.cpp
  324. ${CMAKE_CURRENT_LIST_DIR}/graphics/framebuffer.h
  325. ${CMAKE_CURRENT_LIST_DIR}/graphics/framebuffermanager.cpp
  326. ${CMAKE_CURRENT_LIST_DIR}/graphics/framebuffermanager.h
  327. ${CMAKE_CURRENT_LIST_DIR}/graphics/glutil.h
  328. ${CMAKE_CURRENT_LIST_DIR}/graphics/graphics.cpp
  329. ${CMAKE_CURRENT_LIST_DIR}/graphics/graphics.h
  330. ${CMAKE_CURRENT_LIST_DIR}/graphics/hardwarebuffer.cpp
  331. ${CMAKE_CURRENT_LIST_DIR}/graphics/hardwarebuffer.h
  332. ${CMAKE_CURRENT_LIST_DIR}/graphics/image.cpp
  333. ${CMAKE_CURRENT_LIST_DIR}/graphics/image.h
  334. ${CMAKE_CURRENT_LIST_DIR}/graphics/painter.cpp
  335. ${CMAKE_CURRENT_LIST_DIR}/graphics/painter.h
  336. ${CMAKE_CURRENT_LIST_DIR}/graphics/ogl/painterogl.cpp
  337. ${CMAKE_CURRENT_LIST_DIR}/graphics/ogl/painterogl.h
  338. ${CMAKE_CURRENT_LIST_DIR}/graphics/ogl/painterogl1.cpp
  339. ${CMAKE_CURRENT_LIST_DIR}/graphics/ogl/painterogl1.h
  340. ${CMAKE_CURRENT_LIST_DIR}/graphics/ogl/painterogl2.cpp
  341. ${CMAKE_CURRENT_LIST_DIR}/graphics/ogl/painterogl2.h
  342. ${CMAKE_CURRENT_LIST_DIR}/graphics/ogl/painterogl2_shadersources.h
  343. ${CMAKE_CURRENT_LIST_DIR}/graphics/paintershaderprogram.cpp
  344. ${CMAKE_CURRENT_LIST_DIR}/graphics/paintershaderprogram.h
  345. ${CMAKE_CURRENT_LIST_DIR}/graphics/particleaffector.cpp
  346. ${CMAKE_CURRENT_LIST_DIR}/graphics/particleaffector.h
  347. ${CMAKE_CURRENT_LIST_DIR}/graphics/particle.cpp
  348. ${CMAKE_CURRENT_LIST_DIR}/graphics/particle.h
  349. ${CMAKE_CURRENT_LIST_DIR}/graphics/particletype.cpp
  350. ${CMAKE_CURRENT_LIST_DIR}/graphics/particletype.h
  351. ${CMAKE_CURRENT_LIST_DIR}/graphics/particleemitter.cpp
  352. ${CMAKE_CURRENT_LIST_DIR}/graphics/particleemitter.h
  353. ${CMAKE_CURRENT_LIST_DIR}/graphics/particleeffect.cpp
  354. ${CMAKE_CURRENT_LIST_DIR}/graphics/particleeffect.h
  355. ${CMAKE_CURRENT_LIST_DIR}/graphics/particlemanager.cpp
  356. ${CMAKE_CURRENT_LIST_DIR}/graphics/particlemanager.h
  357. ${CMAKE_CURRENT_LIST_DIR}/graphics/particlesystem.cpp
  358. ${CMAKE_CURRENT_LIST_DIR}/graphics/particlesystem.h
  359. ${CMAKE_CURRENT_LIST_DIR}/graphics/shader.cpp
  360. ${CMAKE_CURRENT_LIST_DIR}/graphics/shader.h
  361. ${CMAKE_CURRENT_LIST_DIR}/graphics/shaderprogram.cpp
  362. ${CMAKE_CURRENT_LIST_DIR}/graphics/shaderprogram.h
  363. ${CMAKE_CURRENT_LIST_DIR}/graphics/texture.cpp
  364. ${CMAKE_CURRENT_LIST_DIR}/graphics/texture.h
  365. ${CMAKE_CURRENT_LIST_DIR}/graphics/texturemanager.cpp
  366. ${CMAKE_CURRENT_LIST_DIR}/graphics/texturemanager.h
  367. ${CMAKE_CURRENT_LIST_DIR}/graphics/vertexarray.h
  368. ${CMAKE_CURRENT_LIST_DIR}/graphics/apngloader.cpp
  369. ${CMAKE_CURRENT_LIST_DIR}/graphics/apngloader.h
  370. # ui
  371. ${CMAKE_CURRENT_LIST_DIR}/ui/declarations.h
  372. ${CMAKE_CURRENT_LIST_DIR}/ui/uianchorlayout.cpp
  373. ${CMAKE_CURRENT_LIST_DIR}/ui/uianchorlayout.h
  374. ${CMAKE_CURRENT_LIST_DIR}/ui/uiboxlayout.cpp
  375. ${CMAKE_CURRENT_LIST_DIR}/ui/uiboxlayout.h
  376. ${CMAKE_CURRENT_LIST_DIR}/ui/uigridlayout.cpp
  377. ${CMAKE_CURRENT_LIST_DIR}/ui/uigridlayout.h
  378. ${CMAKE_CURRENT_LIST_DIR}/ui/ui.h
  379. ${CMAKE_CURRENT_LIST_DIR}/ui/uihorizontallayout.cpp
  380. ${CMAKE_CURRENT_LIST_DIR}/ui/uihorizontallayout.h
  381. ${CMAKE_CURRENT_LIST_DIR}/ui/uilayout.cpp
  382. ${CMAKE_CURRENT_LIST_DIR}/ui/uilayout.h
  383. ${CMAKE_CURRENT_LIST_DIR}/ui/uimanager.cpp
  384. ${CMAKE_CURRENT_LIST_DIR}/ui/uimanager.h
  385. ${CMAKE_CURRENT_LIST_DIR}/ui/uiparticles.cpp
  386. ${CMAKE_CURRENT_LIST_DIR}/ui/uiparticles.h
  387. ${CMAKE_CURRENT_LIST_DIR}/ui/uitextedit.cpp
  388. ${CMAKE_CURRENT_LIST_DIR}/ui/uitextedit.h
  389. ${CMAKE_CURRENT_LIST_DIR}/ui/uitranslator.cpp
  390. ${CMAKE_CURRENT_LIST_DIR}/ui/uitranslator.h
  391. ${CMAKE_CURRENT_LIST_DIR}/ui/uiverticallayout.cpp
  392. ${CMAKE_CURRENT_LIST_DIR}/ui/uiverticallayout.h
  393. ${CMAKE_CURRENT_LIST_DIR}/ui/uiwidgetbasestyle.cpp
  394. ${CMAKE_CURRENT_LIST_DIR}/ui/uiwidget.cpp
  395. ${CMAKE_CURRENT_LIST_DIR}/ui/uiwidget.h
  396. ${CMAKE_CURRENT_LIST_DIR}/ui/uiwidgetimage.cpp
  397. ${CMAKE_CURRENT_LIST_DIR}/ui/uiwidgettext.cpp
  398. # platform window
  399. ${CMAKE_CURRENT_LIST_DIR}/platform/platformwindow.cpp
  400. ${CMAKE_CURRENT_LIST_DIR}/platform/platformwindow.h
  401. ${CMAKE_CURRENT_LIST_DIR}/platform/win32window.cpp
  402. ${CMAKE_CURRENT_LIST_DIR}/platform/win32window.h
  403. ${CMAKE_CURRENT_LIST_DIR}/platform/x11window.cpp
  404. ${CMAKE_CURRENT_LIST_DIR}/platform/x11window.h
  405. # window input
  406. ${CMAKE_CURRENT_LIST_DIR}/input/mouse.cpp
  407. ${CMAKE_CURRENT_LIST_DIR}/input/mouse.h
  408. ${CMAKE_CURRENT_LIST_DIR}/core/graphicalapplication.cpp
  409. ${CMAKE_CURRENT_LIST_DIR}/core/graphicalapplication.h
  410. )
  411. set(framework_DEFINITIONS ${framework_DEFINITIONS} -DFW_GRAPHICS)
  412. else()
  413. set(framework_SOURCES ${framework_SOURCES}
  414. ${CMAKE_CURRENT_LIST_DIR}/core/consoleapplication.cpp
  415. ${CMAKE_CURRENT_LIST_DIR}/core/consoleapplication.h
  416. )
  417. endif()
  418. if(FRAMEWORK_SOUND)
  419. find_package(OpenAL REQUIRED)
  420. find_package(VorbisFile REQUIRED)
  421. find_package(Vorbis REQUIRED)
  422. find_package(Ogg REQUIRED)
  423. set(framework_INCLUDE_DIRS ${framework_INCLUDE_DIRS} ${OPENAL_INCLUDE_DIR} ${VORBISFILE_INCLUDE_DIR})
  424. set(framework_LIBRARIES ${OPENAL_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY} ${framework_LIBRARIES})
  425. if(WIN32)
  426. set(framework_LIBRARIES ${framework_LIBRARIES} winmm)
  427. elseif(APPLE)
  428. set(framework_LIBRARIES ${framework_LIBRARIES} System)
  429. endif()
  430. set(framework_SOURCES ${framework_SOURCES}
  431. ${CMAKE_CURRENT_LIST_DIR}/sound/combinedsoundsource.cpp
  432. ${CMAKE_CURRENT_LIST_DIR}/sound/combinedsoundsource.h
  433. ${CMAKE_CURRENT_LIST_DIR}/sound/declarations.h
  434. ${CMAKE_CURRENT_LIST_DIR}/sound/oggsoundfile.cpp
  435. ${CMAKE_CURRENT_LIST_DIR}/sound/oggsoundfile.h
  436. ${CMAKE_CURRENT_LIST_DIR}/sound/soundbuffer.cpp
  437. ${CMAKE_CURRENT_LIST_DIR}/sound/soundbuffer.h
  438. ${CMAKE_CURRENT_LIST_DIR}/sound/soundchannel.cpp
  439. ${CMAKE_CURRENT_LIST_DIR}/sound/soundchannel.h
  440. ${CMAKE_CURRENT_LIST_DIR}/sound/soundfile.cpp
  441. ${CMAKE_CURRENT_LIST_DIR}/sound/soundfile.h
  442. ${CMAKE_CURRENT_LIST_DIR}/sound/soundmanager.cpp
  443. ${CMAKE_CURRENT_LIST_DIR}/sound/soundmanager.h
  444. ${CMAKE_CURRENT_LIST_DIR}/sound/soundsource.cpp
  445. ${CMAKE_CURRENT_LIST_DIR}/sound/soundsource.h
  446. ${CMAKE_CURRENT_LIST_DIR}/sound/streamsoundsource.cpp
  447. ${CMAKE_CURRENT_LIST_DIR}/sound/streamsoundsource.h
  448. )
  449. set(framework_DEFINITIONS ${framework_DEFINITIONS} -DFW_SOUND)
  450. endif()
  451. if(FRAMEWORK_NET)
  452. if(WIN32)
  453. set(NET_LIBRARIES ws2_32 mswsock)
  454. else()
  455. set(NET_LIBRARIES "")
  456. endif()
  457. set(framework_LIBRARIES ${framework_LIBRARIES} ${NET_LIBRARIES})
  458. set(framework_SOURCES ${framework_SOURCES}
  459. ${CMAKE_CURRENT_LIST_DIR}/net/connection.cpp
  460. ${CMAKE_CURRENT_LIST_DIR}/net/connection.h
  461. ${CMAKE_CURRENT_LIST_DIR}/net/declarations.h
  462. ${CMAKE_CURRENT_LIST_DIR}/net/inputmessage.cpp
  463. ${CMAKE_CURRENT_LIST_DIR}/net/inputmessage.h
  464. ${CMAKE_CURRENT_LIST_DIR}/net/outputmessage.cpp
  465. ${CMAKE_CURRENT_LIST_DIR}/net/outputmessage.h
  466. ${CMAKE_CURRENT_LIST_DIR}/net/protocol.cpp
  467. ${CMAKE_CURRENT_LIST_DIR}/net/protocol.h
  468. ${CMAKE_CURRENT_LIST_DIR}/net/protocolhttp.cpp
  469. ${CMAKE_CURRENT_LIST_DIR}/net/protocolhttp.h
  470. ${CMAKE_CURRENT_LIST_DIR}/net/server.cpp
  471. ${CMAKE_CURRENT_LIST_DIR}/net/server.h
  472. )
  473. set(framework_DEFINITIONS ${framework_DEFINITIONS} -DFW_NET)
  474. endif()
  475. if(FRAMEWORK_XML)
  476. set(framework_SOURCES ${framework_SOURCES}
  477. ${CMAKE_CURRENT_LIST_DIR}/xml/tinyxml.cpp
  478. ${CMAKE_CURRENT_LIST_DIR}/xml/tinyxml.h
  479. ${CMAKE_CURRENT_LIST_DIR}/xml/tinystr.cpp
  480. ${CMAKE_CURRENT_LIST_DIR}/xml/tinystr.h
  481. ${CMAKE_CURRENT_LIST_DIR}/xml/tinyxmlerror.cpp
  482. ${CMAKE_CURRENT_LIST_DIR}/xml/tinyxmlparser.cpp
  483. )
  484. set(framework_DEFINITIONS ${framework_DEFINITIONS} -DFW_XML)
  485. endif()
  486. if(FRAMEWORK_SQL)
  487. find_package(MySQL REQUIRED)
  488. set(framework_INCLUDE_DIRS ${framework_INCLUDE_DIRS} ${MYSQL_INCLUDE_DIR})
  489. set(framework_LIBRARIES ${MYSQL_LIBRARY} ${framework_LIBRARIES})
  490. set(framework_SOURCES ${framework_SOURCES}
  491. ${CMAKE_CURRENT_LIST_DIR}/sql/declarations.h
  492. ${CMAKE_CURRENT_LIST_DIR}/sql/database.cpp
  493. ${CMAKE_CURRENT_LIST_DIR}/sql/database.h
  494. ${CMAKE_CURRENT_LIST_DIR}/sql/mysql.cpp
  495. ${CMAKE_CURRENT_LIST_DIR}/sql/mysql.h
  496. )
  497. set(framework_DEFINITIONS ${framework_DEFINITIONS} -DFW_SQL)
  498. endif()
  499. if(EXTRA_LIBS)
  500. set(framework_LIBRARIES ${framework_LIBRARIES} ${EXTRA_LIBS})
  501. endif()
  502. include_directories(${framework_INCLUDE_DIRS})
  503. add_definitions(${framework_DEFINITIONS})