From 3e894b2de018cadb1ca1c17ae79cd5eb6bd71c88 Mon Sep 17 00:00:00 2001 From: Gammasoft Date: Wed, 27 Dec 2023 08:44:20 +0100 Subject: [PATCH] Simplifying the CMake file --- CMakeLists.txt | 22 +++++----------------- scripts/cmake/xtd_commands.cmake | 14 +++----------- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d8ebd15163a3..c6d109e49f59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,13 +58,7 @@ include(scripts/cmake/package.cmake) # Graphic toolkits definitions get_operating_system_name(XTD_OPERATING_SYSTEM_NAME) -if (${XTD_OPERATING_SYSTEM_NAME} STREQUAL "CLANG") - choice_options(XTD_NATIVE_OPERATING_SYSTEM "Choose Operating System for native system libraries" "CLANG") - choice_options(XTD_NATIVE_GRAPHIC_TOOLKIT "Choose toolkit for native drawing and forms libraries" "wxwidgets" "gtk4" "gtk3" "qt5" "fltk") -elseif (${XTD_OPERATING_SYSTEM_NAME} STREQUAL "CLANGARM") - choice_options(XTD_NATIVE_OPERATING_SYSTEM "Choose Operating System for native system libraries" "CLANGARM") - choice_options(XTD_NATIVE_GRAPHIC_TOOLKIT "Choose toolkit for native drawing and forms libraries" "wxwidgets" "gtk4" "gtk3" "qt5" "fltk") -elseif (${XTD_OPERATING_SYSTEM_NAME} STREQUAL "Darwin" OR ${XTD_OPERATING_SYSTEM_NAME} STREQUAL "macOS") +if (${XTD_OPERATING_SYSTEM_NAME} STREQUAL "Darwin" OR ${XTD_OPERATING_SYSTEM_NAME} STREQUAL "macOS") choice_options(XTD_NATIVE_OPERATING_SYSTEM "Choose Operating System for native system libraries" "macOS" "iOS" "Android") choice_options(XTD_NATIVE_GRAPHIC_TOOLKIT "Choose toolkit for native drawing and forms libraries" "wxwidgets" "cocoa" "qt5" "fltk") elseif (${XTD_OPERATING_SYSTEM_NAME} STREQUAL "FreeBSD") @@ -73,15 +67,9 @@ elseif (${XTD_OPERATING_SYSTEM_NAME} STREQUAL "FreeBSD") elseif (${XTD_OPERATING_SYSTEM_NAME} STREQUAL "Linux") choice_options(XTD_NATIVE_OPERATING_SYSTEM "Choose Operating System for native system libraries" "Linux" "Android") choice_options(XTD_NATIVE_GRAPHIC_TOOLKIT "Choose toolkit for native drawing and forms libraries" "wxwidgets" "gtk4" "gtk3" "qt5" "fltk") -elseif (${XTD_OPERATING_SYSTEM_NAME} STREQUAL "MINGW") - choice_options(XTD_NATIVE_OPERATING_SYSTEM "Choose Operating System for native system libraries" "MINGW") - choice_options(XTD_NATIVE_GRAPHIC_TOOLKIT "Choose toolkit for native drawing and forms libraries" "wxwidgets" "gtk4" "gtk3" "qt5" "fltk") elseif (${XTD_OPERATING_SYSTEM_NAME} STREQUAL "MSYS") choice_options(XTD_NATIVE_OPERATING_SYSTEM "Choose Operating System for native system libraries" "MSYS") choice_options(XTD_NATIVE_GRAPHIC_TOOLKIT "Choose toolkit for native drawing and forms libraries" "wxwidgets" "gtk4" "gtk3" "qt5" "fltk") -elseif (${XTD_OPERATING_SYSTEM_NAME} STREQUAL "UCRT") - choice_options(XTD_NATIVE_OPERATING_SYSTEM "Choose Operating System for native system libraries" "UCRT") - choice_options(XTD_NATIVE_GRAPHIC_TOOLKIT "Choose toolkit for native drawing and forms libraries" "wxwidgets" "gtk4" "gtk3" "qt5" "fltk") elseif (${XTD_OPERATING_SYSTEM_NAME} STREQUAL "Windows") choice_options(XTD_NATIVE_OPERATING_SYSTEM "Choose Operating System for native system libraries" "Windows" "Android") choice_options(XTD_NATIVE_GRAPHIC_TOOLKIT "Choose toolkit for native drawing and forms libraries" "wxwidgets" "msw" "qt5" "fltk") @@ -95,10 +83,6 @@ add_definitions(-D__XTD_NATIVE_OPERATING_SYSTEM__="${XTD_NATIVE_OPERATING_SYSTEM if (${XTD_NATIVE_OPERATING_SYSTEM} STREQUAL "Android") #set(XTD_CORE_NATIVE_LIBRARY xtd.core.native.android) message(FATAL_ERROR "Not yet implemented!") -elseif (${XTD_NATIVE_OPERATING_SYSTEM} STREQUAL "CLANG" OR ${XTD_NATIVE_OPERATING_SYSTEM} STREQUAL "CLANGARM" OR ${XTD_NATIVE_OPERATING_SYSTEM} STREQUAL "MINGW" OR ${XTD_NATIVE_OPERATING_SYSTEM} STREQUAL "MSYS" OR ${XTD_NATIVE_OPERATING_SYSTEM} STREQUAL "UCRT") - set(XTD_CORE_NATIVE_LIBRARY xtd.core.native.win32) - set(XTD_CORE_NATIVE_3RDPARTY_LIBRARIES xtd.3rdparty.StackWalker) - add_compile_options(-Wno-implicit-const-int-float-conversion -Wno-c++20-extensions -Wno-unqualified-std-cast-call -Wno-deprecated-declarations -Wno-missing-braces -Wno-tautological-constant-out-of-range-compare) elseif (${XTD_NATIVE_OPERATING_SYSTEM} STREQUAL "iOS") #set(XTD_CORE_NATIVE_LIBRARY xtd.core.native.ios) message(FATAL_ERROR "Not yet implemented!") @@ -106,6 +90,10 @@ elseif (${XTD_NATIVE_OPERATING_SYSTEM} STREQUAL "Linux") set(XTD_CORE_NATIVE_LIBRARY xtd.core.native.linux) elseif (${XTD_NATIVE_OPERATING_SYSTEM} STREQUAL "macOS") set(XTD_CORE_NATIVE_LIBRARY xtd.core.native.macos) +elseif (${XTD_NATIVE_OPERATING_SYSTEM} STREQUAL "MSYS") + set(XTD_CORE_NATIVE_LIBRARY xtd.core.native.win32) + set(XTD_CORE_NATIVE_3RDPARTY_LIBRARIES xtd.3rdparty.StackWalker) + add_compile_options(-Wno-implicit-const-int-float-conversion -Wno-c++20-extensions -Wno-unqualified-std-cast-call -Wno-deprecated-declarations -Wno-missing-braces -Wno-tautological-constant-out-of-range-compare) elseif (${XTD_NATIVE_OPERATING_SYSTEM} STREQUAL "Unix") set(XTD_CORE_NATIVE_LIBRARY xtd.core.native.unix) elseif (${XTD_NATIVE_OPERATING_SYSTEM} STREQUAL "Windows") diff --git a/scripts/cmake/xtd_commands.cmake b/scripts/cmake/xtd_commands.cmake index ad9831745898..facae698e5e5 100644 --- a/scripts/cmake/xtd_commands.cmake +++ b/scripts/cmake/xtd_commands.cmake @@ -61,18 +61,10 @@ endmacro () ## @endcode macro(get_operating_system_name OPERATING_SYSTEM_NAME) if (WIN32) - if ("$ENV{MSYSTEM}" STREQUAL "CLANG" OR "$ENV{MSYSTEM}" STREQUAL "CLANG32" OR "$ENV{MSYSTEM}" STREQUAL "CLANG64") - set(${OPERATING_SYSTEM_NAME} "CLANG") - elseif ("$ENV{MSYSTEM}" STREQUAL "CLANGARM" OR "$ENV{MSYSTEM}" STREQUAL "CLANGARM32" OR "$ENV{MSYSTEM}" STREQUAL "CLANGARM64") - set(${OPERATING_SYSTEM_NAME} "CLANGARM") - elseif ("$ENV{MSYSTEM}" STREQUAL "MINGW" OR "$ENV{MSYSTEM}" STREQUAL "MINGW32" OR "$ENV{MSYSTEM}" STREQUAL "MINGW64") - set(${OPERATING_SYSTEM_NAME} "MINGW") - elseif ("$ENV{MSYSTEM}" STREQUAL "MSYS" OR "$ENV{MSYSTEM}" STREQUAL "MSYS32" OR "$ENV{MSYSTEM}" STREQUAL "MSYS64") - set(${OPERATING_SYSTEM_NAME} "MYSYS") - elseif ("$ENV{MSYSTEM}" STREQUAL "UCRT" OR "$ENV{MSYSTEM}" STREQUAL "UCRT32" OR "$ENV{MSYSTEM}" STREQUAL "UCRT64") - set(${OPERATING_SYSTEM_NAME} "UCRT") - else () + if ("$ENV{MSYSTEM}" STREQUAL "") set(${OPERATING_SYSTEM_NAME} "Windows") + else () + set(${OPERATING_SYSTEM_NAME} "MSYS") endif () elseif (APPLE) set(${OPERATING_SYSTEM_NAME} "macOS")