i18n: more clean-up
[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
86 find_package(OpenGL REQUIRED)
87
88 find_package(Freetype REQUIRED)
89
90 include_directories(${CMAKE_SOURCE_DIR}/../)
91 include_directories(${OPENGL_INCLUDE_DIR})
92 include_directories(${FREETYPE_INCLUDE_DIRS})
93 include_directories(${CMAKE_SOURCE_DIR}/../../../source/blender/blenfont)
94
95 if(UNIX AND NOT APPLE)
96         find_package(X11 REQUIRED)
97
98         set(PLATFORM_LINKLIBS
99                 ${X11_X11_LIB}
100                 ${X11_Xinput_LIB}
101         )
102 endif()
103
104 # -----------------------------------------------------------------------------
105 # Executables
106
107
108 # Gears (C)
109 add_executable(gears_c
110                 ${CMAKE_SOURCE_DIR}/gears/GHOST_C-Test.c)
111
112 target_link_libraries(gears_c
113                 ghost_lib
114                 string_lib
115                 ${OPENGL_gl_LIBRARY}
116                 ${OPENGL_glu_LIBRARY}
117                 ${PLATFORM_LINKLIBS}
118                 )
119
120
121 # Gears (C++)
122 add_executable(gears_cpp
123                 ${CMAKE_SOURCE_DIR}/gears/GHOST_Test.cpp)
124
125 target_link_libraries(gears_cpp
126                 ghost_lib
127                 string_lib
128                 ${OPENGL_gl_LIBRARY}
129                 ${OPENGL_glu_LIBRARY}
130                 ${PLATFORM_LINKLIBS}
131                 )
132
133
134 # MultiTest (C)
135 add_executable(multitest_c
136         ${CMAKE_SOURCE_DIR}/../../../source/blender/editors/datafiles/bfont.ttf.c
137         ${CMAKE_SOURCE_DIR}/multitest/Basic.c
138         ${CMAKE_SOURCE_DIR}/multitest/EventToBuf.c
139         ${CMAKE_SOURCE_DIR}/multitest/MultiTest.c
140         ${CMAKE_SOURCE_DIR}/multitest/ScrollBar.c
141         ${CMAKE_SOURCE_DIR}/multitest/Util.c
142         ${CMAKE_SOURCE_DIR}/multitest/WindowData.c
143 )
144
145 target_link_libraries(multitest_c
146                 blenfont_lib
147                 bli_lib
148                 ghost_lib
149                 string_lib
150                 guardedalloc_lib
151                 ${OPENGL_gl_LIBRARY}
152                 ${OPENGL_glu_LIBRARY}
153                 ${FREETYPE_LIBRARY}
154                 ${PLATFORM_LINKLIBS}
155                 )