2024-02-07 21:44:20 +08:00
|
|
|
|
cmake_minimum_required(VERSION 3.14)
|
|
|
|
|
|
|
|
|
|
project(ncmdump LANGUAGES CXX)
|
|
|
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
|
|
2024-02-12 23:53:14 +08:00
|
|
|
|
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
|
2024-02-12 22:24:25 +08:00
|
|
|
|
set(WITH_ZLIB OFF)
|
|
|
|
|
set(BUILD_TESTING OFF)
|
2024-02-08 10:26:53 +08:00
|
|
|
|
add_subdirectory(taglib)
|
2024-02-07 21:44:20 +08:00
|
|
|
|
|
2024-03-22 12:07:32 +08:00
|
|
|
|
if(MSVC)
|
|
|
|
|
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/execution-charset:utf-8>")
|
|
|
|
|
endif()
|
|
|
|
|
|
2024-02-07 21:44:20 +08:00
|
|
|
|
FILE(GLOB HEADERS ./*.h)
|
2024-03-22 12:26:19 +08:00
|
|
|
|
FILE(GLOB COMMON_SOURCES cJSON.cpp aes.cpp main.cpp ncmcrypt.cpp)
|
|
|
|
|
FILE(GLOB WIN_SOURCES win32_init.cpp)
|
|
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
|
set(SOURCES ${COMMON_SOURCES} ${WIN_SOURCES})
|
|
|
|
|
else()
|
|
|
|
|
set(SOURCES ${COMMON_SOURCES})
|
|
|
|
|
endif()
|
2024-02-07 21:44:20 +08:00
|
|
|
|
add_executable(ncmdump
|
2024-02-12 21:52:56 +08:00
|
|
|
|
${HEADERS}
|
|
|
|
|
${SOURCES}
|
2024-02-07 21:44:20 +08:00
|
|
|
|
)
|
|
|
|
|
target_link_libraries(ncmdump tag)
|
|
|
|
|
target_include_directories(ncmdump PRIVATE taglib)
|
|
|
|
|
target_include_directories(ncmdump PRIVATE taglib/taglib)
|
|
|
|
|
target_include_directories(ncmdump PRIVATE taglib/taglib/toolkit)
|
|
|
|
|
target_include_directories(ncmdump PRIVATE taglib/taglib/mpeg/id3v2)
|
|
|
|
|
|
2024-02-12 21:52:56 +08:00
|
|
|
|
if(WIN32)
|
2024-02-12 22:37:04 +08:00
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
2024-03-22 12:26:19 +08:00
|
|
|
|
target_link_options(ncmdump PRIVATE -static)
|
2024-02-12 21:52:56 +08:00
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
|
2024-02-07 21:44:20 +08:00
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
install(TARGETS ncmdump
|
2024-02-12 21:52:56 +08:00
|
|
|
|
BUNDLE DESTINATION .
|
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
2024-02-07 21:44:20 +08:00
|
|
|
|
)
|