Build wxiOS on Travis CI.

See https://github.com/wxWidgets/wxWidgets/pull/1895
This commit is contained in:
Vadim Zeitlin
2020-06-21 19:02:54 +02:00
13 changed files with 129 additions and 78 deletions

View File

@@ -49,6 +49,10 @@ matrix:
osx_image: xcode11.4
env: wxCONFIGURE_FLAGS="--enable-monolithic --with-cxx=17 --host=i686-apple-darwin_sim --build=x86_64-apple-darwin17.7.0 --with-osx_iphone --with-macosx-version-min=10.0 --with-macosx-sdk=$(xcrun --sdk iphonesimulator --show-sdk-path) --enable-stl --disable-sys-libs" wxSKIP_GUI=1 wxSKIP_TESTING=1 wxSKIP_SAMPLES=1
name: wxOSX iOS Xcode 11.4
- os: osx
osx_image: xcode11.4
env: wxTOOLSET=cmake wxCMAKE_GENERATOR=Xcode wxCMAKE_DEFINES="-DCMAKE_SYSTEM_NAME=iOS -DCMAKE_FIND_ROOT_PATH=/usr/local -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12" wxCMAKE_SAMPLES=OFF wxCMAKE_TESTS=OFF
name: wxOSX iOS CMake Xcode 11.4
- dist: bionic
compiler: gcc
env: wxCONFIGURE_FLAGS="--with-x11 --enable-pch --disable-stc" wxSKIP_SAMPLES=1

View File

@@ -226,10 +226,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/osx/cocoa/utils.mm
</set>
<set var="BASE_AND_GUI_OSX_IPHONE_SRC" hints="files">
src/osx/iphone/utils.mm
</set>
<!-- Base files used by non-wxMac OS X builds -->
<set var="BASE_OSX_NOTWXMAC_SRC" hints="files">
$(BASE_UNIX_AND_DARWIN_NOTWXMAC_SRC)
@@ -2703,7 +2699,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
<set var="OSX_IPHONE_HDR" hints="files">
wx/osx/iphone/chkconf.h
wx/osx/iphone/evtloop.h
wx/osx/iphone/private.h
wx/generic/region.h
wx/osx/sound.h

View File

@@ -85,7 +85,7 @@ function(wx_write_config)
set(WX_CHARTYPE ansi)
set(lib_unicode_suffix)
endif()
if(CMAKE_CROSSCOMPILING)
if(CMAKE_CROSSCOMPILING AND NOT IPHONE)
set(cross_compiling yes)
set(host_alias ${CMAKE_SYSTEM_NAME})
else()

View File

