Skip to content

Commit

Permalink
Mac Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanTAllen committed Oct 27, 2023
1 parent 883a021 commit 5e1d492
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/libponyc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ target_include_directories(libponyc
PRIVATE ../../lib/blake2
)

if(${CMAKE_HOST_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_OSX_DEPLOYMENT_TARGET 13.0.0)
endif()

if (MSVC)
file(GLOB_RECURSE CFILES "${PROJECT_SOURCE_DIR}/*.c")
set_source_files_properties(${CFILES} PROPERTIES LANGUAGE CXX)
Expand All @@ -126,7 +130,7 @@ if (MSVC)
set(libponyc_standalone_file "${CMAKE_STATIC_LIBRARY_PREFIX}ponyc-standalone${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(libponyc_standalone_path "${CMAKE_BINARY_DIR}/${libponyc_standalone_file}")
add_custom_target(libponyc-standalone ALL
# CMAKE_AR finds the appropriate version of lib.exe acdording to desired target and host architecture
# CMAKE_AR finds the appropriate version of lib.exe acdording to desired target and host architecture
COMMAND ${CMAKE_AR} /NOLOGO /VERBOSE /MACHINE:x64 /OUT:${libponyc_standalone_path} "$<TARGET_FILE:libponyc>" ${LLVM_OBJS} "${PROJECT_SOURCE_DIR}/../../build/libs/lib/blake2.lib"
DEPENDS libponyc)
add_custom_command(TARGET libponyc-standalone POST_BUILD
Expand Down
7 changes: 4 additions & 3 deletions src/libponyc/codegen/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -818,9 +818,10 @@ bool codegen_pass_init(pass_opt_t* opt)
{
triple = LLVMCreateMessage(opt->triple);
} else {
#if defined(PLATFORM_IS_MACOSX) && !defined(PLATFORM_IS_ARM)
// This is to prevent XCode 7+ from claiming OSX 14.5 is required.
triple = LLVMCreateMessage("x86_64-apple-macosx");
#if defined(PLATFORM_IS_MACOSX) && defined(PLATFORM_IS_ARM)
triple = LLVMCreateMessage("arm64-apple-macosx13.0.0");
#elif defined(PLATFORM_IS_MACOSX) && !defined(PLATFORM_IS_ARM)
triple = LLVMCreateMessage("x86_64-apple-macosx13.0.0");
#else
triple = LLVMGetDefaultTargetTriple();
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/libponyc/codegen/genexe.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ static bool link_exe(compile_t* c, ast_t* program,
snprintf(ld_cmd, ld_len,
"%s -execute -arch %.*s "
"-o %s %s %s %s "
"-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -lSystem %s",
"-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -lSystem %s -platform_version macos '13.0.0' '0.0.0'",
linker, (int)arch_len, c->opt->triple, file_exe, file_o,
lib_args, ponyrt, sanitizer_arg
);
Expand Down
4 changes: 4 additions & 0 deletions src/libponyrt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ find_file(_llc_command
PATHS "${CMAKE_BINARY_DIR}/../../libs/bin" "${CMAKE_BINARY_DIR}/../libs/bin"
)

if(${CMAKE_HOST_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_OSX_DEPLOYMENT_TARGET 13.0.0)
endif()

add_library(libponyrt STATIC
${_c_src}
${_ll_except_obj}
Expand Down

0 comments on commit 5e1d492

Please sign in to comment.