-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
executable file
·115 lines (99 loc) · 4.66 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
PROJECT(MARATIS)
## Let's use a reasonable modern version
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
SET(CMAKE_HAS_SORT 1)
SET(CMAKE_MODULE_PATH
${MARATIS_SOURCE_DIR}/CMake
${MARATIS_SOURCE_DIR}/CMake/Packages
${CMAKE_MODULE_PATH}
)
## Disallow in-source builds
INCLUDE(OutOfSourceBuild)
## Set version and info
SET(MARATIS_MAJOR_VERSION 3)
SET(MARATIS_MINOR_VERSION 30)
SET(MARATIS_PATCH_VERSION 0)
SET(MARATIS_PACKAGE "Maratis")
SET(MARATIS_VENDOR "Anael Seghezzi")
SET(MARATIS_VERSION "${MARATIS_MAJOR_VERSION}.${MARATIS_MINOR_VERSION}.${MARATIS_PATCH_VERSION}")
SET(MARATIS_COPYRIGHT "Copyright (c) 2003-2014, ${MARATIS_VENDOR}.")
MESSAGE(STATUS "${MARATIS_PACKAGE} ${MARATIS_VERSION}")
## Set install path
SET(MARATIS_INSTALL_DIR Maratis)
IF(WIN32)
FIND_PACKAGE(OpenGL REQUIRED)
ADD_DEFINITIONS(-DMCORE_DLL)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MARATIS_BUILD_FLAGS} -std=c99 -DWIN32")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D__Debug__")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MARATIS_BUILD_FLAGS} -std=c++98 -fpermissive -DWIN32")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D__Debug__")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
SET(OS_SPECIFIC_LIBRARIES ws2_32)
ENDIF(WIN32)
IF(APPLE)
FIND_PACKAGE(OpenGL REQUIRED)
FIND_LIBRARY(COCOA_LIB Cocoa)
FIND_LIBRARY(CORE_SERVICES_LIB CoreServices)
FIND_LIBRARY(FOUNDATION_LIB Foundation)
FIND_LIBRARY(CORE_FOUNDATION_LIB CoreFoundation)
FIND_LIBRARY(IOKIT_LIB IOKit)
SET(MARATIS_BUILD_FLAGS "-mmacosx-version-min=10.6 -stdlib=libstdc++")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MARATIS_BUILD_FLAGS} -fPIC -DOSX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D__Debug__")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MARATIS_BUILD_FLAGS} -fPIC -DOSX")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D__Debug__")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
SET(CMAKE_SHARED_LINKER_FLAGS "-Wl")
SET(OS_SPECIFIC_LIBRARIES ${COCOA_LIB} ${CORE_SERVICES_LIB} ${FOUNDATION_LIB} ${CORE_FOUNDATION} ${IOKIT_LIB})
ENDIF(APPLE)
IF(UNIX AND NOT APPLE AND NOT ANDROID)
FIND_PACKAGE(OpenGL REQUIRED)
SET(MARATIS_BUILD_FLAGS "")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MARATIS_BUILD_FLAGS} -std=c99 -fPIC -DLINUX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D__Debug__")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MARATIS_BUILD_FLAGS} -std=c++98 -fPIC -DLINUX")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D__Debug__")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
SET(CMAKE_SHARED_LINKER_FLAGS "-ldl -Wl,--as-needed,--allow-multiple-definition,--build-id")
SET(OS_SPECIFIC_LIBRARIES pthread Xxf86vm X11 Xrandr Xi dl)
ENDIF(UNIX AND NOT APPLE AND NOT ANDROID)
IF(ANDROID)
SET(MARATIS_BUILD_FLAGS "-DGL_GLEXT_PROTOTYPES -DANDROID -D_ANDROID_ -D__ANDROID")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MARATIS_BUILD_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MARATIS_BUILD_FLAGS}")
SET(OS_SPECIFIC_LIBRARIES log android EGL GLESv2)
ENDIF(ANDROID)
## Set up 3rd party dependencies
SET(DIRENT_INCLUDE_DIR ${MARATIS_SOURCE_DIR}/3rdparty/windirent/include)
SET(TINYUTF8_INCLUDE_DIR ${MARATIS_SOURCE_DIR}/3rdparty/tinyutf8)
SET(FREETYPE_INCLUDE_DIR ${MARATIS_SOURCE_DIR}/3rdparty/freetype/include)
SET(GLEW_INCLUDE_DIR ${MARATIS_SOURCE_DIR}/3rdparty/glew/include)
SET(TINYXML_INCLUDE_DIR ${MARATIS_SOURCE_DIR}/3rdparty/tinyxml)
SET(FREEIMAGE_INCLUDE_DIR ${MARATIS_SOURCE_DIR}/3rdparty/freeimage/Source)
SET(SDL_INCLUDE_DIR ${MARATIS_SOURCE_DIR}/3rdparty/SDL2/include)
SET(TINYCTHREAD_INCLUDE_DIR ${MARATIS_SOURCE_DIR}/3rdparty/tinycthread/source)
SET(BULLET_INCLUDE_DIR ${MARATIS_SOURCE_DIR}/3rdparty/bullet)
SET(FREETYPE_LIBRARIES freetype)
SET(GLEW_LIBRARIES GLEW_static)
SET(TINYXML_LIBRARIES tinyxml)
SET(FREEIMAGE_LIBRARIES freeimage)
SET(SDL_LIBRARIES SDL2main SDL2-static)
SET(TINYCTHREAD_LIBRARIES tinycthread)
SET(BULLET_LIBRARIES BulletSoftBody BulletDynamics BulletCollision LinearMath)
## Set up SDK dependencies
SET(MCORE_INCLUDE_DIR ${MARATIS_SOURCE_DIR}/Sources/MSDK/MCore/Includes)
SET(MENGINE_INCLUDE_DIR ${MARATIS_SOURCE_DIR}/Sources/MSDK/MEngine/Includes)
SET(MGUI_INCLUDE_DIR ${MARATIS_SOURCE_DIR}/Sources/MSDK/MGui/Includes)
SET(MARATIS_COMMON_INCLUDE_DIR ${MARATIS_SOURCE_DIR}/Sources/Common)
SET(MCORE_LIBRARIES MCore)
SET(MENGINE_LIBRARIES MEngine)
SET(MGUI_LIBRARIES MGui)
## Set up subdirectories...
ADD_SUBDIRECTORY(3rdparty)
ADD_SUBDIRECTORY(Sources/MSDK)
# ADD_SUBDIRECTORY(Sources/Maratis/Editor)
ADD_SUBDIRECTORY(Tests/GUI)
ADD_SUBDIRECTORY(Tests/ManualUse)