-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCMakeLists.txt
87 lines (70 loc) · 3.08 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
# CMakeList.txt : CMake project for SRAL, include source and define
# project specific logic here.
#
cmake_minimum_required (VERSION 3.25)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set(INCLUDES "Include")
# Enable Hot Reload for MSVC compilers if supported.
if (POLICY CMP0141)
cmake_policy(SET CMP0141 NEW)
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
endif()
project ("SRAL")
add_library(${PROJECT_NAME}_obj OBJECT)
target_sources(${PROJECT_NAME}_obj PRIVATE
"SRC/SRAL.cpp" "SRC/Engine.h")
target_sources(${PROJECT_NAME}_obj PUBLIC
FILE_SET HEADERS
BASE_DIRS "${INCLUDES}"
FILES "${INCLUDES}/SRAL.h")
if(WIN32)
target_sources(${PROJECT_NAME}_obj PRIVATE
"SRC/Encoding.h" "SRC/Encoding.cpp"
"SRC/NVDA.h" "SRC/NVDA.cpp" "SRC/SAPI.h" "SRC/SAPI.cpp"
"Dep/blastspeak.h" "Dep/blastspeak.c" "Dep/fsapi.h" "Dep/fsapi.c" "Dep/nvda_control.h" "Dep/nvda_control.c"
"SRC/Jaws.h" "SRC/Jaws.cpp" "SRC/UIA.cpp"
"Dep/UIAProvider.h" "Dep/UIAProvider.cpp" "Dep/wasapi.h" "Dep/wasapi.cpp")
elseif(APPLE)
target_sources(${PROJECT_NAME}_obj PRIVATE
"SRC/AVSpeech.h" "SRC/AVSpeech.mm")
else()
target_sources(${PROJECT_NAME}_obj PRIVATE
"SRC/SpeechDispatcher.h" "SRC/SpeechDispatcher.cpp")
endif()
set_property(TARGET ${PROJECT_NAME}_obj
PROPERTY POSITION_INDEPENDENT_CODE on)
add_library(${PROJECT_NAME} SHARED
$<TARGET_OBJECTS:${PROJECT_NAME}_obj>)
add_library(${PROJECT_NAME}_static STATIC
$<TARGET_OBJECTS:${PROJECT_NAME}_obj>)
target_include_directories(${PROJECT_NAME} PUBLIC ${INCLUDES})
target_include_directories(${PROJECT_NAME}_static PUBLIC ${INCLUDES})
install(TARGETS ${PROJECT_NAME}_obj FILE_SET HEADERS
INCLUDES DESTINATION "include")
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION "bin"
LIBRARY DESTINATION "lib"
ARCHIVE DESTINATION "lib")
install(TARGETS ${PROJECT_NAME}_static DESTINATION "lib")
add_executable(${PROJECT_NAME}_test "Examples/C/SRALExample.c" "Include/SRAL.h")
target_link_libraries(${PROJECT_NAME}_test ${PROJECT_NAME}_static)
if (WIN32)
set(LIBS "uiautomationcore.lib")
target_link_libraries(${PROJECT_NAME} ${LIBS})
target_link_libraries(${PROJECT_NAME}_static ${LIBS})
elseif (APPLE)
enable_language(OBJCXX)
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
target_link_libraries(${PROJECT_NAME} "-framework Foundation" "-framework AVFoundation")
target_link_libraries(${PROJECT_NAME}_test "-framework Foundation" "-framework AVFoundation")
else()
find_package(X11 REQUIRED)
target_link_libraries(${PROJECT_NAME} ${X11_LIBRARIES})
target_link_libraries(${PROJECT_NAME}_test ${X11_LIBRARIES})
find_package(PkgConfig REQUIRED)
pkg_check_modules(SpeechD REQUIRED speech-dispatcher)
target_link_libraries(${PROJECT_NAME} ${SpeechD_LIBRARIES})
target_link_libraries(${PROJECT_NAME}_test ${SpeechD_LIBRARIES})
endif()