CMake fixes for building samples, notably the ones using OpenGL, and
more.

See https://github.com/wxWidgets/wxWidgets/pull/679
This commit is contained in:
Vadim Zeitlin
2018-01-24 16:43:22 +01:00
12 changed files with 78 additions and 22 deletions

View File

@@ -3099,6 +3099,16 @@ set(OPENGL_MSW_HDR
wx/msw/glcanvas.h
)
set(OPENGL_GTK_SRC
src/gtk/glcanvas.cpp
src/unix/glx11.cpp
)
set(OPENGL_GTK_HDR
wx/gtk/glcanvas.h
wx/unix/glx11.h
)
set(OPENGL_OSX_SHARED_SRC
src/osx/cocoa/glcanvas.mm
src/osx/glcanvas_osx.cpp

View File

@@ -166,6 +166,9 @@ function(wx_set_target_properties target_name is_base)
endif()
if(wxUSE_UNICODE)
if(WIN32)
target_compile_definitions(${target_name} PUBLIC UNICODE)
endif()
target_compile_definitions(${target_name} PUBLIC _UNICODE)
endif()
@@ -701,7 +704,7 @@ function(wx_add_test name)
endif()
add_executable(${name} ${test_src})
target_include_directories(${name} PRIVATE "${wxSOURCE_DIR}/tests" "${wxSOURCE_DIR}/3rdparty/catch/include")
wx_exe_link_libraries(${name} base net)
wx_exe_link_libraries(${name} base)
if(wxBUILD_SHARED)
target_compile_definitions(${name} PRIVATE WXUSINGDLL)
endif()

View File

@@ -58,21 +58,7 @@ endif()
if(wxUSE_THREADS AND CMAKE_THREAD_LIBS_INIT)
wx_lib_link_libraries(base PRIVATE ${CMAKE_THREAD_LIBS_INIT})
endif()
if(WIN32)
wx_lib_link_libraries(base PUBLIC
kernel32
user32
shell32
ole32
oleaut32
uuid
rpcrt4
advapi32
Shlwapi
version
uuid
)
elseif(APPLE)
if(APPLE)
wx_lib_link_libraries(base
PRIVATE
"-framework Security"

View File

@@ -13,6 +13,8 @@ wx_append_sources(GL_FILES OPENGL_CMN)
if(WIN32)
wx_append_sources(GL_FILES OPENGL_MSW)
elseif(WXGTK)
wx_append_sources(GL_FILES OPENGL_GTK)
elseif(APPLE)
wx_append_sources(GL_FILES OPENGL_OSX_SHARED)
endif()

View File

@@ -93,7 +93,7 @@ wx_option(wxUSE_APPLE_IEEE "use the Apple IEEE codec")
wx_option(wxUSE_ARCHIVE_STREAMS "use wxArchive streams")
wx_option(wxUSE_BASE64 "use base64 encoding/decoding functions")
wx_option(wxUSE_STACKWALKER "use wxStackWalker class for getting backtraces")
wx_option(wxUSE_ON_FATAL_EXCEPTION "catch signals in wxApp::OnFatalException (Unix only)")
wx_option(wxUSE_ON_FATAL_EXCEPTION "catch signals in wxApp::OnFatalException")
wx_option(wxUSE_CMDLINE_PARSER "use wxCmdLineParser class")
wx_option(wxUSE_DATETIME "use wxDateTime class")
wx_option(wxUSE_DEBUGREPORT "use wxDebugReport class")

View File

@@ -19,7 +19,9 @@ wx_add_sample(combo LIBRARIES adv DATA dropbuth.png dropbutn.png dropbutp.png)
wx_add_sample(config conftest.cpp)
wx_add_sample(console CONSOLE IMPORTANT)
wx_add_sample(dataview IMPORTANT dataview.cpp mymodels.cpp mymodels.h LIBRARIES adv)
wx_add_sample(debugrpt LIBRARIES qa)
if(wxUSE_ON_FATAL_EXCEPTION AND (NOT WIN32 OR MSVC))
wx_add_sample(debugrpt LIBRARIES qa)
endif()
wx_add_sample(dialogs dialogs.cpp dialogs.h LIBRARIES adv DATA tips.txt)
wx_add_sample(dialup nettest.cpp)
wx_add_sample(display)
@@ -229,7 +231,9 @@ if(WIN32)
endif()
wx_add_sample(dll sdk_exe.cpp my_dll.h NAME sdk_exe FOLDER dll LIBRARIES my_dll)
wx_add_sample(flash)
if(MSVC)
wx_add_sample(flash)
endif()
#TODO: renable when sample is fixed
#wx_add_sample(mfc mfctest.cpp mfctest.h resource.h stdafx.h RES mfctest.rc)
wx_add_sample(nativdlg nativdlg.cpp nativdlg.h resource.h RES nativdlg.rc)

View File

@@ -99,6 +99,9 @@ endif()
wx_add_test(test_base ${TEST_SRC})
target_compile_definitions(test_base PRIVATE wxUSE_GUI=0 wxUSE_BASE=1)
if(wxUSE_SOCKETS)
wx_exe_link_libraries(test_base net)
endif()
if(wxUSE_XML)
wx_exe_link_libraries(test_base xml)
endif()

View File

@@ -22,6 +22,9 @@ set(TEST_DRAWING_SRC
drawing/fonttest.cpp
)
wx_add_test(test_drawing ${TEST_DRAWING_SRC})
if(wxUSE_SOCKETS)
wx_exe_link_libraries(test_drawing net)
endif()
wx_exe_link_libraries(test_drawing core)
wx_test_enable_precomp(test_drawing)

View File

@@ -107,5 +107,27 @@ set(TEST_GUI_SRC
xml/xrctest.cpp
)
wx_add_test(test_gui ${TEST_GUI_SRC})
wx_exe_link_libraries(test_gui core richtext media xrc xml adv html net webview)
wx_exe_link_libraries(test_gui core)
if(wxUSE_RICHTEXT)
wx_exe_link_libraries(test_gui richtext)
endif()
if(wxUSE_MEDIACTRL)
wx_exe_link_libraries(test_gui media)
endif()
if(wxUSE_XRC)
wx_exe_link_libraries(test_gui xrc)
endif()
if(wxUSE_XML)
wx_exe_link_libraries(test_gui xml)
endif()
wx_exe_link_libraries(test_gui adv)
if(wxUSE_HTML)
wx_exe_link_libraries(test_gui html)
endif()
if(wxUSE_SOCKETS)
wx_exe_link_libraries(test_gui net)
endif()
if(wxUSE_WEBVIEW)
wx_exe_link_libraries(test_gui webview)
endif()
wx_test_enable_precomp(test_gui)

View File

@@ -68,13 +68,25 @@ endif()
if(WXMSW)
set(wxTOOLKIT_LIBRARIES
kernel32
user32
gdi32
comdlg32
winspool
winmm
shell32
shlwapi
comctl32
ole32
oleaut32
uuid
rpcrt4
Oleacc
advapi32
version
wsock32
wininet
oleacc
uxtheme
)
elseif(WXGTK)
if(WXGTK3)

View File

@@ -13,7 +13,10 @@ if(wxUSE_XRC)
if(wxBUILD_SHARED)
target_compile_definitions(wxrc PRIVATE WXUSINGDLL)
endif()
wx_exe_link_libraries(wxrc xml base)
if(wxUSE_XML)
wx_exe_link_libraries(wxrc xml)
endif()
wx_exe_link_libraries(wxrc base)
# TODO: install
set_target_properties(wxrc PROPERTIES FOLDER "Utilities")
endif()

View File

@@ -3005,6 +3005,14 @@ OPENGL_CMN_HDR =
OPENGL_MSW_SRC =
src/msw/glcanvas.cpp
OPENGL_GTK_HDR =
wx/gtk/glcanvas.h
wx/unix/glx11.h
OPENGL_GTK_SRC =
src/gtk/glcanvas.cpp
src/unix/glx11.cpp
OPENGL_MSW_HDR =
wx/msw/glcanvas.h