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-03-25 11:51:55 +08:00
|
|
|
|
FILE(GLOB COMMON_HEADERS src/include/*.h)
|
|
|
|
|
FILE(GLOB COMMON_SOURCES src/ncmcrypt.cpp src/utils/*.cpp)
|
|
|
|
|
FILE(GLOB EXECUTABLE_SOURCES src/main.cpp)
|
|
|
|
|
FILE(GLOB LIBRARY_HEADERS src/lib/libncmdump.h)
|
|
|
|
|
FILE(GLOB LIBRARY_SOURCES src/lib/*.cpp)
|
2024-04-06 12:09:03 +08:00
|
|
|
|
FILE(GLOB WIN_SOURCES src/platform/win32_init.cpp)
|
2024-03-22 12:26:19 +08:00
|
|
|
|
|
|
|
|
|
if(WIN32)
|
2024-03-25 09:07:01 +08:00
|
|
|
|
add_executable(ncmdump_exec
|
2024-03-25 11:51:55 +08:00
|
|
|
|
${COMMON_HEADERS}
|
2024-03-24 17:27:41 +08:00
|
|
|
|
${COMMON_SOURCES}
|
|
|
|
|
${EXECUTABLE_SOURCES}
|
2024-04-06 12:09:03 +08:00
|
|
|
|
${WIN_SOURCES}
|
2024-03-24 17:27:41 +08:00
|
|
|
|
)
|
2024-03-25 09:07:01 +08:00
|
|
|
|
add_library(ncmdump_lib SHARED
|
2024-03-25 11:51:55 +08:00
|
|
|
|
${COMMON_HEADERS}
|
2024-03-24 17:27:41 +08:00
|
|
|
|
${COMMON_SOURCES}
|
2024-03-25 11:51:55 +08:00
|
|
|
|
${LIBRARY_HEADERS}
|
2024-03-24 17:44:51 +08:00
|
|
|
|
${LIBRARY_SOURCES}
|
2024-04-06 12:09:03 +08:00
|
|
|
|
${WIN_SOURCES}
|
2024-03-24 17:27:41 +08:00
|
|
|
|
)
|
2024-02-07 21:44:20 +08:00
|
|
|
|
|
2024-03-25 12:05:50 +08:00
|
|
|
|
set_target_properties(ncmdump_lib PROPERTIES OUTPUT_NAME "libncmdump")
|
2024-03-25 09:07:01 +08:00
|
|
|
|
|
|
|
|
|
target_include_directories(ncmdump_lib PRIVATE src/include)
|
2024-03-24 17:27:41 +08:00
|
|
|
|
|
2024-03-25 09:07:01 +08:00
|
|
|
|
target_link_libraries(ncmdump_lib tag)
|
|
|
|
|
target_include_directories(ncmdump_lib PRIVATE taglib)
|
|
|
|
|
target_include_directories(ncmdump_lib PRIVATE taglib/taglib)
|
|
|
|
|
target_include_directories(ncmdump_lib PRIVATE taglib/taglib/toolkit)
|
|
|
|
|
target_include_directories(ncmdump_lib PRIVATE taglib/taglib/mpeg/id3v2)
|
2024-03-24 17:27:41 +08:00
|
|
|
|
|
2024-02-12 22:37:04 +08:00
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
2024-03-24 17:44:51 +08:00
|
|
|
|
# static link when using MinGW
|
2024-03-25 09:07:01 +08:00
|
|
|
|
target_link_options(ncmdump_exec PRIVATE -static)
|
|
|
|
|
target_link_options(ncmdump_lib PRIVATE -static)
|
2024-02-12 21:52:56 +08:00
|
|
|
|
endif()
|
2024-03-24 17:44:51 +08:00
|
|
|
|
else()
|
2024-03-25 10:55:00 +08:00
|
|
|
|
add_executable(ncmdump_exec
|
2024-03-25 11:51:55 +08:00
|
|
|
|
${COMMON_HEADERS}
|
2024-03-24 17:44:51 +08:00
|
|
|
|
${COMMON_SOURCES}
|
|
|
|
|
${EXECUTABLE_SOURCES}
|
|
|
|
|
)
|
2024-02-12 21:52:56 +08:00
|
|
|
|
endif()
|
|
|
|
|
|
2024-03-25 11:51:55 +08:00
|
|
|
|
# all executable target
|
2024-03-25 12:09:35 +08:00
|
|
|
|
set_target_properties(ncmdump_exec PROPERTIES OUTPUT_NAME "ncmdump")
|
2024-03-25 09:07:01 +08:00
|
|
|
|
target_include_directories(ncmdump_exec PRIVATE src/include)
|
2024-03-24 17:48:04 +08:00
|
|
|
|
|
2024-03-25 09:07:01 +08:00
|
|
|
|
target_link_libraries(ncmdump_exec tag)
|
|
|
|
|
target_include_directories(ncmdump_exec PRIVATE taglib)
|
|
|
|
|
target_include_directories(ncmdump_exec PRIVATE taglib/taglib)
|
|
|
|
|
target_include_directories(ncmdump_exec PRIVATE taglib/taglib/toolkit)
|
|
|
|
|
target_include_directories(ncmdump_exec PRIVATE taglib/taglib/mpeg/id3v2)
|
2024-03-24 17:48:04 +08:00
|
|
|
|
|
2024-02-07 21:44:20 +08:00
|
|
|
|
include(GNUInstallDirs)
|
2024-03-25 11:51:55 +08:00
|
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
|
install(TARGETS ncmdump_exec ncmdump_lib
|
|
|
|
|
BUNDLE DESTINATION .
|
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
|
|
|
)
|
|
|
|
|
else()
|
|
|
|
|
install(TARGETS ncmdump_exec
|
|
|
|
|
BUNDLE DESTINATION .
|
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
|
|
|
)
|
|
|
|
|
endif()
|