darling-objc4/runtime/CMakeLists.txt
2020-07-18 18:28:56 -04:00

89 lines
2.5 KiB
CMake

project(objc4)
cmake_minimum_required(VERSION 2.4.0)
enable_language(C CXX ASM)
add_compile_options(
-Wno-unused-command-line-argument
)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
cmake_policy(SET CMP0005 NEW)
endif(COMMAND cmake_policy)
add_definitions(-D__STDC_NO_ATOMICS__)
# Override DEBUG CFLAGS because -O0 has been triggering strange bugs
set(CMAKE_C_FLAGS_DEBUG "-ggdb -DOBJC_IS_DEBUG_BUILD=1")
set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -DOBJC_IS_DEBUG_BUILD=1")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -nostdinc -O2 -D__DARWIN_UNIX03 -fPIC -fblocks -fobjc-legacy-dispatch -fvisibility-inlines-hidden -fvisibility=hidden -fstrict-aliasing")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostdinc -nostdinc++ -O2 -std=gnu++14 -D__DARWIN_UNIX03 -fPIC -fblocks -fobjc-legacy-dispatch \
-fno-rtti -fno-exceptions -Wno-c++11-narrowing -fvisibility-inlines-hidden -fvisibility=hidden -Wno-invalid-offsetof -Wno-deprecated-objc-isa-usage \
-Wno-cast-of-sel-type -Wstrict-aliasing=2 -Wstrict-overflow=4 -fstrict-aliasing")
add_definitions(-DOBJC_NO_GC -DOBJC_IS_DEBUG_BUILD=1)
add_definitions(-DTARGET_OS_IPHONE=0 -DOS_OBJECT_USE_OBJC=0)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set(objc_SRCS
maptable.mm
hashtable2.mm
NSObject.mm
objc-accessors.mm
objc-auto.mm
objc-block-trampolines.mm
objc-cache.mm
objc-cache-old.mm
objc-class.mm
objc-class-old.mm
objc-errors.mm
objc-exception.mm
objc-file.mm
objc-file-old.mm
objc-initialize.mm
objc-layout.mm
objc-loadmethod.mm
objc-load.mm
objc-lockdebug.mm
objc-opt.mm
objc-os.mm
objc-references.mm
objc-runtime.mm
objc-runtime-new.mm
objc-runtime-old.mm
objc-sel.mm
objc-sel-old.mm
objc-sel-set.mm
objc-sync.mm
objc-typeencoding.mm
objc-weak.mm
objc-zalloc.mm
Object.mm
Protocol.mm
objc-blocktramps-arm.S
objc-blocktramps-arm64.S
objc-blocktramps-i386.S
objc-blocktramps-x86_64.S
objc-sel-table.S
Messengers.subproj/objc-msg-arm.S
Messengers.subproj/objc-msg-arm64.S
Messengers.subproj/objc-msg-i386.S
Messengers.subproj/objc-msg-x86_64.S
)
set(DYLIB_INSTALL_NAME "/usr/lib/libobjc.A.dylib")
set(DYLIB_COMPAT_VERSION "1.0.0")
set(DYLIB_CURRENT_VERSION "228.0.0")
add_circular(objc FAT
SOURCES ${objc_SRCS}
SIBLINGS system_c system_malloc system_dyld system_blocks unwind system_m macho platform system_kernel system_pthread compiler_rt libdispatch_shared
DEPENDENCIES cxx
)
set_target_properties(objc PROPERTIES OUTPUT_NAME "objc.A")
InstallSymlink("libobjc.A.dylib" "${CMAKE_INSTALL_PREFIX}/libexec/darling/usr/lib/libobjc.dylib")
install(TARGETS objc DESTINATION libexec/darling/usr/lib)