Skip to content

Commit

Permalink
Simplifying the CMake file
Browse files Browse the repository at this point in the history
  • Loading branch information
gammasoft71 committed Dec 27, 2023
1 parent c94886b commit 3e894b2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 28 deletions.
22 changes: 5 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand All @@ -95,17 +83,17 @@ 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!")
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")
Expand Down
14 changes: 3 additions & 11 deletions scripts/cmake/xtd_commands.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 3e894b2

Please sign in to comment.