ghost multi-test builds again, now uses BLF font library
[blender.git] / intern / ghost / test / CMakeLists.txt
1
2 cmake_policy(SET CMP0003 NEW)
3 cmake_policy(SET CMP0005 NEW)
4
5 cmake_minimum_required(VERSION 2.8)
6
7 # -----------------------------------------------------------------------------
8 # Macros
9
10
11 # stub macro, does nothing
12 macro(blender_add_lib
13         name
14         sources
15         includes
16         includes_sys
17         )
18
19 endmacro()
20
21 # suffix relative paths so we can use external cmake files
22 macro(suffix_relpaths
23         new_files files prefix)
24
25         set(${new_files})
26         foreach(_file ${files})
27                 if(IS_ABSOLUTE _file)
28                         list(APPEND ${new_files} ${_file})
29                 else()
30                         list(APPEND ${new_files} "${prefix}${_file}")
31                 endif()
32         endforeach()
33         unset(_file)
34 endmacro()
35
36
37 # -----------------------------------------------------------------------------
38 # Libraries
39
40 # ghost
41 include(${CMAKE_SOURCE_DIR}/../CMakeLists.txt)
42 suffix_relpaths(INC_NEW "${INC}" "../")
43 suffix_relpaths(SRC_NEW "${SRC}" "../")
44 include_directories(${INC_NEW})
45 add_library(ghost_lib ${SRC_NEW})
46
47 # string
48 include(${CMAKE_SOURCE_DIR}/../../string/CMakeLists.txt)
49 suffix_relpaths(INC_NEW "${INC}" "../../string/")
50 suffix_relpaths(SRC_NEW "${SRC}" "../../string/")
51 include_directories(${INC_NEW})
52 add_library(string_lib ${SRC_NEW})
53
54 # guardedalloc
55 include(${CMAKE_SOURCE_DIR}/../../guardedalloc/CMakeLists.txt)
56 suffix_relpaths(INC_NEW "${INC}" "../../guardedalloc/")
57 suffix_relpaths(SRC_NEW "${SRC}" "../../guardedalloc/")
58 include_directories(${INC_NEW})
59 add_library(guardedalloc_lib ${SRC_NEW})
60
61 # blenfont 
62 include(${CMAKE_SOURCE_DIR}/../../../source/blender/blenfont/CMakeLists.txt)
63 suffix_relpaths(INC_NEW "${INC}" "../../../source/blender/blenfont/")
64 suffix_relpaths(SRC_NEW "${SRC}" "../../../source/blender/blenfont/")
65 include_directories(${INC_NEW})
66 add_library(blenfont_lib ${SRC_NEW})
67
68 # grr, blenfont needs BLI
69 include_directories(
70                 "../../../source/blender/blenlib"
71                 "../../../source/blender/blenloader"
72                 )
73 add_library(bli_lib 
74                 "../../../source/blender/blenlib/intern/fileops.c"
75                 "../../../source/blender/blenlib/intern/rct.c"
76                 "../../../source/blender/blenlib/intern/string.c"
77                 "../../../source/blender/blenlib/intern/listbase.c"
78                 "../../../source/blender/blenlib/intern/storage.c"
79                 "../../../source/blender/blenlib/intern/path_util.c"
80                 "../../../source/blender/blenlib/intern/BLI_dynstr.c"
81                 "../../../source/blender/blenlib/intern/BLI_linklist.c"
82                 "../../../source/blender/blenlib/intern/BLI_memarena.c"
83                 )
84
85 message(STATUS "EEEk ${SRC_NEW}")
86
87
88 find_package(OpenGL REQUIRED)
89
90 find_package(Freetype REQUIRED)
91
92 include_directories(${CMAKE_SOURCE_DIR}/../)
93 include_directories(${OPENGL_INCLUDE_DIR})
94 include_directories(${FREETYPE_INCLUDE_DIRS})
95 include_directories(${CMAKE_SOURCE_DIR}/../../../source/blender/blenfont)
96
97 if(UNIX AND NOT APPLE)
98         find_package(X11 REQUIRED)
99
100         set(PLATFORM_LINKLIBS
101                 ${X11_X11_LIB}
102                 ${X11_Xinput_LIB}
103         )
104 endif()
105
106 # -----------------------------------------------------------------------------
107 # Executables
108
109
110 # Gears (C)
111 add_executable(gears_c
112                 ${CMAKE_SOURCE_DIR}/gears/GHOST_C-Test.c)
113
114 target_link_libraries(gears_c
115                 ghost_lib
116                 string_lib
117                 ${OPENGL_gl_LIBRARY}
118                 ${OPENGL_glu_LIBRARY}
119                 ${PLATFORM_LINKLIBS}
120                 )
121
122
123 # Gears (C++)
124 add_executable(gears_cpp
125                 ${CMAKE_SOURCE_DIR}/gears/GHOST_Test.cpp)
126
127 target_link_libraries(gears_cpp
128                 ghost_lib
129                 string_lib
130                 ${OPENGL_gl_LIBRARY}
131                 ${OPENGL_glu_LIBRARY}
132                 ${PLATFORM_LINKLIBS}
133                 )
134
135
136 # MultiTest (C)
137 add_executable(multitest_c
138         ${CMAKE_SOURCE_DIR}/../../../source/blender/editors/datafiles/bfont.ttf.c
139         ${CMAKE_SOURCE_DIR}/multitest/Basic.c
140         ${CMAKE_SOURCE_DIR}/multitest/EventToBuf.c
141         ${CMAKE_SOURCE_DIR}/multitest/MultiTest.c
142         ${CMAKE_SOURCE_DIR}/multitest/ScrollBar.c
143         ${CMAKE_SOURCE_DIR}/multitest/Util.c
144         ${CMAKE_SOURCE_DIR}/multitest/WindowData.c
145 )
146
147 target_link_libraries(multitest_c
148                 blenfont_lib
149                 bli_lib
150                 ghost_lib
151                 string_lib
152                 guardedalloc_lib
153                 ${OPENGL_gl_LIBRARY}
154                 ${OPENGL_glu_LIBRARY}
155                 ${FREETYPE_LIBRARY}
156                 ${PLATFORM_LINKLIBS}
157                 )