Browse Source

Adding CMake support

master
Joel Bodenmann 12 months ago
parent
commit
64aa71339c
  1. 4
      .gitignore
  2. 1
      changelog.txt
  3. 47
      cmake/Findugfx.cmake
  4. 21
      cmake/target_setup.cmake
  5. 28
      drivers/multiple/SDL/driver.cmake
  6. 9
      src/gadc/gadc.cmake
  7. 9
      src/gaudio/gaudio.cmake
  8. 27
      src/gdisp/gdisp.cmake
  9. 9
      src/gdriver/gdriver.cmake
  10. 9
      src/gevent/gevent.cmake
  11. 24
      src/gfile/gfile.cmake
  12. 14
      src/ginput/ginput.cmake
  13. 13
      src/gmisc/gmisc.cmake
  14. 22
      src/gos/gos.cmake
  15. 9
      src/gqueue/gqueue.cmake
  16. 9
      src/gtimer/gtimer.cmake
  17. 9
      src/gtrans/gtrans.cmake
  18. 30
      src/gwin/gwin.cmake

4
.gitignore

@ -16,3 +16,7 @@ docs/html
docs/html.zip
docs/*.db
docs/*.tmp
# CLion
.idea/
cmake-build-*/

1
changelog.txt

@ -27,6 +27,7 @@ FIX: Fix missing return value in gfxQueueFSyncInsert().
FEATURE: Adding support for FreeBSD.
FIX: Fix incorrect calls to mmap() and sem_open() in SDL2 driver (lax operating systems such as Linux & MacOS were silently tolerating these).
FIX: Minor code improvements
FEATURE: Add cmake support
*** Release 2.9 ***

47
cmake/Findugfx.cmake

@ -0,0 +1,47 @@
# Ensure that CHIBIOS_ROOT is set
if(NOT UGFX_ROOT)
message(FATAL_ERROR "No UGFX_ROOT specified")
endif()
# Assemble list of components
list(APPEND ugfx_COMPONENTS
gadc
gaudio
gdisp
gdriver
gevent
gfile
ginput
gmisc
gos
gqueue
gtimer
gtrans
gwin
)
# Core sources
list(APPEND ugfx_SOURCES
${UGFX_ROOT}/src/gfx.c
)
# Core include directories
list(APPEND ugfx_INCLUDE_DIRS
${UGFX_ROOT}/src
)
# Include each component
foreach(component ${ugfx_COMPONENTS})
include(${UGFX_ROOT}/src/${component}/${component}.cmake)
endforeach()
# Include target setup for ease-of-use
include(${CMAKE_CURRENT_LIST_DIR}/target_setup.cmake)
# Remove duplicates from non-cached variables
list(REMOVE_DUPLICATES ugfx_SOURCES)
list(REMOVE_DUPLICATES ugfx_INCLUDE_DIRS)
# Outsource heavy-lifting to cmake
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ugfx DEFAULT_MSG ugfx_SOURCES ugfx_INCLUDE_DIRS)

21
cmake/target_setup.cmake

@ -0,0 +1,21 @@
function(ugfx_target_setup TARGET)
target_include_directories(
${TARGET}
PRIVATE
${ugfx_INCLUDE_DIRS}
)
target_sources(
${TARGET}
PRIVATE
${ugfx_SOURCES}
)
target_compile_definitions(
${TARGET}
PRIVATE
${ugfx_DEFS}
)
endfunction()

28
drivers/multiple/SDL/driver.cmake

@ -0,0 +1,28 @@
set(ROOT_PATH ${UGFX_ROOT}/drivers/multiple/SDL)
list(APPEND ugfx_INCLUDE_DIRS
${ROOT_PATH}
)
list(APPEND ugfx_SOURCES
${ROOT_PATH}/gdisp_lld_SDL.c
)
list(APPEND ugfx_DEFS
GFX_OS_PRE_INIT_FUNCTION=sdl_driver_init
)
# Find SDL2
find_package(
SDL2
REQUIRED
)
# Setup target
function(ugfx_driver_setup_SDL TARGET)
target_link_libraries(
${TARGET}
PRIVATE
SDL2::SDL2
)
endfunction()

9
src/gadc/gadc.cmake

