comparison libmlk-core/CMakeLists.txt @ 447:e1fa1b867281

cmake: resurrection Using GNU make for such a big project is tedious.
author David Demelier <markand@malikania.fr>
date Sat, 18 Feb 2023 12:43:05 +0100
parents
children b26dd49f69ff
comparison
equal deleted inserted replaced
446:4607eea0eabc 447:e1fa1b867281
1 #
2 # CMakeLists.txt -- CMake build system for Molko's Engine
3 #
4 # Copyright (c) 2020-2022 David Demelier <markand@malikania.fr>
5 #
6 # Permission to use, copy, modify, and/or distribute this software for any
7 # purpose with or without fee is hereby granted, provided that the above
8 # copyright notice and this permission notice appear in all copies.
9 #
10 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #
18
19 project(libmlk-core)
20
21 set(
22 SOURCES
23 ${libmlk-core_SOURCE_DIR}/mlk/core/action.c
24 ${libmlk-core_SOURCE_DIR}/mlk/core/action.h
25 ${libmlk-core_SOURCE_DIR}/mlk/core/action-stack.c
26 ${libmlk-core_SOURCE_DIR}/mlk/core/action-stack.h
27 ${libmlk-core_SOURCE_DIR}/mlk/core/alloc.c
28 ${libmlk-core_SOURCE_DIR}/mlk/core/alloc.h
29 ${libmlk-core_SOURCE_DIR}/mlk/core/animation.c
30 ${libmlk-core_SOURCE_DIR}/mlk/core/animation.h
31 ${libmlk-core_SOURCE_DIR}/mlk/core/clock.c
32 ${libmlk-core_SOURCE_DIR}/mlk/core/clock.h
33 ${libmlk-core_SOURCE_DIR}/mlk/core/color.h
34 ${libmlk-core_SOURCE_DIR}/mlk/core/core.c
35 ${libmlk-core_SOURCE_DIR}/mlk/core/core.h
36 ${libmlk-core_SOURCE_DIR}/mlk/core/drawable.c
37 ${libmlk-core_SOURCE_DIR}/mlk/core/drawable.h
38 ${libmlk-core_SOURCE_DIR}/mlk/core/drawable-stack.c
39 ${libmlk-core_SOURCE_DIR}/mlk/core/drawable-stack.h
40 ${libmlk-core_SOURCE_DIR}/mlk/core/error.c
41 ${libmlk-core_SOURCE_DIR}/mlk/core/error.h
42 ${libmlk-core_SOURCE_DIR}/mlk/core/event.c
43 ${libmlk-core_SOURCE_DIR}/mlk/core/event.h
44 ${libmlk-core_SOURCE_DIR}/mlk/core/font.c
45 ${libmlk-core_SOURCE_DIR}/mlk/core/font.h
46 ${libmlk-core_SOURCE_DIR}/mlk/core/game.c
47 ${libmlk-core_SOURCE_DIR}/mlk/core/game.h
48 ${libmlk-core_SOURCE_DIR}/mlk/core/image.c
49 ${libmlk-core_SOURCE_DIR}/mlk/core/image.h
50 ${libmlk-core_SOURCE_DIR}/mlk/core/inhibit.h
51 ${libmlk-core_SOURCE_DIR}/mlk/core/key.h
52 ${libmlk-core_SOURCE_DIR}/mlk/core/maths.c
53 ${libmlk-core_SOURCE_DIR}/mlk/core/maths.h
54 ${libmlk-core_SOURCE_DIR}/mlk/core/mouse.h
55 ${libmlk-core_SOURCE_DIR}/mlk/core/music.c
56 ${libmlk-core_SOURCE_DIR}/mlk/core/music.h
57 ${libmlk-core_SOURCE_DIR}/mlk/core/painter.c
58 ${libmlk-core_SOURCE_DIR}/mlk/core/painter.h
59 ${libmlk-core_SOURCE_DIR}/mlk/core/panic.c
60 ${libmlk-core_SOURCE_DIR}/mlk/core/panic.h
61 ${libmlk-core_SOURCE_DIR}/mlk/core/script.c
62 ${libmlk-core_SOURCE_DIR}/mlk/core/script.h
63 ${libmlk-core_SOURCE_DIR}/mlk/core/sound.c
64 ${libmlk-core_SOURCE_DIR}/mlk/core/sound.h
65 ${libmlk-core_SOURCE_DIR}/mlk/core/sprite.c
66 ${libmlk-core_SOURCE_DIR}/mlk/core/sprite.h
67 ${libmlk-core_SOURCE_DIR}/mlk/core/state.c
68 ${libmlk-core_SOURCE_DIR}/mlk/core/state.h
69 ${libmlk-core_SOURCE_DIR}/mlk/core/sys.c
70 ${libmlk-core_SOURCE_DIR}/mlk/core/sys.h
71 ${libmlk-core_SOURCE_DIR}/mlk/core/sys_p.h
72 ${libmlk-core_SOURCE_DIR}/mlk/core/texture.c
73 ${libmlk-core_SOURCE_DIR}/mlk/core/texture.h
74 ${libmlk-core_SOURCE_DIR}/mlk/core/texture_p.h
75 ${libmlk-core_SOURCE_DIR}/mlk/core/trace.c
76 ${libmlk-core_SOURCE_DIR}/mlk/core/trace.h
77 ${libmlk-core_SOURCE_DIR}/mlk/core/util.c
78 ${libmlk-core_SOURCE_DIR}/mlk/core/util.h
79 ${libmlk-core_SOURCE_DIR}/mlk/core/window.c
80 ${libmlk-core_SOURCE_DIR}/mlk/core/window.h
81 ${libmlk-core_SOURCE_DIR}/mlk/core/window_p.h
82 )
83
84 set(
85 NLS
86 ${libmlk-core_SOURCE_DIR}/nls/fr.po
87 )
88
89 if (MLK_WITH_NLS)
90 list(APPEND LIBRARIES ${Intl_LIBRARIES})
91 endif ()
92
93 if (MLK_WITH_ZSTD)
94 list(APPEND LIBRARIES ZSTD::ZSTD)
95 endif ()
96
97 if (MLK_WITH_ZIP)
98 list(APPEND LIBRARIES Libzip::Libzip)
99 endif ()
100
101 if (CMAKE_SYSTEM_NAME MATCHES "Windows")
102 list(APPEND LIBRARIES shlwapi)
103 endif ()
104
105 if (M_LIBRARY)
106 list(APPEND LIBRARIES ${M_LIBRARY})
107 endif ()
108
109 mlk_library(
110 NAME libmlk-core
111 SOURCES ${SOURCES} ${NLS}
112 LANGS ${NLS}
113 LIBRARIES
114 PUBLIC
115 ${LIBRARIES}
116 ${OPENAL_LIBRARY}
117 SndFile::SndFile
118 SDL2::SDL2
119 SDL2::image
120 SDL2::ttf
121 libmlk-util
122 INCLUDES
123 PUBLIC
124 ${OPENAL_INCLUDE_DIR}
125 $<BUILD_INTERFACE:${libmlk-core_SOURCE_DIR}>
126 )
127
128 source_group(TREE ${libmlk-core_SOURCE_DIR} FILES ${SOURCES} ${NLS})