Build both osx and osx-arm64 versions in a directory called osx.
authorCarl Hetherington <cth@carlh.net>
Thu, 7 Jan 2021 11:04:13 +0000 (12:04 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 7 Jan 2021 12:16:40 +0000 (13:16 +0100)
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.

Makefile
cscript

index e0f50d4c08f39f802b95fce288dbad5c18724a4b..347b29b38bc17786d7092d6c22665f156b066ac5 100644 (file)
--- 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 f7b859de6639116f6da432640f683b1664ebebf3..4fad21a8368db8a26c045b355618657c54c9e64f 100644 (file)
--- 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))