From ada8d3ed6507e934fd4a5f2a0892684f28e02448 Mon Sep 17 00:00:00 2001 From: tsukumi Date: Tue, 13 Feb 2024 23:52:48 +0000 Subject: [PATCH] =?UTF-8?q?Revert=20"CMake=E3=81=AE=E6=96=B0=E3=81=97?= =?UTF-8?q?=E3=81=84=E6=A9=9F=E8=83=BD=E3=82=92=E3=82=82=E3=81=A1=E3=81=84?= =?UTF-8?q?=E3=81=A6=E3=82=B3=E3=83=B3=E3=83=91=E3=82=A4=E3=83=AB/?= =?UTF-8?q?=E3=83=AA=E3=83=B3=E3=82=AF=E3=83=95=E3=83=A9=E3=82=B0=E3=81=AE?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E3=82=92=E3=81=99=E3=82=8B"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 797d94c1261104b2d8ec558815196c855a87a269. --- CMakeLists.txt | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 334b578..bccb557 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.15) +cmake_minimum_required(VERSION 3.1) if(CMAKE_VERSION VERSION_GREATER 3.21) cmake_policy(SET CMP0128 NEW) @@ -6,8 +6,9 @@ endif() if(CMAKE_VERSION VERSION_GREATER 3.15) cmake_policy(SET CMP0091 NEW) endif() -cmake_policy(SET CMP0054 NEW) -cmake_policy(SET CMP0063 NEW) +if(CMAKE_VERSION VERSION_GREATER 3.1) + cmake_policy(SET CMP0054 NEW) +endif() set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE INTERNAL "limit build types" FORCE) @@ -76,28 +77,37 @@ set(ARIBB25_VERSION_STRING ${ARIBB25_VERSION_NUMBER}) # ---------- define flags ---------- if(CMAKE_C_COMPILER_ID MATCHES "(GNU|Clang)") - set(CMAKE_C_VISIBILITY_PRESET "hidden") - set(CMAKE_CXX_VISIBILITY_PRESET "hidden") + 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") if(UNIX AND NOT CYGWIN) include(ElfInterp) - set(CMAKE_POSITION_INDEPENDENT_CODE ON) + set(CMAKE_C_FLAGS "-fPIC ${CMAKE_C_FLAGS}") + set(CMAKE_CXX_FLAGS "-fPIC ${CMAKE_CXX_FLAGS}") if(NOT APPLE) - add_link_options("-Wl,-eshow_version") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-eshow_version") endif() else(MINGW) - add_link_options("-Wl,--enable-stdcall-fixup" "-static-libgcc") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--enable-stdcall-fixup -static-libgcc") endif() if(MINGW AND USE_UNICODE) - add_link_options("-municode") + set(CMAKE_C_FLAGS "-municode ${CMAKE_C_FLAGS}") + set(CMAKE_CXX_FLAGS "-municode ${CMAKE_CXX_FLAGS}") endif() if(USE_AVX2) - add_compile_options("-mavx2") + set(CMAKE_C_FLAGS "-mavx2 ${CMAKE_C_FLAGS}") + set(CMAKE_CXX_FLAGS "-mavx2 ${CMAKE_CXX_FLAGS}") endif() if(USE_NEON) - add_compile_options("-mfpu=neon") + set(CMAKE_C_FLAGS "-mfpu=neon ${CMAKE_C_FLAGS}") + set(CMAKE_CXX_FLAGS "-mfpu=neon ${CMAKE_CXX_FLAGS}") endif() elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC") add_definitions("-D_CRT_SECURE_NO_WARNINGS") @@ -106,7 +116,8 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC") if(USE_AVX2) add_definitions("-DENABLE_MULTI2_SIMD") - add_compile_options("/arch:AVX2") + set(CMAKE_C_FLAGS "/arch:AVX2 ${CMAKE_C_FLAGS}") + set(CMAKE_CXX_FLAGS "/arch:AVX2 ${CMAKE_CXX_FLAGS}") endif() endif() @@ -128,9 +139,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) @@ -176,9 +187,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)