Skip to content

Commit ab30ee0

Browse files
Add support for CMake
1 parent f7b647f commit ab30ee0

2 files changed

Lines changed: 91 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Copyright (C) 2024 by Skyward
2+
#
3+
# This program is free software; you can redistribute it and/or
4+
# it under the terms of the GNU General Public License as published
5+
# the Free Software Foundation; either version 2 of the License, or
6+
# (at your option) any later version.
7+
#
8+
# This program is distributed in the hope that it will be useful,
9+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
# GNU General Public License for more details.
12+
#
13+
# As a special exception, if other files instantiate templates or use
14+
# macros or inline functions from this file, or you compile this file
15+
# and link it with other works to produce a work based on this file,
16+
# this file does not by itself cause the resulting work to be covered
17+
# by the GNU General Public License. However the source code for this
18+
# file must still be made available in accordance with the GNU
19+
# Public License. This exception does not invalidate any other
20+
# why a work based on this file might be covered by the GNU General
21+
# Public License.
22+
#
23+
# You should have received a copy of the GNU General Public License
24+
# along with this program; if not, see <http://www.gnu.org/licenses/>
25+
26+
cmake_minimum_required(VERSION 3.16)
27+
28+
project(MxGui
29+
DESCRIPTION "GUI library for the Miosix kernel"
30+
LANGUAGES C CXX
31+
)
32+
33+
set(MXGUI_PATH ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "Path to mxgui")
34+
35+
set(MXGUI_SRC
36+
${MXGUI_PATH}/display.cpp
37+
${MXGUI_PATH}/font.cpp
38+
${MXGUI_PATH}/misc_inst.cpp
39+
${MXGUI_PATH}/tga_image.cpp
40+
${MXGUI_PATH}/resource_image.cpp
41+
${MXGUI_PATH}/textbox.cpp
42+
${MXGUI_PATH}/level2/input.cpp
43+
${MXGUI_PATH}/level2/application.cpp
44+
${MXGUI_PATH}/level2/drawing_context_proxy.cpp
45+
${MXGUI_PATH}/level2/label.cpp
46+
${MXGUI_PATH}/level2/button.cpp
47+
${MXGUI_PATH}/level2/checkbox.cpp
48+
${MXGUI_PATH}/level2/radio_button.cpp
49+
${MXGUI_PATH}/level2/scrolling_list.cpp
50+
${MXGUI_PATH}/level2/simple_plot.cpp
51+
${MXGUI_PATH}/drivers/display_stm3210e-eval.cpp
52+
${MXGUI_PATH}/drivers/event_stm3210e-eval.cpp
53+
${MXGUI_PATH}/drivers/display_mp3v2.cpp
54+
${MXGUI_PATH}/drivers/event_mp3v2.cpp
55+
${MXGUI_PATH}/drivers/resfs_mp3v2.cpp
56+
${MXGUI_PATH}/drivers/display_strive.cpp
57+
${MXGUI_PATH}/drivers/display_st7735.cpp
58+
${MXGUI_PATH}/drivers/display_oledboard2.cpp
59+
${MXGUI_PATH}/drivers/event_strive.cpp
60+
${MXGUI_PATH}/drivers/display_redbull_v2.cpp
61+
${MXGUI_PATH}/drivers/event_redbull_v2.cpp
62+
${MXGUI_PATH}/drivers/display_bitsboard.cpp
63+
${MXGUI_PATH}/drivers/display_sony-newman.cpp
64+
${MXGUI_PATH}/drivers/event_sony-newman.cpp
65+
${MXGUI_PATH}/drivers/display_stm32f4discovery.cpp
66+
${MXGUI_PATH}/drivers/event_stm32f4discovery.cpp
67+
${MXGUI_PATH}/drivers/display_generic_1bpp.cpp
68+
${MXGUI_PATH}/drivers/display_generic_4bpp.cpp
69+
${MXGUI_PATH}/drivers/display_st7735.cpp
70+
${MXGUI_PATH}/drivers/display_st25dvdiscovery.cpp
71+
${MXGUI_PATH}/drivers/display_stm3220g-eval.cpp
72+
${MXGUI_PATH}/drivers/event_stm3220g-eval.cpp
73+
${MXGUI_PATH}/drivers/event_st25dvdiscovery.cpp
74+
)
75+
76+
add_library(mxgui STATIC ${MXGUI_SRC})
77+
78+
target_include_directories(mxgui PUBLIC ${MXGUI_PATH})
79+
80+
# The user can set a custom path for mxgui_settings.h
81+
set(MXGUI_SETTINGS_PATH ${MIOSIX_KPATH}/default CACHE PATH "Include directory for miosix_settings.h")
82+
mark_as_advanced(MXGUI_SETTINGS_PATH)
83+
if(NOT MXGUI_SETTINGS_PATH STREQUAL ${MIOSIX_KPATH}/default)
84+
message(NOTICE "You have set a custom path for mxgui_settings.h")
85+
endif()
86+
87+
# Define "MXGUI_LIBRARY" for private headers
88+
target_compile_definitions(mxgui PRIVATE MXGUI_LIBRARY)
89+
90+
# Link against Miosix
91+
target_link_libraries(mxgui PRIVATE miosix)

0 commit comments

Comments
 (0)