summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-01-07 12:04:13 +0100
committerCarl Hetherington <cth@carlh.net>2021-01-07 13:16:40 +0100
commit3601ea5bae9247add596e2c6920e80a236803964 (patch)
treea77ea654724f1d36e68bb7ea0130d87a64186486
parentf2a1573f085e7e822bc8a4a3cc3fbf5eaecbb741 (diff)
Build both osx and osx-arm64 versions in a directory called osx.
When DCP-o-matic makes its universal binary it assumes that the path to the arm64 library can be found by replacing x86_64 with arm64 in the path. This fails if we build the x86_64 version in build_osx and the arm64 version in build_osx-arm64.
-rw-r--r--Makefile46
-rw-r--r--cscript11
2 files changed, 30 insertions, 27 deletions
diff --git a/Makefile b/Makefile
index e0f50d4..347b29b 100644
--- a/Makefile
+++ b/Makefile
@@ -21,69 +21,69 @@ COMMON_DEFINITIONS = \
-DVERSION=$(VERSION) \
define generate_common
- rm -R -f build_$(1)
- mkdir build_$(1)
- cd build_$(1) && cmake -G"Unix Makefiles" \
+ rm -R -f build_$(2)
+ mkdir build_$(2)
+ cd build_$(2) && cmake -G"Unix Makefiles" \
$(COMMON_DEFINITIONS) \
-DLWEXT4_BUILD_SHARED_LIB=ON \
- $(2) \
+ $(3) \
-DCMAKE_TOOLCHAIN_FILE=../toolchain/$(1).cmake ..
endef
define generate_common_static
- rm -R -f build_$(1)
- mkdir build_$(1)
- cd build_$(1) && cmake -G"Unix Makefiles" \
+ rm -R -f build_$(2)
+ mkdir build_$(2)
+ cd build_$(2) && cmake -G"Unix Makefiles" \
$(COMMON_DEFINITIONS) \
-DLWEXT4_BUILD_SHARED_LIB=OFF \
- $(2) \
+ $(3) \
-DCMAKE_TOOLCHAIN_FILE=../toolchain/$(1).cmake ..
endef
generic:
- $(call generate_common_static,$@)
+ $(call generate_common_static,$@,$@)
osx:
- $(call generate_common,$@)
+ $(call generate_common,$@,$@)
osx32:
- $(call generate_common,$@,-DCMAKE_OSX_ARCHITECTURES=i386)
+ $(call generate_common,$@,osx,-DCMAKE_OSX_ARCHITECTURES=i386)
osx-arm64:
- $(call generate_common,$@)
+ $(call generate_common,$@,osx)
cortex-m0:
- $(call generate_common,$@)
+ $(call generate_common,$@,$@)
cortex-m0+:
- $(call generate_common,$@)
+ $(call generate_common,$@,$@)
cortex-m3:
- $(call generate_common,$@)
+ $(call generate_common,$@,$@)
cortex-m4:
- $(call generate_common,$@)
+ $(call generate_common,$@,$@)
cortex-m4f:
- $(call generate_common,$@)
+ $(call generate_common,$@,$@)
cortex-m7:
- $(call generate_common,$@)
+ $(call generate_common,$@,$@)
arm-sim:
- $(call generate_common,$@)
+ $(call generate_common,$@,$@)
avrxmega7:
- $(call generate_common,$@)
+ $(call generate_common,$@,$@)
msp430:
- $(call generate_common,$@)
+ $(call generate_common,$@,$@)
mingw:
- $(call generate_common,$@,-DWIN32=1)
+ $(call generate_common,$@,$@,-DWIN32=1)
mingw-32:
- $(call generate_common,$@,-DWIN32=1)
+ $(call generate_common,$@,$@,-DWIN32=1)
lib_only:
rm -R -f build_lib_only
diff --git a/cscript b/cscript
index f7b859d..4fad21a 100644
--- a/cscript
+++ b/cscript
@@ -45,6 +45,7 @@ def make_toolchain(filename, arch, sdk_prefix, sdk):
def build(target, options):
if target.platform == 'linux':
type = 'generic'
+ build_suffix = type
blockdev = 'linux'
ext = 'a'
device = 'dev'
@@ -53,12 +54,14 @@ def build(target, options):
type = 'osx'
elif target.arch == 'arm64':
type = 'osx-arm64'
+ build_suffix = 'osx'
make_toolchain('toolchain/%s.cmake' % type, target.arch, target.sdk_prefix, target.sdk)
blockdev = 'linux'
ext = 'dylib'
device = 'dev'
elif target.platform == 'windows':
type = 'mingw' if target.bits == 64 else 'mingw-32'
+ build_suffix = type
blockdev = 'windows'
ext = 'dll'
device = 'windows'
@@ -66,9 +69,9 @@ def build(target, options):
target.command('mkdir -p %s/include/lwext4' % target.directory)
target.command('cp -r include/* %s/include/lwext4' % target.directory)
target.command('make %s' % type)
- target.command('make -j%d -C build_%s' % (target.parallel, type))
- target.command('cp -r build_%s/include/generated %s/include/lwext4' % (type, target.directory))
+ target.command('make -j%d -C build_%s' % (target.parallel, build_suffix))
+ target.command('cp -r build_%s/include/generated %s/include/lwext4' % (build_suffix, target.directory))
target.command('cp blockdev/%s/file_%s.h %s/include/lwext4' % (blockdev, device, target.directory))
target.command('mkdir -p %s/lib' % target.directory)
- target.command('cp build_%s/src/liblwext4.%s %s/lib' % (type, ext, target.directory))
- target.command('cp build_%s/blockdev/libblockdev.%s %s/lib' % (type, ext, target.directory))
+ target.command('cp build_%s/src/liblwext4.%s %s/lib' % (build_suffix, ext, target.directory))
+ target.command('cp build_%s/blockdev/libblockdev.%s %s/lib' % (build_suffix, ext, target.directory))