WiP Windows build workflow

This commit is contained in:
Raphael Coeffic
2021-09-13 11:13:08 +02:00
parent 8f8374f3b9
commit 118fc26374
12 changed files with 259 additions and 1144 deletions
+5 -5
View File
@@ -325,9 +325,9 @@ set(STM32LIB_SRC
MACRO(GET_GCC_INCLUDE_PATH gcc_include_path)
if (WIN32)
execute_process(COMMAND arm-none-eabi-gcc -v -x c -E NUL ERROR_VARIABLE _gcc_output OUTPUT_QUIET)
execute_process(COMMAND ${CMAKE_C_COMPILER} -v -x c -E NUL ERROR_VARIABLE _gcc_output OUTPUT_QUIET)
else()
execute_process(COMMAND arm-none-eabi-gcc -v -x c -E - INPUT_FILE /dev/null ERROR_VARIABLE _gcc_output OUTPUT_QUIET)
execute_process(COMMAND ${CMAKE_C_COMPILER} -v -x c -E - INPUT_FILE /dev/null ERROR_VARIABLE _gcc_output OUTPUT_QUIET)
endif()
# Build an array of string from the GCC output
@@ -346,7 +346,7 @@ MACRO(GET_GCC_INCLUDE_PATH gcc_include_path)
# Remove the leading and trailing empty characters
string(REPLACE "\r" "" _line ${_line})
string(SUBSTRING "${_line}" 1 -1 _line)
set(_include_path "${_include_path}" "-I${_line}")
set(_include_path "${_include_path}" "-I\"${_line}\"")
endif()
if(${_line} STREQUAL "#include <...> search starts here:")
@@ -357,12 +357,12 @@ MACRO(GET_GCC_INCLUDE_PATH gcc_include_path)
ENDMACRO()
if(PYTHONINTERP_FOUND)
GET_GCC_INCLUDE_PATH(arm_gcc_include_path)
GET_GCC_INCLUDE_PATH(gcc_include_path)
add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/radio/src/datacopy.cpp
WORKING_DIRECTORY ${RADIO_DIRECTORY}/src
COMMAND ${PYTHON_EXECUTABLE} ${RADIO_DIRECTORY}/util/generate_datacopy.py datastructs.h -DPCBHORUS -DPCBX10 -DCPUARM -DSTM32F4 -DSTM32F429_439xx -DCOLORLCD -DBACKUP -DSIMU -I. -Igui/colorlcd -Itargets/horus -Itargets/common/arm/stm32 -I${THIRDPARTY_DIR} -I${THIRDPARTY_DIR}/libopenui/src -I${THIRDPARTY_DIR}/STM32F4xx_DSP_StdPeriph_Lib_V1.8.0/Libraries/STM32F4xx_StdPeriph_Driver/inc -I${THIRDPARTY_DIR}/STM32F4xx_DSP_StdPeriph_Lib_V1.8.0/Libraries/CMSIS/Device/ST/STM32F4xx/Include -I${THIRDPARTY_DIR}/STM32F4xx_DSP_StdPeriph_Lib_V1.8.0/Libraries/CMSIS/Include ${arm_gcc_include_path} -Wno-pragma-once-outside-header > ${PROJECT_BINARY_DIR}/radio/src/datacopy.cpp
COMMAND ${PYTHON_EXECUTABLE} ${RADIO_DIRECTORY}/util/generate_datacopy.py datastructs.h -DPCBHORUS -DPCBX10 -DCPUARM -DSTM32F4 -DSTM32F429_439xx -DCOLORLCD -DBACKUP -DSIMU -I. -Igui/colorlcd -Itargets/horus -Itargets/common/arm/stm32 -I${THIRDPARTY_DIR} -I${THIRDPARTY_DIR}/libopenui/src -I${THIRDPARTY_DIR}/STM32F4xx_DSP_StdPeriph_Lib_V1.8.0/Libraries/STM32F4xx_StdPeriph_Driver/inc -I${THIRDPARTY_DIR}/STM32F4xx_DSP_StdPeriph_Lib_V1.8.0/Libraries/CMSIS/Device/ST/STM32F4xx/Include -I${THIRDPARTY_DIR}/STM32F4xx_DSP_StdPeriph_Lib_V1.8.0/Libraries/CMSIS/Include ${gcc_include_path} -Wno-pragma-once-outside-header > ${PROJECT_BINARY_DIR}/radio/src/datacopy.cpp
DEPENDS ${RADIO_DIRECTORY}/src/datastructs.h ${RADIO_DIRECTORY}/util/generate_datacopy.py
)
+21 -21
View File
@@ -208,24 +208,24 @@ void splitPath(const std::string & path, std::string & dir, std::string & name)
#if !MSVC_BUILD
bool isFile(const std::string & fullName, unsigned int d_type)
bool isFile(const std::string & fullName)
{
#if defined(WIN32) || defined(__APPLE__) || defined(__FreeBSD__)
#define REGULAR_FILE DT_REG
#define SYMBOLIC_LINK DT_LNK
#else
#define REGULAR_FILE simu::DT_REG
#define SYMBOLIC_LINK simu::DT_LNK
#endif
//#if defined(WIN32) || defined(__APPLE__) || defined(__FreeBSD__)
// #define REGULAR_FILE DT_REG
// #define SYMBOLIC_LINK DT_LNK
//#else
// #define REGULAR_FILE simu::DT_REG
// #define SYMBOLIC_LINK simu::DT_LNK
//#endif
if (d_type == REGULAR_FILE) return true;
if (d_type == SYMBOLIC_LINK) {
//if (d_type == REGULAR_FILE) return true;
//if (d_type == SYMBOLIC_LINK) {
struct stat tmp;
if (stat(fullName.c_str(), &tmp) == 0) {
// TRACE_SIMPGMSPACE("\tsymlik: %s is %s", fullName.c_str(), (tmp.st_mode & S_IFREG) ? "file" : "other");
if (tmp.st_mode & S_IFREG) return true;
}
}
//}
return false;
}
#endif
@@ -255,7 +255,7 @@ std::vector<std::string> listDirectoryFiles(const std::string & dirName)
struct simu::dirent * res;
while ((res = simu::readdir(dir)) != 0) {
std::string fullName = dirName + "/" + std::string(res->d_name);
if (isFile(fullName, res->d_type)) {
if (isFile(fullName)) {
// TRACE_SIMPGMSPACE("listDirectoryFiles(): %s", fullName.c_str());
result.push_back(fullName);
}
@@ -452,20 +452,20 @@ FRESULT f_readdir (DIR * rep, FILINFO * fil)
if (strcmp(ent->d_name, ".") && strcmp(ent->d_name, "..") ) break;
}
#if defined(WIN32) || !defined(__GNUC__) || defined(__APPLE__) || defined(__FreeBSD__)
fil->fattrib = (ent->d_type == DT_DIR ? AM_DIR : 0);
#else
if (ent->d_type == simu::DT_UNKNOWN || ent->d_type == simu::DT_LNK) {
//#if defined(WIN32) || !defined(__GNUC__) || defined(__APPLE__) || defined(__FreeBSD__)
// fil->fattrib = (ent->d_type == DT_DIR ? AM_DIR : 0);
//#else
// if (ent->d_type == simu::DT_UNKNOWN || ent->d_type == simu::DT_LNK) {
fil->fattrib = 0;
struct stat buf;
if (stat(ent->d_name, &buf) == 0) {
fil->fattrib = (S_ISDIR(buf.st_mode) ? AM_DIR : 0);
}
}
else {
fil->fattrib = (ent->d_type == simu::DT_DIR ? AM_DIR : 0);
}
#endif
//}
//else {
// fil->fattrib = (ent->d_type == simu::DT_DIR ? AM_DIR : 0);
//}
//#endif
memset(fil->fname, 0, FF_MAX_LFN);
strcpy(fil->fname, ent->d_name);