Ticket #170: CMakeLists.txt

File CMakeLists.txt, 4.3 KB (added by n.bruenggel@…, 4 months ago)

Quickly hacked together CMake file.

Line 
1cmake_minimum_required(VERSION 3.7)
2
3project(GrafX2)
4
5set(CMAKE_C_STANDARD 99)
6
7set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
8
9find_package(SDL2 REQUIRED)
10find_package(SDL2_image REQUIRED)
11find_package(SDL2_ttf REQUIRED)
12find_package(TIFF REQUIRED)
13find_package(PNG REQUIRED)
14find_package(ZLIB REQUIRED)
15
16set(Z_LIB_PATH CACHE FILEPATH "")
17
18set(SRC
19 src/2gsformats.c
20 src/SFont.c
21 src/brush.c
22 src/brush_ops.c
23 src/buttons.c
24 src/buttons_effects.c
25 src/c64formats.c
26 src/c64load.c
27 src/colorred.c
28 src/cpcformats.c
29 src/engine.c
30 src/factory.c
31 src/fileformats.c
32 src/filesel.c
33 src/fileseltools.c
34 # src/generatedoc.c
35 src/gfx2log.c
36 src/gfx2mem.c
37 src/gfx2surface.c
38 src/giformat.c
39 src/graph.c
40 src/help.c
41 src/hotkeys.c
42 src/ifformat.c
43 src/init.c
44 src/input.c
45 src/io.c
46 src/keyboard.c
47 src/layers.c
48 src/libraw2crtc.c
49 src/loadrecoil.c
50 src/loadsave.c
51 src/loadsavefuncs.c
52 src/main.c
53 src/misc.c
54 src/miscfileformats.c
55 src/motoformats.c
56 src/mountlist.c
57 src/msxformats.c
58 src/oldies.c
59 src/op_c.c
60 src/operatio.c
61 src/osdep.c
62 src/packbits.c
63 src/pages.c
64 src/palette.c
65 src/pngformat.c
66 src/pversion.c
67 src/pxdouble.c
68 src/pxquad.c
69 src/pxsimple.c
70 src/pxtall.c
71 src/pxtall2.c
72 src/pxtall3.c
73 src/pxtriple.c
74 src/pxwide.c
75 src/pxwide2.c
76 src/readini.c
77 src/readline.c
78 src/realpath.c
79 src/recoil.c
80 src/saveini.c
81 src/sdlscreen.c
82 src/setup.c
83 src/shade.c
84 src/special.c
85 src/stformats.c
86 src/text.c
87 src/tifformat.c
88 src/tiles.c
89 src/transform.c
90 src/unicode.c
91 src/version.c
92 # windows specific
93 # src/win32screen.c
94 src/windows.c
95 # linux specific
96 # src/x11screen.c
97)
98
99set(HEADER
100 src/SDLMain.h
101 src/SFont.h
102 src/bitcount.h
103 src/brush.h
104 src/buttons.h
105 src/c64load.h
106 src/c64picview_inc.h
107 src/colorred.h
108 src/const.h
109 src/cpc_scr_simple_loader.h
110 src/engine.h
111 src/errors.h
112 src/factory.h
113 src/fileformats.h
114 src/filesel.h
115 src/fileseltools.h
116 src/gfx2log.h
117 src/gfx2mem.h
118 src/gfx2surface.h
119 src/global.h
120 src/graph.h
121 src/haiku.h
122 src/help.h
123 src/helpfile.h
124 src/hotkeys.h
125 src/impdraw_loader.h
126 src/init.h
127 src/init_buttons.h
128 src/input.h
129 src/io.h
130 src/keyboard.h
131 src/keycodes.h
132 src/layers.h
133 src/libraw2crtc.h
134 src/loadsave.h
135 src/loadsavefuncs.h
136 src/misc.h
137 src/mountlist.h
138 src/oldies.h
139 src/op_c.h
140 src/operatio.h
141 src/osdep.h
142 src/packbits.h
143 src/pages.h
144 src/palette.h
145 src/pxdouble.h
146 src/pxquad.h
147 src/pxsimple.h
148 src/pxtall.h
149 src/pxtall2.h
150 src/pxtall3.h
151 src/pxtriple.h
152 src/pxwide.h
153 src/pxwide2.h
154 src/readini.h
155 src/readline.h
156 src/realpath.h
157 src/recoil.h
158 src/saveini.h
159 src/screen.h
160 src/sdlscreen.h
161 src/setup.h
162 src/shade.h
163 src/special.h
164 src/struct.h
165 src/text.h
166 src/tiles.h
167 src/transform.h
168 src/unicode.h
169 src/win32screen.h
170 src/windows.h
171 src/6502types.h
172
173# -DCPU_6502_STATIC -DCPU_6502_USE_LOCAL_HEADER -DCPU_6502_DEPENDENCIES_H=\"6502types.h\"
174 3rdparty/6502/sources/6502.c
175)
176
177set(MAC_SRC
178 src/pasteboard.m
179)
180
181# 6502.h: 6502.c
182
183# 6502.c: ../3rdparty/6502/sources/6502.c
184
185if(APPLE) # Eat it, haha!
186add_definitions(-D__macosx__)
187endif()
188
189add_definitions(-DUSE_SDL2)
190
191include_directories(${CMAKE_SOURCE_DIR}/src)
192include_directories(${SDL2_INCLUDE_DIRS} ${SDL2_IMAGE_INCLUDE_DIRS} ${SDL2_ttf_INCLUDE_DIRS})
193include_directories(${PNG_INCLUDE_DIR})
194include_directories(${CMAKE_SOURCE_DIR}/3rdparty/6502/API/)
195include_directories(${CMAKE_SOURCE_DIR}/3rdparty/6502/API/emulation/CPU/)
196include_directories(${Z_LIB_PATH})
197include_directories(${TIFF_INCLUDE_DIR})
198include_directories(${ZLIB_INCLUDE_DIRS}) # There are two Z libs.
199
200if(APPLE)
201add_executable(grafx2 ${SRC} ${MAC_SRC} ${HEADER})
202else()
203add_executable(grafx2 ${SRC} ${HEADER})
204endif()
205
206if(APPLE)
207target_link_libraries(grafx2 ${SDL2_LIBRARIES} ${SDL2_IMAGE_LIBRARIES} ${SDL2_TTF_LIBRARIES} ${PNG_LIBRARY} ${TIFF_LIBRARIES} ${ZLIB_LIBRARIES}
208 "-framework QuartzCore"
209 "-framework Cocoa"
210)
211else()
212 target_link_libraries(grafx2 ${SDL2_LIBRARIES} ${PNG_LIBRARY} ${TIFF_LIBRARIES} ${ZLIB_LIBRARIES})
213endif()