1
0
Fork 0
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:
Max Paperno 2018-07-09 12:02:26 -04:00
parent d507dbb5dd
commit 6110bbce98
No known key found for this signature in database
GPG key ID: F5A9DFACA08DD174
4 changed files with 17 additions and 6 deletions

View file

@ -72,9 +72,13 @@ else()
set(LUA NO)
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)
if(NOT DISABLE_COMPANION)
if(NOT DISABLE_COMPANION) # FIXME cosmetics/style
find_package(Qt5Core)
find_package(Qt5Widgets)
find_package(Qt5Xml)
@ -114,6 +118,9 @@ if(Qt5Core_FOUND)
list(APPEND APP_COMMON_DEFINES -DQXT_STATIC)
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)
# 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)
@ -153,7 +160,7 @@ if(Qt5Core_FOUND OR FOX_FOUND)
message(STATUS "SDL not found! Simulator audio, and joystick inputs, will not work.")
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
if (EXISTS ${RADIO_SRC_DIRECTORY}/stamp.h OR EXISTS ${RADIO_SRC_DIRECTORY}/translations/en.h)

View file

@ -49,8 +49,8 @@ macro(use_cxx11)
endmacro(use_cxx11)
macro(PrintTargetReport targetName)
if(CMAKE_CXX_COMPILER MATCHES "/cl\\.exe$")
set(cpp_version ${MSVC_VERSION})
if(CMAKE_CXX_COMPILER MATCHES "/(clang-)?cl\\.exe$")
set(cpp_version ${CMAKE_CXX_COMPILER_VERSION})
else()
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE cpp_version)
endif()

View file

@ -81,7 +81,9 @@ if(WIN32)
set(WIN_EXECUTABLE_TYPE WIN32) # GUI (WinMain) app
endif()
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)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS,5.01") # is this even needed?
endif()

View file

@ -75,7 +75,9 @@ if(WIN32)
endif(WIN32)
if(MSVC)
set(CMAKE_CXX_FLAGS "/EHsc /LD /MP")
if(NOT CLANG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /LD /MP")
endif()
else()
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