blob: bdc1fa5f96a8477c25e91f1316a877bbfc5b1a5a [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001From 1b4fadf550587b46e405d7ccb777dcb00aa791a2 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Tue, 29 Jan 2019 15:39:15 +0800
4Subject: [PATCH 1/2] cross compiling support
5
6Do not generate config files at build time, use pre-generated
7files to instead.
8
9Upstream-Status: Inappropriate [oe specific]
10
11Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
12---
13 CMakeLists.txt | 6 ++++++
14 src/CMakeLists.txt | 23 -----------------------
15 2 files changed, 6 insertions(+), 23 deletions(-)
16
Brad Bishop19323692019-04-05 15:28:33 -040017--- a/CMakeLists.txt
18+++ b/CMakeLists.txt
Brad Bishope42b3e32020-01-15 22:08:42 -050019@@ -770,4 +770,10 @@ endif ()
Brad Bishop19323692019-04-05 15:28:33 -040020 #-----------------------------------------------------------------------------
21 configure_file (${HDF_RESOURCES_DIR}/H5pubconf.h.in ${HDF5_BINARY_DIR}/H5pubconf.h @ONLY)
22
23+#-----------------------------------------------------------------------------
24+# Copy the pre-generated files in place
25+#-----------------------------------------------------------------------------
26+configure_file(H5Tinit.c H5Tinit.c COPYONLY)
27+configure_file(H5lib_settings.c H5lib_settings.c COPYONLY)
28+
29 include (CMakeInstallation.cmake)
Brad Bishop19323692019-04-05 15:28:33 -040030--- a/src/CMakeLists.txt
31+++ b/src/CMakeLists.txt
Brad Bishope42b3e32020-01-15 22:08:42 -050032@@ -613,36 +613,9 @@ set (H5_PRIVATE_HEADERS
Brad Bishop19323692019-04-05 15:28:33 -040033 #-----------------------------------------------------------------------------
34 add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c)
35 TARGET_C_PROPERTIES (H5detect STATIC " " " ")
36-if (MSVC OR MINGW)
37- target_link_libraries (H5detect "ws2_32.lib")
38-endif ()
Brad Bishope42b3e32020-01-15 22:08:42 -050039-if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
40- set_property(TARGET H5detect PROPERTY LINK_FLAGS "-O0")
41-endif ()
Brad Bishop19323692019-04-05 15:28:33 -040042-
Brad Bishop19323692019-04-05 15:28:33 -040043-add_custom_command (
44- OUTPUT ${HDF5_BINARY_DIR}/H5Tinit.c
Brad Bishope42b3e32020-01-15 22:08:42 -050045- COMMAND $<TARGET_FILE:H5detect>
Brad Bishop19323692019-04-05 15:28:33 -040046- ARGS > ${HDF5_BINARY_DIR}/H5Tinit.c
47- DEPENDS H5detect
48-)
49
50 add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c)
51 TARGET_C_PROPERTIES (H5make_libsettings STATIC " " " ")
52-if (MSVC OR MINGW)
53- target_link_libraries (H5make_libsettings "ws2_32.lib")
54-endif ()
Brad Bishope42b3e32020-01-15 22:08:42 -050055-if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
56- set_property(TARGET H5make_libsettings PROPERTY LINK_FLAGS "-O0")
57-endif ()
Brad Bishop19323692019-04-05 15:28:33 -040058-
Brad Bishop19323692019-04-05 15:28:33 -040059-add_custom_command (
60- OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c
Brad Bishope42b3e32020-01-15 22:08:42 -050061- COMMAND $<TARGET_FILE:H5make_libsettings>
Brad Bishop19323692019-04-05 15:28:33 -040062- ARGS > ${HDF5_BINARY_DIR}/H5lib_settings.c
63- DEPENDS H5make_libsettings
64- WORKING_DIRECTORY ${HDF5_BINARY_DIR}
65-)
66
67 if (GENERATE_ERROR_HEADERS)
68 find_package (Perl)