Skip to content

Commit

Permalink
[FMUComplianceChecker] Add builder (JuliaPackaging#4284)
Browse files Browse the repository at this point in the history
* [New Package] FMUComplianceChecker

* Update build_tarballs.jl

* Update build_tarballs.jl

* Update build_tarballs.jl

* Update build_tarballs.jl

* Update build_tarballs.jl

* Update build_tarballs.jl

* Update build_tarballs.jl

* Update build_tarballs.jl

* Update build_tarballs.jl

* Update build_tarballs.jl

* fix typo

* Updates based on review

* Update checksum

* Move binaries manually

* [FMUComplianceChecker] Add patches and build for all platforms

* [FMUComplianceChecker] Use proper libtool for macOS

* [FMUComplianceChecker] Remove extra stuff from the tarball

* Update F/FMUComplianceChecker/build_tarballs.jl

Co-authored-by: Mosè Giordano <[email protected]>
Co-authored-by: Mosè Giordano <[email protected]>
  • Loading branch information
2 people authored and simeonschaub committed Feb 23, 2022
1 parent 51020a9 commit 74a619f
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 0 deletions.
49 changes: 49 additions & 0 deletions F/FMUComplianceChecker/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Note that this script can accept some limited command-line arguments, run
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder, Pkg

name = "FMUComplianceChecker"
version = v"2.0.4"

# Collection of sources required to complete build
sources = [
ArchiveSource("https://github.com/modelica-tools/FMUComplianceChecker/archive/f0fd0b2ca78c415a725b028deec46c1962799f1d.zip",
"db4607e7b6230d9b7f2e394e6ec132e90cee19ae6625997c09d946ab61dda156"),
DirectorySource("./bundled"),
]

# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir/FMUComplianceChecker*/
atomic_patch -p1 ../patches/forward-cmake-toolchain.patch
atomic_patch -p1 ../patches/windows-lowercase-header-file.patch
export CFLAGS="-I${includedir}"
if [[ "${target}" == *-apple-* ]]; then
# Replace `/usr/bin/libtool` with `libtool` from our toolchain to fix error
# libtool: error: unrecognised option: '-static'
ln -sf $(which libtool) /usr/bin/libtool
fi
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=${prefix} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} -DCMAKE_BUILD_TYPE=Release ..
make -j${nproc}
install -Dm755 fmuCheck.* "${bindir}/fmuCheck${exeext}"
# Delete expat stuff
rm -rf "${includedir}" "${prefix}/lib"
install_license "../LICENSE"
"""

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = supported_platforms()

# The products that we will ensure are always built
products = [
ExecutableProduct("fmuCheck", :fmucheck),
]

# Dependencies that must be installed before this package can be built
dependencies = Dependency[
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6")
1 change: 1 addition & 0 deletions F/FMUComplianceChecker/bundled/patches/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.patch binary
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- a/Config.cmake/fmixml.cmake
+++ b/Config.cmake/fmixml.cmake
@@ -159,6 +159,7 @@ set(EXPAT_SETTINGS
-DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_MODULE_LINKER_FLAGS}
-DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_SHARED_LINKER_FLAGS}
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_BINARY_DIR}/ExpatEx/install
+ -DCMAKE_TOOLCHAIN_FILE:PATH=${CMAKE_TOOLCHAIN_FILE}
)

ExternalProject_Add(
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -108,7 +108,7 @@
-DFMILIB_BUILD_SHARED_LIB:BOOLEAN=OFF
-DFMILIB_INSTALL_SUBLIBS:BOOLEAN=OFF
-DFMILIB_GENERATE_DOXYGEN_DOC:BOOLEAN=OFF
- -DFMILIB_BUILD_TESTS:BOOLEAN=ON
+ -DFMILIB_BUILD_TESTS:BOOLEAN=OFF
-DFMILIB_GENERATE_BUILD_STAMP:BOOLEAN=OFF
-DFMILIB_ENABLE_LOG_LEVEL_DEBUG:BOOLEAN=${FMUCHK_ENABLE_LOG_LEVEL_DEBUG}
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
@@ -126,6 +126,7 @@
-DCMAKE_LINK_LIBRARY_FLAG:STRING=${CMAKE_LINK_LIBRARY_FLAG}
-DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_MODULE_LINKER_FLAGS}
-DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_SHARED_LINKER_FLAGS}
+ -DCMAKE_TOOLCHAIN_FILE:PATH=${CMAKE_TOOLCHAIN_FILE}
)

if(MSVC)
@@ -146,6 +147,16 @@
)

ExternalProject_Add_Step(
+ fmil fmil_patch
+ DEPENDEES patch
+ DEPENDERS configure
+ COMMAND atomic_patch -p1 /workspace/srcdir/patches/fmi-library-cmake-expatex-cmake.patch
+ COMMAND atomic_patch -p1 /workspace/srcdir/patches/windows-linking-lowercase.patch
+ DEPENDS ${FMUCHK_BUILD}/CMakeCache.txt ${FMUCHK_HOME}/CMakeLists.txt
+ WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/FMIL"
+)
+
+ExternalProject_Add_Step(
fmil fmil_reconfigure
DEPENDEES configure
DEPENDERS build
@@ -213,7 +224,7 @@
add_executable(${fmuCheck} ${SOURCE} ${HEADERS})
target_link_libraries(${fmuCheck} fmilib)
if(WIN32)
- target_link_libraries(${fmuCheck} Shlwapi)
+ target_link_libraries(${fmuCheck} shlwapi)
endif(WIN32)
if(UNIX)
target_link_libraries(${fmuCheck} dl)
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -264,12 +264,12 @@ if(FMILIB_BUILD_STATIC_LIB)
include(mergestaticlibs)
if(WIN32)
merge_static_libs(fmilib ${FMILIB_SUBLIBS})
- target_link_libraries(fmilib Shlwapi)
+ target_link_libraries(fmilib shlwapi)
foreach(CONFIG_TYPE ${CMAKE_CONFIGURATION_TYPES})
set(flags "")
string(TOUPPER "STATIC_LIBRARY_FLAGS_${CONFIG_TYPE}" PROPNAME)
get_target_property(flags fmilib ${PROPNAME})
- set_target_properties(fmilib PROPERTIES ${PROPNAME} "${flags} Shlwapi.lib")
+ set_target_properties(fmilib PROPERTIES ${PROPNAME} "${flags} shlwapi.lib")
endforeach()
else()
merge_static_libs(fmilib ${FMILIB_SUBLIBS} )
--- a/Config.cmake/jmutil.cmake
+++ b/Config.cmake/jmutil.cmake
@@ -67,7 +67,7 @@ if(UNIX)
target_link_libraries(jmutils dl)
endif(UNIX)
if(WIN32)
- target_link_libraries(jmutils Shlwapi)
+ target_link_libraries(jmutils shlwapi)
endif(WIN32)

endif(NOT JMUTILDIR)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/src/Common/fmuChecker.c
+++ b/src/Common/fmuChecker.c
@@ -17,7 +17,7 @@
#include <sys/stat.h>

#if defined(_WIN32) || defined(WIN32)
- #include <Shlwapi.h>
+ #include <shlwapi.h>
#endif

// #include <config_test.h>

0 comments on commit 74a619f

Please sign in to comment.