Skip to content

Commit

Permalink
Build on m1 macOS 11.3 (#224)
Browse files Browse the repository at this point in the history
* Build on m1 macOS 11.3

* `CMakeLists.txt`:
    * Remove hard-coded `x86_64` in macOS builds
    * Set CMake Policy `CMP0068` (RPATH on macOS) to `NEW`
    * Ensure that `NekoTargets.cmake` is set to append in
      `export(TARGETS` command for `nekoml` to appease newer CMake
    * Drop duplicate arch64 detection block

Signed-off-by: Daniel Llewellyn <[email protected]>

* Re-add CMAKE_OSX_ARCHITECTURES to CmakeLists.txt

This is an attempt to fix the mac static azure devops testsuite.
We now default `CMAKE_OSX_ARCHITECTURES` to equal `NATIVE_ARCH_ACTUAL`. We could also use `ARCHS_STANDARD` for a Universal build.

Signed-off-by: Dani Llewellyn <[email protected]>

* Add missing arm64 branch to static openssl build of mysql

Signed-off-by: Dani Llewellyn <[email protected]>

---------

Signed-off-by: Daniel Llewellyn <[email protected]>
Signed-off-by: Dani Llewellyn <[email protected]>
Co-authored-by: Daniel Llewellyn <[email protected]>
  • Loading branch information
lucyllewy and Daniel Llewellyn authored Mar 27, 2023
1 parent 9aa2aae commit 5d017b1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 18 deletions.
25 changes: 7 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ if (NOT ${CMAKE_VERSION} VERSION_LESS 3.24)
elseif (NOT ${CMAKE_VERSION} VERSION_LESS 3.19)
cmake_policy(VERSION 3.19)
endif()
cmake_policy(SET CMP0068 NEW)

include(GNUInstallDirs)
include(CheckCCompilerFlag)
include(CheckIncludeFile)
include(TestBigEndian)
project(Neko C)

set(CMAKE_OSX_ARCHITECTURES x86_64)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
EXECUTE_PROCESS(COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE CMAKE_OSX_ARCHITECTURES)
endif()
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})

if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
Expand Down Expand Up @@ -70,8 +73,10 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
set(arch_64 "")
elseif (${CMAKE_OSX_ARCHITECTURES} STREQUAL "x86_64")
set(arch_64 "64")
elseif (${CMAKE_OSX_ARCHITECTURES} STREQUAL "arm64")
set(arch_64 "64")
else()
message( FATAL_ERROR "CMAKE_OSX_ARCHITECTURES should be i386 or x86_64." )
message( FATAL_ERROR "CMAKE_OSX_ARCHITECTURES should be i386, arm64, or x86_64." )
endif()
else()
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
Expand Down Expand Up @@ -750,22 +755,6 @@ else()
set(bin_archive_format tar.gz)
endif()

if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
if (${CMAKE_OSX_ARCHITECTURES} STREQUAL "i386")
set(arch_64 "")
elseif (${CMAKE_OSX_ARCHITECTURES} STREQUAL "x86_64")
set(arch_64 "64")
else()
message( FATAL_ERROR "CMAKE_OSX_ARCHITECTURES should be i386 or x86_64." )
endif()
else()
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(arch_64 "64")
else()
set(arch_64 "")
endif()
endif()

if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(OS_NAME "win")
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
Expand Down
2 changes: 2 additions & 0 deletions libs/mysql/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ if (STATIC_OPENSSL)
set(OPENSSL_CONF ./Configure darwin-i386-cc "-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
elseif (${CMAKE_OSX_ARCHITECTURES} STREQUAL "x86_64")
set(OPENSSL_CONF ./Configure darwin64-x86_64-cc "-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
elseif (${CMAKE_OSX_ARCHITECTURES} STREQUAL "arm64")
set(OPENSSL_CONF ./Configure darwin64-arm64-cc "-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
endif()
else()
set(OPENSSL_CONF ./config)
Expand Down

0 comments on commit 5d017b1

Please sign in to comment.