@ -0,0 +1,9 @@
set(ROOT_PATH ${UGFX_ROOT}/src/gadc)
list(APPEND ugfx_INCLUDE_DIRS
${ROOT_PATH}
)
list(APPEND ugfx_SOURCES
${ROOT_PATH}/gadc.c
)

9
src/gaudio/gaudio.cmake

@ -0,0 +1,9 @@
set(ROOT_PATH ${UGFX_ROOT}/src/gaudio)
list(APPEND ugfx_INCLUDE_DIRS
${ROOT_PATH}
)
list(APPEND ugfx_SOURCES
${ROOT_PATH}/gaudio.c
)

27
src/gdisp/gdisp.cmake

@ -0,0 +1,27 @@
set(ROOT_PATH ${UGFX_ROOT}/src/gdisp)
list(APPEND ugfx_INCLUDE_DIRS
${ROOT_PATH}
${ROOT_PATH}/mcufont
)
list(APPEND ugfx_SOURCES
${ROOT_PATH}/gdisp.c
${ROOT_PATH}/gdisp_fonts.c
${ROOT_PATH}/gdisp_pixmap.c
${ROOT_PATH}/gdisp_image.c
${ROOT_PATH}/gdisp_image_native.c
${ROOT_PATH}/gdisp_image_gif.c
${ROOT_PATH}/gdisp_image_bmp.c
${ROOT_PATH}/gdisp_image_jpg.c
${ROOT_PATH}/gdisp_image_png.c
${ROOT_PATH}/mcufont/mf_encoding.c
${ROOT_PATH}/mcufont/mf_font.c
${ROOT_PATH}/mcufont/mf_justify.c
${ROOT_PATH}/mcufont/mf_kerning.c
${ROOT_PATH}/mcufont/mf_rlefont.c
${ROOT_PATH}/mcufont/mf_bwfont.c
${ROOT_PATH}/mcufont/mf_scaledfont.c
${ROOT_PATH}/mcufont/mf_wordwrap.c
)

9
src/gdriver/gdriver.cmake

@ -0,0 +1,9 @@
set(ROOT_PATH ${UGFX_ROOT}/src/gdriver)
list(APPEND ugfx_INCLUDE_DIRS
${ROOT_PATH}
)
list(APPEND ugfx_SOURCES
${ROOT_PATH}/gdriver.c
)

9
src/gevent/gevent.cmake

@ -0,0 +1,9 @@
set(ROOT_PATH ${UGFX_ROOT}/src/gevent)
list(APPEND ugfx_INCLUDE_DIRS
${ROOT_PATH}
)
list(APPEND ugfx_SOURCES
${ROOT_PATH}/gevent.c
)

24
src/gfile/gfile.cmake

@ -0,0 +1,24 @@
set(ROOT_PATH ${UGFX_ROOT}/src/gfile)
list(APPEND ugfx_INCLUDE_DIRS
${ROOT_PATH}
)
list(APPEND ugfx_SOURCES
${ROOT_PATH}/gfile.c
${ROOT_PATH}/gfile_fs_native.c
${ROOT_PATH}/gfile_fs_ram.c
${ROOT_PATH}/gfile_fs_rom.c
${ROOT_PATH}/gfile_fs_fatfs.c
${ROOT_PATH}/gfile_fs_petitfs.c
${ROOT_PATH}/gfile_fs_mem.c
${ROOT_PATH}/gfile_fs_chibios.c
${ROOT_PATH}/gfile_fs_strings.c
${ROOT_PATH}/gfile_printg.c
${ROOT_PATH}/gfile_scang.c
${ROOT_PATH}/gfile_stdio.c
${ROOT_PATH}/gfile_fatfs_wrapper.c
${ROOT_PATH}/gfile_fatfs_diskio_chibios.c
${ROOT_PATH}/gfile_petitfs_wrapper.c
${ROOT_PATH}/gfile_petitfs_diskio_chibios.c
)

14
src/ginput/ginput.cmake

@ -0,0 +1,14 @@
set(ROOT_PATH ${UGFX_ROOT}/src/ginput)
list(APPEND ugfx_INCLUDE_DIRS
${ROOT_PATH}
)
list(APPEND ugfx_SOURCES
${ROOT_PATH}/ginput.c
${ROOT_PATH}/ginput_mouse.c
${ROOT_PATH}/ginput_keyboard.c
${ROOT_PATH}/ginput_keyboard_microcode.c
${ROOT_PATH}/ginput_toggle.c
${ROOT_PATH}/ginput_dial.c
)

