80 lines
1.7 KiB
CMake
80 lines
1.7 KiB
CMake
cmake_minimum_required(VERSION 3.10)
|
|
|
|
project("FT22 Steering Wheel Display")
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
# DEPENDENCIES {{{
|
|
|
|
find_package(SDL2 REQUIRED)
|
|
find_package(SDL2TTF REQUIRED)
|
|
find_package(SDL2IMAGE REQUIRED)
|
|
find_library(I2C_LIBRARY i2c REQUIRED)
|
|
if ("${I2C_LIBRARY}" STREQUAL "I2C_LIBRARY-NOTFOUND")
|
|
message(FATAL_ERROR "libi2c not found!")
|
|
else()
|
|
message("libi2c found at ${I2C_LIBRARY}")
|
|
endif()
|
|
|
|
include(FetchContent)
|
|
|
|
# fmtlib
|
|
set(stw_display_orig_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
|
|
set(BUILD_SHARED_LIBS ON)
|
|
FetchContent_Declare(
|
|
fmt
|
|
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
|
|
GIT_TAG 8.1.1
|
|
)
|
|
if (NOT fmt_POPULATED)
|
|
FetchContent_MakeAvailable(fmt)
|
|
endif()
|
|
if (NOT DEFINED fmt_INCLUDE_DIR)
|
|
set(fmt_INCLUDE_DIR ${fmt_SOURCE_DIR}/${FMT_INC_DIR})
|
|
endif()
|
|
set(BUILD_SHARED_LIBS ${stw_display_orig_BUILD_SHARED_LIBS})
|
|
|
|
# spdlog
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE true)
|
|
set(SPDLOG_FMT_EXTERNAL_HO true)
|
|
FetchContent_Declare(
|
|
spdlog
|
|
GIT_REPOSITORY https://github.com/gabime/spdlog.git
|
|
GIT_TAG v1.9.2
|
|
)
|
|
FetchContent_MakeAvailable(spdlog)
|
|
|
|
# }}}
|
|
|
|
add_compile_options(-Wall -Wextra -Wimplicit-fallthrough)
|
|
|
|
add_executable(
|
|
stw-display
|
|
src/main.cpp
|
|
src/App.cpp
|
|
src/AppState.cpp
|
|
src/View.cpp
|
|
src/MissionSelect.cpp
|
|
src/widgets.cpp
|
|
src/util.cpp
|
|
)
|
|
target_include_directories(
|
|
stw-display PUBLIC
|
|
"include"
|
|
)
|
|
target_include_directories(
|
|
stw-display PRIVATE
|
|
${SDL2_INCLUDE_DIRS}
|
|
${fmt_INCLUDE_DIR}
|
|
)
|
|
target_link_libraries(
|
|
stw-display
|
|
${SDL2_LIBRARIES}
|
|
${SDL2TTF_LIBRARY}
|
|
${SDL2IMAGE_LIBRARY}
|
|
${I2C_LIBRARY}
|
|
fmt
|
|
spdlog::spdlog)
|
|
add_dependencies(stw-display fmt) |