Reformat cmake files.

This commit is contained in:
2023-09-24 17:20:53 +01:00
parent 04e7854c0d
commit f781c45c07
6 changed files with 220 additions and 220 deletions

View File

@@ -24,21 +24,21 @@ if(APPLE)
if(NOT DEFINED AARU_MACOS_TARGET_ARCH)
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
SET(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for macOS" FORCE)
set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for macOS" FORCE)
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm64")
SET(CMAKE_OSX_ARCHITECTURES "arm64" CACHE STRING "Build architectures for macOS" FORCE)
set(CMAKE_OSX_ARCHITECTURES "arm64" CACHE STRING "Build architectures for macOS" FORCE)
else()
message(FATAL_ERROR "Unknown system processor ${CMAKE_SYSTEM_PROCESSOR} for macOS")
endif()
elseif(AARU_MACOS_TARGET_ARCH STREQUAL "x86_64")
SET(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for macOS" FORCE)
set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for macOS" FORCE)
elseif(AARU_MACOS_TARGET_ARCH STREQUAL "arm64")
SET(CMAKE_OSX_ARCHITECTURES "arm64" CACHE STRING "Build architectures for macOS" FORCE)
set(CMAKE_OSX_ARCHITECTURES "arm64" CACHE STRING "Build architectures for macOS" FORCE)
else()
message(FATAL_ERROR "Unknown Aaru target architecture ${AARU_MACOS_TARGET_ARCH} for macOS")
endif()
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version")
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version")
endif(APPLE)
project("Aaru.Compression.Native" C)
@@ -81,7 +81,7 @@ if("${CMAKE_BUILD_TYPE}" MATCHES "Release" OR "${CMAKE_BUILD_TYPE}" MATCHES "Rel
add_compile_options("/O2 /Ob2 /Oi /Ot /Oy /Og /fp:fast")
if(${CMAKE_C_COMPILER_ARCHITECTURE_ID} MATCHES "X86")
add_compile_options("/arch:SSE2")
elseif (${CMAKE_C_COMPILER_ARCHITECTURE_ID} MATCHES "ARM")
elseif(${CMAKE_C_COMPILER_ARCHITECTURE_ID} MATCHES "ARM")
add_compile_options("/arch:VFPv4")
endif()
else()
@@ -93,7 +93,7 @@ if("${CMAKE_BUILD_TYPE}" MATCHES "Release" OR "${CMAKE_BUILD_TYPE}" MATCHES "Rel
elseif(${AARU_MACOS_TARGET_ARCH} MATCHES "arm64")
add_compile_options(-mcpu=apple-m1 -mtune=apple-m1)
endif()
endif ()
endif()
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "i686" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "AMD64")
if(NOT "${CMAKE_C_COMPILER_ID}" MATCHES "AppleClang")
@@ -136,26 +136,26 @@ include(3rdparty/lzfse.cmake)
include(3rdparty/lzip.cmake)
include(3rdparty/lzma.cmake)
macro(TARGET_LINK_LIBRARIES_WHOLE_ARCHIVE target)
macro(target_link_libraries_whole_archive target)
if("${CMAKE_C_COMPILER_ID}" MATCHES "MSVC")
foreach(arg IN LISTS ARGN)
SET_TARGET_PROPERTIES(
set_target_properties(
${target} PROPERTIES LINK_FLAGS "/WHOLEARCHIVE:${lib}"
)
endforeach()
else()
if("${CMAKE_C_COMPILER_ID}" MATCHES "AppleClang")
SET(LINK_FLAGS "-Wl,-all_load")
SET(UNDO_FLAGS "-Wl")
set(LINK_FLAGS "-Wl,-all_load")
set(UNDO_FLAGS "-Wl")
else()
SET(LINK_FLAGS "-Wl,--whole-archive")
SET(UNDO_FLAGS "-Wl,--no-whole-archive")
set(LINK_FLAGS "-Wl,--whole-archive")
set(UNDO_FLAGS "-Wl,--no-whole-archive")
endif()
TARGET_LINK_LIBRARIES(${target} ${LINK_FLAGS} ${ARGN} ${UNDO_FLAGS})
target_link_libraries(${target} ${LINK_FLAGS} ${ARGN} ${UNDO_FLAGS})
endif()
endmacro()
TARGET_LINK_LIBRARIES_WHOLE_ARCHIVE("Aaru.Compression.Native" libzstd_static m)
target_link_libraries_whole_archive("Aaru.Compression.Native" libzstd_static m)
check_include_file("semaphore.h" HAVE_SEMAPHORE_H)
@@ -169,7 +169,7 @@ if(HAVE_SEMAPHORE_H)
endif()
if(HAVE_PTHREAD)
TARGET_LINK_LIBRARIES_WHOLE_ARCHIVE("Aaru.Compression.Native" Threads::Threads)
target_link_libraries_whole_archive("Aaru.Compression.Native" Threads::Threads)
endif()
if(NOT "${CMAKE_C_PLATFORM_ID}" MATCHES "MinGW" OR (NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm" AND NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64"))