Mercurial > minori
annotate dep/animia/CMakeLists.txt @ 163:44c5e6dd9488
dep/animia/osx: move GetProcessName to util/osx so we can use it in quartz
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sat, 18 Nov 2023 00:47:40 -0500 |
parents | 61b76c7b656a |
children | 54c5d80a737e |
rev | line source |
---|---|
158
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
1 cmake_minimum_required(VERSION 3.16) |
155
d2bbb5773616
dep/animia: add quartz backend for windows
Paper <mrpapersonic@gmail.com>
parents:
154
diff
changeset
|
2 project(animia LANGUAGES CXX) |
56
6ff7aabeb9d7
deps: add animia for open files detection
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
3 set(SRC_FILES |
137
69db40272acd
dep/animia: [WIP] huge refactor
Paper <mrpapersonic@gmail.com>
parents:
84
diff
changeset
|
4 # any non-platform-specific files go here |
69db40272acd
dep/animia: [WIP] huge refactor
Paper <mrpapersonic@gmail.com>
parents:
84
diff
changeset
|
5 src/animia.cc |
69db40272acd
dep/animia: [WIP] huge refactor
Paper <mrpapersonic@gmail.com>
parents:
84
diff
changeset
|
6 src/player.cc |
69db40272acd
dep/animia: [WIP] huge refactor
Paper <mrpapersonic@gmail.com>
parents:
84
diff
changeset
|
7 src/util.cc |
138
28842a8d0c6b
dep/animia: huge refactor (again...)
Paper <mrpapersonic@gmail.com>
parents:
137
diff
changeset
|
8 src/strategist.cc |
146
d8a61e7e2a36
dep/animia: move fd stuff to a new fd.cc, don't force the user
Paper <mrpapersonic@gmail.com>
parents:
139
diff
changeset
|
9 src/fd.cc |
152
8700806c2cc2
dep/animia: awesome new breaking changes!
Paper <mrpapersonic@gmail.com>
parents:
146
diff
changeset
|
10 src/win.cc |
56
6ff7aabeb9d7
deps: add animia for open files detection
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
11 ) |
139
478f3b366199
dep/animia: separate lots of things, use base class for OS stuff
Paper <mrpapersonic@gmail.com>
parents:
138
diff
changeset
|
12 |
162
61b76c7b656a
dep/animia: add os x launchservices method
Paper <mrpapersonic@gmail.com>
parents:
158
diff
changeset
|
13 include(CheckLanguage) |
61b76c7b656a
dep/animia: add os x launchservices method
Paper <mrpapersonic@gmail.com>
parents:
158
diff
changeset
|
14 |
155
d2bbb5773616
dep/animia: add quartz backend for windows
Paper <mrpapersonic@gmail.com>
parents:
154
diff
changeset
|
15 set(LIBRARIES) |
158
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
16 set(INCLUDE_DIRS) |
156
cdf79282d647
dep/animia: add VERY early x11 window stuff
Paper <mrpapersonic@gmail.com>
parents:
155
diff
changeset
|
17 set(DEFINES) |
cdf79282d647
dep/animia: add VERY early x11 window stuff
Paper <mrpapersonic@gmail.com>
parents:
155
diff
changeset
|
18 |
158
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
19 if(APPLE) |
156
cdf79282d647
dep/animia: add VERY early x11 window stuff
Paper <mrpapersonic@gmail.com>
parents:
155
diff
changeset
|
20 list(APPEND DEFINES MACOSX) |
137
69db40272acd
dep/animia: [WIP] huge refactor
Paper <mrpapersonic@gmail.com>
parents:
84
diff
changeset
|
21 list(APPEND SRC_FILES |
153
bd439dd6ffc5
*: make win stuff actually work, rename bsd.cc to xnu.cc
Paper <mrpapersonic@gmail.com>
parents:
152
diff
changeset
|
22 # xnu stuff |
bd439dd6ffc5
*: make win stuff actually work, rename bsd.cc to xnu.cc
Paper <mrpapersonic@gmail.com>
parents:
152
diff
changeset
|
23 src/fd/xnu.cc |
163
44c5e6dd9488
dep/animia/osx: move GetProcessName to util/osx so we can use it in quartz
Paper <mrpapersonic@gmail.com>
parents:
162
diff
changeset
|
24 src/util/osx.cc |
137
69db40272acd
dep/animia: [WIP] huge refactor
Paper <mrpapersonic@gmail.com>
parents:
84
diff
changeset
|
25 ) |
162
61b76c7b656a
dep/animia: add os x launchservices method
Paper <mrpapersonic@gmail.com>
parents:
158
diff
changeset
|
26 |
61b76c7b656a
dep/animia: add os x launchservices method
Paper <mrpapersonic@gmail.com>
parents:
158
diff
changeset
|
27 include(CheckIncludeFile) |
61b76c7b656a
dep/animia: add os x launchservices method
Paper <mrpapersonic@gmail.com>
parents:
158
diff
changeset
|
28 check_include_file("CoreFoundation/CoreFoundation.h" HAVE_COREFOUNDATION) |
163
44c5e6dd9488
dep/animia/osx: move GetProcessName to util/osx so we can use it in quartz
Paper <mrpapersonic@gmail.com>
parents:
162
diff
changeset
|
29 # If you're building on OS X, you most likely do have this file, but we |
44c5e6dd9488
dep/animia/osx: move GetProcessName to util/osx so we can use it in quartz
Paper <mrpapersonic@gmail.com>
parents:
162
diff
changeset
|
30 # check anyway. |
162
61b76c7b656a
dep/animia: add os x launchservices method
Paper <mrpapersonic@gmail.com>
parents:
158
diff
changeset
|
31 if (HAVE_COREFOUNDATION) |
61b76c7b656a
dep/animia: add os x launchservices method
Paper <mrpapersonic@gmail.com>
parents:
158
diff
changeset
|
32 list(APPEND DEFINES HAVE_COREFOUNDATION) |
61b76c7b656a
dep/animia: add os x launchservices method
Paper <mrpapersonic@gmail.com>
parents:
158
diff
changeset
|
33 endif() |
61b76c7b656a
dep/animia: add os x launchservices method
Paper <mrpapersonic@gmail.com>
parents:
158
diff
changeset
|
34 |
158
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
35 check_language(OBJCXX) |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
36 if(CMAKE_OBJCXX_COMPILER) |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
37 enable_language(OBJCXX) |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
38 list(APPEND SRC_FILES |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
39 src/win/quartz.mm |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
40 ) |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
41 find_library(FOUNDATION_LIBRARY Foundation) |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
42 find_library(COREGRAPHICS_LIBRARY CoreGraphics) |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
43 find_library(APPKIT_LIBRARY AppKit) |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
44 list(APPEND LIBRARIES ${FOUNDATION_LIBRARY} ${COREGRAPHICS_LIBRARY} ${APPKIT_LIBRARY}) |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
45 else() # NOT CMAKE_OBJCXX_COMPILER |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
46 message(WARNING "An Objective-C++ compiler couldn't be found! Window enumeration support will not be compiled.") |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
47 endif() # CMAKE_OBJCXX_COMPILER |
56
6ff7aabeb9d7
deps: add animia for open files detection
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
48 elseif(WIN32) |
156
cdf79282d647
dep/animia: add VERY early x11 window stuff
Paper <mrpapersonic@gmail.com>
parents:
155
diff
changeset
|
49 list(APPEND DEFINES WIN32) |
137
69db40272acd
dep/animia: [WIP] huge refactor
Paper <mrpapersonic@gmail.com>
parents:
84
diff
changeset
|
50 list(APPEND SRC_FILES |
69db40272acd
dep/animia: [WIP] huge refactor
Paper <mrpapersonic@gmail.com>
parents:
84
diff
changeset
|
51 # win32 |
138
28842a8d0c6b
dep/animia: huge refactor (again...)
Paper <mrpapersonic@gmail.com>
parents:
137
diff
changeset
|
52 src/fd/win32.cc |
152
8700806c2cc2
dep/animia: awesome new breaking changes!
Paper <mrpapersonic@gmail.com>
parents:
146
diff
changeset
|
53 src/win/win32.cc |
8700806c2cc2
dep/animia: awesome new breaking changes!
Paper <mrpapersonic@gmail.com>
parents:
146
diff
changeset
|
54 src/util/win32.cc |
8700806c2cc2
dep/animia: awesome new breaking changes!
Paper <mrpapersonic@gmail.com>
parents:
146
diff
changeset
|
55 ) |
158
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
56 else() # NOT WIN32 AND NOT APPLE |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
57 if(LINUX) |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
58 list(APPEND DEFINES LINUX) |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
59 list(APPEND SRC_FILES |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
60 # linux |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
61 src/fd/linux.cc |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
62 ) |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
63 endif() # LINUX |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
64 |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
65 # X11 |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
66 find_package(X11 COMPONENTS X11) |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
67 if(X11_FOUND) |
156
cdf79282d647
dep/animia: add VERY early x11 window stuff
Paper <mrpapersonic@gmail.com>
parents:
155
diff
changeset
|
68 list(APPEND DEFINES X11) |
cdf79282d647
dep/animia: add VERY early x11 window stuff
Paper <mrpapersonic@gmail.com>
parents:
155
diff
changeset
|
69 list(APPEND SRC_FILES |
cdf79282d647
dep/animia: add VERY early x11 window stuff
Paper <mrpapersonic@gmail.com>
parents:
155
diff
changeset
|
70 src/win/x11.cc |
cdf79282d647
dep/animia: add VERY early x11 window stuff
Paper <mrpapersonic@gmail.com>
parents:
155
diff
changeset
|
71 ) |
cdf79282d647
dep/animia: add VERY early x11 window stuff
Paper <mrpapersonic@gmail.com>
parents:
155
diff
changeset
|
72 list(APPEND INCLUDE_DIRS |
158
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
73 ${X11_INCLUDE_DIRS} |
156
cdf79282d647
dep/animia: add VERY early x11 window stuff
Paper <mrpapersonic@gmail.com>
parents:
155
diff
changeset
|
74 ) |
cdf79282d647
dep/animia: add VERY early x11 window stuff
Paper <mrpapersonic@gmail.com>
parents:
155
diff
changeset
|
75 list(APPEND LIBRARIES |
cdf79282d647
dep/animia: add VERY early x11 window stuff
Paper <mrpapersonic@gmail.com>
parents:
155
diff
changeset
|
76 ${X11_LIBRARIES} |
cdf79282d647
dep/animia: add VERY early x11 window stuff
Paper <mrpapersonic@gmail.com>
parents:
155
diff
changeset
|
77 ) |
158
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
78 else() # NOT X11_FOUND |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
79 # For some systems, i.e. Debian, FindX11 fails to find X11, so we have |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
80 # to use pkg_config as a fallback |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
81 find_package(PkgConfig) |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
82 if(PKG_CONFIG_FOUND) |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
83 pkg_check_modules(X11 x11) |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
84 if(X11_FOUND) |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
85 list(APPEND DEFINES X11) |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
86 list(APPEND SRC_FILES |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
87 src/win/x11.cc |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
88 ) |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
89 list(APPEND INCLUDE_DIRS |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
90 ${X11_INCLUDE_DIRS} |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
91 ) |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
92 list(APPEND LIBRARIES |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
93 ${X11_LIBRARIES} |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
94 ) |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
95 endif() # X11_FOUND |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
96 endif() # PKG_CONFIG_FOUND |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
97 endif() # X11_FOUND |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
98 endif() # WIN32 AND APPLE |
152
8700806c2cc2
dep/animia: awesome new breaking changes!
Paper <mrpapersonic@gmail.com>
parents:
146
diff
changeset
|
99 |
56
6ff7aabeb9d7
deps: add animia for open files detection
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
100 add_library(animia SHARED ${SRC_FILES}) |
78
1ce00c1c8ddc
dep/animia: update to upstream
Paper <mrpapersonic@gmail.com>
parents:
64
diff
changeset
|
101 set_target_properties(animia PROPERTIES |
137
69db40272acd
dep/animia: [WIP] huge refactor
Paper <mrpapersonic@gmail.com>
parents:
84
diff
changeset
|
102 PUBLIC_HEADER include/animia.h |
69db40272acd
dep/animia: [WIP] huge refactor
Paper <mrpapersonic@gmail.com>
parents:
84
diff
changeset
|
103 CXX_STANDARD 17 |
69db40272acd
dep/animia: [WIP] huge refactor
Paper <mrpapersonic@gmail.com>
parents:
84
diff
changeset
|
104 ) |
139
478f3b366199
dep/animia: separate lots of things, use base class for OS stuff
Paper <mrpapersonic@gmail.com>
parents:
138
diff
changeset
|
105 |
158
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
106 target_compile_definitions(animia PUBLIC ${DEFINES}) |
80d6b28eb29f
dep/animia: fix most X11 stuff
Paper <mrpapersonic@gmail.com>
parents:
156
diff
changeset
|
107 target_include_directories(animia PRIVATE include PUBLIC ${INCLUDE_DIRS}) |
155
d2bbb5773616
dep/animia: add quartz backend for windows
Paper <mrpapersonic@gmail.com>
parents:
154
diff
changeset
|
108 target_link_libraries(animia PUBLIC ${LIBRARIES}) |