diff --git a/build/cmake/functions.cmake b/build/cmake/functions.cmake index c33dd3946c..2c56b25f82 100644 --- a/build/cmake/functions.cmake +++ b/build/cmake/functions.cmake @@ -83,6 +83,10 @@ function(wx_set_common_target_properties target_name) RUNTIME_OUTPUT_DIRECTORY "${wxOUTPUT_DIR}${wxPLATFORM_LIB_DIR}" ) + if(wxBUILD_PIC) + set_target_properties(${target_name} PROPERTIES POSITION_INDEPENDENT_CODE TRUE) + endif() + if(MSVC) if(wxCOMMON_TARGET_PROPS_DEFAULT_WARNINGS) set(MSVC_WARNING_LEVEL "/W3") @@ -340,7 +344,7 @@ macro(wx_add_library name) add_library(${name} ${wxBUILD_LIB_TYPE} ${src_files}) add_library(wx::${name_short} ALIAS ${name}) wx_set_target_properties(${name} ${wxADD_LIBRARY_IS_BASE}) - set_property(TARGET ${name} PROPERTY PROJECT_LABEL ${name_short}) + set_target_properties(${name} PROPERTIES PROJECT_LABEL ${name_short}) # Setup install wx_install(TARGETS ${name} @@ -498,6 +502,10 @@ function(wx_set_builtin_target_properties target_name) set_target_properties(${target_name} PROPERTIES FOLDER "Third Party Libraries") + if(wxBUILD_SHARED OR wxBUILD_PIC) + set_target_properties(${target_name} PROPERTIES POSITION_INDEPENDENT_CODE TRUE) + endif() + wx_set_common_target_properties(${target_name} DEFAULT_WARNINGS) if(NOT wxBUILD_SHARED) wx_install(TARGETS ${name} ARCHIVE DESTINATION "lib${wxPLATFORM_LIB_DIR}") @@ -517,10 +525,7 @@ function(wx_add_builtin_library name) add_library(${name} STATIC ${src_list}) add_library(wx::${name_short} ALIAS ${name}) wx_set_builtin_target_properties(${name}) - set_property(TARGET ${name} PROPERTY PROJECT_LABEL ${name_short}) - if(wxBUILD_SHARED) - set_target_properties(${name} PROPERTIES POSITION_INDEPENDENT_CODE TRUE) - endif() + set_target_properties(${name} PROPERTIES PROJECT_LABEL ${name_short}) endfunction() # List of third party libraries added via wx_add_thirdparty_library() diff --git a/build/cmake/lib/expat.cmake b/build/cmake/lib/expat.cmake index 1d2b79b1fa..7200dd5dab 100644 --- a/build/cmake/lib/expat.cmake +++ b/build/cmake/lib/expat.cmake @@ -8,6 +8,8 @@ ############################################################################# if(wxUSE_EXPAT STREQUAL "builtin") + # TODO: implement building expat via its CMake file, using + # add_subdirectory or ExternalProject_Add wx_add_builtin_library(wxexpat src/expat/expat/lib/xmlparse.c src/expat/expat/lib/xmlrole.c diff --git a/build/cmake/lib/png.cmake b/build/cmake/lib/png.cmake index c06a8cc5f0..13ddab58e0 100644 --- a/build/cmake/lib/png.cmake +++ b/build/cmake/lib/png.cmake @@ -8,6 +8,8 @@ ############################################################################# if(wxUSE_LIBPNG STREQUAL "builtin") + # TODO: implement building libpng via its CMake file, using + # add_subdirectory or ExternalProject_Add if(NOT MSVC) set(PNG_EXTRA_SOURCES src/png/mips/filter_msa_intrinsics.c diff --git a/build/cmake/lib/regex.cmake b/build/cmake/lib/regex.cmake index 0478f5d42e..b28fc2c7ce 100644 --- a/build/cmake/lib/regex.cmake +++ b/build/cmake/lib/regex.cmake @@ -8,7 +8,6 @@ ############################################################################# if(wxUSE_REGEX) - # TODO: Forcing builtin until sys is implemented set(wxUSE_REGEX builtin) wx_add_builtin_library(wxregex src/regex/regcomp.c @@ -20,5 +19,3 @@ if(wxUSE_REGEX) set(REGEX_LIBRARIES wxregex) set(REGEX_INCLUDE_DIRS ${wxSOURCE_DIR}/src/regex) endif() - -#TODO: find external lib and include dir diff --git a/build/cmake/lib/tiff.cmake b/build/cmake/lib/tiff.cmake index 289390db73..f77e5283de 100644 --- a/build/cmake/lib/tiff.cmake +++ b/build/cmake/lib/tiff.cmake @@ -8,13 +8,8 @@ ############################################################################# if(wxUSE_LIBTIFF STREQUAL "builtin") - # TODO: implement building libtiff via ExternalProject_Add() - if(UNIX AND NOT APPLE) - message(WARNING "Builtin libtiff on unix is currently not supported") - wx_option_force_value(wxUSE_LIBTIFF OFF) - return() - endif() - + # TODO: implement building libtiff via its CMake file, using + # add_subdirectory or ExternalProject_Add if(WIN32) set(TIFF_PLATFORM_SRC src/tiff/libtiff/tif_win32.c) elseif(UNIX) diff --git a/build/cmake/lib/zlib.cmake b/build/cmake/lib/zlib.cmake index 0666e010ec..1eede10235 100644 --- a/build/cmake/lib/zlib.cmake +++ b/build/cmake/lib/zlib.cmake @@ -8,6 +8,8 @@ ############################################################################# if(wxUSE_ZLIB STREQUAL "builtin") + # TODO: implement building zlib via its CMake file, using + # add_subdirectory or ExternalProject_Add wx_add_builtin_library(wxzlib src/zlib/adler32.c src/zlib/compress.c diff --git a/build/cmake/modules/FindWEBKIT2.cmake b/build/cmake/modules/FindWEBKIT2.cmake index 33a8e4a863..92a0874c60 100644 --- a/build/cmake/modules/FindWEBKIT2.cmake +++ b/build/cmake/modules/FindWEBKIT2.cmake @@ -9,6 +9,7 @@ SET( WEBKIT2_VERSION 4.0) set(WEBKIT2_INCLUDE_DIR WEBKIT2_INCLUDE_DIR-NOTFOUND) set(WEBKIT2_LIBRARY WEBKIT2_LIBRARY-NOTFOUND) +set(WEBKIT2_JS_LIBRARY WEBKIT2_JS_LIBRARY-NOTFOUND) set(WEBKIT2_LIBRARIES WEBKIT2_LIBRARIES-NOTFOUND) FIND_PATH(WEBKIT2_INCLUDE_DIR webkit2/webkit2.h @@ -20,6 +21,11 @@ FIND_LIBRARY(WEBKIT2_LIBRARY NAMES ${WEBKIT2_NAMES} ) +SET(WEBKIT2_JS_NAMES "javascriptcoregtk-${WEBKIT2_VERSION}") +FIND_LIBRARY(WEBKIT2_JS_LIBRARY + NAMES ${WEBKIT2_JS_NAMES} +) + # Handle the QUIETLY and REQUIRED arguments and set WEBKIT2_FOUND to # TRUE if all listed variables are TRUE. INCLUDE(FindPackageHandleStandardArgs) @@ -29,7 +35,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS( ) IF(WEBKIT2_FOUND) - SET( WEBKIT2_LIBRARIES ${WEBKIT2_LIBRARY} ) + SET( WEBKIT2_LIBRARIES ${WEBKIT2_LIBRARY} ${WEBKIT2_JS_LIBRARY} ) ELSE(WEBKIT2_FOUND) SET( WEBKIT2_LIBRARIES ) ENDIF(WEBKIT2_FOUND) diff --git a/build/cmake/options.cmake b/build/cmake/options.cmake index 913f35542d..deca75f467 100644 --- a/build/cmake/options.cmake +++ b/build/cmake/options.cmake @@ -64,6 +64,8 @@ else() endif() wx_option(wxBUILD_STRIPPED_RELEASE "remove debug symbols in release build" ${wxBUILD_STRIPPED_RELEASE_DEFAULT}) mark_as_advanced(wxBUILD_STRIPPED_RELEASE) +wx_option(wxBUILD_PIC "Enable position independent code (PIC)." ON) +mark_as_advanced(wxBUILD_PIC) wx_option(wxUSE_NO_RTTI "disable RTTI support" OFF) # STL options diff --git a/build/cmake/samples/CMakeLists.txt b/build/cmake/samples/CMakeLists.txt index 0f02941a74..811db5ce7c 100644 --- a/build/cmake/samples/CMakeLists.txt +++ b/build/cmake/samples/CMakeLists.txt @@ -42,7 +42,7 @@ wx_add_sample(docview docview.cpp doc.cpp view.cpp docview.h doc.h view.h wx_add_sample(dragimag dragimag.cpp dragimag.h RES dragimag.rc DATA backgrnd.png shape01.png shape02.png shape03.png DEPENDS wxUSE_DRAGIMAGE) -wx_add_sample(drawing DATA pat4.bmp pat35.bmp pat36.bmp image.bmp mask.bmp) +wx_add_sample(drawing DATA pat4.bmp pat35.bmp pat36.bmp image.bmp mask.bmp NAME drawingsample) wx_add_sample(erase) wx_add_sample(event event.cpp gestures.cpp gestures.h chessboard.cpp chessboard.h) wx_add_sample(except DEPENDS wxUSE_EXCEPTIONS) @@ -71,7 +71,7 @@ wx_add_sample(image image.cpp canvas.cpp canvas.h cursor_png.c RES image.rc DATA horse.png horse.jpg horse.bmp horse.gif horse.pcx horse.pnm horse_ag.pnm horse_rg.pnm horse.tif horse.tga horse.xpm horse.cur horse.ico horse3.ani smile.xbm toucan.png cmyk.jpg cursor.png - DEPENDS wxUSE_IMAGE) + NAME imagesample DEPENDS wxUSE_IMAGE) foreach(lang ar bg cs de fr it ka pl ru sv ja ja_JP.EUC-JP) list(APPEND INTERNAT_DATA_FILES ${lang}/internat.po ${lang}/internat.mo) endforeach() diff --git a/build/cmake/setup.cmake b/build/cmake/setup.cmake index 1272e3de49..37c6af78d2 100644 --- a/build/cmake/setup.cmake +++ b/build/cmake/setup.cmake @@ -587,14 +587,11 @@ foreach(func endforeach() # Check various functions -foreach(func - fsync - snprintf vsnprintf strnlen strtoull - setpriority - ) - string(TOUPPER ${func} func_upper) - check_function_exists(${func} HAVE_${func_upper}) -endforeach() +wx_check_funcs(fsync + snprintf vsnprintf strnlen strtoull + setpriority + gettimeofday + ) if(MSVC) check_symbol_exists(vsscanf stdio.h HAVE_VSSCANF) @@ -643,7 +640,6 @@ cmake_pop_check_state() if(HAVE_DLOPEN) check_symbol_exists(dladdr dlfcn.h HAVE_DLADDR) endif() -check_function_exists(gettimeofday HAVE_GETTIMEOFDAY) if(APPLE) set(wxUSE_EPOLL_DISPATCHER OFF) diff --git a/configure b/configure index 3352c06eee..0a6727e2ca 100755 --- a/configure +++ b/configure @@ -634,6 +634,7 @@ WX_VERSION_TAG DMALLOC_LIBS OPENGL_LIBS LDFLAGS_GL +SAMPLES_CXXFLAGS SAMPLES_SUBDIRS DISTDIR GUIDIST @@ -889,7 +890,6 @@ RANLIB USE_DPI_AWARE_MANIFEST HOST_SUFFIX HEADER_PAD_OPTION -SAMPLES_CXXFLAGS SAMPLES_RPATH_FLAG DYLIB_RPATH_POSTLINK DYLIB_RPATH_INSTALL @@ -1123,6 +1123,7 @@ enable_utf8only enable_extended_rtti enable_optimise enable_profile +enable_pic enable_no_rtti enable_no_exceptions enable_permissive @@ -2079,6 +2080,7 @@ Optional Features: --enable-extended_rtti use extended RTTI (XTI) --disable-optimise compile without optimisations --enable-profile create code with profiling information + --disable-pic don't use position independent code when building static libraries (shared libraries always use PIC) --enable-no_rtti create code without RTTI information --enable-no_exceptions create code without C++ exceptions handling --enable-permissive compile code disregarding strict ANSI @@ -5939,6 +5941,35 @@ fi eval "$wx_cv_use_profile" + enablestring=disable + defaultval= + if test -z "$defaultval"; then + if test x"$enablestring" = xdisable; then + defaultval=yes + else + defaultval=no + fi + fi + + # Check whether --enable-pic was given. +if test "${enable_pic+set}" = set; then : + enableval=$enable_pic; + if test "$enableval" = yes; then + wx_cv_use_pic='wxUSE_PIC=yes' + else + wx_cv_use_pic='wxUSE_PIC=no' + fi + +else + + wx_cv_use_pic='wxUSE_PIC=${'DEFAULT_wxUSE_PIC":-$defaultval}" + +fi + + + eval "$wx_cv_use_pic" + + enablestring= defaultval= if test -z "$defaultval"; then @@ -26276,8 +26307,7 @@ $as_echo "yes" >&6; } TOOLKIT_INCLUDE="${TOOLKIT_INCLUDE} ${QT5_CFLAGS}" GUI_TK_LIBRARY="${GUI_TK_LIBRARY} ${QT5_LIBS}" if `pkg-config --variable qt_config Qt5Core | grep "reduce_relocations" >/dev/null`; then - SAMPLES_CXXFLAGS="-fPIC $SAMPLES_CXXFLAGS" - WXCONFIG_CXXFLAGS="-fPIC $WXCONFIG_CXXFLAGS" + wxUSE_PIC=yes fi fi @@ -33152,6 +33182,11 @@ $as_echo "$as_me: WARNING: plugins require wxDynamicLibrary, disabling" >&2;} fi fi +if test "$wxUSE_PIC" = "no" -a "$wxUSE_SHARED" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: position independent code (PIC) can not be disabled for shared libraries" >&5 +$as_echo "$as_me: WARNING: position independent code (PIC) can not be disabled for shared libraries" >&2;} +fi + if test "$wxUSE_FSWATCHER" = "yes"; then if test "$USE_WIN32" != 1; then @@ -38157,7 +38192,6 @@ TOOLKIT_LOWERCASE=`echo $TOOLKIT | tr '[A-Z]' '[a-z]'` - case "$TOOLKIT" in GTK) TOOLKIT_DESC="GTK+" @@ -40592,6 +40626,14 @@ then #OBJCXXFLAGS="-DWX_PRECOMP $CXXFLAGS" fi +if test "$wxUSE_PIC" = "yes" ; then + if test "$wxUSE_SHARED" = "no" ; then + CFLAGS="$CFLAGS $PIC_FLAG" + CXXFLAGS="$CXXFLAGS $PIC_FLAG" + fi + SAMPLES_CXXFLAGS="$SAMPLES_CXXFLAGS $PIC_FLAG" +fi + if test "$DEPS_TRACKING" = 1 -a "$wxUSE_MAC" = 1 ; then if test "x$wxUSE_UNIVERSAL_BINARY" != "xno" ; then @@ -40690,6 +40732,7 @@ SAMPLES_SUBDIRS="`echo $SAMPLES_SUBDIRS | tr -s ' ' | tr ' ' '\n' | sort | uniq + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 diff --git a/configure.in b/configure.in index 27fe34a7cd..37622d6d51 100644 --- a/configure.in +++ b/configure.in @@ -678,6 +678,7 @@ WX_ARG_ENABLE(extended_rtti, [ --enable-extended_rtti use extended RTTI (XTI)] WX_ARG_DISABLE(optimise, [ --disable-optimise compile without optimisations], wxUSE_OPTIMISE) WX_ARG_ENABLE(profile, [ --enable-profile create code with profiling information], wxUSE_PROFILE) +WX_ARG_DISABLE(pic, [ --disable-pic don't use position independent code when building static libraries (shared libraries always use PIC)], wxUSE_PIC) WX_ARG_ENABLE(no_rtti, [ --enable-no_rtti create code without RTTI information], wxUSE_NO_RTTI) WX_ARG_ENABLE(no_exceptions, [ --enable-no_exceptions create code without C++ exceptions handling], wxUSE_NO_EXCEPTIONS) WX_ARG_ENABLE(permissive, [ --enable-permissive compile code disregarding strict ANSI], wxUSE_PERMISSIVE) @@ -3610,8 +3611,7 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config GUI_TK_LIBRARY="${GUI_TK_LIBRARY} ${QT5_LIBS}" if `pkg-config --variable qt_config Qt5Core | grep "reduce_relocations" >/dev/null`; then dnl build with position independent code if Qt needs it - SAMPLES_CXXFLAGS="-fPIC $SAMPLES_CXXFLAGS" - WXCONFIG_CXXFLAGS="-fPIC $WXCONFIG_CXXFLAGS" + wxUSE_PIC=yes fi ], [ @@ -5586,6 +5586,10 @@ if test "$wxUSE_PLUGINS" = "yes" ; then fi fi +if test "$wxUSE_PIC" = "no" -a "$wxUSE_SHARED" = "yes"; then + AC_MSG_WARN([position independent code (PIC) can not be disabled for shared libraries]) +fi + dnl --------------------------------------------------------------------------- dnl File system watcher checks dnl --------------------------------------------------------------------------- @@ -8269,7 +8273,6 @@ AC_SUBST(TOOLKIT_VERSION) AC_SUBST(DYLIB_RPATH_INSTALL) AC_SUBST(DYLIB_RPATH_POSTLINK) AC_SUBST(SAMPLES_RPATH_FLAG) -AC_SUBST(SAMPLES_CXXFLAGS) AC_SUBST(HEADER_PAD_OPTION) AC_SUBST(HOST_SUFFIX) AC_SUBST(USE_DPI_AWARE_MANIFEST) @@ -8359,6 +8362,15 @@ then #OBJCXXFLAGS="-DWX_PRECOMP $CXXFLAGS" fi +dnl cc/cxx option for position independent code +if test "$wxUSE_PIC" = "yes" ; then + if test "$wxUSE_SHARED" = "no" ; then + CFLAGS="$CFLAGS $PIC_FLAG" + CXXFLAGS="$CXXFLAGS $PIC_FLAG" + fi + SAMPLES_CXXFLAGS="$SAMPLES_CXXFLAGS $PIC_FLAG" +fi + dnl HACK ALERT!! dnl For now, we need to alter bk-deps not to generate deps dnl when we've configured a Universal binary build. @@ -8501,6 +8513,7 @@ AC_SUBST(DISTDIR) dnl additional subdirectories where we will build AC_SUBST(SAMPLES_SUBDIRS) +AC_SUBST(SAMPLES_CXXFLAGS) dnl additional libraries and linker settings AC_SUBST(LDFLAGS_GL) diff --git a/demos/bombs/game.cpp b/demos/bombs/game.cpp index 48bd783d79..fc373513e9 100644 --- a/demos/bombs/game.cpp +++ b/demos/bombs/game.cpp @@ -64,7 +64,7 @@ bool BombsGame::Init(int aWidth, int aHeight, bool easyCorner) { for(y=0; yGetClientSize().x - GetPosition().x; int visibleWidth = wxMin(GetClientSize().x, availableWidth - GetWindowBorderSize().x); diff --git a/src/stc/gen_iface.py b/src/stc/gen_iface.py index 6e976fded1..d55b2cb703 100755 --- a/src/stc/gen_iface.py +++ b/src/stc/gen_iface.py @@ -1174,11 +1174,20 @@ def processIface(iface, h_tmplt, cpp_tmplt, ih_tmplt, h_dest, cpp_dest, docstr_d ih_text = ih_text % data # write out destination files - open(h_dest, 'w').write(h_text) - open(cpp_dest, 'w').write(cpp_text) + # Use 'wb' with Python 2 to enforce LF newlines. This does not work with + # Python 3, use 'newline':'\n' there (which in turn does not work with 2). + if sys.version_info[0] == 2: + acc = 'wb' + eol = {} + else: + acc = 'wt' + eol = {'newline':'\n'} + + open(h_dest, acc, **eol).write(h_text) + open(cpp_dest, acc, **eol).write(cpp_text) if docstr_dest: - open(docstr_dest, 'w').write(docstrings) - open(ih_dest, 'w').write(ih_text) + open(docstr_dest, acc, **eol).write(docstrings) + open(ih_dest, acc, **eol).write(ih_text) def joinWithNewLines(values): diff --git a/src/stc/scintilla/include/Scintilla.iface b/src/stc/scintilla/include/Scintilla.iface index 6b9a77f66e..035d80235f 100644 --- a/src/stc/scintilla/include/Scintilla.iface +++ b/src/stc/scintilla/include/Scintilla.iface @@ -331,7 +331,7 @@ set void MarkerSetBack=2042(int markerNumber, colour back) # Set the background colour used for a particular marker number when its folding block is selected. set void MarkerSetBackSelected=2292(int markerNumber, colour back) -# Enable/disable highlight for current folding bloc (smallest one that contains the caret) +# Enable/disable highlight for current folding block (smallest one that contains the caret) fun void MarkerEnableHighlight=2293(bool enabled,) # Add a marker to a line, returning an ID which can be used to find or delete the marker. diff --git a/src/stc/stc.cpp b/src/stc/stc.cpp index 8e3820d162..8eabc40aa3 100644 --- a/src/stc/stc.cpp +++ b/src/stc/stc.cpp @@ -622,7 +622,7 @@ void wxStyledTextCtrl::MarkerSetBackgroundSelected(int markerNumber, const wxCol SendMsg(SCI_MARKERSETBACKSELECTED, markerNumber, wxColourAsLong(back)); } -// Enable/disable highlight for current folding bloc (smallest one that contains the caret) +// Enable/disable highlight for current folding block (smallest one that contains the caret) void wxStyledTextCtrl::MarkerEnableHighlight(bool enabled) { SendMsg(SCI_MARKERENABLEHIGHLIGHT, enabled, 0); diff --git a/src/stc/stc.interface.h.in b/src/stc/stc.interface.h.in index af05c72bde..3ce91d11e4 100644 --- a/src/stc/stc.interface.h.in +++ b/src/stc/stc.interface.h.in @@ -868,7 +868,7 @@ public: @section event_types Event Types The following is a brief description of when the control generates these - events and a list of which methods provide relevent information. Additional + events and a list of which methods provide relevant information. Additional details can be found in the Scintilla documentation (http://www.scintilla.org/ScintillaDoc.html#Notifications).