Skip to content

Commit

Permalink
Update get_operating_system_name
Browse files Browse the repository at this point in the history
  • Loading branch information
gammasoft71 committed Dec 12, 2023
1 parent 57bd688 commit 3c744f0
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 8 deletions.
19 changes: 17 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@ include(scripts/cmake/package.cmake)

# Graphic toolkits definitions
get_operating_system_name(XTD_OPERATING_SYSTEM_NAME)
if (${XTD_OPERATING_SYSTEM_NAME} STREQUAL "Darwin" OR ${XTD_OPERATING_SYSTEM_NAME} STREQUAL "macOS")
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")
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")
Expand All @@ -71,7 +77,10 @@ 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" "MSYS2")
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")
Expand All @@ -86,6 +95,10 @@ 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")
set(XTD_CORE_NATIVE_LIBRARY xtd.core.native.posix)
elseif (${XTD_NATIVE_OPERATING_SYSTEM} STREQUAL "CLANGARM")
set(XTD_CORE_NATIVE_LIBRARY xtd.core.native.posix)
elseif (${XTD_NATIVE_OPERATING_SYSTEM} STREQUAL "iOS")
#set(XTD_CORE_NATIVE_LIBRARY xtd.core.native.ios)
message(FATAL_ERROR "Not yet implemented!")
Expand All @@ -97,6 +110,8 @@ elseif (${XTD_NATIVE_OPERATING_SYSTEM} STREQUAL "MINGW")
set(XTD_CORE_NATIVE_LIBRARY xtd.core.native.posix)
elseif (${XTD_NATIVE_OPERATING_SYSTEM} STREQUAL "MSYS")
set(XTD_CORE_NATIVE_LIBRARY xtd.core.native.posix)
elseif (${XTD_NATIVE_OPERATING_SYSTEM} STREQUAL "UCRT")
set(XTD_CORE_NATIVE_LIBRARY xtd.core.native.posix)
elseif (${XTD_NATIVE_OPERATING_SYSTEM} STREQUAL "Unix")
set(XTD_CORE_NATIVE_LIBRARY xtd.core.native.unix)
elseif (${XTD_NATIVE_OPERATING_SYSTEM} STREQUAL "Windows")
Expand Down
25 changes: 19 additions & 6 deletions scripts/cmake/xtd_commands.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,25 @@ endmacro ()
## message("The current operating system name is \"${OPERATING_SYSTEM_NAME}\"")
## @endcode
macro(get_operating_system_name OPERATING_SYSTEM_NAME)
if (MINGW)
set(${OPERATING_SYSTEM_NAME} "MINGW")
elseif (MSYS)
set(${OPERATING_SYSTEM_NAME} "MSYS")
elseif (WIN32)
set(${OPERATING_SYSTEM_NAME} "Windows")
#if (MINGW)
# set(${OPERATING_SYSTEM_NAME} "blabla")
#elseif (MSYS)
# set(${OPERATING_SYSTEM_NAME} "MSYS")
#else
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} "CLANGARM")
else ()
set(${OPERATING_SYSTEM_NAME} "Windows")
endif ()
elseif (APPLE)
set(${OPERATING_SYSTEM_NAME} "macOS")
elseif (UNIX)
Expand Down

0 comments on commit 3c744f0

Please sign in to comment.