-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
124 lines (102 loc) · 3.1 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
cmake_minimum_required(VERSION 3.16)
project("yaltl"
VERSION 0.1
DESCRIPTION "Terminal based launcher"
LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
list(APPEND SOURCES
./src/main.cpp
./src/yaltl.cpp
./src/modes/dmenu.cpp
./src/modes/run.cpp
./src/modes/script.cpp
./src/utils/command.cpp
./src/utils/regex.cpp
)
list(APPEND LIBRARIES
ftxui::screen
ftxui::dom
ftxui::component
mtl)
list(APPEND INCLUDE_DIRS
./include
"${PROJECT_BINARY_DIR}")
list(APPEND CFLAGS -Wall)
include(FetchContent)
FetchContent_Declare(
ftxui
GIT_REPOSITORY https://github.com/ArthurSonzogni/FTXUI
GIT_TAG 0a9a72cbaa7a063d4efbef7175f0808cf674b059
)
FetchContent_Declare(
mtl
GIT_REPOSITORY https://github.com/scaryrawr/mtl
GIT_TAG origin/main
)
FetchContent_MakeAvailable(ftxui)
FetchContent_MakeAvailable(mtl)
if(WIN32)
FetchContent_Declare(
WIL
GIT_REPOSITORY https://github.com/microsoft/wil
)
FetchContent_MakeAvailable(WIL)
FetchContent_Declare(
getopt
GIT_REPOSITORY https://github.com/scaryrawr/getopt
GIT_TAG origin/main
)
FetchContent_MakeAvailable(getopt)
list(APPEND SOURCES ./src/utils/win32/spawn.cpp)
list(APPEND LIBRARIES WIL getopt)
else()
list(APPEND SOURCES ./src/utils/posix/spawn.cpp)
endif()
find_package(PkgConfig)
if(${PKGCONFIG_FOUND})
pkg_check_modules(PCRE2 libpcre2-32)
if(${PCRE2_FOUND})
list(APPEND SOURCES ./src/utils/regex_pcre.cpp)
list(APPEND CFLAGS -DPCRE2_CODE_UNIT_WIDTH=32 ${PCRE2_CFLAGS})
list(APPEND LIBRARIES ${PCRE2_LIBRARIES})
list(APPEND INCLUDE_DIRS ${PCRE2_INCLUDE_DIRS})
else()
list(APPEND SOURCES ./src/utils/regex_stl.cpp)
endif()
pkg_check_modules(GIOMM giomm-2.4)
if(${GIOMM_FOUND})
list(APPEND LIBRARIES ${GIOMM_LIBRARIES})
list(APPEND INCLUDE_DIRS ${GIOMM_INCLUDE_DIRS})
list(APPEND CFLAGS ${GIOMM_CFLAGS})
list(APPEND SOURCES ./src/modes/drun.cpp)
endif()
pkg_check_modules(GTKMM gtkmm-3.0)
if(${GTKMM_FOUND})
list(APPEND LIBRARIES ${GTKMM_LIBRARIES})
list(APPEND INCLUDE_DIRS ${GTKMM_INCLUDE_DIRS})
list(APPEND CFLAGS ${GTKMM_CFLAGS})
list(APPEND SOURCES ./src/modes/recent.cpp)
endif()
# I3IPC depends on Package Config
option(I3IPC_FOUND "Build with i3ipc enabled" ON)
if(I3IPC_FOUND)
FetchContent_Declare(
i3ipc++
GIT_REPOSITORY https://github.com/scaryrawr/i3ipcpp
GIT_TAG origin/main
)
FetchContent_MakeAvailable(i3ipc++)
list(APPEND LIBRARIES i3ipc++)
list(APPEND SOURCES ./src/modes/i3wm.cpp)
endif()
else()
list(APPEND SOURCES ./src/utils/regex_stl.cpp)
endif()
configure_file(YaltlConfig.h.cmake YaltlConfig.h)
add_executable(yaltl ${SOURCES})
target_link_libraries(yaltl PRIVATE ${LIBRARIES})
target_include_directories(yaltl PRIVATE ${INCLUDE_DIRS})
target_compile_options(yaltl PRIVATE ${CFLAGS})
install(TARGETS yaltl)