VC++ compilation
This commit is contained in:
+15
-12
@@ -16,7 +16,9 @@ option(AUTOSWITCH "Automatic switch detection in menus" ON)
|
|||||||
|
|
||||||
set(OPT s)
|
set(OPT s)
|
||||||
|
|
||||||
enable_language(ASM)
|
if (NOT MSVC)
|
||||||
|
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)
|
||||||
@@ -657,15 +659,16 @@ endif()
|
|||||||
|
|
||||||
set(SRC ${SRC} ${FIRMWARE_SRC})
|
set(SRC ${SRC} ${FIRMWARE_SRC})
|
||||||
|
|
||||||
include(CMakeForceCompiler)
|
if(NOT MSVC)
|
||||||
|
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)
|
||||||
@@ -698,7 +701,7 @@ if(ARCH STREQUAL ARM)
|
|||||||
COMMAND arm-none-eabi-objcopy -O binary firmware.elf firmware.bin
|
COMMAND arm-none-eabi-objcopy -O binary firmware.elf firmware.bin
|
||||||
DEPENDS firmware.elf
|
DEPENDS firmware.elf
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
cmake_force_c_compiler(avr-gcc GNU)
|
cmake_force_c_compiler(avr-gcc GNU)
|
||||||
cmake_force_cxx_compiler(avr-gcc GNU)
|
cmake_force_cxx_compiler(avr-gcc GNU)
|
||||||
|
|
||||||
@@ -731,17 +734,17 @@ else()
|
|||||||
COMMAND avr-size --mcu=${MCU} --format=avr firmware.elf
|
COMMAND avr-size --mcu=${MCU} --format=avr firmware.elf
|
||||||
DEPENDS firmware.hex
|
DEPENDS firmware.hex
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_custom_target(firmware.lss
|
add_custom_target(firmware.lss
|
||||||
COMMAND avr-objdump -h -S firmware.elf > firmware.lss
|
COMMAND avr-objdump -h -S firmware.elf > firmware.lss
|
||||||
DEPENDS firmware.elf
|
DEPENDS firmware.elf
|
||||||
)
|
)
|
||||||
|
|
||||||
if(CPU_FAMILY STREQUAL STM32)
|
if(CPU_FAMILY STREQUAL STM32)
|
||||||
add_custom_target(flash
|
add_custom_target(flash
|
||||||
COMMAND dfu-util --alt 0 --dfuse-address 0x08000000 -D firmware.bin
|
COMMAND dfu-util --alt 0 --dfuse-address 0x08000000 -D firmware.bin
|
||||||
DEPENDS firmware.bin
|
DEPENDS firmware.bin
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user