mirror of
https://github.com/opentx/opentx.git
synced 2025-07-12 19:10:19 +03:00
Support Companion build with clang-cl on Windows (fw/libsimu not working yet due to compiler-specific macros in that code).
This commit is contained in:
parent
d507dbb5dd
commit
6110bbce98
4 changed files with 17 additions and 6 deletions
|
@ -72,9 +72,13 @@ else()
|
||||||
set(LUA NO)
|
set(LUA NO)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") # regular Clang or AppleClang
|
||||||
|
set(CLANG TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
option(DISABLE_COMPANION "Disable building companion and simulators" OFF)
|
option(DISABLE_COMPANION "Disable building companion and simulators" OFF)
|
||||||
|
|
||||||
if(NOT DISABLE_COMPANION)
|
if(NOT DISABLE_COMPANION) # FIXME cosmetics/style
|
||||||
find_package(Qt5Core)
|
find_package(Qt5Core)
|
||||||
find_package(Qt5Widgets)
|
find_package(Qt5Widgets)
|
||||||
find_package(Qt5Xml)
|
find_package(Qt5Xml)
|
||||||
|
@ -114,6 +118,9 @@ if(Qt5Core_FOUND)
|
||||||
list(APPEND APP_COMMON_DEFINES -DQXT_STATIC)
|
list(APPEND APP_COMMON_DEFINES -DQXT_STATIC)
|
||||||
list(APPEND APP_COMMON_DEFINES -DQT_USE_QSTRINGBUILDER) # more efficient QString construction using % operator
|
list(APPEND APP_COMMON_DEFINES -DQT_USE_QSTRINGBUILDER) # more efficient QString construction using % operator
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
list(APPEND APP_COMMON_DEFINES -D__STDC_LIMIT_MACROS)
|
||||||
|
endif()
|
||||||
if(APP_CUSTOM_DBG_HANDLER)
|
if(APP_CUSTOM_DBG_HANDLER)
|
||||||
# provide full qDebug log context to our custom handler. This may also affect libsimulator, which is why it is here
|
# provide full qDebug log context to our custom handler. This may also affect libsimulator, which is why it is here
|
||||||
list(APPEND APP_COMMON_DEFINES -DQT_MESSAGELOGCONTEXT)
|
list(APPEND APP_COMMON_DEFINES -DQT_MESSAGELOGCONTEXT)
|
||||||
|
@ -153,7 +160,7 @@ if(Qt5Core_FOUND OR FOX_FOUND)
|
||||||
message(STATUS "SDL not found! Simulator audio, and joystick inputs, will not work.")
|
message(STATUS "SDL not found! Simulator audio, and joystick inputs, will not work.")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif(NOT DISABLE_COMPANION)
|
||||||
|
|
||||||
# Check for a file that is typically left from a OpenTX 2.1 build and abort if found
|
# Check for a file that is typically left from a OpenTX 2.1 build and abort if found
|
||||||
if (EXISTS ${RADIO_SRC_DIRECTORY}/stamp.h OR EXISTS ${RADIO_SRC_DIRECTORY}/translations/en.h)
|
if (EXISTS ${RADIO_SRC_DIRECTORY}/stamp.h OR EXISTS ${RADIO_SRC_DIRECTORY}/translations/en.h)
|
||||||
|
|
|
@ -49,8 +49,8 @@ macro(use_cxx11)
|
||||||
endmacro(use_cxx11)
|
endmacro(use_cxx11)
|
||||||
|
|
||||||
macro(PrintTargetReport targetName)
|
macro(PrintTargetReport targetName)
|
||||||
if(CMAKE_CXX_COMPILER MATCHES "/cl\\.exe$")
|
if(CMAKE_CXX_COMPILER MATCHES "/(clang-)?cl\\.exe$")
|
||||||
set(cpp_version ${MSVC_VERSION})
|
set(cpp_version ${CMAKE_CXX_COMPILER_VERSION})
|
||||||
else()
|
else()
|
||||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE cpp_version)
|
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE cpp_version)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -81,7 +81,9 @@ if(WIN32)
|
||||||
set(WIN_EXECUTABLE_TYPE WIN32) # GUI (WinMain) app
|
set(WIN_EXECUTABLE_TYPE WIN32) # GUI (WinMain) app
|
||||||
endif()
|
endif()
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /LD /MP")
|
if(NOT CLANG)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /LD /MP")
|
||||||
|
endif()
|
||||||
if(NOT WIN_USE_CONSOLE)
|
if(NOT WIN_USE_CONSOLE)
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS,5.01") # is this even needed?
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS,5.01") # is this even needed?
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -75,7 +75,9 @@ if(WIN32)
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
set(CMAKE_CXX_FLAGS "/EHsc /LD /MP")
|
if(NOT CLANG)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /LD /MP")
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
if(MINGW)
|
if(MINGW)
|
||||||
# struct packing breaks on MinGW w/out -mno-ms-bitfields: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991 & http://stackoverflow.com/questions/24015852/struct-packing-and-alignment-with-mingw
|
# struct packing breaks on MinGW w/out -mno-ms-bitfields: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991 & http://stackoverflow.com/questions/24015852/struct-packing-and-alignment-with-mingw
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue