Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More documentation for building with cmake #42

Open
christophe0606 opened this issue Aug 21, 2023 · 0 comments
Open

More documentation for building with cmake #42

christophe0606 opened this issue Aug 21, 2023 · 0 comments
Labels
documentation This issue is a documentation flaw that will be improved in future. help wanted Extra attention is needed Review This issue is under review. Please be patient.

Comments

@christophe0606
Copy link
Contributor

christophe0606 commented Aug 21, 2023

There is a new cmake build but more information is needed.

An example CMakeLists.txt could look like this one (not yet tested):

# Because we are adding sub directories that are not subfolder of the project
cmake_policy(SET CMP0079 NEW)

project(arm2d_demo_examples C CXX ASM)

set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)

# For GCC. Change if you use different compiler.
add_compile_options(
    -g
    -ffunction-sections 
    -fdata-sections
    -Ofast)

add_link_options(-flto)


add_executable(arm2d_demo  main.c ...)

# If you include Arm2D headers from any CPP file you need to at least
# disable those warnings 
# (but there will be other warnings)
set_source_files_properties(anycppfile.cpp PROPERTIES COMPILE_FLAGS -Wno-subobject-linkage)

# Add platform sources
# This must be copied from Arm-2D project template folder and customized
target_sources(arm2d_demo PUBLIC platform/arm_2d_disp_adapter_0.c)
   
#When building on host (for instance Mac) you may want to add this
#target_compile_definitions(arm2d_demo PRIVATE _THREAD_SAFE SDL_DISABLE_ARM_NEON_H)
    
# Add CMSIS-DSP project
# Set to ON when building on host (Mac for instance). OFF for embedded
option(HOST "" OFF)
add_subdirectory(${CMSISDSP}/Source bin_dsp)

# Add Arm2D project
# Define the options before adding the project

# Set to ON when building on host (Mac for instance). To OFF for embedded.
option(ARM2D_HOST "" OFF)

option(ARM2D_CONTROLS "" ON)
option(ARM2D_HELPER "" ON)
option(ARM2D_LCD_PRINTF "" ON)
option(ARM2D_BENCHMARK_GENERIC "" OFF)
option(ARM2D_BENCHMARK_WATCHPANEL "" OFF)
option(ARM2D_ALPHA_BLENDING "" ON)
option(ARM2D_TRANSFORM "" ON)

add_subdirectory(${ARM2D} arm2d_demo_bin)

# Some Arm2D headers must be copied into platform and customized
# Those headers can be found in the Arm-2D template folder
target_include_directories(ARM2D PUBLIC platform)

# Link libs ARM2D depends on CMSISDSP
# and the app depends on Arm2D 
# CMSISDSP -> Arm-2D
target_link_libraries(ARM2D PUBLIC CMSISDSP)
# Arm-2D -> Your app
target_link_libraries(arm2d_demo PUBLIC ARM2D)

# Include SDL if building on host
#target_include_directories(arm2d_demo PUBLIC ${SDL2_INCLUDE_DIR})
#target_link_directories(arm2d_demo PUBLIC ${SDL2_LIBRARY})
# Link SDL
#target_link_libraries(arm2d_demo PUBLIC SDL2main SDL2)

# If SDL used, you'll need support file in the Platform folder. 
# It can be found in Arm-2D example folders
@GorgonMeducer GorgonMeducer added documentation This issue is a documentation flaw that will be improved in future. help wanted Extra attention is needed Review This issue is under review. Please be patient. labels Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation This issue is a documentation flaw that will be improved in future. help wanted Extra attention is needed Review This issue is under review. Please be patient.
Projects
None yet
Development

No branches or pull requests

2 participants