1cmake_minimum_required(VERSION 3.13 FATAL_ERROR) 2cmake_policy(SET CMP0054 NEW) 3cmake_policy(SET CMP0057 NEW) 4cmake_policy(SET CMP0077 NEW) 5 6project(guix_test LANGUAGES C) 7 8# Set build configurations 9set(BUILD_CONFIGURATIONS 10 default_build_coverage 11 disable_error_check_build 12 no_utf8_build_coverage 13 no_utf8_no_checking_build 14 ex_unicode_build 15 ex_unicode_no_checking_build 16 mouse_support_build 17 font_kerning_support_build 18 dynamic_bidi_text_build 19 dynamic_bidi_text_no_checking_build 20 _5_4_0_compatible_no_checking_build 21 synergy_font_support_build 22 thai_glyph_shaping_support_build 23 palette_mode_aa_text_colors_16_build 24 disable_deprecated_string_api_build 25 partial_canvas_support_build 26 partial_canvas_support_vertical_refresh_build 27 partial_canvas_support_horizontal_refresh_build) 28 29set(CMAKE_CONFIGURATION_TYPES 30 ${BUILD_CONFIGURATIONS} 31 CACHE STRING "list of supported configuration types" FORCE) 32set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 33 ${CMAKE_CONFIGURATION_TYPES}) 34list(GET CMAKE_CONFIGURATION_TYPES 0 BUILD_TYPE) 35if((NOT CMAKE_BUILD_TYPE) OR (NOT ("${CMAKE_BUILD_TYPE}" IN_LIST 36 CMAKE_CONFIGURATION_TYPES))) 37 set(CMAKE_BUILD_TYPE 38 "${BUILD_TYPE}" 39 CACHE STRING "Build Type of the project" FORCE) 40endif() 41 42message(STATUS "Build for guix") 43message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") 44message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}.") 45 46set(default_build_coverage "") 47set(disable_error_checking_build -DGX_DISABLE_ERROR_CHECKING) 48set(no_utf8_build_coverage -DGX_DISABLE_UTF8_SUPPORT) 49set(no_utf8_no_checking_build -DGX_DISABLE_UTF8_SUPPORT 50 -DGX_DISABLE_ERROR_CHECKING) 51set(ex_unicode_build -DGX_EXTENDED_UNICODE_SUPPORT) 52set(ex_unicode_no_checking_build -DGX_EXTENDED_UNICODE_SUPPORT 53 -DGX_DISABLE_ERROR_CHECKING) 54set(mouse_support_build -DGX_MOUSE_SUPPORT) 55set(font_kerning_support_build -DGX_FONT_KERNING_SUPPORT) 56set(dynamic_bidi_text_build -DGX_DYNAMIC_BIDI_TEXT_SUPPORT 57 -DGX_DYNAMIC_ARABIC_SHAPING_SUPPORT) 58set(dynamic_bidi_text_no_checking_build 59 -DGX_DYNAMIC_BIDI_TEXT_SUPPORT -DGX_DYNAMIC_ARABIC_SHAPING_SUPPORT 60 -DGX_DISABLE_ERROR_CHECKING) 61set(_5_4_0_compatible_no_checking_build -DGX_DISABLED_ERROR_CHECKING 62 -DGUIX_5_4_0_COMPATIBILITY) 63set(synergy_font_support_build -DGX_SYNERGY_FONT_FORMAT_SUPPORT) 64set(thai_glyph_shaping_support_build -DGX_THAI_GLYPH_SHAPING_SUPPORT) 65set(palette_mode_aa_text_colors_16_build -DGX_PALETTE_MODE_AA_TEXT_COLORS=16) 66set(disable_deprecated_string_api_build -DGX_DISABLE_DEPRECATED_STRING_API) 67set(partial_canvas_support_build -DGX_ENABLE_CANVAS_PARTIAL_FRAME_BUFFER) 68set(partial_canvas_support_vertical_refresh_build -DGX_ENABLE_CANVAS_PARTIAL_FRAME_BUFFER -DGX_CANVAS_REFRESH_DIRECTION_HORIZONTAL) 69set(partial_canvas_support_horizontal_refresh_build -DGX_ENABLE_CANVAS_PARTIAL_FRAME_BUFFER -DGX_CANVAS_REFRESH_DIRECTION_VERTICAL) 70 71if($ENV{ENABLE_64}) 72 message(STATUS "Building for 64bit") 73else() 74 add_compile_options(-m32) 75 add_link_options(-m32) 76 message(STATUS "Building for 32bit") 77endif() 78add_compile_options( 79 -std=c99 80 -ggdb 81 -g3 82 -gdwarf-2 83 -fdiagnostics-color 84 -DWQVGA_272_SCREEN 85 -DCOLOR_DEPTH_16BPP 86 -DGX_CURSOR_BLINK_INTERVAL=1 87 -DGX_TARGET_LINUX 88 -DGX_CUSTOM_FONTS=16 89 -DGX_CUSTOM_PIXELMAPS=32 90 -Dwin32_graphics_driver_setup_24bpp=gx_validation_display_driver_setup_24bpp 91 -Dwin32_graphics_driver_setup_565rgb=gx_validation_display_driver_setup_565rgb 92 -Dwin32_graphics_driver_setup_565rgb_rotated=gx_validation_display_driver_setup_565rgb_rotated 93 -Dwin32_graphics_driver_setup_565bgr=gx_validation_display_driver_setup_565rgb 94 -Dwin32_graphics_driver_setup_1555xrgb=gx_validation_display_driver_setup_1555xrgb 95 -Dwin32_graphics_driver_setup_24xrgb=gx_validation_display_driver_setup_24xrgb 96 -Dwin32_graphics_driver_setup_24xrgb_rotated=gx_validation_display_driver_setup_24xrgb_rotated 97 -Dwin32_graphics_driver_setup_32argb=gx_validation_display_driver_setup_32argb 98 -Dwin32_graphics_driver_setup_32argb_rotated=gx_validation_display_driver_setup_32argb_rotated 99 -Dwin32_graphics_driver_setup_332rgb=gx_validation_display_driver_setup_332rgb 100 -Dwin32_graphics_driver_setup_4444argb=gx_validation_display_driver_setup_4444argb 101 -Dwin32_graphics_driver_setup_4bpp_grayscale=gx_validation_display_driver_setup_4bpp_grayscale 102 -Dwin32_graphics_driver_setup_8bit_palette=gx_validation_display_driver_setup_8bit_palette 103 -Dwin32_graphics_driver_setup_8bit_palette_rotated=gx_validation_display_driver_setup_8bit_palette_rotated 104 -Dwin32_graphics_driver_setup_monochrome=gx_validation_display_driver_setup_monochrome 105 -Dwin32_dave2d_graphics_driver_setup_24xrgb=gx_validation_dave2d_display_driver_setup_24xrgb 106 -Dwin32_dave2d_graphics_driver_setup_565rgb=gx_validation_dave2d_display_driver_setup_565rgb 107 -Dwin32_dave2d_graphics_driver_setup_565rgb_rotated=gx_validation_dave2d_display_driver_setup_565rgb_rotated 108 -Dwin32_dave2d_graphics_driver_setup_8bit_palette_rotated=gx_validation_dave2d_display_driver_setup_8bit_palette_rotated 109 -Dwin32_dave2d_graphics_driver_setup_24xrgb_rotated=gx_validation_dave2d_display_driver_setup_24xrgb_rotated 110 ${${CMAKE_BUILD_TYPE}}) 111 112enable_testing() 113 114add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../../../ guix) 115add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/regression regression) 116 117# Create output files 118file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/regression/output_files) 119 120# Coverage 121if(CMAKE_BUILD_TYPE MATCHES ".*_coverage") 122 target_compile_options(guix PRIVATE -fprofile-arcs -ftest-coverage) 123 target_link_options(guix PRIVATE -fprofile-arcs -ftest-coverage) 124endif() 125 126# Build ThreadX library once 127execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/run.sh build_libs) 128add_custom_target(build_libs ALL COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/run.sh 129 build_libs) 130add_dependencies(guix build_libs) 131target_include_directories(guix PUBLIC ${CMAKE_BINARY_DIR}/../libs/inc) 132add_library(threadx SHARED IMPORTED GLOBAL) 133add_library("azrtos::threadx" ALIAS threadx) 134set_target_properties( 135 threadx PROPERTIES IMPORTED_LOCATION 136 ${CMAKE_BINARY_DIR}/../libs/threadx/libthreadx.so) 137 138target_compile_options( 139 guix 140 PRIVATE -Werror 141 -Wall 142 -Wextra 143 -pedantic 144 -fmessage-length=0 145 -fsigned-char 146 -ffunction-sections 147 -fdata-sections 148 -Wunused 149 -Wuninitialized 150 -Wmissing-declarations 151 -Wconversion 152 -Wpointer-arith 153 -Wshadow 154 -Wlogical-op 155 -Waggregate-return 156 -Wfloat-equal) 157