-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
67 lines (56 loc) · 1.41 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
cmake_minimum_required(VERSION 3.16)
# project
project(magfy VERSION 0.1.0 LANGUAGES CXX)
# enviroments
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# vars
set(MAGFY_SOURCES
"src/main.cpp"
"src/config/Config.cpp"
"src/translate/translate.cpp"
)
set(MAGFY_INCLUDES
"src/config"
"src/backend"
"src/core"
"src/translate"
)
set(MAGFY_LIBS)
set(VENDOR)
# libs
find_package(yaml-cpp REQUIRED)
list(APPEND MAGFY_LIBS yaml-cpp)
# vendor setting
if(VENDOR STREQUAL "Windows")
add_compile_definitions(MAGFY_WINDOWS)
list(APPEND MAGFY_SOURCES
"src/core/windows/core.cpp"
"src/backend/windows/Magnifier.cpp"
)
list(APPEND MAGFY_LIBS Magnification)
elseif(VENDOR STREQUAL "X11")
add_compile_definitions(MAGFY_X11)
list(APPEND MAGFY_SOURCES
"src/core/x11/core.cpp"
"src/backend/gnome/Magnifier.cpp"
)
list(APPEND MAGFY_LIBS X11)
else()
message(FATAL_ERROR "You must specify vendor: Windows, X11")
endif()
# debug setting
if(NOT CMAKE_BUILD_TYPE STREQUAL "Release")
add_compile_definitions(CONFIG_FILE="${CMAKE_SOURCE_DIR}/debug/config.yaml")
endif()
# includes
include_directories(${MAGFY_INCLUDES})
# magfy
if(VENDOR STREQUAL "Windows")
add_executable(magfy WIN32 ${MAGFY_SOURCES})
else()
add_executable(magfy ${MAGFY_SOURCES})
endif()
target_link_libraries(magfy PRIVATE ${MAGFY_LIBS})
# install
install(TARGETS magfy)