13
src/gmisc/gmisc.cmake

@ -0,0 +1,13 @@
set(ROOT_PATH ${UGFX_ROOT}/src/gmisc)
list(APPEND ugfx_INCLUDE_DIRS
${ROOT_PATH}
)
list(APPEND ugfx_SOURCES
${ROOT_PATH}/gmisc.c
${ROOT_PATH}/gmisc_arrayops.c
${ROOT_PATH}/gmisc_matrix2d.c
${ROOT_PATH}/gmisc_trig.c
${ROOT_PATH}/gmisc_hittest.c
)

22
src/gos/gos.cmake

@ -0,0 +1,22 @@
set(ROOT_PATH ${UGFX_ROOT}/src/gos)
list(APPEND ugfx_INCLUDE_DIRS
${ROOT_PATH}
)
list(APPEND ugfx_SOURCES
${ROOT_PATH}/gos_chibios.c
${ROOT_PATH}/gos_freertos.c
${ROOT_PATH}/gos_win32.c
${ROOT_PATH}/gos_linux.c
${ROOT_PATH}/gos_osx.c
${ROOT_PATH}/gos_raw32.c
${ROOT_PATH}/gos_ecos.c
${ROOT_PATH}/gos_rawrtos.c
${ROOT_PATH}/gos_arduino.c
${ROOT_PATH}/gos_cmsis.c
${ROOT_PATH}/gos_nios.c
${ROOT_PATH}/gos_zephyr.c
${ROOT_PATH}/gos_x_threads.c
${ROOT_PATH}/gos_x_heap.c
)

9
src/gqueue/gqueue.cmake

@ -0,0 +1,9 @@
set(ROOT_PATH ${UGFX_ROOT}/src/gqueue)
list(APPEND ugfx_INCLUDE_DIRS
${ROOT_PATH}
)
list(APPEND ugfx_SOURCES
${ROOT_PATH}/gqueue.c
)

9
src/gtimer/gtimer.cmake

@ -0,0 +1,9 @@
set(ROOT_PATH ${UGFX_ROOT}/src/gtimer)
list(APPEND ugfx_INCLUDE_DIRS
${ROOT_PATH}
)
list(APPEND ugfx_SOURCES
${ROOT_PATH}/gtimer.c
)

9
src/gtrans/gtrans.cmake

@ -0,0 +1,9 @@
set(ROOT_PATH ${UGFX_ROOT}/src/gtrans)
list(APPEND ugfx_INCLUDE_DIRS
${ROOT_PATH}
)
list(APPEND ugfx_SOURCES
${ROOT_PATH}/gtrans.c
)

30
src/gwin/gwin.cmake

@ -0,0 +1,30 @@
set(ROOT_PATH ${UGFX_ROOT}/src/gwin)
list(APPEND ugfx_INCLUDE_DIRS
${ROOT_PATH}
${UGFX_ROOT}/3rdparty/tinygl-0.4-ugfx/include
)
list(APPEND ugfx_SOURCES
${ROOT_PATH}/gwin.c
${ROOT_PATH}/gwin_widget.c
${ROOT_PATH}/gwin_wm.c
${ROOT_PATH}/gwin_console.c
${ROOT_PATH}/gwin_graph.c
${ROOT_PATH}/gwin_button.c
${ROOT_PATH}/gwin_slider.c
${ROOT_PATH}/gwin_checkbox.c
${ROOT_PATH}/gwin_image.c
${ROOT_PATH}/gwin_label.c
${ROOT_PATH}/gwin_radio.c
${ROOT_PATH}/gwin_list.c
${ROOT_PATH}/gwin_progressbar.c
${ROOT_PATH}/gwin_progressbar.c
${ROOT_PATH}/gwin_container.c
${ROOT_PATH}/gwin_frame.c
${ROOT_PATH}/gwin_tabset.c
${ROOT_PATH}/gwin_gl3d.c
${ROOT_PATH}/gwin_keyboard.c
${ROOT_PATH}/gwin_keyboard_layout.c
${ROOT_PATH}/gwin_textedit.c
)
Loading…
Cancel
Save