diff --git a/CMakeLists.txt b/CMakeLists.txt index e8b7361111..d03194a39c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -611,16 +611,27 @@ include_directories(${TOP_BINARY_DIR} ${TOP_SRC_DIR}/src) set(Spelling_FOUND OFF) set(Include_used_spellchecker) # String will be inserted into config.h +if(LYX_3RDPARTY_BUILD) + add_subdirectory(src/3rdparty/hunspell) + add_definitions(-DHUNSPELL_STATIC) + set(HUNSPELL_FOUND ON) + message(STATUS " * Hunspell:") + message(STATUS " - include: ${HUNSPELL_INCLUDE_DIR}") + message(STATUS " - library: ${HUNSPELL_LIBRARY}") +endif() + foreach(_spell "ASPELL" "Enchant" "Hunspell") string(TOUPPER ${_spell} _upspell) - find_package(${_spell}) + if (NOT ${_upspell}_FOUND) + find_package(${_spell}) + endif() if (${_upspell}_FOUND) include_directories(${${_upspell}_INCLUDE_DIR}) set(Spelling_FOUND ON) message(STATUS "Building with USE_${_upspell}") set(Include_used_spellchecker "${Include_used_spellchecker}#define USE_${_upspell} 1\n") else() - if(LYX_${_upspell} AND NOT LYX_HUNSPELL) + if(LYX_${_upspell}) message(FATAL_ERROR "Required ${_spell} devel package not found") else() message(STATUS "${_upspell} not found, building without ${_spell} support") @@ -628,14 +639,6 @@ foreach(_spell "ASPELL" "Enchant" "Hunspell") endif() endforeach() -if(LYX_HUNSPELL AND NOT HUNSPELL_FOUND) - add_subdirectory(src/3rdparty/hunspell) - set(Spelling_FOUND ON) -endif() -message(STATUS " * Hunspell:") -message(STATUS " - include: ${HUNSPELL_INCLUDE_DIR}") -message(STATUS " - library: ${HUNSPELL_LIBRARY}") - find_package(PythonInterp 2.7 QUIET) if(PYTHONINTERP_FOUND) @@ -674,11 +677,8 @@ if(UNIX) find_package(ZLIB REQUIRED) endif() -if(NOT ICONV_FOUND) +if(LYX_3RDPARTY_BUILD) add_subdirectory(src/3rdparty/libiconv) -endif() - -if(NOT ZLIB_FOUND) add_subdirectory(src/3rdparty/zlib) endif() diff --git a/src/3rdparty/hunspell/CMakeLists.txt b/src/3rdparty/hunspell/CMakeLists.txt index 856f1e9755..0000eac5fa 100644 --- a/src/3rdparty/hunspell/CMakeLists.txt +++ b/src/3rdparty/hunspell/CMakeLists.txt @@ -7,7 +7,12 @@ set(HUNSPELL_VERSION 1.3.3) set(SRCDIR ${CMAKE_CURRENT_SOURCE_DIR}/${HUNSPELL_VERSION}/src) -include_directories(./ ${SRCDIR}/hunspell ${SRCDIR}/parsers ${SRCDIR}/tools ${SRCDIR}/win_api) +include_directories(./ ${SRCDIR}/hunspell ${SRCDIR}/parsers ${SRCDIR}/tools) + +if(WIN32) + include_directories(${SRCDIR}/win_api) + set(HUNCONFIG ${SRCDIR}/win_api/config.h) +endif() # LIBS set(SRCS @@ -45,8 +50,11 @@ set(HEADERS ${SRCDIR}/hunspell/replist.hxx ${SRCDIR}/hunspell/hunvisapi.h) -add_library(hunspell STATIC ${HEADERS} ${SRCS}) +add_definitions(-DHUNSPELL_STATIC) +add_library(hunspell STATIC ${HEADERS} ${SRCS} ${HUNCONFIG}) set(HUNSPELL_LIBRARY hunspell CACHE STRING "Hunspell library" FORCE) set(HUNSPELL_INCLUDE_DIR ${SRCDIR} CACHE STRING "Hunspell include dir" FORCE) -set(HUNSPELL_FOUND CACHE STRING "Hunspell found" FORCE) \ No newline at end of file +set(HUNSPELL_FOUND CACHE STRING "Hunspell found" FORCE) + +set_target_properties(hunspell PROPERTIES FOLDER "3rd_party") diff --git a/src/3rdparty/libiconv/CMakeLists.txt b/src/3rdparty/libiconv/CMakeLists.txt index e092828ed2..65046e7e34 100644 --- a/src/3rdparty/libiconv/CMakeLists.txt +++ b/src/3rdparty/libiconv/CMakeLists.txt @@ -25,18 +25,20 @@ set(BROKEN_WCHAR_H 0) set(HAVE_WCHAR_T 0) set(BINDIR ${CMAKE_BINARY_DIR}/libiconv) -configure_file(config.h.cmake ${BINDIR}/config.h) -configure_file(${SRCDIR}/include/iconv.h.build.in ${BINDIR}/include/iconv.h) +configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) +configure_file(${SRCDIR}/include/iconv.h.build.in ${CMAKE_CURRENT_BINARY_DIR}/iconv.h) + configure_file(${SRCDIR}/libcharset/include/libcharset.h.in ${BINDIR}/include/libcharset.h) configure_file(${SRCDIR}/srclib/uniwidth.in.h ${BINDIR}/srclib/uniwidth.h) configure_file(${SRCDIR}/srclib/unitypes.in.h ${BINDIR}/srclib/unitypes.h) +configure_file(${SRCDIR}/include/iconv.h.in ${BINDIR}/include/iconv.h) # Dirty fix for MinGW if(MINGW) add_definitions(-DELOOP=0 -DHAVE_DECL_STRERROR_R=0) endif () -include_directories( ${BINDIR}/include ${SRCDIR}/include ${SRCDIR}/srclib) +include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${BINDIR}/include ${SRCDIR}/include ${SRCDIR}/srclib) add_definitions(-Dset_relocation_prefix=libcharset_set_relocation_prefix -Drelocate=libcharset_relocate -DHAVE_CONFIG_H -DINSTALLPREFIX=NULL -DNO_XMALLOC -DBUILDING_LIBCHARSET -DINSTALLDIR="" -DLIBDIR="" -DENABLE_RELOCATABLE=1 -DIN_LIBRARY) # libcharset @@ -51,3 +53,5 @@ set_target_properties(iconv PROPERTIES COMPILE_FLAGS -DBUILDING_LIBICONV) set(ICONV_INCLUDE_DIR ${BINDIR}/include CACHE STRING "libiconv include dir" FORCE) set(ICONV_LIBRARY iconv CACHE STRING "libiconv library" FORCE) set(ICONV_FOUND iconv CACHE STRING "libiconv found" FORCE) + +set_target_properties(iconv PROPERTIES FOLDER "3rd_party") diff --git a/src/3rdparty/libiconv/configure.cmake b/src/3rdparty/libiconv/configure.cmake index 497450e873..f5f73cd8e3 100644 --- a/src/3rdparty/libiconv/configure.cmake +++ b/src/3rdparty/libiconv/configure.cmake @@ -242,8 +242,12 @@ set ( HAVE_SIGNED_SIG_ATOMIC_T 1 ) set ( HAVE_SIGNED_WINT_T 1) set ( HAVE_SIGSET_T ) +if(MSVC) +set ( HAVE_VISIBILITY 0 ) +else() set ( HAVE_VISIBILITY 1 ) -set ( ICONV_CONST "" ) +endif() +set ( ICONV_CONST "const" ) set ( INSTALLPREFIX "" ) set ( MALLOC_0_IS_NONNULL 1 ) set ( HAVE_WORKING_O_NOATIME 0 ) diff --git a/src/3rdparty/zlib/CMakeLists.txt b/src/3rdparty/zlib/CMakeLists.txt index 9f930951cb..de6de6a9b7 100644 --- a/src/3rdparty/zlib/CMakeLists.txt +++ b/src/3rdparty/zlib/CMakeLists.txt @@ -157,3 +157,4 @@ set(ZLIB_LIBRARY zlibstatic CACHE STRING "Zlib library" FORCE) set(ZLIB_INCLUDE_DIR ${SRCDIR} CACHE STRING "Zlib include dir" FORCE) set(ZLIB_FOUND CACHE STRING "Zlib found" FORCE ) +set_target_properties(zlibstatic PROPERTIES FOLDER "3rd_party")