Merge pull request #1607 from PhenomRetroShare/Fix_CMark_Compil

Fix CMark compilation
This commit is contained in:
G10h4ck 2019-09-02 16:28:45 +02:00 committed by GitHub
commit e31b7c2816
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 52 additions and 51 deletions

View File

@ -22,7 +22,7 @@ before_install:
- if [ $TRAVIS_OS_NAME == osx ]; then brew install ccach; export PATH="/usr/local/opt/ccache/libexec:$PATH" ; fi
- if [ $TRAVIS_OS_NAME == osx ]; then brew install qt5; fi
- if [ $TRAVIS_OS_NAME == osx ]; then brew link --force qt5 ; fi
- if [ $TRAVIS_OS_NAME == osx ]; then brew install openssl miniupnpc libmicrohttpd sqlcipher xapian; fi
- if [ $TRAVIS_OS_NAME == osx ]; then brew install openssl miniupnpc libmicrohttpd sqlcipher xapian cmark; fi
- if [ $TRAVIS_OS_NAME == osx ]; then brew install p7zip; fi
- if [ $TRAVIS_OS_NAME == osx ]; then npm install -g appdmg; fi

View File

@ -90,7 +90,7 @@ install:
# Configuring MSys2
- set PATH=C:\msys64\usr\bin;%PATH%
- set PATH=C:\msys64\mingw32\bin;%PATH%
- pacman --noconfirm -S mingw-w64-i686-qt5 mingw-w64-i686-miniupnpc mingw-w64-i686-sqlcipher mingw-w64-i686-libmicrohttpd mingw-w64-i686-xapian-core
- pacman --noconfirm -S mingw-w64-i686-qt5 mingw-w64-i686-miniupnpc mingw-w64-i686-sqlcipher mingw-w64-i686-libmicrohttpd mingw-w64-i686-xapian-core mingw-w64-i686-cmark
#- pacman --noconfirm -S mingw-w64-i686-qt5-static mingw-w64-i686-miniupnpc mingw-w64-i686-sqlcipher mingw-w64-i686-libmicrohttpd
#- set PATH=C:\msys64\mingw32\qt5-static\bin\;%PATH%
@ -146,6 +146,7 @@ before_package:
# to run your custom scripts instead of automatic MSBuild
build_script:
- env
- git submodule update --init
- qmake -Wall -spec win32-g++ "CONFIG=debug"
- mingw32-make -j3
@ -245,6 +246,10 @@ after_build:
- copy C:\msys64\mingw32\bin\libunistring*.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\libffi*.dll %RS_DEPLOY%\
## Needed for cmark
- copy C:\msys64\mingw32\bin\libcmark*.dll %RS_DEPLOY%\
- copy C:\msys64\mingw32\bin\libdouble-conversion*.dll %RS_DEPLOY%\
- find C:\projects\RetroShare >> filelist.txt
# to disable automatic builds

View File