@@ -153,10 +153,6 @@ set(BASE_AND_GUI_OSX_COCOA_SRC
src/osx/cocoa/power.mm
)
set(BASE_AND_GUI_OSX_IPHONE_SRC
src/osx/iphone/utils.mm
)
set(BASE_OSX_NOTWXMAC_SRC
${BASE_UNIX_AND_DARWIN_NOTWXMAC_SRC}
${BASE_COREFOUNDATION_SRC}
@@ -2573,7 +2569,6 @@ set(OSX_IPHONE_SRC
set(OSX_IPHONE_HDR
wx/osx/iphone/chkconf.h
wx/osx/iphone/evtloop.h
wx/osx/iphone/private.h
wx/generic/region.h
wx/osx/sound.h
@@ -3046,11 +3041,16 @@ set(OPENGL_GTK_HDR
wx/unix/glx11.h
)
set(OPENGL_OSX_SHARED_SRC
set(OPENGL_OSX_COCOA_SRC
src/osx/cocoa/glcanvas.mm
src/osx/glcanvas_osx.cpp
)
set(OPENGL_OSX_IPHONE_SRC
src/osx/iphone/glcanvas.mm
src/osx/glcanvas_osx.cpp
)
set(UNIX_SOUND_SDL_SRC
src/unix/sound_sdl.cpp
)

View File

@@ -385,7 +385,12 @@ if(wxUSE_GUI)
# extra dependencies
if(wxUSE_OPENGL)
find_package(OpenGL)
if(WXOSX_IPHONE)
set(OPENGL_FOUND TRUE)
set(OPENGL_LIBRARIES "-framework OpenGLES" "-framework QuartzCore")
else()
find_package(OpenGL)
endif()
if(NOT OPENGL_FOUND)
message(WARNING "opengl not found, wxGLCanvas won't be available")
wx_option_force_value(wxUSE_OPENGL OFF)
@@ -538,17 +543,23 @@ endif()
set(wxBUILD_PRECOMP_PREV ${wxBUILD_PRECOMP} CACHE INTERNAL "")
if(wxBUILD_PRECOMP)
if(DEFINED CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED)
set(try_flags "-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=${CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED}")
endif()
if (CLEAN_PRECOMP_TEST)
try_compile(RESULT_VAR_CLEAN
"${wxBINARY_DIR}/CMakeFiles/cotire_test"
"${wxSOURCE_DIR}/build/cmake/modules/cotire_test"
CotireExample clean_cotire
CMAKE_FLAGS ${try_flags}
)
endif()
try_compile(RESULT_VAR
"${wxBINARY_DIR}/CMakeFiles/cotire_test"
"${wxSOURCE_DIR}/build/cmake/modules/cotire_test"
CotireExample OUTPUT_VARIABLE OUTPUT_VAR
CotireExample
CMAKE_FLAGS ${try_flags}
OUTPUT_VARIABLE OUTPUT_VAR
)
# check if output has precompiled header warnings. The build can still succeed, so check the output

View File

@@ -17,9 +17,7 @@ if(WIN32)
wx_append_sources(BASE_FILES BASE_AND_GUI_WIN32)
elseif(APPLE)
wx_append_sources(BASE_FILES BASE_OSX_SHARED)
if(wxBUILD_TOOLKIT MATCHES "osx_iphone")
wx_append_sources(BASE_FILES BASE_AND_GUI_OSX_IPHONE)
else()
if(WXOSX_COCOA)
wx_append_sources(BASE_FILES BASE_AND_GUI_OSX_COCOA)
endif()
elseif(UNIX)
@@ -58,14 +56,19 @@ endif()
if(APPLE)
wx_lib_link_libraries(wxbase
PRIVATE
"-framework Security"
PUBLIC
"-framework Carbon"
"-framework Cocoa"
"-framework CoreFoundation"
"-framework IOKit"
)
if(WXOSX_COCOA)
wx_lib_link_libraries(wxbase
PRIVATE
"-framework Security"
PUBLIC
"-framework Carbon"
"-framework Cocoa"
"-framework IOKit"
)
endif()
elseif(UNIX)
wx_lib_link_libraries(wxbase PRIVATE dl)
endif()

View File

@@ -47,6 +47,9 @@ elseif(WXOSX_COCOA)
wx_append_sources(CORE_SRC OSX_LOWLEVEL)
wx_append_sources(CORE_SRC OSX_SHARED)
wx_append_sources(CORE_SRC OSX_COCOA)
elseif(WXOSX_IPHONE)
wx_append_sources(CORE_SRC OSX_LOWLEVEL)
wx_append_sources(CORE_SRC OSX_IPHONE)
elseif(WXQT)
wx_append_sources(CORE_SRC QT)
if(WIN32)
@@ -76,6 +79,15 @@ if(WXOSX_COCOA)
wx_lib_link_libraries(wxcore PUBLIC "-framework WebKit")
endif()
endif()
if(WXOSX_IPHONE)
wx_lib_link_libraries(wxcore
PUBLIC
"-framework AudioToolbox"
"-framework CoreGraphics"
"-framework CoreText"
"-framework UIKit"
)
endif()
if(WXGTK AND wxUSE_PRIVATE_FONTS)
wx_lib_include_directories(wxcore PUBLIC ${FONTCONFIG_INCLUDE_DIRS} ${PANGOFT2_INCLUDE_DIRS})
wx_lib_link_libraries(wxcore PUBLIC ${FONTCONFIG_LIBRARIES} ${PANGOFT2_LIBRARIES})

View File

@@ -15,8 +15,10 @@ if(WXMSW)
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)
elseif(WXOSX_COCOA)
wx_append_sources(GL_FILES OPENGL_OSX_COCOA)
elseif(WXOSX_IPHONE)
wx_append_sources(GL_FILES OPENGL_OSX_IPHONE)
elseif(WXQT)
wx_append_sources(GL_FILES OPENGL_QT)
endif()

View File

@@ -15,6 +15,8 @@ if(WXMSW)
wx_append_sources(MEDIA_FILES MEDIA_MSW)
elseif(WXOSX_COCOA)
wx_append_sources(MEDIA_FILES MEDIA_OSX_COCOA)
elseif(WXOSX_IPHONE)
wx_append_sources(MEDIA_FILES MEDIA_OSX_IPHONE)
elseif(UNIX)
wx_append_sources(MEDIA_FILES MEDIA_UNIX)
elseif(WXQT)
@@ -22,13 +24,11 @@ elseif(WXQT)
endif()
wx_add_library(wxmedia ${MEDIA_FILES})
if(WXOSX_COCOA)
# TODO: add version detection of some kind and/or wx_option
wx_lib_compile_definitions(wxmedia PRIVATE -DwxOSX_USE_QTKIT=0)
if(WXOSX)
wx_lib_link_libraries(wxmedia PUBLIC
"-framework AVFoundation"
"-framework AVKit"
"-framework CoreMedia"
"-weak_framework AVKit"
)
elseif(UNIX)
wx_lib_include_directories(wxmedia PUBLIC ${GSTREAMER_INCLUDE_DIRS})

View File

@@ -12,6 +12,10 @@ wx_option(wxUSE_GUI "Use GUI" ON)
if(CMAKE_OSX_SYSROOT MATCHES iphoneos)
set(IPHONE ON)
# workaround a bug where try_compile (and functions using it,
# like find_package, check_c_source_compiles) fails
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
endif()
if(WIN32)

View File

@@ -20,18 +20,28 @@ if(wxUSE_XRC)
set_target_properties(wxrc PROPERTIES FOLDER "Utilities")
wx_install(TARGETS wxrc RUNTIME DESTINATION "bin")
wx_install(TARGETS wxrc
RUNTIME DESTINATION "bin"
BUNDLE DESTINATION "bin"
)
if(IPHONE)
set(EXE_SUFFIX ".app")
else()
set(EXE_SUFFIX ${CMAKE_EXECUTABLE_SUFFIX})
endif()
if(NOT MSVC)
install(CODE "execute_process( \
COMMAND ${CMAKE_COMMAND} -E rename \
${CMAKE_INSTALL_PREFIX}/bin/wxrc${CMAKE_EXECUTABLE_SUFFIX} \
${CMAKE_INSTALL_PREFIX}/bin/wxrc-${wxMAJOR_VERSION}.${wxMINOR_VERSION}${CMAKE_EXECUTABLE_SUFFIX} \
${CMAKE_INSTALL_PREFIX}/bin/wxrc${EXE_SUFFIX} \
${CMAKE_INSTALL_PREFIX}/bin/wxrc-${wxMAJOR_VERSION}.${wxMINOR_VERSION}${EXE_SUFFIX} \
)"
)
install(CODE "execute_process( \
COMMAND ${CMAKE_COMMAND} -E create_symlink \
${CMAKE_INSTALL_PREFIX}/bin/wxrc-${wxMAJOR_VERSION}.${wxMINOR_VERSION}${CMAKE_EXECUTABLE_SUFFIX} \
${CMAKE_INSTALL_PREFIX}/bin/wxrc${CMAKE_EXECUTABLE_SUFFIX} \
${CMAKE_INSTALL_PREFIX}/bin/wxrc-${wxMAJOR_VERSION}.${wxMINOR_VERSION}${EXE_SUFFIX} \
${CMAKE_INSTALL_PREFIX}/bin/wxrc${EXE_SUFFIX} \
)"
)
endif()

View File

@@ -176,9 +176,6 @@ BASE_AND_GUI_OSX_COCOA_SRC =
src/osx/cocoa/utils.mm
src/osx/cocoa/power.mm
BASE_AND_GUI_OSX_IPHONE_SRC =
src/osx/iphone/utils.mm
# files used by non-wxMac OS X builds
BASE_OSX_NOTWXMAC_SRC =
$(BASE_UNIX_AND_DARWIN_NOTWXMAC_SRC)
@@ -2552,7 +2549,6 @@ OSX_IPHONE_SRC =
OSX_IPHONE_HDR =
wx/generic/region.h
wx/osx/iphone/chkconf.h
wx/osx/iphone/evtloop.h
wx/osx/iphone/private.h
wx/osx/sound.h
@@ -2984,10 +2980,14 @@ OPENGL_GTK_SRC =
OPENGL_MSW_HDR =
wx/msw/glcanvas.h
OPENGL_OSX_SHARED_SRC =
OPENGL_OSX_COCOA_SRC =
src/osx/cocoa/glcanvas.mm
src/osx/glcanvas_osx.cpp
OPENGL_OSX_IPHONE_SRC =
src/osx/iphone/glcanvas.mm
src/osx/glcanvas_osx.cpp
# Misc plugin sources:
UNIX_SOUND_SDL_SRC =

View File

@@ -6,31 +6,37 @@ set -e
wxPROC_COUNT=`getconf _NPROCESSORS_ONLN`
((wxPROC_COUNT++))
if [ "$wxTOOLSET" == "cmake" ] && [ "$wxCMAKE_GENERATOR" == "Xcode" ]; then
wxJOBS="-jobs $wxPROC_COUNT"
else
wxJOBS="-j$wxPROC_COUNT"
fi
wxBUILD_ARGS="-j$wxPROC_COUNT"
case $wxTOOLSET in
cmake)
if [ -z $wxCMAKE_TESTS ]; then wxCMAKE_TESTS=CONSOLE_ONLY; fi
if [ -z $wxCMAKE_SAMPLES ]; then wxCMAKE_SAMPLES=SOME; fi
if [ "$wxCMAKE_GENERATOR" == "Xcode" ]; then
wxBUILD_ARGS="-jobs $wxPROC_COUNT -quiet"
fi
cmake --version
echo 'travis_fold:start:configure'
echo 'Configuring...'
mkdir build_cmake
pushd build_cmake
cmake -G "$wxCMAKE_GENERATOR" $wxCMAKE_DEFINES -D wxBUILD_SAMPLES=SOME -D wxBUILD_TESTS=$wxCMAKE_TESTS ..
cmake -G "$wxCMAKE_GENERATOR" $wxCMAKE_DEFINES -D wxBUILD_SAMPLES=$wxCMAKE_SAMPLES -D wxBUILD_TESTS=$wxCMAKE_TESTS ..
echo 'travis_fold:end:configure'
echo 'travis_fold:start:building'
echo 'Building...'
if [ "$wxCMAKE_GENERATOR" == "Xcode" ]; then
wxTOOL_ARG="-quiet"
if [ "$wxCMAKE_GENERATOR" != "Xcode" ]; then
echo 'travis_fold:start:building'
echo 'Building...'
cmake --build . -- $wxBUILD_ARGS
echo 'travis_fold:end:building'
fi
cmake --build . -- $wxJOBS $wxTOOL_ARG
echo 'travis_fold:end:building'
echo 'travis_fold:start:install'
if [ "$wxCMAKE_GENERATOR" == "Xcode" ]; then echo -n 'Building and '; fi
echo 'Installing...'
sudo env "PATH=$PATH" cmake --build . --target install -- $wxBUILD_ARGS
popd
echo 'travis_fold:end:install'
if [ "$wxCMAKE_TESTS" != "OFF" ]; then
echo 'travis_fold:start:testing'
@@ -39,21 +45,18 @@ case $wxTOOLSET in
echo 'travis_fold:end:testing'
fi
echo 'Installing...' && echo -en 'travis_fold:start:script.install\\r'
sudo env "PATH=$PATH" cmake --build . --target install
popd
echo -en 'travis_fold:end:script.install\\r'
echo 'Testing installation...' && echo -en 'travis_fold:start:script.testinstall\\r'
echo 'travis_fold:start:testinstall'
echo 'Testing installation...'
mkdir build_cmake_install_test
pushd build_cmake_install_test
cmake "$wxCMAKE_GENERATOR" $wxCMAKE_DEFINES ../samples/minimal
cmake --build .
cmake -G "$wxCMAKE_GENERATOR" $wxCMAKE_DEFINES ../samples/minimal
cmake --build . -- $wxBUILD_ARGS
popd
echo -en 'travis_fold:end:script.testinstall\\r'
echo 'travis_fold:end:testinstall'
;;
*)
echo 'Configuring...' && echo -en 'travis_fold:start:script.configure\\r'
echo 'travis_fold:start:configure'
echo 'Configuring...'
./configure --disable-optimise --disable-debug_info $wxCONFIGURE_FLAGS || rc=$?
if [ -n "$rc" ]; then
echo '*** Configuring failed, contents of config.log follows: ***'
@@ -62,25 +65,28 @@ case $wxTOOLSET in
echo '-----------------------------------------------------------'
exit $rc
fi
echo -en 'travis_fold:end:script.configure\\r'
echo 'travis_fold:end:configure'
echo 'Building...' && echo -en 'travis_fold:start:script.build\\r'
make $wxJOBS
echo -en 'travis_fold:end:script.build\\r'
echo 'travis_fold:start:building'
echo 'Building...'
make $wxBUILD_ARGS
echo 'travis_fold:end:building'
echo 'Building tests...' && echo -en 'travis_fold:start:script.tests\\r'
[ "$wxSKIP_GUI" = 1 ] || make -C tests $wxJOBS failtest
make -C tests $wxJOBS $wxMAKEFILE_FLAGS
echo -en 'travis_fold:end:script.tests\\r'
echo 'travis_fold:start:tests'
echo 'Building tests...'
[ "$wxSKIP_GUI" = 1 ] || make -C tests $wxBUILD_ARGS failtest
make -C tests $wxBUILD_ARGS $wxMAKEFILE_FLAGS
echo 'travis_fold:end:tests'
if [ "$wxSKIP_TESTING" = 1 ]; then
echo 'Skipping running tests'
exit 0
fi
echo 'Testing...' && echo -en 'travis_fold:start:script.testing\\r'
echo 'travis_fold:start:testing'
echo 'Testing...'
pushd tests && ./test && popd
echo -en 'travis_fold:end:script.testing\\r'
echo 'travis_fold:end:testing'
if [ "$wxSKIP_GUI" = 1 ]; then
echo 'Skipping the rest of tests for non-GUI build.'
@@ -88,22 +94,26 @@ case $wxTOOLSET in
fi
if [ "$wxUSE_XVFB" = 1 ]; then
echo 'Testing GUI using Xvfb...' && echo -en 'travis_fold:start:script.testing_gui\\r'
echo 'travis_fold:start:testing_gui'
echo 'Testing GUI using Xvfb...'
pushd tests && xvfb-run -a -s '-screen 0 1600x1200x24' ./test_gui && popd
echo -en 'travis_fold:end:script.testing_gui\\r'
echo 'travis_fold:end:testing_gui'
fi
echo 'Building samples...' && echo -en 'travis_fold:start:script.samples\\r'
echo 'travis_fold:start:samples'
echo 'Building samples...'
(test "$wxSKIP_SAMPLES" && echo 'SKIPPED') || make samples
echo -en 'travis_fold:end:script.samples\\r'
echo 'travis_fold:end:samples'
echo 'Installing...' && echo -en 'travis_fold:start:script.install\\r'
echo 'travis_fold:start:install'
echo 'Installing...'
sudo make install
echo -en 'travis_fold:end:script.install\\r'
echo 'travis_fold:end:install'
echo 'Testing installation...' && echo -en 'travis_fold:start:script.testinstall\\r'
echo 'travis_fold:start:testinstall'
echo 'Testing installation...'
make -C samples/minimal -f makefile.unx clean
make -C samples/minimal -f makefile.unx $wxMAKEFILE_FLAGS
echo -en 'travis_fold:end:script.testinstall\\r'
echo 'travis_fold:end:testinstall'
;;
esac