annotate CMakeLists.txt @ 31:668f4f31ddda

strategist: outward APIs are now in C
author Paper <paper@tflc.us>
date Mon, 10 Feb 2025 00:07:21 -0500
parents 40fd3776ce9b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
1 cmake_minimum_required(VERSION 3.16)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
2 project(animone LANGUAGES CXX)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
3 set(SRC_FILES
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
4 # any non-platform-specific files go here
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
5 src/animone.cc
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
6 src/player.cc
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
7 src/util.cc
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
8 src/strategist.cc
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
9 src/fd.cc
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
10 src/a11y.cc
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
11 src/win.cc
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
12 )
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
13
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
14 set(LIBRARIES)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
15 set(INCLUDE_DIRS)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
16 set(DEFINES)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
17
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
18 list(APPEND DEFINES DLL_EXPORT)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
19
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
20 if(APPLE)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
21 list(APPEND DEFINES USE_MACOSX)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
22 list(APPEND SRC_FILES
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
23 # xnu stuff
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
24 src/fd/xnu.cc
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
25 src/win/quartz.cc
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
26 )
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
27
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
28 # ...
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
29 find_library(OBJC_LIBRARY objc REQUIRED)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
30 find_library(FOUNDATION_LIBRARY Foundation REQUIRED)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
31 find_library(COREGRAPHICS_LIBRARY CoreGraphics REQUIRED)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
32 find_library(APPLICATIONSERVICES_LIBRARY ApplicationServices REQUIRED)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
33 list(APPEND LIBRARIES ${FOUNDATION_LIBRARY} ${COREGRAPHICS_LIBRARY} ${APPLICATIONSERVICES_LIBRARY} ${OBJC_LIBRARY})
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
34 elseif(WIN32)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
35 list(APPEND DEFINES USE_WIN32)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
36 list(APPEND SRC_FILES
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
37 # win32
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
38 src/a11y/win32.cc
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
39 src/fd/win32.cc
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
40 src/win/win32.cc
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
41 src/util/win32.cc
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
42 )
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
43
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
44 find_library(OLE32_LIB ole32 REQUIRED)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
45 find_library(OLEAUT32_LIB oleaut32 REQUIRED)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
46 list(APPEND LIBRARIES ${OLE32_LIB} ${OLEAUT32_LIB})
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
47 else() # NOT WIN32 AND NOT APPLE
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
48 find_library(LIBUTIL_LIB util)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
49 find_library(LIBKVM_LIB kvm)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
50
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
51 if(LINUX)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
52 list(APPEND DEFINES USE_LINUX)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
53 list(APPEND SRC_FILES src/fd/proc.cc)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
54 elseif(LIBUTIL_LIBRARY) # FreeBSD
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
55 # stupid hackarounds
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
56 get_filename_component(LIBUTIL_DIR ${LIBUTIL_LIBRARY} DIRECTORY)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
57
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
58 include(CheckLibraryExists)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
59 check_library_exists(util kinfo_getfile ${LIBUTIL_DIR} LIBUTIL_GOOD)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
60
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
61 if(LIBUTIL_GOOD)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
62 list(APPEND DEFINES USE_FREEBSD)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
63 list(APPEND LIBRARIES ${LIBUTIL_LIBRARY})
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
64 list(APPEND SRC_FILES src/fd/freebsd.cc)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
65 endif() # LIBUTIL_GOOD
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
66 elseif(LIBKVM_LIBRARY) # OpenBSD
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
67 get_filename_component(LIBKVM_DIR ${LIBKVM_LIBRARY} DIRECTORY)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
68
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
69 include(CheckLibraryExists)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
70 check_library_exists(kvm kvm_getfiles ${LIBKVM_DIR} LIBKVM_HAS_GETFILES)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
71
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
72 if(LIBKVM_HAS_GETFILES)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
73 list(APPEND DEFINES USE_OPENBSD)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
74 list(APPEND LIBRARIES ${LIBKVM_LIBRARY})
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
75 list(APPEND SRC_FILES src/fd/openbsd.cc)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
76 endif() # LIBKVM_HAS_GETFILES
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
77 endif() # LINUX
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
78 endif() # WIN32 AND APPLE
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
79
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
80 # X11
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
81 find_package(PkgConfig)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
82 if(PKG_CONFIG_FOUND)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
83 pkg_check_modules(XCB xcb xcb-res)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
84 if (XCB_FOUND)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
85 list(APPEND DEFINES USE_X11)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
86 list(APPEND LIBRARIES ${XCB_LINK_LIBRARIES})
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
87 list(APPEND INCLUDE_DIRS ${XCB_INCLUDE_DIRS})
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
88 list(APPEND SRC_FILES src/win/x11.cc)
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
89 endif() # XCB_FOUND
28
fac2b2d242d3 animone: add preliminary AT-SPI stuff
Paper <paper@tflc.us>
parents: 26
diff changeset
90
fac2b2d242d3 animone: add preliminary AT-SPI stuff
Paper <paper@tflc.us>
parents: 26
diff changeset
91 pkg_check_modules(ATSPI atspi-2)
fac2b2d242d3 animone: add preliminary AT-SPI stuff
Paper <paper@tflc.us>
parents: 26
diff changeset
92 if (ATSPI_FOUND)
fac2b2d242d3 animone: add preliminary AT-SPI stuff
Paper <paper@tflc.us>
parents: 26
diff changeset
93 list(APPEND DEFINES USE_ATSPI)
fac2b2d242d3 animone: add preliminary AT-SPI stuff
Paper <paper@tflc.us>
parents: 26
diff changeset
94 list(APPEND LIBRARIES ${ATSPI_LINK_LIBRARIES})
fac2b2d242d3 animone: add preliminary AT-SPI stuff
Paper <paper@tflc.us>
parents: 26
diff changeset
95 list(APPEND INCLUDE_DIRS ${ATSPI_INCLUDE_DIRS})
fac2b2d242d3 animone: add preliminary AT-SPI stuff
Paper <paper@tflc.us>
parents: 26
diff changeset
96 list(APPEND SRC_FILES src/a11y/atspi.cc)
fac2b2d242d3 animone: add preliminary AT-SPI stuff
Paper <paper@tflc.us>
parents: 26
diff changeset
97 endif() # ATSPI_FOUND
26
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
98 endif() # PKG_CONFIG_FOUND
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
99
29
40fd3776ce9b cmake: we are not "animia" anymore
Paper <paper@tflc.us>
parents: 28
diff changeset
100 add_library(animone SHARED ${SRC_FILES})
40fd3776ce9b cmake: we are not "animia" anymore
Paper <paper@tflc.us>
parents: 28
diff changeset
101 set_target_properties(animone PROPERTIES
40fd3776ce9b cmake: we are not "animia" anymore
Paper <paper@tflc.us>
parents: 28
diff changeset
102 PUBLIC_HEADER include/animone.h
26
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
103 CXX_STANDARD 17
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
104 )
77a5ea5e996c *: transfer back to cmake from autotools
Paper <paper@paper.us.eu.org>
parents:
diff changeset
105
29
40fd3776ce9b cmake: we are not "animia" anymore
Paper <paper@tflc.us>
parents: 28
diff changeset
106 target_compile_definitions(animone PRIVATE ${DEFINES})
40fd3776ce9b cmake: we are not "animia" anymore
Paper <paper@tflc.us>
parents: 28
diff changeset
107 target_include_directories(animone PUBLIC include PRIVATE ${INCLUDE_DIRS})
40fd3776ce9b cmake: we are not "animia" anymore
Paper <paper@tflc.us>
parents: 28
diff changeset
108 target_link_libraries(animone PUBLIC ${LIBRARIES})