From d1956d63a3c5d52b4a2203ccd2f2182fe1a9260e Mon Sep 17 00:00:00 2001 From: maleicacid Date: Mon, 20 Nov 2023 02:36:51 +0900 Subject: [PATCH 1/4] =?UTF-8?q?CMP0091=E3=82=92NEW=E3=81=AB=E8=A8=AD?= =?UTF-8?q?=E5=AE=9A=E3=81=97=E3=80=81CMAKE=EF=BC=BFMSVC=5FRUNTIME=5FLIBRA?= =?UTF-8?q?RY=E3=82=92=E5=8F=97=E3=81=91=E5=85=A5=E3=82=8C=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e81b250..5c5fcbf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,13 @@ cmake_minimum_required(VERSION 3.1) -# Higher than 3.21 if(CMAKE_VERSION VERSION_GREATER 3.21) -cmake_policy(SET CMP0128 NEW) + cmake_policy(SET CMP0128 NEW) +endif() +if(CMAKE_VERSION VERSION_GREATER 3.15) + cmake_policy(SET CMP0091 NEW) endif() if(CMAKE_VERSION VERSION_GREATER 3.1) -cmake_policy(SET CMP0054 NEW) + cmake_policy(SET CMP0054 NEW) endif() set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") From 0ae1668840b49c8bd84326f1a5c72a1d26f86268 Mon Sep 17 00:00:00 2001 From: maleicacid Date: Mon, 20 Nov 2023 02:42:57 +0900 Subject: [PATCH 2/4] =?UTF-8?q?MSVC=E3=81=AB=E3=81=8A=E3=81=84=E3=81=A6?= =?UTF-8?q?=E3=82=B3=E3=83=BC=E3=83=89=E3=81=AE=E6=96=87=E5=AD=97=E3=82=B3?= =?UTF-8?q?=E3=83=BC=E3=83=89=E3=81=A8=E3=81=97=E3=81=A6UTF-8=E3=82=92?= =?UTF-8?q?=E6=9C=9F=E5=BE=85=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c5fcbf..45df8f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,6 +112,7 @@ if(CMAKE_C_COMPILER_ID MATCHES "(GNU|Clang)") elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC") add_definitions("-D_CRT_SECURE_NO_WARNINGS") set(CMAKE_SUPPRESS_REGENERATION TRUE) + add_compile_options("/utf-8") if(USE_AVX2) add_definitions("-DENABLE_MULTI2_SIMD") From cd6a9dd5d26cb94d4cbe90d1537a4d85f91376ef Mon Sep 17 00:00:00 2001 From: maleicacid Date: Thu, 23 Nov 2023 21:33:09 +0900 Subject: [PATCH 3/4] =?UTF-8?q?ARM=E3=81=AE=E3=83=93=E3=83=AB=E3=83=89?= =?UTF-8?q?=E6=99=82=E3=81=ABAVX2=E3=81=AE=E3=82=B3=E3=83=BC=E3=83=89?= =?UTF-8?q?=E3=82=92=E3=83=93=E3=83=AB=E3=83=89=E3=81=97=E3=81=A6=E3=81=97?= =?UTF-8?q?=E3=81=BE=E3=81=86=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 45df8f4..bccb557 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,7 +34,7 @@ if(WIN32) option(USE_UNICODE "enable unicode support" ON) endif() option(USE_AVX2 "enable AVX2" OFF) -if(NOT WIN32) +if(CMAKE_SYSTEM_PROCESSOR MATCHES "(ARM|ARM64|AARCH64)") option(USE_NEON "enable NEON" OFF) endif() @@ -138,7 +138,7 @@ link_directories(${PCSC_LIBRARY_DIRS}) # ---------- libaribb1 ---------- -if(WIN32) +if(WIN32 AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "(ARM|ARM64|AARCH64)") add_library(aribb1-objlib OBJECT aribb25/arib_std_b25.c aribb25/b_cas_card.c aribb25/multi2.c aribb25/multi2_simd.c aribb25/ts_section_parser.c aribb25/version_b1.c) else() add_library(aribb1-objlib OBJECT aribb25/arib_std_b25.c aribb25/b_cas_card.c aribb25/multi2.cc aribb25/ts_section_parser.c aribb25/version_b1.c) @@ -186,7 +186,7 @@ configure_file(aribb25/version_b1.rc.in version_b1.rc @ONLY) # ---------- libaribb25 ---------- -if(WIN32) +if(WIN32 AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "(ARM|ARM64|AARCH64)") add_library(aribb25-objlib OBJECT aribb25/arib_std_b25.c aribb25/b_cas_card.c aribb25/multi2.c aribb25/multi2_simd.c aribb25/ts_section_parser.c aribb25/version_b25.c) else() add_library(aribb25-objlib OBJECT aribb25/arib_std_b25.c aribb25/b_cas_card.c aribb25/multi2.cc aribb25/ts_section_parser.c aribb25/version_b25.c) From 797d94c1261104b2d8ec558815196c855a87a269 Mon Sep 17 00:00:00 2001 From: maleicacid Date: Mon, 20 Nov 2023 02:50:28 +0900 Subject: [PATCH 4/4] =?UTF-8?q?CMake=E3=81=AE=E6=96=B0=E3=81=97=E3=81=84?= =?UTF-8?q?=E6=A9=9F=E8=83=BD=E3=82=92=E3=82=82=E3=81=A1=E3=81=84=E3=81=A6?= =?UTF-8?q?=E3=82=B3=E3=83=B3=E3=83=91=E3=82=A4=E3=83=AB/=E3=83=AA?= =?UTF-8?q?=E3=83=B3=E3=82=AF=E3=83=95=E3=83=A9=E3=82=B0=E3=81=AE=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E3=82=92=E3=81=99=E3=82=8B=20CMAKE=5FMSVC=5FRUNTIME?= =?UTF-8?q?=5FLIBRARY=E3=82=92=E5=8F=97=E3=81=91=E5=85=A5=E3=82=8C?= =?UTF-8?q?=E3=82=8B3.15=E3=82=92=E4=B8=8B=E9=99=90=E3=81=AE=E3=83=90?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E3=81=A8=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 43 ++++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bccb557..334b578 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) if(CMAKE_VERSION VERSION_GREATER 3.21) cmake_policy(SET CMP0128 NEW) @@ -6,9 +6,8 @@ endif() if(CMAKE_VERSION VERSION_GREATER 3.15) cmake_policy(SET CMP0091 NEW) endif() -if(CMAKE_VERSION VERSION_GREATER 3.1) - cmake_policy(SET CMP0054 NEW) -endif() +cmake_policy(SET CMP0054 NEW) +cmake_policy(SET CMP0063 NEW) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE INTERNAL "limit build types" FORCE) @@ -77,37 +76,28 @@ set(ARIBB25_VERSION_STRING ${ARIBB25_VERSION_NUMBER}) # ---------- define flags ---------- if(CMAKE_C_COMPILER_ID MATCHES "(GNU|Clang)") - set(CMAKE_C_FLAGS "-Wall") - set(CMAKE_C_FLAGS_DEBUG "-O2 -g") - set(CMAKE_C_FLAGS_RELEASE "-O2") - set(CMAKE_CXX_FLAGS "-Wall") - set(CMAKE_CXX_FLAGS_DEBUG "-O3 -g") - set(CMAKE_CXX_FLAGS_RELEASE "-O3") - set(CMAKE_SHARED_LINKER_FLAGS "-fvisibility=hidden") + set(CMAKE_C_VISIBILITY_PRESET "hidden") + set(CMAKE_CXX_VISIBILITY_PRESET "hidden") if(UNIX AND NOT CYGWIN) include(ElfInterp) - set(CMAKE_C_FLAGS "-fPIC ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-fPIC ${CMAKE_CXX_FLAGS}") + set(CMAKE_POSITION_INDEPENDENT_CODE ON) if(NOT APPLE) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-eshow_version") + add_link_options("-Wl,-eshow_version") endif() else(MINGW) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--enable-stdcall-fixup -static-libgcc") + add_link_options("-Wl,--enable-stdcall-fixup" "-static-libgcc") endif() if(MINGW AND USE_UNICODE) - set(CMAKE_C_FLAGS "-municode ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-municode ${CMAKE_CXX_FLAGS}") + add_link_options("-municode") endif() if(USE_AVX2) - set(CMAKE_C_FLAGS "-mavx2 ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-mavx2 ${CMAKE_CXX_FLAGS}") + add_compile_options("-mavx2") endif() if(USE_NEON) - set(CMAKE_C_FLAGS "-mfpu=neon ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-mfpu=neon ${CMAKE_CXX_FLAGS}") + add_compile_options("-mfpu=neon") endif() elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC") add_definitions("-D_CRT_SECURE_NO_WARNINGS") @@ -116,8 +106,7 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC") if(USE_AVX2) add_definitions("-DENABLE_MULTI2_SIMD") - set(CMAKE_C_FLAGS "/arch:AVX2 ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "/arch:AVX2 ${CMAKE_CXX_FLAGS}") + add_compile_options("/arch:AVX2") endif() endif() @@ -139,9 +128,9 @@ link_directories(${PCSC_LIBRARY_DIRS}) # ---------- libaribb1 ---------- if(WIN32 AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "(ARM|ARM64|AARCH64)") -add_library(aribb1-objlib OBJECT aribb25/arib_std_b25.c aribb25/b_cas_card.c aribb25/multi2.c aribb25/multi2_simd.c aribb25/ts_section_parser.c aribb25/version_b1.c) + add_library(aribb1-objlib OBJECT aribb25/arib_std_b25.c aribb25/b_cas_card.c aribb25/multi2.c aribb25/multi2_simd.c aribb25/ts_section_parser.c aribb25/version_b1.c) else() -add_library(aribb1-objlib OBJECT aribb25/arib_std_b25.c aribb25/b_cas_card.c aribb25/multi2.cc aribb25/ts_section_parser.c aribb25/version_b1.c) + add_library(aribb1-objlib OBJECT aribb25/arib_std_b25.c aribb25/b_cas_card.c aribb25/multi2.cc aribb25/ts_section_parser.c aribb25/version_b1.c) endif() set_target_properties(aribb1-objlib PROPERTIES COMPILE_DEFINITIONS ARIBB1_DLL) target_compile_definitions(aribb1-objlib PRIVATE ENABLE_ARIB_STD_B1) @@ -187,9 +176,9 @@ configure_file(aribb25/version_b1.rc.in version_b1.rc @ONLY) # ---------- libaribb25 ---------- if(WIN32 AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "(ARM|ARM64|AARCH64)") -add_library(aribb25-objlib OBJECT aribb25/arib_std_b25.c aribb25/b_cas_card.c aribb25/multi2.c aribb25/multi2_simd.c aribb25/ts_section_parser.c aribb25/version_b25.c) + add_library(aribb25-objlib OBJECT aribb25/arib_std_b25.c aribb25/b_cas_card.c aribb25/multi2.c aribb25/multi2_simd.c aribb25/ts_section_parser.c aribb25/version_b25.c) else() -add_library(aribb25-objlib OBJECT aribb25/arib_std_b25.c aribb25/b_cas_card.c aribb25/multi2.cc aribb25/ts_section_parser.c aribb25/version_b25.c) + add_library(aribb25-objlib OBJECT aribb25/arib_std_b25.c aribb25/b_cas_card.c aribb25/multi2.cc aribb25/ts_section_parser.c aribb25/version_b25.c) endif() set_target_properties(aribb25-objlib PROPERTIES COMPILE_DEFINITIONS ARIBB25_DLL)