-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
120 lines (90 loc) · 2.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
115
116
117
118
119
120
cmake_minimum_required(VERSION 3.10)
project("RMGraphics" VERSION 1.0.0)
set(RMGAPHICS_VERSION 1.0.0)
set(CMAKE_CXX_STANDARD 14)
# RMGraphics C++ API documentation
add_subdirectory(docs)
# Gets OpenGL header and library
set(OpenGL_GL_PREFERENCE LEGACY)
find_package(OpenGL REQUIRED)
if(UNIX)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/$<0:>)
else()
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/$<0:>)
endif()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/$<0:>)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/$<0:>)
link_directories(${CMAKE_BINARY_DIR}/lib)
link_directories(${PROJECT_SOURCE_DIR}/external/lib)
set(CMAKE_INSTALL_FULL_BINDIR ${CMAKE_INSTALL_PREFIX}/bin)
set(CMAKE_INSTALL_FULL_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib)
set(CMAKE_INSTALL_FULL_INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/include)
#
# Preparing external dependencies.
#
if(UNIX)
find_package(PNG REQUIRED)
find_package(TIFF REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(FREETYPE REQUIRED freetype2)
pkg_check_modules(GLFW REQUIRED glfw3)
else()
set(FREETYPE_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/external/include)
set(FREETYPE_LIBRARIES freetype)
set(GLFW_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/external/include)
set(GLFW_LIBRARIES glfw3)
set(PNG_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/external/include/libpng)
set(PNG_LIBRARY libpng16_static zlibstatic)
set(TIFF_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/external/include/libtiff)
set(TIFF_LIBRARY tiff zlibstatic)
endif()
if(WIN32)
set(wxWidgets_ROOT_DIR C:/wxWidgets-3.1.6)
set(wxWidgets_CONFIGURATION mswu)
endif()
find_package(wxWidgets 3.1 COMPONENTS base core gl)
# Compile flags
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_definitions(
-Wall
-Wno-unused-function
-Wno-unused-label
-Wno-unused-value
-Wno-unused-variable
)
else()
add_definitions(
-D_CRT_SECURE_NO_WARNINGS
/wd26451
/wd4098
/wd4217
/wd4244
/wd4267
/wd4273
)
endif()
# Compile RMGraphics
add_subdirectory(src)
#
# Compile definitions, include directories and libraries
#
set(RMGRAPHICS_DEFINITIONS "")
set(RMGRAPHICS_INCLUDE_DIRS
${PROJECT_SOURCE_DIR}/src/config
${PROJECT_SOURCE_DIR}/src/base
${PROJECT_SOURCE_DIR}/src/window
${PROJECT_SOURCE_DIR}/src/wx
)
set(RMGRAPHICS_LIBRARIES
rmgbase
rmgwindow
)
if(wxWidgets_FOUND)
list(APPEND RMGRAPHICS_DEFINITIONS ${wxWidgets_DEFINITIONS} USE_OPENGL=1)
list(APPEND RMGRAPHICS_INCLUDE_DIRS ${wxWidgets_INCLUDE_DIRS})
list(APPEND RMGRAPHICS_LIBRARIES rmgwx)
endif()
set(BUILD_GMOCK OFF CACHE BOOL "" FORCE)
set(gtest_force_shared_crt ON CACHE BOOL "compile gtest with MD" FORCE)
add_subdirectory(external/googletest)
add_subdirectory(test)