2010-11-08 23:04:33 +01:00
|
|
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
|
|
|
PROJECT(otclient)
|
2010-11-18 23:13:35 +01:00
|
|
|
|
2011-05-15 21:19:41 +02:00
|
|
|
# setup custom cmake modules path
|
2010-11-21 22:48:58 +01:00
|
|
|
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}")
|
|
|
|
|
2011-08-14 04:09:11 +02:00
|
|
|
OPTION(USE_PCH "Use precompiled header" ON)
|
2011-10-31 00:30:23 +01:00
|
|
|
OPTION(NO_CONSOLE "Disable console window on Windows" OFF)
|
2011-10-31 17:57:14 +01:00
|
|
|
OPTION(HANDLE_EXCEPTIONS "Generate crash reports" OFF)
|
2011-11-03 21:54:53 +01:00
|
|
|
OPTION(FORBIDDEN_FUNCTIONS "Enable forbidden lua functions" ON)
|
2011-08-14 04:09:11 +02:00
|
|
|
|
2010-11-18 23:13:35 +01:00
|
|
|
# find needed packages
|
|
|
|
SET(Boost_USE_STATIC_LIBS ON)
|
2011-05-01 20:47:35 +02:00
|
|
|
SET(Boost_USE_MULTITHREADED OFF)
|
2011-07-27 01:13:27 +02:00
|
|
|
FIND_PACKAGE(Boost COMPONENTS system REQUIRED)
|
2010-11-18 23:13:35 +01:00
|
|
|
FIND_PACKAGE(OpenGL REQUIRED)
|
2011-05-15 23:12:39 +02:00
|
|
|
FIND_PACKAGE(Lua REQUIRED)
|
2010-11-21 22:48:58 +01:00
|
|
|
FIND_PACKAGE(PhysFS REQUIRED)
|
2011-04-10 03:25:13 +02:00
|
|
|
FIND_PACKAGE(GMP REQUIRED)
|
2011-05-15 19:26:05 +02:00
|
|
|
FIND_PACKAGE(ZLIB REQUIRED)
|
2011-08-14 04:09:11 +02:00
|
|
|
FIND_PACKAGE(PCHSupport REQUIRED)
|
2010-11-18 23:13:35 +01:00
|
|
|
|
|
|
|
# choose a default build type if not specified
|
|
|
|
IF(NOT CMAKE_BUILD_TYPE)
|
2011-10-31 00:30:23 +01:00
|
|
|
SET(CMAKE_BUILD_TYPE ReleaseWithDebInfo)
|
2010-11-18 23:13:35 +01:00
|
|
|
ENDIF(NOT CMAKE_BUILD_TYPE)
|
|
|
|
MESSAGE(STATUS "BUILD TYPE: " ${CMAKE_BUILD_TYPE})
|
|
|
|
|
|
|
|
# setup compiler options
|
|
|
|
IF(CMAKE_COMPILER_IS_GNUCXX)
|
2011-08-29 07:54:28 +02:00
|
|
|
SET(CXX_WARNS "-Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unused-variable -Wno-switch")
|
2011-10-30 21:11:43 +01:00
|
|
|
SET(CMAKE_CXX_FLAGS "-std=gnu++0x -pipe ${CXX_WARNS}")
|
2011-08-14 04:09:11 +02:00
|
|
|
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -ggdb3 -fno-inline")
|
2011-08-31 01:39:14 +02:00
|
|
|
SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -rdynamic")
|
2011-08-14 04:09:11 +02:00
|
|
|
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O1 -g -fno-inline")
|
2010-11-18 23:13:35 +01:00
|
|
|
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
|
2011-08-14 04:09:11 +02:00
|
|
|
|
2010-11-18 23:13:35 +01:00
|
|
|
INCLUDE_DIRECTORIES(
|
2010-11-21 22:48:58 +01:00
|
|
|
${Boost_INCLUDE_DIRS}
|
2011-05-14 03:28:59 +02:00
|
|
|
${OPENGL_INCLUDE_DIR}
|
|
|
|
${LUA_INCLUDE_DIR}
|
|
|
|
${PHYSFS_INCLUDE_DIR}
|
2011-04-10 03:25:13 +02:00
|
|
|
${GMP_INCLUDE_DIR}
|
2011-05-15 19:26:05 +02:00
|
|
|
${ZLIB_INCLUDE_DIR}
|
2011-08-15 16:06:15 +02:00
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/src"
|
2011-08-14 04:09:11 +02:00
|
|
|
)
|
2010-11-18 23:13:35 +01:00
|
|
|
|
|
|
|
IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
|
|
ADD_DEFINITIONS(-D_DEBUG)
|
|
|
|
ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
|
|
|
2011-11-16 00:47:32 +01:00
|
|
|
SET(SOURCES
|
2011-08-15 16:06:15 +02:00
|
|
|
# main
|
2011-03-19 00:49:30 +01:00
|
|
|
src/main.cpp
|
2011-08-15 16:06:15 +02:00
|
|
|
|
|
|
|
# otclient
|
|
|
|
src/otclient/otclient.cpp
|
2011-11-19 01:12:17 +01:00
|
|
|
|
|
|
|
# otclient luascript
|
|
|
|
src/otclient/luascript/luafunctions.cpp
|
|
|
|
src/otclient/luascript/luavaluecasts.cpp
|
2011-08-15 16:06:15 +02:00
|
|
|
|
|
|
|
# otclient core
|
|
|
|
src/otclient/core/game.cpp
|
|
|
|
src/otclient/core/map.cpp
|
2011-08-31 17:03:33 +02:00
|
|
|
src/otclient/core/thingstype.cpp
|
2011-08-15 21:15:49 +02:00
|
|
|
src/otclient/core/spritemanager.cpp
|
2011-08-15 16:06:15 +02:00
|
|
|
src/otclient/core/item.cpp
|
|
|
|
src/otclient/core/tile.cpp
|
|
|
|
src/otclient/core/thing.cpp
|
|
|
|
src/otclient/core/creature.cpp
|
|
|
|
src/otclient/core/effect.cpp
|
2011-11-08 02:44:30 +01:00
|
|
|
src/otclient/core/missile.cpp
|
2011-08-15 23:02:52 +02:00
|
|
|
src/otclient/core/localplayer.cpp
|
2011-11-13 09:46:19 +01:00
|
|
|
src/otclient/core/outfit.cpp
|
2011-08-15 16:06:15 +02:00
|
|
|
|
2011-08-29 05:04:23 +02:00
|
|
|
# otclient ui
|
2011-11-10 06:29:25 +01:00
|
|
|
src/otclient/ui/uiitem.cpp
|
2011-11-14 23:32:55 +01:00
|
|
|
src/otclient/ui/uicreature.cpp
|
2011-08-29 05:04:23 +02:00
|
|
|
src/otclient/ui/uimap.cpp
|
2011-11-20 21:38:35 +01:00
|
|
|
src/otclient/ui/uigame.cpp
|
2011-08-29 05:04:23 +02:00
|
|
|
|
2011-08-15 16:06:15 +02:00
|
|
|
# otclient net
|
|
|
|
src/otclient/net/protocollogin.cpp
|
|
|
|
src/otclient/net/protocolgame.cpp
|
|
|
|
src/otclient/net/protocolgamesend.cpp
|
|
|
|
src/otclient/net/protocolgameparse.cpp
|
2011-04-09 01:24:51 +02:00
|
|
|
|
2011-08-14 04:09:11 +02:00
|
|
|
# framework third party
|
|
|
|
src/framework/thirdparty/apngloader.cpp
|
2011-04-10 17:37:15 +02:00
|
|
|
|
2011-08-14 04:09:11 +02:00
|
|
|
# framework net
|
|
|
|
src/framework/net/connection.cpp
|
|
|
|
src/framework/net/inputmessage.cpp
|
|
|
|
src/framework/net/outputmessage.cpp
|
|
|
|
src/framework/net/protocol.cpp
|
|
|
|
src/framework/net/rsa.cpp
|
2011-11-04 17:40:26 +01:00
|
|
|
src/framework/net/server.cpp
|
2011-04-19 04:10:08 +02:00
|
|
|
|
2011-08-14 04:09:11 +02:00
|
|
|
# framework core
|
2011-08-20 22:30:41 +02:00
|
|
|
src/framework/core/logger.cpp
|
2011-08-16 14:47:30 +02:00
|
|
|
src/framework/core/configs.cpp
|
2011-08-14 04:09:11 +02:00
|
|
|
src/framework/core/resourcemanager.cpp
|
|
|
|
src/framework/core/eventdispatcher.cpp
|
|
|
|
src/framework/core/modulemanager.cpp
|
|
|
|
src/framework/core/module.cpp
|
|
|
|
|
|
|
|
# framework graphics
|
2011-04-10 17:37:15 +02:00
|
|
|
src/framework/graphics/font.cpp
|
2011-08-14 04:09:11 +02:00
|
|
|
src/framework/graphics/fontmanager.cpp
|
|
|
|
src/framework/graphics/graphics.cpp
|
2011-04-10 17:37:15 +02:00
|
|
|
src/framework/graphics/texture.cpp
|
2011-08-14 04:09:11 +02:00
|
|
|
src/framework/graphics/framebuffer.cpp
|
2011-05-13 01:24:57 +02:00
|
|
|
src/framework/graphics/animatedtexture.cpp
|
2011-08-14 04:09:11 +02:00
|
|
|
src/framework/graphics/framebuffer.cpp
|
|
|
|
src/framework/graphics/texturemanager.cpp
|
|
|
|
src/framework/graphics/borderimage.cpp
|
|
|
|
src/framework/graphics/image.cpp
|
2011-04-10 17:37:15 +02:00
|
|
|
|
2011-08-14 04:09:11 +02:00
|
|
|
# framework otml
|
|
|
|
src/framework/otml/otmldocument.cpp
|
|
|
|
src/framework/otml/otmlemitter.cpp
|
|
|
|
src/framework/otml/otmlnode.cpp
|
|
|
|
src/framework/otml/otmlparser.cpp
|
2011-08-19 20:53:23 +02:00
|
|
|
src/framework/otml/otmlexception.cpp
|
2011-08-14 04:09:11 +02:00
|
|
|
|
|
|
|
# framework luascript
|
|
|
|
src/framework/luascript/luainterface.cpp
|
|
|
|
src/framework/luascript/luaobject.cpp
|
|
|
|
src/framework/luascript/luaexception.cpp
|
|
|
|
src/framework/luascript/luafunctions.cpp
|
2011-08-19 20:53:23 +02:00
|
|
|
src/framework/luascript/luavaluecasts.cpp
|
2011-08-14 04:09:11 +02:00
|
|
|
|
|
|
|
# framework ui
|
|
|
|
src/framework/ui/uimanager.cpp
|
|
|
|
src/framework/ui/uiwidget.cpp
|
2011-04-08 07:10:00 +02:00
|
|
|
src/framework/ui/uilabel.cpp
|
2011-08-14 04:09:11 +02:00
|
|
|
src/framework/ui/uibutton.cpp
|
|
|
|
src/framework/ui/uilineedit.cpp
|
2011-04-10 00:55:58 +02:00
|
|
|
src/framework/ui/uiwindow.cpp
|
2011-08-26 17:06:52 +02:00
|
|
|
src/framework/ui/uianchorlayout.cpp
|
|
|
|
src/framework/ui/uiverticallayout.cpp
|
|
|
|
src/framework/ui/uilayout.cpp
|
2011-11-14 03:40:18 +01:00
|
|
|
src/framework/ui/uiprogressbar.cpp
|
2011-11-16 00:47:32 +01:00
|
|
|
src/framework/ui/uicheckbox.cpp
|
|
|
|
src/framework/ui/uiframecounter.cpp
|
|
|
|
src/framework/ui/uitranslator.cpp
|
2011-04-10 17:37:15 +02:00
|
|
|
)
|
2010-11-18 23:13:35 +01:00
|
|
|
|
2011-10-31 17:57:14 +01:00
|
|
|
IF(HANDLE_EXCEPTIONS)
|
|
|
|
ADD_DEFINITIONS(-DHANDLE_EXCEPTIONS)
|
|
|
|
ENDIF(HANDLE_EXCEPTIONS)
|
|
|
|
|
2011-11-03 21:54:53 +01:00
|
|
|
IF(FORBIDDEN_FUNCTIONS)
|
|
|
|
ADD_DEFINITIONS(-DFORBIDDEN_FUNCTIONS)
|
|
|
|
ENDIF(FORBIDDEN_FUNCTIONS)
|
|
|
|
|
2010-11-18 23:13:35 +01:00
|
|
|
IF(WIN32)
|
2011-08-15 16:06:15 +02:00
|
|
|
SET(SOURCES ${SOURCES} src/framework/platform/win32platform.cpp)
|
2011-11-05 14:36:02 +01:00
|
|
|
SET(ADDITIONAL_LIBRARIES ws2_32 mswsock)
|
2011-10-31 00:30:23 +01:00
|
|
|
|
2011-05-17 06:48:52 +02:00
|
|
|
IF(CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
ADD_DEFINITIONS(-D_WIN32_WINNT=0x0501)
|
|
|
|
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
2011-10-31 00:30:23 +01:00
|
|
|
|
|
|
|
IF(NO_CONSOLE)
|
|
|
|
ADD_DEFINITIONS(-DWIN32_NO_CONSOLE)
|
|
|
|
IF(CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -mwindows")
|
|
|
|
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
ENDIF(NO_CONSOLE)
|
2011-11-17 03:53:17 +01:00
|
|
|
|
|
|
|
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/icon.o
|
|
|
|
COMMAND ${CMAKE_RC_COMPILER}
|
|
|
|
-I${CMAKE_CURRENT_SOURCE_DIR}/src/otclient/win32icon
|
|
|
|
-i${CMAKE_CURRENT_SOURCE_DIR}/src/otclient/win32icon/icon.rc
|
|
|
|
-o ${CMAKE_CURRENT_BINARY_DIR}/icon.o)
|
|
|
|
SET(SOURCES ${SOURCES} icon.o)
|
2010-11-18 23:13:35 +01:00
|
|
|
ELSE(WIN32)
|
2011-08-29 06:51:45 +02:00
|
|
|
SET(ADDITIONAL_LIBRARIES -lpthread)
|
2011-08-15 16:06:15 +02:00
|
|
|
SET(SOURCES ${SOURCES} src/framework/platform/x11platform.cpp)
|
2010-11-18 23:13:35 +01:00
|
|
|
ENDIF(WIN32)
|
|
|
|
|
|
|
|
# target executable
|
|
|
|
ADD_EXECUTABLE(otclient ${SOURCES})
|
|
|
|
|
|
|
|
# target link libraries
|
2011-08-14 04:09:11 +02:00
|
|
|
TARGET_LINK_LIBRARIES(
|
|
|
|
otclient
|
2010-11-21 22:48:58 +01:00
|
|
|
${Boost_LIBRARIES}
|
2011-05-14 03:28:59 +02:00
|
|
|
${OPENGL_LIBRARIES}
|
2011-04-19 04:10:08 +02:00
|
|
|
${LUA_LIBRARIES}
|
2010-11-21 22:48:58 +01:00
|
|
|
${PHYSFS_LIBRARY}
|
2011-05-15 21:19:41 +02:00
|
|
|
${GMP_LIBRARY}
|
2011-05-15 19:26:05 +02:00
|
|
|
${ZLIB_LIBRARY}
|
2011-08-14 04:09:11 +02:00
|
|
|
${ADDITIONAL_LIBRARIES}
|
|
|
|
)
|
|
|
|
|
|
|
|
IF(USE_PCH)
|
2011-08-15 16:06:15 +02:00
|
|
|
ADD_PRECOMPILED_HEADER(otclient ${CMAKE_CURRENT_SOURCE_DIR}/src/pch.h)
|
2011-08-14 04:09:11 +02:00
|
|
|
ENDIF(USE_PCH)
|
2011-05-16 22:59:34 +02:00
|
|
|
|
|
|
|
# installation
|
|
|
|
SET(DATA_INSTALL_DIR share/otclient)
|
|
|
|
INSTALL(TARGETS otclient RUNTIME DESTINATION bin)
|
2011-10-30 21:11:43 +01:00
|
|
|
INSTALL(DIRECTORY modules DESTINATION ${DATA_INSTALL_DIR}
|
|
|
|
PATTERN ".git" EXCLUDE)
|