[LyX/master] Revert "Amend 3093789e for cmake build"

Kornel Benko kornel at lyx.org
Mon Nov 30 09:01:39 UTC 2020


commit a171c651a6802380aad7d7e24ed1a95ffa814de6
Author: Kornel Benko <kornel at lyx.org>
Date:   Mon Nov 30 10:17:40 2020 +0100

    Revert "Amend 3093789e for cmake build"
    
    This reverts commit b3d43404f4649e1a5539f1a819a07f8ae16fad7f.
---
 3rdparty/boost/libs/CMakeLists.txt                |    9 +++++
 3rdparty/boost/libs/regex/CMakeLists.txt          |   26 ++++++++++++++
 3rdparty/boost/libs/regex/src/CMakeLists.txt      |   39 +++++++++++++++++++++
 CMakeLists.txt                                    |   21 +++++++++--
 INSTALL.cmake                                     |    3 +-
 development/cmake/configCompiler.h.cmake          |   13 +++++++
 development/cmake/modules/FindCXX11Compiler.cmake |    2 +-
 src/client/CMakeLists.txt                         |    2 +
 src/frontends/CMakeLists.txt                      |    2 +-
 src/frontends/tests/CMakeLists.txt                |    4 +-
 src/support/CMakeLists.txt                        |    2 +-
 src/support/tests/CMakeLists.txt                  |    4 +-
 src/tests/CMakeLists.txt                          |   16 ++++----
 src/tex2lyx/CMakeLists.txt                        |    1 +
 14 files changed, 124 insertions(+), 20 deletions(-)

diff --git a/3rdparty/boost/libs/CMakeLists.txt b/3rdparty/boost/libs/CMakeLists.txt
new file mode 100644
index 0000000..84da81e
--- /dev/null
+++ b/3rdparty/boost/libs/CMakeLists.txt
@@ -0,0 +1,9 @@
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+#
+# Copyright (c) 2010-2011 Peter Kümmel, <syntheticpp at gmx.net>
+#
+
+project(boost)
+
+message(STATUS "Using std regex")
diff --git a/3rdparty/boost/libs/regex/CMakeLists.txt b/3rdparty/boost/libs/regex/CMakeLists.txt
new file mode 100644
index 0000000..0b09b77
--- /dev/null
+++ b/3rdparty/boost/libs/regex/CMakeLists.txt
@@ -0,0 +1,26 @@
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+#
+# Copyright (c) 2006-2011 Peter Kümmel, <syntheticpp at gmx.net>
+#
+
+project(boost_regex)
+
+set(boost_regex_sources
+	cpp_regex_traits.cpp
+	c_regex_traits.cpp
+	cregex.cpp
+	fileiter.cpp
+	instances.cpp
+	regex.cpp
+	regex_raw_buffer.cpp
+	regex_traits_defaults.cpp
+	static_mutex.cpp
+	w32_regex_traits.cpp)
+
+lyx_add_path(boost_regex_sources ${TOP_SRC_DIR}/3rdparty/boost/libs/regex/src)
+
+add_library(boost_regex STATIC ${boost_regex_sources})
+
+set_target_properties(boost_regex PROPERTIES FOLDER "3rd_party")
+
diff --git a/3rdparty/boost/libs/regex/src/CMakeLists.txt b/3rdparty/boost/libs/regex/src/CMakeLists.txt
new file mode 100755
index 0000000..5ec05a2
--- /dev/null
+++ b/3rdparty/boost/libs/regex/src/CMakeLists.txt
@@ -0,0 +1,39 @@
+#
+# Copyright Troy D. Straszheim
+#
+# Distributed under the Boost Software License, Version 1.0.
+# See http://www.boost.org/LICENSE_1_0.txt
+#
+# Look for the ICU library. If we find it, we'll compile in support for ICU
+include(FindICU)
+set(BOOST_REGEX_LIBRARIES)
+if (ICU_FOUND AND ICU_I18N_FOUND)
+  add_definitions(-DBOOST_HAS_ICU=1)
+  include_directories(${ICU_INCLUDE_DIRS})
+  set(BOOST_REGEX_LIBRARIES ${ICU_LIBRARIES} ${ICU_I18N_LIBRARIES})
+endif (ICU_FOUND AND ICU_I18N_FOUND)
+ 
+boost_add_library(boost_regex
+   c_regex_traits.cpp
+   cpp_regex_traits.cpp
+   cregex.cpp
+   fileiter.cpp
+   instances.cpp
+   posix_api.cpp
+   regex.cpp
+   regex_debug.cpp
+   regex_raw_buffer.cpp
+   regex_traits_defaults.cpp
+   static_mutex.cpp
+   w32_regex_traits.cpp
+   wc_regex_traits.cpp
+   wide_posix_api.cpp
+   winstances.cpp 
+   usinstances.cpp 
+   LINK_LIBS ${BOOST_REGEX_LIBRARIES}
+   SHARED_COMPILE_FLAGS -DBOOST_REGEX_DYN_LINK=1)
+
+
+
+
+
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 59c9d7c..02a1b30 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -231,6 +231,7 @@ LYX_COMBO(EXTERNAL_MYTHES   "OFF := Build 3rdparty lib mytheslib" AUTO OFF ON)
 
 # GCC specific
 LYX_OPTION(PROFILE              "Build with options for gprof" ${DefaultLyxProfile} GCC)