@ -43,6 +43,46 @@ rs_jsonapi {
FORMS *= gui/settings/JsonApiPage.ui
}
# Auto detect installed version of cmark
rs_gui_cmark {
DEFINES *= USE_CMARK
no_rs_cross_compiling {
message("Using compiled cmark")
CMARK_SRC_PATH=$$clean_path($${RS_SRC_PATH}/supportlibs/cmark)
CMARK_BUILD_PATH=$$clean_path($${RS_BUILD_PATH}/supportlibs/cmark/build)
INCLUDEPATH *= $$clean_path($${RS_SRC_PATH}/src/)
DEPENDPATH *= $$clean_path($${RS_SRC_PATH}/src/)
QMAKE_LIBDIR *= $$clean_path($${CMARK_BUILD_PATH}/)
# Using sLibs would fail as libcmark.a is generated at compile-time
LIBS *= -L$$clean_path($${CMARK_BUILD_PATH}/src/) -lcmark
DUMMYCMARKINPUT = FORCE
CMAKE_GENERATOR_OVERRIDE=""
win32-g++:CMAKE_GENERATOR_OVERRIDE="-G \"MSYS Makefiles\""
gencmarklib.name = Generating libcmark.
gencmarklib.input = DUMMYCMARKINPUT
gencmarklib.output = $$clean_path($${CMARK_BUILD_PATH}/src/libcmark.a)
gencmarklib.CONFIG += target_predeps combine
gencmarklib.variable_out = PRE_TARGETDEPS
gencmarklib.commands = \
cd $${RS_SRC_PATH} && ( \
git submodule update --init supportlibs/cmark ; \
cd $${CMARK_SRC_PATH} ; \
true ) && \
mkdir -p $${CMARK_BUILD_PATH} && cd $${CMARK_BUILD_PATH} && \
cmake \
-DCMAKE_CXX_COMPILER=$$QMAKE_CXX \
$${CMAKE_GENERATOR_OVERRIDE} \
-DCMAKE_INSTALL_PREFIX=. \
-B. \
-H$$shell_path($${CMARK_SRC_PATH}) && \
$(MAKE)
QMAKE_EXTRA_COMPILERS += gencmarklib
} else {
message("Using systems cmark")
sLibs *= libcmark
}
}
FORMS += TorControl/TorControlWindow.ui
SOURCES += TorControl/TorControlWindow.cpp
@ -1399,44 +1439,3 @@ gxsgui {
}
cmark {
DEFINES *= USE_CMARK
HEADERS += \
../../supportlibs/cmark/src/buffer.h \
../../supportlibs/cmark/src/chunk.h \
../../supportlibs/cmark/src/cmark.h \
../../supportlibs/cmark/src/cmark_ctype.h \
../../supportlibs/cmark/src/houdini.h \
../../supportlibs/cmark/src/inlines.h \
../../supportlibs/cmark/src/iterator.h \
../../supportlibs/cmark/src/node.h \
../../supportlibs/cmark/src/parser.h \
../../supportlibs/cmark/src/references.h \
../../supportlibs/cmark/src/render.h \
../../supportlibs/cmark/src/scanners.h \
../../supportlibs/cmark/src/utf8.h \
SOURCES += \
../../supportlibs/cmark/src/blocks.c \
../../supportlibs/cmark/src/buffer.c \
../../supportlibs/cmark/src/cmark.c \
../../supportlibs/cmark/src/cmark_ctype.c \
../../supportlibs/cmark/src/commonmark.c \
../../supportlibs/cmark/src/houdini_href_e.c \
../../supportlibs/cmark/src/houdini_html_e.c \
../../supportlibs/cmark/src/houdini_html_u.c \
../../supportlibs/cmark/src/html.c \
../../supportlibs/cmark/src/inlines.c \
../../supportlibs/cmark/src/iterator.c \
../../supportlibs/cmark/src/latex.c \
../../supportlibs/cmark/src/man.c \
../../supportlibs/cmark/src/node.c \
../../supportlibs/cmark/src/references.c \
../../supportlibs/cmark/src/render.c \
../../supportlibs/cmark/src/scanners.c \
../../supportlibs/cmark/src/utf8.c \
../../supportlibs/cmark/src/xml.c \
}

View File

@ -35,9 +35,7 @@
#ifdef USE_CMARK
//Include for CMark
// This needs to be fixed: use system library if available, etc.
#include <gui/../../../supportlibs/cmark/src/cmark.h>
#include <gui/../../../supportlibs/cmark/src/node.h>
#include <cmark.h>
#endif
#include <iostream>
@ -593,7 +591,7 @@ QString RsHtml::formatText(QTextDocument *textDocument, const QString &text, ulo
// Parse CommonMark
int options = CMARK_OPT_DEFAULT;
cmark_parser *parser = cmark_parser_new(options);
cmark_parser_feed(parser, formattedText.toStdString().c_str(),formattedText.length());
cmark_parser_feed(parser, formattedText.toStdString().c_str(),static_cast<size_t>(formattedText.length()));
cmark_node *document = cmark_parser_finish(parser);
cmark_parser_free(parser);
char *result;
@ -601,7 +599,6 @@ QString RsHtml::formatText(QTextDocument *textDocument, const QString &text, ulo
// Get result as html
formattedText = QString::fromUtf8(result);
//Clean
cmark_node_mem(document)->free(result);
cmark_node_free(document);
//Get document formed HTML
textBrowser.setHtml(formattedText);

View File

@ -38,8 +38,8 @@ no_retroshare_nogui:CONFIG -= retroshare_nogui
# To disable cmark append the following
# assignation to qmake command line "CONFIG+=no_cmark"
CONFIG *= no_cmark
cmark:CONFIG -= no_cmark
CONFIG *= rs_gui_cmark
no_rs_gui_cmark:CONFIG -= rs_gui_cmark
# To enable RetroShare plugins append the following
# assignation to qmake command line "CONFIG+=retroshare_plugins"