Skip to content

Commit bbd2c3f

Browse files
Use autotools for PCRE2.cmake (Windows Only) (#465)
### Use autotools for PCRE2.cmake (Windows Only) ### Linked issues #462 ### Summarize your change. Changing back to autotools instead of CMake for PCRE2. ### Describe the reason for the change. A few weeks ago, I changed the build for PCRE2 to use CMake instead of autotools, but it seems like it is causing some issue on some Windows setups from the community. This is the same code as before the changes to CMake. ### Describe what you have tested and on which operating system. Windows ### Add a list of changes, and note any that might need special attention during the review. ### If possible, provide screenshots. Signed-off-by: Cédrik Fuoco <[email protected]>
1 parent 86f4464 commit bbd2c3f

File tree

1 file changed

+19
-41
lines changed

1 file changed

+19
-41
lines changed

cmake/dependencies/pcre2.cmake

Lines changed: 19 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,20 @@ SET(_install_dir
2222
${RV_DEPS_BASE_DIR}/${_target}/install
2323
)
2424

25-
IF(CMAKE_BUILD_TYPE MATCHES "^Debug$")
26-
SET(_pcre2_debug_postfix_ "d")
27-
ENDIF()
28-
2925
# PCRE is not used for Linux and MacOS (Boost regex is used) in the current code.
3026
IF(RV_TARGET_WINDOWS)
3127
SET(_pcre2_libname
32-
pcre2-8${_pcre2_debug_postfix_}${CMAKE_SHARED_LIBRARY_SUFFIX}
28+
libpcre2-8-0${CMAKE_SHARED_LIBRARY_SUFFIX}
3329
)
3430
SET(_pcre2_libname_posix
35-
pcre2-posix${_pcre2_debug_postfix_}${CMAKE_SHARED_LIBRARY_SUFFIX}
31+
libpcre2-posix-3${CMAKE_SHARED_LIBRARY_SUFFIX}
3632
)
3733

3834
SET(_pcre2_implibname
39-
pcre2-8${_pcre2_debug_postfix_}.lib
35+
libpcre2-8.dll.a
4036
)
4137
SET(_pcre2_implibname_posix
42-
pcre2-posix${_pcre2_debug_postfix_}.lib
38+
libpcre2-posix.dll.a
4339
)
4440

4541
SET(_pcre2_libpath
@@ -61,40 +57,24 @@ SET(_pcre2_include_dir
6157
${_install_dir}/include
6258
)
6359

64-
LIST(APPEND _pcre2_cmake_configure_args "-G ${CMAKE_GENERATOR}")
65-
LIST(APPEND _pcre2_cmake_configure_args "-S ${_source_dir}")
66-
LIST(APPEND _pcre2_cmake_configure_args "-B ${_build_dir}")
60+
SET(_pcre2_configure_command
61+
sh ./configure
62+
)
6763

68-
LIST(APPEND _pcre2_cmake_configure_args "-DBUILD_SHARED_LIBS=ON")
69-
LIST(APPEND _pcre2_cmake_configure_args "-DBUILD_STATIC_LIBS=OFF")
70-
LIST(APPEND _pcre2_cmake_configure_args "-DPCRE2_BUILD_PCRE2GREP=OFF")
71-
LIST(APPEND _pcre2_cmake_configure_args "-DPCRE2_SUPPORT_LIBZ=OFF")
72-
LIST(APPEND _pcre2_cmake_configure_args "-DPCRE2_SUPPORT_LIBBZ2=OFF")
73-
LIST(APPEND _pcre2_cmake_configure_args "-DPCRE2_BUILD_TESTS=OFF")
64+
SET(_pcre2_autogen_command
65+
sh ./autogen.sh
66+
)
7467

75-
LIST(APPEND _pcre2_cmake_configure_args "-DPCRE2_STATIC_RUNTIME=OFF")
68+
LIST(APPEND _pcre2_configure_args "--prefix=${_install_dir}")
69+
# Build as shared library
70+
LIST(APPEND _pcre2_configure_args "--disable-static")
71+
LIST(APPEND _pcre2_configure_args "--disable-pcre2grep-libbz2")
72+
LIST(APPEND _pcre2_configure_args "--disable-pcre2grep-libz")
7673

7774
IF(CMAKE_BUILD_TYPE MATCHES "^Debug$")
78-
LIST(APPEND _pcre2_cmake_configure_args "-DPCRE2_DEBUG=ON")
75+
LIST(APPEND _pcre2_configure_args "--enable-debug")
7976
ENDIF()
8077

81-
# Build PCRE2 using 8 bits options (same as PCRE "1").
82-
LIST(APPEND _pcre2_cmake_configure_args "-DPCRE2_BUILD_PCRE2_8=ON")
83-
LIST(APPEND _pcre2_cmake_configure_args "-DPCRE2_BUILD_PCRE2_16=OFF")
84-
LIST(APPEND _pcre2_cmake_configure_args "-DPCRE2_BUILD_PCRE2_32=OFF")
85-
86-
LIST(APPEND _pcre2_cmake_build_args "--build" "${_build_dir}" "--config" "${CMAKE_BUILD_TYPE}")
87-
88-
LIST(APPEND
89-
_pcre2_cmake_install_args
90-
"--install"
91-
"${_build_dir}"
92-
"--prefix"
93-
"${_install_dir}"
94-
"--config"
95-
"${CMAKE_BUILD_TYPE}"
96-
)
97-
9878
EXTERNALPROJECT_ADD(
9979
${_target}
10080
URL ${_download_url}
@@ -103,13 +83,11 @@ EXTERNALPROJECT_ADD(
10383
DOWNLOAD_DIR ${RV_DEPS_DOWNLOAD_DIR}
10484
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
10585
SOURCE_DIR ${_source_dir}
106-
BINARY_DIR ${_build_dir}
10786
INSTALL_DIR ${_install_dir}
10887
DEPENDS ZLIB::ZLIB
109-
CONFIGURE_COMMAND ${CMAKE_COMMAND} ${_pcre2_cmake_configure_args}
110-
BUILD_COMMAND ${CMAKE_COMMAND} ${_pcre2_cmake_build_args}
111-
INSTALL_COMMAND ${CMAKE_COMMAND} ${_pcre2_cmake_install_args}
112-
BUILD_IN_SOURCE FALSE
88+
CONFIGURE_COMMAND ${_pcre2_autogen_command} && ${_pcre2_configure_command} ${_pcre2_configure_args}
89+
BUILD_COMMAND make -j${_cpu_count}
90+
BUILD_IN_SOURCE TRUE
11391
BUILD_ALWAYS FALSE
11492
BUILD_BYPRODUCTS ${_pcre2_libname} ${_pcre2_libname_posix} ${_pcre2_implibname} ${_pcre2_implibname_posix}
11593
USES_TERMINAL_BUILD TRUE

0 commit comments

Comments
 (0)