+LYX_OPTION(EXTERNAL_BOOST       "Use external boost" ${DefaultExternalLibs} GCC)
 LYX_OPTION(PROGRAM_SUFFIX       "Append version suffix to binaries" ON GCC)
 LYX_OPTION(DEBUG_GLIBC          "Enable libstdc++ debug mode" OFF GCC)
 LYX_OPTION(DEBUG_GLIBC_PEDANTIC "Enable libstdc++ pedantic debug mode" OFF GCC)
@@ -274,6 +275,11 @@ if (LYX_ENABLE_VALGRIND_TESTS)
 		message(FATAL_ERROR "Cannot use valgrind tests, executable valgrind is missing. Please disable LYX_ENABLE_VALGRIND_TESTS")
 	endif()
 endif()
+if (LYX_DEBUG_GLIBC OR LYX_DEBUG_GLIBC_PEDANTIC OR LYX_STDLIB_DEBUG)
+  if (LYX_EXTERNAL_BOOST)
+    message(FATAL_ERROR "Using external boost not compatible with debug mode for stdlib")
+  endif()
+endif()
 
 if(LYX_DMG)
 	set(LYX_BUNDLE ON)
@@ -927,6 +933,13 @@ if(NOT LYX_EXTERNAL_DTL)
   add_subdirectory(3rdparty/dtl)
 endif()
 
+# Set only include path.
+# Use internal boost, which is known to exist
+# we don't need any libraries
+set(Lyx_Boost_Libraries)
+add_definitions(-DBOOST_USER_CONFIG=<config.h>)
+include_directories(${TOP_SRC_DIR}/3rdparty/boost)
+
 if(WIN32)
 	if(LYX_CONSOLE)
 		set(LYX_QTMAIN_LIBRARY)
@@ -978,9 +991,9 @@ if(LYX_PCH)
 				COMPILE_FLAGS "/Ycconfig.h /Fp\$(IntDir)/config.pch")
 			set(${name_}_sources ${${name_}_sources} ${TOP_BINARY_DIR}/config_pch.cpp
 				${TOP_BINARY_DIR}/pcheaders.h)
-			set(CMAKE_CXX_FLAGS_DEBUG	"${CMAKE_CXX_FLAGS_DEBUG} /DLYX_PCH_STL /DLYX_PCH_QT")
-			set(CMAKE_CXX_FLAGS_RELEASE	"${CMAKE_CXX_FLAGS_RELEASE} /DLYX_PCH_STL /DLYX_PCH_QT")
-			set(CMAKE_CXX_FLAGS_MINSIZEREL	"${CMAKE_CXX_FLAGS_MINSIZEREL} /DLYX_PCH_STL")
+			set(CMAKE_CXX_FLAGS_DEBUG	"${CMAKE_CXX_FLAGS_DEBUG} /DLYX_PCH_STL /DLYX_PCH_BOOST /DLYX_PCH_QT")
+			set(CMAKE_CXX_FLAGS_RELEASE	"${CMAKE_CXX_FLAGS_RELEASE} /DLYX_PCH_STL /DLYX_PCH_BOOST /DLYX_PCH_QT")
+			set(CMAKE_CXX_FLAGS_MINSIZEREL	"${CMAKE_CXX_FLAGS_MINSIZEREL} /DLYX_PCH_STL /DLYX_PCH_BOOST")
 		endmacro(lyx_add_msvc_pch)
 		macro(lyx_add_gcc_pch name_)
 		endmacro()
