VC++ compilation
This commit is contained in:
@@ -130,7 +130,7 @@ Section "OpenTX Companion" SecDummy
|
|||||||
|
|
||||||
CreateDirectory "$INSTDIR\lang"
|
CreateDirectory "$INSTDIR\lang"
|
||||||
SetOutPath "$INSTDIR\lang"
|
SetOutPath "$INSTDIR\lang"
|
||||||
File "*.qm"
|
File "*companion/src/.qm"
|
||||||
|
|
||||||
SetOutPath "$INSTDIR"
|
SetOutPath "$INSTDIR"
|
||||||
;Store installation folder
|
;Store installation folder
|
||||||
|
|||||||
+75
-78
@@ -16,9 +16,7 @@ option(AUTOSWITCH "Automatic switch detection in menus" ON)
|
|||||||
|
|
||||||
set(OPT s)
|
set(OPT s)
|
||||||
|
|
||||||
if (NOT MSVC)
|
enable_language(ASM)
|
||||||
enable_language(ASM)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(THIRDPARTY_DIR thirdparty)
|
set(THIRDPARTY_DIR thirdparty)
|
||||||
set(LUA_DIR ${THIRDPARTY_DIR}/Lua/src)
|
set(LUA_DIR ${THIRDPARTY_DIR}/Lua/src)
|
||||||
@@ -659,92 +657,91 @@ endif()
|
|||||||
|
|
||||||
set(SRC ${SRC} ${FIRMWARE_SRC})
|
set(SRC ${SRC} ${FIRMWARE_SRC})
|
||||||
|
|
||||||
if(NOT MSVC)
|
include(CMakeForceCompiler)
|
||||||
include(CMakeForceCompiler)
|
|
||||||
|
|
||||||
set(WARNING_FLAGS "-Wall -Wno-strict-aliasing -Wformat -Wreturn-type -Wunused -Wuninitialized -Wunknown-pragmas -Wno-switch -Wtype-limits")
|
set(WARNING_FLAGS "-Wall -Wno-strict-aliasing -Wformat -Wreturn-type -Wunused -Wuninitialized -Wunknown-pragmas -Wno-switch -Wtype-limits")
|
||||||
|
|
||||||
# trick to remove the -rdynamic issue
|
# trick to remove the -rdynamic issue
|
||||||
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
|
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
|
||||||
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
|
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
|
||||||
|
|
||||||
if(ARCH STREQUAL ARM)
|
if(ARCH STREQUAL ARM)
|
||||||
cmake_force_c_compiler(arm-none-eabi-gcc GNU)
|
cmake_force_c_compiler(arm-none-eabi-gcc GNU)
|
||||||
cmake_force_cxx_compiler(arm-none-eabi-gcc GNU)
|
cmake_force_cxx_compiler(arm-none-eabi-gcc GNU)
|
||||||
set(CMAKE_ASM_COMPILER arm-none-eabi-as)
|
set(CMAKE_ASM_COMPILER arm-none-eabi-as)
|
||||||
|
|
||||||
set(CMAKE_SYSTEM_NAME Generic)
|
set(CMAKE_SYSTEM_NAME Generic)
|
||||||
set(CMAKE_SYSTEM_VERSION 1)
|
set(CMAKE_SYSTEM_VERSION 1)
|
||||||
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -o <OBJECT> <SOURCE>")
|
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -o <OBJECT> <SOURCE>")
|
||||||
|
|
||||||
set(COMMON_FLAGS "-mcpu=${MCU} -mthumb -fomit-frame-pointer -fverbose-asm -Wa,-ahlms=opentx.lst -O${OPT} -gdwarf-2 -DHSE_VALUE=${HSE_VALUE} -fno-exceptions -fdata-sections -ffunction-sections ${WARNING_FLAGS}")
|
set(COMMON_FLAGS "-mcpu=${MCU} -mthumb -fomit-frame-pointer -fverbose-asm -Wa,-ahlms=opentx.lst -O${OPT} -gdwarf-2 -DHSE_VALUE=${HSE_VALUE} -fno-exceptions -fdata-sections -ffunction-sections ${WARNING_FLAGS}")
|
||||||
set(CMAKE_C_FLAGS "${COMMON_FLAGS} -Wimplicit")
|
set(CMAKE_C_FLAGS "${COMMON_FLAGS} -Wimplicit")
|
||||||
set(CMAKE_CXX_FLAGS "${COMMON_FLAGS}")
|
set(CMAKE_CXX_FLAGS "${COMMON_FLAGS}")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "-mcpu=${MCU} -mthumb -nostartfiles -lm -T${RADIO_SRC_DIRECTORY}/${LINKER_SCRIPT} -Wl,-Map=opentx.map,--cref,--no-warn-mismatch,--gc-sections")
|
set(CMAKE_EXE_LINKER_FLAGS "-mcpu=${MCU} -mthumb -nostartfiles -lm -T${RADIO_SRC_DIRECTORY}/${LINKER_SCRIPT} -Wl,-Map=opentx.map,--cref,--no-warn-mismatch,--gc-sections")
|
||||||
|
|
||||||
if(PCB STREQUAL TARANIS)
|
if(PCB STREQUAL TARANIS)
|
||||||
add_subdirectory(targets/${TARGET_DIR}/bootloader)
|
add_subdirectory(targets/${TARGET_DIR}/bootloader)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT bootloader.bin bootloader.lbm
|
OUTPUT bootloader.bin bootloader.lbm
|
||||||
COMMAND arm-none-eabi-objcopy -O binary targets/${TARGET_DIR}/bootloader/bootloader.elf bootloader.bin
|
COMMAND arm-none-eabi-objcopy -O binary targets/${TARGET_DIR}/bootloader/bootloader.elf bootloader.bin
|
||||||
COMMAND python ${RADIO_DIRECTORY}/util/bin2lbm.py bootloader.bin bootloader.lbm
|
COMMAND python ${RADIO_DIRECTORY}/util/bin2lbm.py bootloader.bin bootloader.lbm
|
||||||
DEPENDS bootloader.elf
|
DEPENDS bootloader.elf
|
||||||
)
|
|
||||||
add_custom_target(bootloader DEPENDS bootloader.lbm)
|
|
||||||
set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} bootloader)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_executable(firmware.elf ${SRC} ${FIRMWARE_HEADERS})
|
|
||||||
add_dependencies(firmware.elf ${FIRMWARE_DEPENDENCIES})
|
|
||||||
|
|
||||||
add_custom_target(firmware.bin
|
|
||||||
COMMAND arm-none-eabi-objcopy -O binary firmware.elf firmware.bin
|
|
||||||
DEPENDS firmware.elf
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
cmake_force_c_compiler(avr-gcc GNU)
|
|
||||||
cmake_force_cxx_compiler(avr-gcc GNU)
|
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS "-mmcu=${MCU} -DF_CPU=16000000UL -O${OPT} -gdwarf-2 -fno-exceptions -flto -fwhole-program -fno-inline-small-functions -mstrict-X ${WARNING_FLAGS}")
|
|
||||||
|
|
||||||
include_directories(storage gui/${GUI_DIR})
|
|
||||||
|
|
||||||
set(ALLSRC ${PROJECT_BINARY_DIR}/allsrc.cpp)
|
|
||||||
foreach(FILE ${SRC})
|
|
||||||
file(READ ${FILE} FILE_CONTENT)
|
|
||||||
set(ALLSRC_CONTENT "${ALLSRC_CONTENT}# 1 \"${FILE}\"\n${FILE_CONTENT}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
file(WRITE ${ALLSRC} "${ALLSRC_CONTENT}")
|
|
||||||
|
|
||||||
add_executable(firmware.elf ${ALLSRC})
|
|
||||||
add_dependencies(firmware.elf ${FIRMWARE_DEPENDENCIES})
|
|
||||||
|
|
||||||
add_custom_target(firmware.hex
|
|
||||||
COMMAND avr-objcopy -O ihex -R .eeprom firmware.elf firmware.hex
|
|
||||||
DEPENDS firmware.elf
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_target(firmware.bin
|
|
||||||
COMMAND avr-objcopy -O binary firmware.elf firmware.bin
|
|
||||||
DEPENDS firmware.elf
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_target(firmware
|
|
||||||
COMMAND avr-size --mcu=${MCU} --format=avr firmware.elf
|
|
||||||
DEPENDS firmware.hex
|
|
||||||
)
|
)
|
||||||
|
add_custom_target(bootloader DEPENDS bootloader.lbm)
|
||||||
|
set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} bootloader)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_custom_target(firmware.lss
|
add_executable(firmware.elf ${SRC} ${FIRMWARE_HEADERS})
|
||||||
COMMAND avr-objdump -h -S firmware.elf > firmware.lss
|
add_dependencies(firmware.elf ${FIRMWARE_DEPENDENCIES})
|
||||||
|
|
||||||
|
add_custom_target(firmware.bin
|
||||||
|
COMMAND arm-none-eabi-objcopy -O binary firmware.elf firmware.bin
|
||||||
|
DEPENDS firmware.elf
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
cmake_force_c_compiler(avr-gcc GNU)
|
||||||
|
cmake_force_cxx_compiler(avr-gcc GNU)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_FLAGS "-mmcu=${MCU} -DF_CPU=16000000UL -O${OPT} -gdwarf-2 -fno-exceptions -flto -fwhole-program -fno-inline-small-functions -mstrict-X ${WARNING_FLAGS}")
|
||||||
|
|
||||||
|
include_directories(storage gui/${GUI_DIR})
|
||||||
|
|
||||||
|
set(ALLSRC ${PROJECT_BINARY_DIR}/allsrc.cpp)
|
||||||
|
foreach(FILE ${SRC})
|
||||||
|
file(READ ${FILE} FILE_CONTENT)
|
||||||
|
set(ALLSRC_CONTENT "${ALLSRC_CONTENT}# 1 \"${FILE}\"\n${FILE_CONTENT}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
file(WRITE ${ALLSRC} "${ALLSRC_CONTENT}")
|
||||||
|
|
||||||
|
add_executable(firmware.elf ${ALLSRC})
|
||||||
|
add_dependencies(firmware.elf ${FIRMWARE_DEPENDENCIES})
|
||||||
|
|
||||||
|
add_custom_target(firmware.hex
|
||||||
|
COMMAND avr-objcopy -O ihex -R .eeprom firmware.elf firmware.hex
|
||||||
DEPENDS firmware.elf
|
DEPENDS firmware.elf
|
||||||
)
|
)
|
||||||
|
|
||||||
if(CPU_FAMILY STREQUAL STM32)
|
add_custom_target(firmware.bin
|
||||||
add_custom_target(flash
|
COMMAND avr-objcopy -O binary firmware.elf firmware.bin
|
||||||
COMMAND dfu-util --alt 0 --dfuse-address 0x08000000 -D firmware.bin
|
DEPENDS firmware.elf
|
||||||
DEPENDS firmware.bin
|
)
|
||||||
|
|
||||||
|
add_custom_target(firmware
|
||||||
|
COMMAND avr-size --mcu=${MCU} --format=avr firmware.elf
|
||||||
|
DEPENDS firmware.hex
|
||||||
)
|
)
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_custom_target(firmware.lss
|
||||||
|
COMMAND avr-objdump -h -S firmware.elf > firmware.lss
|
||||||
|
DEPENDS firmware.elf
|
||||||
|
)
|
||||||
|
|
||||||
|
if(CPU_FAMILY STREQUAL STM32)
|
||||||
|
add_custom_target(flash
|
||||||
|
COMMAND dfu-util --alt 0 --dfuse-address 0x08000000 -D firmware.bin
|
||||||
|
DEPENDS firmware.bin
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
add_truetype_font_target(horus tinsize "DejaVu Sans" 9)
|
add_truetype_font_target(horus tinsize "DejaVu Sans" 9)
|
||||||
add_truetype_font_target(horus smlsize "DejaVu Sans" 13)
|
add_truetype_font_target(horus smlsize "DejaVu Sans" 13)
|
||||||
add_truetype_font_target(horus stdsize "DejaVu Sans" 16)
|
add_truetype_font_target(horus stdsize "DejaVu Sans" 16)
|
||||||
add_truetype_font_target(horus midsize "DejaVu Sans" 24)
|
add_truetype_font_target(horus midsize "DejaVu Sans" 24)
|
||||||
add_truetype_font_target(horus xxlsize "DejaVu Sans" 48)
|
add_truetype_font_target(horus xxlsize "DejaVu Sans" 48)
|
||||||
add_custom_target(ttf_horus_fonts DEPENDS ttf_horus_tinsize ttf_horus_smlsize ttf_horus_stdsize ttf_horus_midsize ttf_horus_dblsize ttf_horus_xxlsize)
|
add_custom_target(ttf_horus_fonts DEPENDS ttf_horus_tinsize ttf_horus_smlsize ttf_horus_stdsize ttf_horus_midsize ttf_horus_dblsize ttf_horus_xxlsize)
|
||||||
|
|
||||||
add_bitmaps_target(horus_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/????[^_]*.png" 480 5/6/5/8)
|
add_bitmaps_target(horus_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/????[^_]*.png" 480 5/6/5/8)
|
||||||
add_bitmaps_target(horus_masks ${RADIO_SRC_DIRECTORY}/bitmaps/horus/mask_*.png 480 8bits)
|
add_bitmaps_target(horus_masks ${RADIO_SRC_DIRECTORY}/bitmaps/horus/mask_*.png 480 8bits)
|
||||||
add_bitmaps_target(horus_fonts ${RADIO_SRC_DIRECTORY}/fonts/horus/*.png 480 8bits)
|
add_bitmaps_target(horus_fonts ${RADIO_SRC_DIRECTORY}/fonts/horus/*.png 480 8bits)
|
||||||
add_dependencies(horus_bitmaps horus_masks)
|
add_dependencies(horus_bitmaps horus_masks)
|
||||||
|
|||||||
Reference in New Issue
Block a user