forked from lvgl/lv_port_pc_vscode
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
75 lines (60 loc) · 1.69 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
cmake_minimum_required(VERSION 3.18)
# project name
project(lvgl-sdl LANGUAGES C CXX)
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMake/")
find_package(SDL2 REQUIRED)
if(SDL2_FOUND)
message("SDL2 inc ${SDL2_INCLUDE_DIRS}")
message("SDL2 lib ${SDL2_LIBRARY}")
endif()
include_directories(
${SDL2_INCLUDE_DIRS}
)
# Generate compile_commands.json file
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_compile_options(
-ffunction-sections
-fdata-sections
-Wall
-Wshadow
$<$<CONFIG:DEBUG>:-g3>
$<$<CONFIG:DEBUG>:-Og>
$<$<CONFIG:RELEASE>:-Os>
)
add_compile_definitions(
LV_BUILD_TEST=0
SIMULATOR=1
$<$<CONFIG:DEBUG>:DEBUG>
)
include_directories(
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/main/src
${CMAKE_SOURCE_DIR}/lvgl
${CMAKE_SOURCE_DIR}/lv_examples
)
add_subdirectory(lv_drivers)
add_subdirectory(lvgl)
add_subdirectory(lv_examples)
# list of modules to build the appliaction (without extension .c or .cpp)
add_executable(${PROJECT_NAME}
main/src/main.c
main/src/mouse_cursor_icon.c
)
target_link_libraries(${PROJECT_NAME} PRIVATE lv_examples lvgl lv_drivers ${SDL2_LIBRARY})
if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
# using Clang
target_link_options(${PROJECT_NAME} PRIVATE
LINKER:-map,${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.map
)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# using GCC
target_link_options(${PROJECT_NAME} PRIVATE
LINKER:-Map,${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.map
)
endif()