@@ -988,7 +1001,7 @@ if(LYX_PCH)
 		macro(lyx_add_msvc_pch name_)
 		endmacro()
 		macro(lyx_add_gcc_pch name_)
-			add_definitions(-DLYX_PCH_STL -DLYX_PCH_QT)
+			add_definitions(-DLYX_PCH_STL -DLYX_PCH_BOOST -DLYX_PCH_QT)
 			ADD_PRECOMPILED_HEADER(${name_} ${TOP_BINARY_DIR}/config_pch.cpp ${TOP_BINARY_DIR}/config.h.gch)
 		endmacro()
 	endif()
diff --git a/INSTALL.cmake b/INSTALL.cmake
index 5d4ed1c..e0e7afd 100644
--- a/INSTALL.cmake
+++ b/INSTALL.cmake
@@ -171,6 +171,7 @@ Build options
 
     # GCC specific 
     -- LYX_PROFILE              = OFF    : Build with options for gprof
+    -- LYX_EXTERNAL_BOOST       = OFF    : Use external boost
     -- LYX_PROGRAM_SUFFIX       = ON     : Append version suffix to binaries
     -- LYX_DEBUG_GLIBC          = OFF    : Enable libstdc++ debug mode
     -- LYX_DEBUG_GLIBC_PEDANTIC = OFF    : Enable libstdc++ pedantic debug mode
@@ -243,7 +244,7 @@ Visual Studio C++
     * for the 'Debug' and 'Release' build all precompiled headers are enabled
       to compile without pch (non file merge mode) This could be used to check
       if all necessary headers are included.
-        * use 'MinSizeRel' which only precompiles the STL headers
+        * use 'MinSizeRel' which only precompiles the STL and Boost headers
         * use 'RelWithDebInfo' which does not use any precompiled headers
 
 
diff --git a/development/cmake/configCompiler.h.cmake b/development/cmake/configCompiler.h.cmake
index 232771a..9fce467 100644
--- a/development/cmake/configCompiler.h.cmake
+++ b/development/cmake/configCompiler.h.cmake
@@ -80,12 +80,25 @@
 #undef HAVE_MKDIR // use _mkdir instead
 #endif
 
+#define BOOST_ALL_NO_LIB 1
+
 #ifdef _DEBUG
 #  define ENABLE_ASSERTIONS 1
 #endif
 
+#ifndef ENABLE_ASSERTIONS
+#  define BOOST_DISABLE_ASSERTS 1
+#endif
+#define BOOST_ENABLE_ASSERT_HANDLER 1
+
+//#define BOOST_DISABLE_THREADS 1
+#define BOOST_NO_WSTRING 1
+
 #ifdef __CYGWIN__
 #  define _DEFAULT_SOURCE
+#  define BOOST_POSIX 1
+#  define BOOST_POSIX_API 1
+#  define BOOST_POSIX_PATH 1
 #endif
 
 #if defined(HAVE_WCHAR_T) && SIZEOF_WCHAR_T == 4
diff --git a/development/cmake/modules/FindCXX11Compiler.cmake b/development/cmake/modules/FindCXX11Compiler.cmake
index 112ea12..01d6e6c 100644
--- a/development/cmake/modules/FindCXX11Compiler.cmake
+++ b/development/cmake/modules/FindCXX11Compiler.cmake
@@ -36,7 +36,7 @@ INCLUDE(FindPackageHandleStandardArgs)
 
 # get cmake-known std numbers
 # Detection of c++20 works well, but our code is not ready for it yet.
-# We currently get errors from our code.
+# We currently get errors with internal boost and also from our code.
 set(_max_std_num 17)
 lyxgetknowncmakestd(${_max_std_num} tmpnums)
 
diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt
index 9a809c9..95535e0 100644
--- a/src/client/CMakeLists.txt
+++ b/src/client/CMakeLists.txt
@@ -16,12 +16,14 @@ list(REMOVE_ITEM _lyxclient_sources "${TOP_SRC_DIR}/src/client/lyxclient.cpp")
 
 include_directories(BEFORE
 	"${TOP_SRC_DIR}/src/client"
+	"${TOP_SRC_DIR}/3rdparty/boost"
 	${ZLIB_INCLUDE_DIR})
 
 add_executable(${_lyxclient} ${_lyxclient_sources} ${_lyxclient_headers})
 
 target_link_libraries(${_lyxclient}
 	support
+	${Lyx_Boost_Libraries}
 	${ICONV_LIBRARY}
 	${QT_QTCORE_LIBRARY}
 	${QT_QTGUI_LIBRARY})
diff --git a/src/frontends/CMakeLists.txt b/src/frontends/CMakeLists.txt
index 3ef2168..97e1265 100644
--- a/src/frontends/CMakeLists.txt
+++ b/src/frontends/CMakeLists.txt
@@ -22,7 +22,7 @@ else()
 endif()
 set_target_properties(frontends PROPERTIES FOLDER "applications/LyX")
 
-#target_link_libraries(frontends)
+target_link_libraries(frontends ${Lyx_Boost_Libraries})
 
 project_source_group("${GROUP_CODE}" frontends_sources frontends_headers)
 
diff --git a/src/frontends/tests/CMakeLists.txt b/src/frontends/tests/CMakeLists.txt
index e7f8efb..f7712e5 100644
--- a/src/frontends/tests/CMakeLists.txt
+++ b/src/frontends/tests/CMakeLists.txt
@@ -7,8 +7,8 @@ project(testFrontends)
 
 set(TESTS "test_biblio")
 
-add_executable(biblio biblio.cpp)
-#target_link_libraries(biblio)
+add_executable(biblio biblio.cpp boost.cpp)
+target_link_libraries(biblio ${Lyx_Boost_Libraries})
 add_dependencies(lyx_run_tests biblio)
 set_target_properties(biblio PROPERTIES FOLDER "tests/frontends")
 
diff --git a/src/support/CMakeLists.txt b/src/support/CMakeLists.txt
index b851aef..99b4383 100644
--- a/src/support/CMakeLists.txt
+++ b/src/support/CMakeLists.txt
@@ -82,7 +82,7 @@ set_target_properties(support PROPERTIES FOLDER "applications/LyX")
 
 qt_use_modules(support Core Gui)
 
-target_link_libraries(support ${QT_QTCORE_LIBRARY} ${ZLIB_LIBRARY})
+target_link_libraries(support ${Lyx_Boost_Libraries} ${QT_QTCORE_LIBRARY} ${ZLIB_LIBRARY})
 
 lyx_add_gcc_pch(support)
 
diff --git a/src/support/tests/CMakeLists.txt b/src/support/tests/CMakeLists.txt
index 9ba00b0..e5ef4fa 100644
--- a/src/support/tests/CMakeLists.txt
+++ b/src/support/tests/CMakeLists.txt
@@ -14,7 +14,7 @@ macro(sources _program)
 	set(${_program}_SOURCES ${_tmplist})
 	add_executable(${_program} ${_tmplist})
 	target_link_libraries(${_program} support
-		${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY}
+		${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY}
 		${ZLIB_LIBRARY} ${ICONV_LIBRARY})
 	lyx_target_link_libraries(${_program} Magic)
 	if(CYGWIN)
@@ -39,7 +39,7 @@ file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/regfiles")
 
 set(_depends)
 foreach(_src ${check_PROGRAMS})
