Merge pull request #1282 from EdgeTX/pfeerick/issue395

End the LUA != LUA confusion
This commit is contained in:
Raphael Coeffic
2021-12-24 08:07:57 +01:00
committed by GitHub
6 changed files with 16 additions and 8 deletions
+8 -3
View File
@@ -36,6 +36,7 @@ if(SDL_FOUND)
option(SIMU_AUDIO "Enable simulator audio." ON) option(SIMU_AUDIO "Enable simulator audio." ON)
endif() endif()
option(LUA "Enable LUA support" ON) option(LUA "Enable LUA support" ON)
option(LUA_MIXER "Enable LUA mixer/model scripts support" OFF)
option(SIMU_DISKIO "Enable disk IO simulation in simulator. Simulator will use FatFs module and simulated IO layer that uses \"./sdcard.image\" file as image of SD card. This file must contain whole SD card from first to last sector" OFF) option(SIMU_DISKIO "Enable disk IO simulation in simulator. Simulator will use FatFs module and simulated IO layer that uses \"./sdcard.image\" file as image of SD card. This file must contain whole SD card from first to last sector" OFF)
option(SIMU_LUA_COMPILER "Pre-compile and save Lua scripts in simulator." ON) option(SIMU_LUA_COMPILER "Pre-compile and save Lua scripts in simulator." ON)
option(FAS_PROTOTYPE "Support of old FAS prototypes (different resistors)" OFF) option(FAS_PROTOTYPE "Support of old FAS prototypes (different resistors)" OFF)
@@ -199,7 +200,7 @@ if(RTC_BACKUP_RAM)
set(GTEST_SRC ${GTEST_SRC} ${RADIO_SRC_DIR}/storage/rtc_backup.cpp) set(GTEST_SRC ${GTEST_SRC} ${RADIO_SRC_DIR}/storage/rtc_backup.cpp)
endif() endif()
if(NOT LUA STREQUAL NO) if(LUA)
add_definitions(-DLUA) add_definitions(-DLUA)
if(LUA_COMPILER) if(LUA_COMPILER)
add_definitions(-DLUA_COMPILER) add_definitions(-DLUA_COMPILER)
@@ -212,7 +213,7 @@ if(NOT LUA STREQUAL NO)
endif() endif()
include_directories(${LUA_DIR}) include_directories(${LUA_DIR})
set(RADIO_DEPENDENCIES ${RADIO_DEPENDENCIES} ${LUA_EXPORT}) set(RADIO_DEPENDENCIES ${RADIO_DEPENDENCIES} ${LUA_EXPORT})
if(LUA STREQUAL YES) if(LUA_MIXER)
add_definitions(-DLUA_MODEL_SCRIPTS) add_definitions(-DLUA_MODEL_SCRIPTS)
endif() endif()
@@ -273,6 +274,10 @@ if(NOT LUA STREQUAL NO)
endif() endif()
endif() endif()
if (LUA_MIXER AND NOT LUA)
message(FATAL_ERROR "LUA_MIXER requires LUA!!")
endif()
if(HELI) if(HELI)
add_definitions(-DHELI) add_definitions(-DHELI)
endif() endif()
@@ -589,7 +594,7 @@ if(NOT MSVC)
# Use newlib nano, which saves a few kilobytes. # Use newlib nano, which saves a few kilobytes.
if(NOT NANO STREQUAL NO) if(NOT NANO STREQUAL NO)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --specs=nano.specs") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --specs=nano.specs")
if(NOT LUA STREQUAL NO) if(LUA)
# Lua needs %g and %f # Lua needs %g and %f
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -u _printf_float -u _scanf_float") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -u _printf_float -u _scanf_float")
endif() endif()
+1 -1
View File
@@ -28,7 +28,7 @@ if(FLIGHT_MODES)
) )
endif() endif()
if(LUA STREQUAL YES) if(LUA_MIXER)
set(GUI_SRC set(GUI_SRC
${GUI_SRC} ${GUI_SRC}
model_custom_scripts.cpp model_custom_scripts.cpp
+1 -1
View File
@@ -28,7 +28,7 @@ if(FLIGHT_MODES)
) )
endif() endif()
if(LUA STREQUAL YES) if(LUA_MIXER)
set(GUI_SRC set(GUI_SRC
${GUI_SRC} ${GUI_SRC}
model_custom_scripts.cpp model_custom_scripts.cpp
+1 -1
View File
@@ -89,7 +89,7 @@ if(LUA)
set(SRC ${SRC} lua/widgets.cpp) set(SRC ${SRC} lua/widgets.cpp)
endif() endif()
if(LUA STREQUAL YES) if(LUA_MIXER)
add_gui_src(model_mixer_scripts.cpp) add_gui_src(model_mixer_scripts.cpp)
endif() endif()
+2 -1
View File
@@ -119,6 +119,7 @@ class FormGridLayoutEx : public FormGridLayout
uint8_t _lineHeight = PAGE_LINE_HEIGHT; uint8_t _lineHeight = PAGE_LINE_HEIGHT;
}; };
#if defined(LUA)
void buildLuaUi(std::vector<LuaScript> luaScripts, FormWindow *window, FormGridLayoutEx &grid) void buildLuaUi(std::vector<LuaScript> luaScripts, FormWindow *window, FormGridLayoutEx &grid)
{ {
for (auto luaScript : luaScripts) { for (auto luaScript : luaScripts) {
@@ -156,7 +157,7 @@ void buildLuaUi(std::vector<LuaScript> luaScripts, FormWindow *window, FormGridL
grid.nextLine(); grid.nextLine();
} }
} }
#endif
void RadioToolsPage::rebuild(FormWindow * window) void RadioToolsPage::rebuild(FormWindow * window)
{ {
+2
View File
@@ -21,6 +21,7 @@
#pragma once #pragma once
#if defined(LUA)
#include "libopenui.h" #include "libopenui.h"
#include "lua/lua_api.h" #include "lua/lua_api.h"
@@ -77,3 +78,4 @@ protected:
LuaTouchData touch; LuaTouchData touch;
#endif #endif
}; };
#endif