From f4e4c912a982e352dc6cb1304e311776b964eef7 Mon Sep 17 00:00:00 2001 From: tsukumi Date: Tue, 11 Apr 2023 09:11:04 +0000 Subject: [PATCH] =?UTF-8?q?deb=20=E3=83=91=E3=83=83=E3=82=B1=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=81=A7=E3=81=AE=20libaribb1=20/=20libaribb25=20?= =?UTF-8?q?=E3=81=AE=E3=82=A4=E3=83=B3=E3=82=B9=E3=83=88=E3=83=BC=E3=83=AB?= =?UTF-8?q?=E3=83=87=E3=82=A3=E3=83=AC=E3=82=AF=E3=83=88=E3=83=AA=E3=82=92?= =?UTF-8?q?=20/usr/lib/(arch)-linux-gnu=20=E4=BB=A5=E4=B8=8B=E3=81=AB?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cc71cf1..72c615e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.1) -#Higher than 3.21 +# Higher than 3.21 if(CMAKE_VERSION VERSION_GREATER 3.21) cmake_policy(SET CMP0128 NEW) endif() @@ -22,7 +22,7 @@ include(GenerateExportHeader) include(GNUInstallDirs) find_package(PCSC REQUIRED) -if (UNIX OR MSYS) +if(UNIX OR MSYS) find_program(LDCONFIG_EXECUTABLE "ldconfig") set(WITH_PCSC_PACKAGE "libpcsclite" CACHE STRING "pkg-config package name for PC/SC") set(WITH_PCSC_LIBRARY "" CACHE STRING "library name for PC/SC") @@ -36,6 +36,32 @@ if(NOT WIN32) option(USE_NEON "enable NEON" OFF) endif() +if(UNIX AND NOT CYGWIN) + # アーキテクチャ情報を取得 + set(ARCH ${CMAKE_SYSTEM_PROCESSOR}) + + # アーキテクチャに応じたGNUトリプレットを生成 + if(ARCH STREQUAL "x86_64") + set(ARCH_TRIPLET "x86_64-linux-gnu") + elseif(ARCH STREQUAL "aarch64") + set(ARCH_TRIPLET "aarch64-linux-gnu") + else() + message(WARNING "Unknown architecture: ${ARCH}. Defaulting to x86_64.") + set(ARCH_TRIPLET "x86_64-linux-gnu") + endif() + + # インストール先のディレクトリを指定 + if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "default install path" FORCE) + endif() + + if(CMAKE_INSTALL_PREFIX STREQUAL "/usr") + set(CMAKE_INSTALL_LIBDIR "lib/${ARCH_TRIPLET}") + else() + set(CMAKE_INSTALL_LIBDIR "lib") + endif() +endif() + # ---------- set variable (libaribb1) ---------- set(ARIBB1_LIB_NAME "aribb1")