-	sources(${_src} ${_src}.cpp dummy_functions.cpp)
+	sources(${_src} ${_src}.cpp dummy_functions.cpp boost.cpp)
 	string(REPLACE "check_" "" _srcx ${_src})
 	set(src_data_file "${TOP_SRC_DIR}/src/support/tests/regfiles/${_srcx}")
 	if (MSVC AND EXISTS "${src_data_file}.MSVC")
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
index 23b78c6..957e4c0 100644
--- a/src/tests/CMakeLists.txt
+++ b/src/tests/CMakeLists.txt
@@ -8,7 +8,7 @@ set(check_layout_SOURCES)
 foreach(_f insets/InsetLayout.cpp CiteEnginesList.cpp Color.cpp Counters.cpp Floating.cpp
        FloatList.cpp FontInfo.cpp Layout.cpp LayoutFile.cpp Lexer.cpp
        ModuleList.cpp Spacing.cpp TextClass.cpp tests/check_layout.cpp
-       tests/dummy_functions.cpp)
+       tests/boost.cpp tests/dummy_functions.cpp)
   list(APPEND check_layout_SOURCES "${TOP_SRC_DIR}/src/${_f}")
 endforeach()
 
@@ -17,7 +17,7 @@ include_directories(${TOP_SRC_DIR}/src/support/tests)
 add_executable(check_layout ${check_layout_SOURCES})
 
 target_link_libraries(check_layout support
-  ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY}
+  ${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY}
   ${ZLIB_LIBRARY} ${ICONV_LIBRARY})
 if(CYGWIN)
     target_link_libraries(check_layout shlwapi)
@@ -67,7 +67,7 @@ endforeach()
 set(check_ExternalTransforms_SOURCES)
 foreach(_f graphics/GraphicsParams.cpp insets/ExternalTransforms.cpp
 	tests/check_ExternalTransforms.cpp
-	tests/dummy_functions.cpp)
+	tests/boost.cpp tests/dummy_functions.cpp)
     list(APPEND check_ExternalTransforms_SOURCES ${TOP_SRC_DIR}/src/${_f})
 endforeach()
 
@@ -75,7 +75,7 @@ include_directories(${TOP_SRC_DIR}/src/tests)
 add_executable(check_ExternalTransforms ${check_ExternalTransforms_SOURCES})
 
 target_link_libraries(check_ExternalTransforms support
-	${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
+	${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
 lyx_target_link_libraries(check_ExternalTransforms Magic)
 
 add_dependencies(lyx_run_tests check_ExternalTransforms)
@@ -90,13 +90,13 @@ add_test(NAME "check_ExternalTransforms"
 add_dependencies(lyx_run_tests check_ExternalTransforms)
 
 set(check_Length_SOURCES)
-foreach(_f tests/check_Length.cpp tests/dummy_functions.cpp)
+foreach(_f tests/check_Length.cpp tests/boost.cpp tests/dummy_functions.cpp)
   list(APPEND check_Length_SOURCES ${TOP_SRC_DIR}/src/${_f})
 endforeach()
 add_executable(check_Length ${check_Length_SOURCES})
 
 target_link_libraries(check_Length support
-	${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
+	${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
 lyx_target_link_libraries(check_Length Magic)
 
 add_dependencies(lyx_run_tests check_Length)
@@ -112,13 +112,13 @@ add_dependencies(lyx_run_tests check_Length)
 
 include_directories(${TOP_SRC_DIR}/src/tests)
 set(check_ListingsCaption_SOURCES)
-foreach(_f tests/check_ListingsCaption.cpp tests/dummy_functions.cpp)
+foreach(_f tests/check_ListingsCaption.cpp tests/boost.cpp tests/dummy_functions.cpp)
   list(APPEND check_ListingsCaption_SOURCES ${TOP_SRC_DIR}/src/${_f})
 endforeach()
 add_executable(check_ListingsCaption ${check_ListingsCaption_SOURCES})
 
 target_link_libraries(check_ListingsCaption support
-	${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
+	${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
 lyx_target_link_libraries(check_ListingsCaption Magic)
 
 add_dependencies(lyx_run_tests check_ListingsCaption)
diff --git a/src/tex2lyx/CMakeLists.txt b/src/tex2lyx/CMakeLists.txt
index 3828576..2a68e71 100644
--- a/src/tex2lyx/CMakeLists.txt
+++ b/src/tex2lyx/CMakeLists.txt
@@ -45,6 +45,7 @@ set_target_properties(${_tex2lyx} PROPERTIES
 
 target_link_libraries(${_tex2lyx}
 	support
+	${Lyx_Boost_Libraries}
 	${QT_QTCORE_LIBRARY}
 	${QT_QTGUI_LIBRARY}
 	${ICONV_LIBRARY})


More information about the lyx-cvs mailing list