1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

pkg/relic: adapt cmake xcompile on macOS

This commit is contained in:
smlng 2018-03-27 19:03:51 +02:00
parent 3ad07c6a9d
commit 0e26cf849d
2 changed files with 13 additions and 36 deletions

View File

@ -5,17 +5,22 @@ PKG_LICENSE=LGPL-2.1
.PHONY: all
CFLAGS += -Wno-gnu-zero-variadic-macro-arguments -Wno-unused-function -Wno-newline-eof
TOOLCHAIN_FILE=$(PKG_BUILDDIR)/xcompile-toolchain.cmake
all: $(PKG_BUILDDIR)/Makefile
"$(MAKE)" -C $(PKG_BUILDDIR) && \
$(MAKE) -C $(PKG_BUILDDIR) && \
cp $(PKG_BUILDDIR)/lib/librelic_s.a $(BINDIR)/$(PKG_NAME).a
$(PKG_BUILDDIR)/comp-options.cmake: fix_source
cd "$(PKG_BUILDDIR)" && perl $(PKG_DIR)/generate-cmake-xcompile.perl > comp-options.cmake
$(PKG_BUILDDIR)/Makefile: $(TOOLCHAIN_FILE)
cd $(PKG_BUILDDIR) && \
COMP="$(filter-out -Werror=old-style-definition -Werror=strict-prototypes, $(CFLAGS) ) " \
cmake -DCMAKE_TOOLCHAIN_FILE=$(TOOLCHAIN_FILE) \
-DCHECK=off -DTESTS=0 -DBENCH=0 -DSHLIB=off -Wno-dev $(RELIC_CONFIG_FLAGS) .
$(PKG_BUILDDIR)/Makefile: $(PKG_BUILDDIR)/comp-options.cmake
cd "$(PKG_BUILDDIR)" && COMP="$(filter-out -Werror=old-style-definition -Werror=strict-prototypes, $(CFLAGS) ) " cmake -DCMAKE_TOOLCHAIN_FILE=comp-options.cmake -DCHECK=off -DTESTS=0 -DBENCH=0 -DSHLIB=off -Wno-dev $(RELIC_CONFIG_FLAGS) .
CFLAGS += -Wno-gnu-zero-variadic-macro-arguments -Wno-unused-function -Wno-newline-eof
$(TOOLCHAIN_FILE): fix_source
$(RIOTBASE)/dist/tools/cmake/generate-xcompile-toolchain.sh > $(TOOLCHAIN_FILE)
fix_source: git-download
./fix-util_print_wo_args.sh $(PKG_BUILDDIR)
@ -23,4 +28,5 @@ fix_source: git-download
clean::
@rm -rf $(BINDIR)/$(PKG_NAME).a
include $(RIOTBASE)/pkg/pkg.mk

View File

@ -1,29 +0,0 @@
#!/usr/bin/env perl
print "INCLUDE(CMakeForceCompiler)\n";
print "\n";
print "\n";
print "SET(CMAKE_SYSTEM_NAME Generic)\n";
print "SET(CMAKE_SYSTEM_VERSION 1)\n";
print "\n";
print "SET(CMAKE_C_COMPILER \"$ENV{CC}\" CACHE STRING \"\")\n";
print "SET(CMAKE_CXX_COMPILER \"$ENV{CXX}\" CACHE STRING \"\")\n";
print "SET(CMAKE_RANLIB \"echo\" CACHE STRING \"\")\n";
print "\n";
print "# specify the cross compiler\n";
print "CMAKE_FORCE_C_COMPILER(\${CMAKE_C_COMPILER} GNU)\n";
print "CMAKE_FORCE_CXX_COMPILER(\${CMAKE_CXX_COMPILER} GNU)\n";
print "SET(CMAKE_LINKER \"$ENV{LINK}\" CACHE STRING \"\")\n";
print "\n";
my $esc_c_flags = "$ENV{CFLAGS}";
$esc_c_flags =~ s/"/\\"/g;
print "SET(CMAKE_C_FLAGS \"$esc_c_flags\" CACHE STRING \"\")\n";
print "\n";
print "SET(CMAKE_EXE_LINKER_FLAGS \"$ENV{LINKFLAGS}\" CACHE STRING \"\")\n";
print "\n";
print "# search for programs in the build host directories\n";
print "SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n";
print "# for libraries and headers in the target directories\n";
print "SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)\n";
print "SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)\n";