From 46c21c305aa10e72b64b66f937cf1d222b152356 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 29 Aug 2019 14:23:22 -0500 Subject: Fix EXISTS test and add toolchain --- MANIFEST | 1 + config/cmake/vfdTest.cmake | 8 ++++---- config/cmake_ext_mod/grepTest.cmake | 8 ++++---- config/cmake_ext_mod/runTest.cmake | 8 ++++---- config/toolchain/build32.cmake | 39 +++++++++++++++++++++++++++++++++++++ src/CMakeLists.txt | 4 ++-- 6 files changed, 54 insertions(+), 14 deletions(-) create mode 100644 config/toolchain/build32.cmake diff --git a/MANIFEST b/MANIFEST index e10a1f9..eeae62a 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2330,6 +2330,7 @@ ./hl/c++/test/Makefile.in # CMake-specific Files +./config/toolchain/build32.cmake ./config/toolchain/GCC.cmake ./config/toolchain/intel.cmake ./config/toolchain/mingw64.cmake diff --git a/config/cmake/vfdTest.cmake b/config/cmake/vfdTest.cmake index 3556d07..12ee40b 100644 --- a/config/cmake/vfdTest.cmake +++ b/config/cmake/vfdTest.cmake @@ -23,11 +23,11 @@ if (NOT TEST_VFD) message (FATAL_ERROR "Require TEST_VFD to be defined") endif () -if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) endif () -if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) endif () @@ -54,7 +54,7 @@ execute_process ( message (STATUS "COMMAND Result: ${TEST_RESULT}") # if the .err file exists and ERRROR_APPEND is enabled -if (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.err) +if (ERROR_APPEND AND EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.err") file (READ ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.err TEST_STREAM) file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out "${TEST_STREAM}") endif () @@ -62,7 +62,7 @@ endif () # if the return value is !=${TEST_EXPECT} bail out if (NOT TEST_RESULT EQUAL TEST_EXPECT) if (NOT TEST_NOERRDISPLAY) - if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out) + if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out") file (READ ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out TEST_STREAM) message (STATUS "Output USING ${TEST_VFD}:\n${TEST_STREAM}") endif () diff --git a/config/cmake_ext_mod/grepTest.cmake b/config/cmake_ext_mod/grepTest.cmake index ab00e70..78ee0da 100644 --- a/config/cmake_ext_mod/grepTest.cmake +++ b/config/cmake_ext_mod/grepTest.cmake @@ -35,11 +35,11 @@ if (NOT TEST_REFERENCE) message (FATAL_ERROR "Require TEST_REFERENCE to be defined") endif () -if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) endif () -if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) endif () @@ -84,7 +84,7 @@ endif () # if the TEST_ERRREF exists grep the error output with the error reference if (TEST_ERRREF) # if the .err file exists grep the error output with the error reference before comparing stdout - if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) + if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_ERR_STREAM) # TEST_ERRREF should always be matched @@ -97,7 +97,7 @@ if (TEST_ERRREF) #always compare output file to reference unless this must be skipped if (NOT TEST_SKIP_COMPARE) - if (EXISTS ${TEST_FOLDER}/${TEST_REFERENCE}) + if (EXISTS "${TEST_FOLDER}/${TEST_REFERENCE}") if (WIN32 OR MINGW) configure_file(${TEST_FOLDER}/${TEST_REFERENCE} ${TEST_FOLDER}/${TEST_REFERENCE}.tmp NEWLINE_STYLE CRLF) file(RENAME ${TEST_FOLDER}/${TEST_REFERENCE}.tmp ${TEST_FOLDER}/${TEST_REFERENCE}) diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index 21c8c18..100de3e 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -27,11 +27,11 @@ if (NOT TEST_EXPECT) message (STATUS "Require TEST_EXPECT to be defined") endif () -if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) endif () -if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) endif () @@ -88,7 +88,7 @@ endif () message (STATUS "COMMAND Result: ${TEST_RESULT}") # if the .err file exists and ERRROR_APPEND is enabled -if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) if (TEST_MASK_FILE) STRING(REGEX REPLACE "CurrentDir is [^\n]+\n" "CurrentDir is (dir name)\n" TEST_STREAM "${TEST_STREAM}") @@ -113,7 +113,7 @@ endif () # if the return value is !=${TEST_EXPECT} bail out if (NOT TEST_RESULT EQUAL TEST_EXPECT) if (NOT TEST_NOERRDISPLAY) - if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) + if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) message (STATUS "Output :\n${TEST_STREAM}") endif () diff --git a/config/toolchain/build32.cmake b/config/toolchain/build32.cmake new file mode 100644 index 0000000..3d9197d --- /dev/null +++ b/config/toolchain/build32.cmake @@ -0,0 +1,39 @@ +if (WIN32) + set (CMAKE_SYSTEM_NAME Windows) + set (CMAKE_GENERATOR_PLATFORM "x86") +elseif(APPLE) + set (CMAKE_OSX_ARCHITECTURES "i386") +else () + set (CMAKE_SYSTEM_NAME Linux) + + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32" CACHE STRING "c++ flags") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32" CACHE STRING "c flags") + + set (LIB32 /usr/lib) # Fedora + + if (EXISTS /usr/lib32) + set (LIB32 /usr/lib32) # Arch, Solus + endif () + + set (CMAKE_SYSTEM_LIBRARY_PATH ${LIB32} CACHE STRING "system library search path" FORCE) + set (CMAKE_LIBRARY_PATH ${LIB32} CACHE STRING "library search path" FORCE) + + # this is probably unlikely to be needed, but just in case + set (CMAKE_EXE_LINKER_FLAGS "-m32 -L${LIB32}" CACHE STRING "executable linker flags" FORCE) + set (CMAKE_SHARED_LINKER_FLAGS "-m32 -L${LIB32}" CACHE STRING "shared library linker flags" FORCE) + set (CMAKE_MODULE_LINKER_FLAGS "-m32 -L${LIB32}" CACHE STRING "module linker flags" FORCE) + + # on Fedora and Arch and similar, point pkgconfig at 32 bit .pc files. We have + # to include the regular system .pc files as well (at the end), because some + # are not always present in the 32 bit directory + if (EXISTS ${LIB32}/pkgconfig) + set (ENV{PKG_CONFIG_LIBDIR} ${LIB32}/pkgconfig:/usr/share/pkgconfig:/usr/lib/pkgconfig:/usr/lib64/pkgconfig) + endif () +# where is the target environment + set (CMAKE_FIND_ROOT_PATH ${LIB32}) +# search for programs in the build host directories + set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +# for libraries and headers in the target directories + set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) + set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +endif () \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bb1d171..86deb10 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -735,7 +735,7 @@ set (H5_PRIVATE_HEADERS ${HDF5_SRC_DIR}/H5Tprivate.h ${HDF5_SRC_DIR}/H5TSprivate.h - + ${HDF5_SRC_DIR}/H5VMprivate.h ${HDF5_SRC_DIR}/H5WBprivate.h @@ -797,7 +797,7 @@ if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_BINARY_DIR}/shared") endif () -if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) +if (NOT EXISTS "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c") add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) target_include_directories (H5detect PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") target_compile_definitions(H5detect PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) -- cgit v0.12