Skip to content

Commit

Permalink
Update libxml2 to version 2.11.4. (#1216)
Browse files Browse the repository at this point in the history
* Update libxml2 to version 2.11.4.

  - This version comes with CMake support and many other fixes and improvements.

    - It is taken from https://github.com/GNOME/libxml2
    - The folders: `doc`, `fuzz`, `m4`, `result`, and `test` are removed to save space since they are not needed.
    - The required CMake version has been downgraded from 3.18 to 3.15.
      Ubuntu focal, one of our supported platforms, comes with CMake 3.16 so that is the maximum CMake version we can require right now.
      The libxml required CMake version was upgraded by GNOME/libxml2@a5bc460 in order to use `check_linker_flag` CMake utility function. We do not need that so it is removed and the CMake version is downgraded.

  - The CMake support allows OMSimulator to move one step closer to complete CMake based build.

* Disable iconv for MSVC builds.

* Do not add 's' postfix for the static lib.

  - We are intersted in building only the static library. No shared version.
    That means there is not going to be any name conflict. So just output
    the library without any posfix (just libxml2.lib instead of libxml2s.lib).

    This saves us from having to updated the expected library name in
    other places.

  - Debug builds still get the 'd' postfix for now. Perhaps this should
    be removed as well.

* Define LIBXML_STATIC since we are using the static libxml

  - This will tell libxml2 headers not to add dll direction specifiers
    (`__declspec(dllimport)` and `__declspec(dllexport)`)

* Compile OMTLMSimulator libs with /MD if using MSVC.

  - This seems to be what is picked by default by cmake. OMTLMSimulator
    does not need or use CMake right now, however it links to libraries
    built by CMake (within OMSimulator, e.g., libxml2) which get compiled
    with /MD. So set it here as well to avoid link time failures.

* Libxml2 is no longer needed to be installed after build.

  - It is built as a static library now even on Windows with MSVC.

* Update 3rdParty and OMTLMSimulator to merged versions.
  • Loading branch information
mahge authored Jul 18, 2023
1 parent f8bd7ce commit d89f397
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion 3rdParty
Submodule 3rdParty updated 412 files
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -284,14 +284,14 @@ config-libxml2:
@echo
else
config-libxml2: 3rdParty/libxml2/$(INSTALL_DIR)/lib/libxml2.a
3rdParty/libxml2/$(INSTALL_DIR)/lib/libxml2.a: 3rdParty/libxml2/Makefile
$(MAKE) -C 3rdParty/libxml2/ && $(MAKE) -C 3rdParty/libxml2/ install
3rdParty/libxml2/Makefile:
3rdParty/libxml2/$(INSTALL_DIR)/lib/libxml2.a: 3rdParty/libxml2/$(BUILD_DIR)/Makefile
$(MAKE) -C 3rdParty/libxml2/$(BUILD_DIR)/ install
3rdParty/libxml2/$(BUILD_DIR)/Makefile: 3rdParty/libxml2/CMakeLists.txt
@echo
@echo "# config libxml2"
@echo
$(MKDIR) 3rdParty/libxml2/$(INSTALL_DIR)
cd 3rdParty/libxml2 && $(FPIC) ./autogen.sh --prefix="$(ROOT_DIR)/3rdParty/libxml2/$(INSTALL_DIR)" $(DISABLE_SHARED) --without-python --without-zlib --without-lzma $(HOST_CROSS_TRIPLE)
$(MKDIR) 3rdParty/libxml2/$(BUILD_DIR)
cd 3rdParty/libxml2/$(BUILD_DIR) && $(CMAKE) $(CMAKE_TARGET) ../.. -DCMAKE_INSTALL_PREFIX=../../$(INSTALL_DIR) -DBUILD_SHARED_LIBS=OFF -DLIBXML2_WITH_PYTHON=OFF -DLIBXML2_WITH_ZLIB=OFF -DLIBXML2_WITH_LZMA=OFF -DLIBXML2_WITH_TESTS=OFF
endif

distclean:
Expand All @@ -309,6 +309,8 @@ distclean:
$(RM) 3rdParty/kinsol/$(INSTALL_DIR)
$(RM) 3rdParty/xerces/$(BUILD_DIR)
$(RM) 3rdParty/xerces/$(INSTALL_DIR)
$(RM) 3rdParty/libxml2/$(BUILD_DIR)
$(RM) 3rdParty/libxml2/$(INSTALL_DIR)

testsuite:
@echo
Expand Down
2 changes: 1 addition & 1 deletion OMTLMSimulator
15 changes: 9 additions & 6 deletions configWinVS.bat
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,16 @@ EXIT /B 0
:: -- config libxml2 ------------------
:libxml2
ECHO # config libxml2
CD 3rdParty\libxml2
START /B /WAIT CMD /C "buildWinVS.bat %OMS_VS_TARGET%"
IF EXIST "3rdParty\libxml2\build\win\" RMDIR /S /Q 3rdParty\libxml2\build\win
IF EXIST "3rdParty\libxml2\install\win\" RMDIR /S /Q 3rdParty\libxml2\install\win
MKDIR 3rdParty\libxml2\build\win
CD 3rdParty\libxml2\build\win
cmake.exe -G %OMS_VS_VERSION% ..\.. -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_INSTALL_PREFIX=..\..\install\win -DBUILD_SHARED_LIBS=OFF -DLIBXML2_WITH_PYTHON=OFF -DLIBXML2_WITH_ZLIB=OFF -DLIBXML2_WITH_LZMA=OFF -DLIBXML2_WITH_TESTS=OFF -DLIBXML2_WITH_ICONV=OFF
IF NOT ["%ERRORLEVEL%"]==["0"] GOTO fail
CD ..\..\..\..
ECHO # build libxml2
msbuild.exe "3rdParty\libxml2\build\win\INSTALL.vcxproj" /t:Build /p:configuration=Release /maxcpucount
IF NOT ["%ERRORLEVEL%"]==["0"] GOTO fail
CD ..\..
ECHO # copy libxml2
IF NOT EXIST "install\win\bin" MKDIR install\win\bin
XCOPY /Y /F 3rdParty\libxml2\install\win\bin\libxml2.dll install\win\bin
EXIT /B 0
:: -- config libxml2 ------------------

Expand Down
1 change: 0 additions & 1 deletion src/OMSimulatorPython/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ IF (WIN32 AND MSVC)
install(DIRECTORY ${CMAKE_INSTALL_PREFIX}/bin/ DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/OMSimulator FILES_MATCHING PATTERN "*imulator*.dll" PATTERN "OMSimulator" EXCLUDE PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ)
install(DIRECTORY ${CMAKE_INSTALL_PREFIX}/bin/ DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/OMSimulator FILES_MATCHING PATTERN "*boost*mt-1*.dll" PATTERN "OMSimulator" EXCLUDE PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ)
install(FILES ${CMAKE_INSTALL_PREFIX}/bin/pthreadVC2.dll DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/OMSimulator PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ)
install(FILES ${CMAKE_INSTALL_PREFIX}/bin/libxml2.dll DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/OMSimulator PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ)
ELSEIF (WIN32 AND MINGW)
install(FILES OMSimulatorPython3.bat DESTINATION ${CMAKE_INSTALL_PREFIX}/bin PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ)
install(FILES OMSimulatorPython3 DESTINATION ${CMAKE_INSTALL_PREFIX}/bin PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ)
Expand Down

0 comments on commit d89f397

Please sign in to comment.