-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
85 lines (69 loc) · 2.32 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
cmake_minimum_required(VERSION 3.5.1)
set(CMAKE_CXX_STANDARD 17)
project(Buildroid)
if(APPLE)
message(STATUS "Configuring for macOS")
set(JSON_INC_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external/vcpkg/packages/jsoncpp_arm64-osx/include)
set(JSON_LIB_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external/vcpkg/packages/jsoncpp_arm64-osx/lib)
elseif(UNIX AND NOT APPLE)
message(STATUS "Configuring for Linux (Ubuntu or other distributions)")
set(JSON_INC_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external/vcpkg/packages/jsoncpp_x64-linux/include)
set(JSON_LIB_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external/vcpkg/packages/jsoncpp_x64-linux/lib)
else()
message(FATAL_ERROR "Unsupported operating system")
endif()
set(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(LIBS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libs)
set(SHARED_LIBS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/shared)
file(
GLOB
SOURCE_FILES
${SOURCE_DIR}/*.cpp
${SOURCE_DIR}/fragments/*.cpp
${SOURCE_DIR}/tgbot_fragment_db_impl/*.cpp
)
add_executable(
Buildroid
${SOURCE_FILES}
)
add_subdirectory(${LIBS_DIR}/tgbot_fragment)
target_include_directories(
Buildroid PRIVATE
${JSON_INC_PATH}
"shared/sqlite_cpp/include"
"shared/libgit2/include"
"libs/tgbot_fragment/tgbot-cpp/include/tgbot"
"libs/tgbot_fragment/include"
"src/include"
)
add_library(Buildroid_Libs SHARED IMPORTED)
add_library(libgit2 SHARED IMPORTED)
if(APPLE)
set_target_properties(Buildroid_Libs PROPERTIES
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/deps/libBuildroid_Libs.dylib
)
set_target_properties(libgit2 PROPERTIES
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/deps/libgit2.dylib
)
elseif(UNIX AND NOT APPLE)
set_target_properties(Buildroid_Libs PROPERTIES
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/deps/libBuildroid_Libs.so
)
set_target_properties(libgit2 PROPERTIES
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/deps/libgit2.so
)
else()
message(FATAL_ERROR "Unsupported operating system")
endif()
find_library(sqlite_cpp sqlite_cpp PATHS ${SHARED_LIBS_DIR}/build/sqlite_cpp)
find_library(jsoncpp jsoncpp PATHS ${JSON_LIB_PATH})
find_package(cpprestsdk REQUIRED)
target_link_libraries(Buildroid PRIVATE
Buildroid_Libs
libgit2
dl
tgbot_fragment
TgBot
cpprestsdk::cpprest
${sqlite_cpp}
${jsoncpp})