Cmake build of wxWidgets

Needed some tinkering, to render
it sensible in visual studio
This commit is contained in:
Cheng 2024-02-22 12:41:07 +00:00
parent 5fd97439ac
commit cb9a793248
No known key found for this signature in database
GPG Key ID: 571C3A9C3B9E6FCA
6 changed files with 22 additions and 12 deletions

2
.gitignore vendored
View File

@ -240,6 +240,8 @@
/lib/wxmsw*.ilk /lib/wxmsw*.ilk
/lib/wxmsw*.lib /lib/wxmsw*.lib
/lib/zlib*.lib /lib/zlib*.lib
/lib/wxWidgetsConfig.cmake
/lib/wxWidgetsConfigVersion.cmake
# /locale/ # /locale/
/locale/*.mo /locale/*.mo

View File

@ -17,6 +17,14 @@ if(NOT CMAKE_CONFIGURATION_TYPES)
endif() endif()
endif() endif()
if(MSVC)
add_compile_options(
$<$<CONFIG:>:/MT> #---------|
$<$<CONFIG:Debug>:/MTd> #---|-- Statically link the runtime libraries
$<$<CONFIG:Release>:/MT> #--|
)
endif()
file(TO_CMAKE_PATH "${CMAKE_INSTALL_PREFIX}" CMAKE_INSTALL_PREFIX) file(TO_CMAKE_PATH "${CMAKE_INSTALL_PREFIX}" CMAKE_INSTALL_PREFIX)
# https://blog.kitware.com/cmake-and-the-default-build-type/ # https://blog.kitware.com/cmake-and-the-default-build-type/

View File

@ -95,10 +95,10 @@ elseif(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_CXX_COMPILER_ID}
endif() endif()
if(wxBUILD_COMPATIBILITY VERSION_LESS 3.0) if(wxBUILD_COMPATIBILITY VERSION_LESS 3.0)
set(WXWIN_COMPATIBILITY_2_8 ON) set(WXWIN_COMPATIBILITY_2_8 OFF)
endif() endif()
if(wxBUILD_COMPATIBILITY VERSION_LESS 3.1) if(wxBUILD_COMPATIBILITY VERSION_LESS 3.1)
set(WXWIN_COMPATIBILITY_3_0 ON) set(WXWIN_COMPATIBILITY_3_0 OFF)
endif() endif()
# Build wxBUILD_FILE_ID used for config and setup path # Build wxBUILD_FILE_ID used for config and setup path

View File

@ -20,7 +20,7 @@ wx_option(wxBUILD_PRECOMP "Use precompiled headers" ON STRINGS ON OFF COTIRE)
mark_as_advanced(wxBUILD_PRECOMP) mark_as_advanced(wxBUILD_PRECOMP)
wx_option(wxBUILD_INSTALL "Create install/uninstall target for wxWidgets") wx_option(wxBUILD_INSTALL "Create install/uninstall target for wxWidgets")
wx_option(wxBUILD_COMPATIBILITY wx_option(wxBUILD_COMPATIBILITY
"enable compatibilty with earlier wxWidgets versions" 3.0 STRINGS 2.8 3.0 3.1) "enable compatibilty with earlier wxWidgets versions" 3.2 STRINGS 2.8 3.0 3.1 3.2)
mark_as_advanced(wxBUILD_COMPATIBILITY) mark_as_advanced(wxBUILD_COMPATIBILITY)
# Allow user specified setup.h folder # Allow user specified setup.h folder
set(wxBUILD_CUSTOM_SETUP_HEADER_PATH "" CACHE PATH "Include path containing custom wx/setup.h") set(wxBUILD_CUSTOM_SETUP_HEADER_PATH "" CACHE PATH "Include path containing custom wx/setup.h")
@ -83,7 +83,7 @@ wx_option(wxUSE_NO_RTTI "disable RTTI support" OFF)
# STL options # STL options
wx_option(wxUSE_STL "use standard C++ classes for everything" OFF) wx_option(wxUSE_STL "use standard C++ classes for everything" OFF)
set(wxTHIRD_PARTY_LIBRARIES ${wxTHIRD_PARTY_LIBRARIES} wxUSE_STL "use C++ STL classes") set(wxTHIRD_PARTY_LIBRARIES ${wxTHIRD_PARTY_LIBRARIES} wxUSE_STL "use C++ STL classes")
wx_dependent_option(wxUSE_STD_CONTAINERS "use standard C++ container classes" ON "wxUSE_STL" OFF) wx_option(wxUSE_STD_CONTAINERS "use standard C++ container classes" ON)
wx_option(wxUSE_UNICODE "compile with Unicode support (NOT RECOMMENDED to be turned off)") wx_option(wxUSE_UNICODE "compile with Unicode support (NOT RECOMMENDED to be turned off)")
if(NOT WIN32) if(NOT WIN32)
@ -91,7 +91,7 @@ if(NOT WIN32)
wx_dependent_option(wxUSE_UTF8_LOCALE_ONLY "only support UTF-8 locales in UTF-8 build (Unix only)" ON "wxUSE_UNICODE_UTF8" OFF) wx_dependent_option(wxUSE_UTF8_LOCALE_ONLY "only support UTF-8 locales in UTF-8 build (Unix only)" ON "wxUSE_UNICODE_UTF8" OFF)
endif() endif()
wx_option(wxUSE_COMPILER_TLS "enable use of compiler TLS support") wx_option(wxUSE_COMPILER_TLS "enable use of compiler TLS support" 2)
if(NOT WIN32) if(NOT WIN32)
wx_option(wxUSE_VISIBILITY "use of ELF symbols visibility") wx_option(wxUSE_VISIBILITY "use of ELF symbols visibility")
endif() endif()

View File

@ -136,7 +136,7 @@
#cmakedefine01 wxDIALOG_UNIT_COMPATIBILITY #cmakedefine01 wxDIALOG_UNIT_COMPATIBILITY
#cmakedefine01 wxUSE_UNSAFE_WXSTRING_CONV #define wxUSE_UNSAFE_WXSTRING_CONV 1
#cmakedefine01 wxUSE_REPRODUCIBLE_BUILD #cmakedefine01 wxUSE_REPRODUCIBLE_BUILD
@ -185,7 +185,7 @@
#cmakedefine01 wxUSE_PRINTF_POS_PARAMS #cmakedefine01 wxUSE_PRINTF_POS_PARAMS
#cmakedefine01 wxUSE_COMPILER_TLS #define wxUSE_COMPILER_TLS 2
#cmakedefine01 wxUSE_STL #cmakedefine01 wxUSE_STL
@ -194,13 +194,13 @@
#define wxUSE_STD_CONTAINERS_COMPATIBLY wxUSE_STD_DEFAULT #define wxUSE_STD_CONTAINERS_COMPATIBLY wxUSE_STD_DEFAULT
#cmakedefine01 wxUSE_STD_CONTAINERS #define wxUSE_STD_CONTAINERS 1
#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT #define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT
#define wxUSE_STD_STRING wxUSE_STD_DEFAULT #define wxUSE_STD_STRING wxUSE_STD_DEFAULT
#define wxUSE_STD_STRING_CONV_IN_WXSTRING wxUSE_STL #define wxUSE_STD_STRING_CONV_IN_WXSTRING 1
#cmakedefine01 wxUSE_LONGLONG #cmakedefine01 wxUSE_LONGLONG
@ -240,7 +240,7 @@
#cmakedefine01 wxUSE_CONFIG_NATIVE #cmakedefine01 wxUSE_CONFIG_NATIVE
#cmakedefine01 wxUSE_DIALUP_MANAGER #define wxUSE_DIALUP_MANAGER 0
#cmakedefine01 wxUSE_DYNLIB_CLASS #cmakedefine01 wxUSE_DYNLIB_CLASS

View File

@ -40,7 +40,7 @@
// in the version after it completely. // in the version after it completely.
// //
// Recommended setting: 0 (please update your code) // Recommended setting: 0 (please update your code)
#define WXWIN_COMPATIBILITY_3_0 1 #define WXWIN_COMPATIBILITY_3_0 0
// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when // MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when
// default system font is used for wxWindow::GetCharWidth/Height() instead of // default system font is used for wxWindow::GetCharWidth/Height() instead of
@ -299,7 +299,7 @@
// //
// Recommended setting: 2 if you want to have maximal performance and don't // Recommended setting: 2 if you want to have maximal performance and don't
// care about the scenario described above. // care about the scenario described above.
#define wxUSE_COMPILER_TLS 1 #define wxUSE_COMPILER_TLS 2
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Interoperability with the standard library. // Interoperability with the standard library.