refactor: project file structure

This commit is contained in:
TaurusXin 2024-03-24 09:20:25 +08:00
parent ae08d4475c
commit aa7ae6128d
Signed by: taurusxin
GPG Key ID: C334DCA04AC2D2CC
12 changed files with 9 additions and 5 deletions

View File

@ -14,9 +14,10 @@ if(MSVC)
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/execution-charset:utf-8>") add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/execution-charset:utf-8>")
endif() endif()
FILE(GLOB HEADERS ./*.h) FILE(GLOB HEADERS ./src/include/*.h)
FILE(GLOB COMMON_SOURCES cJSON.cpp aes.cpp main.cpp ncmcrypt.cpp) FILE(GLOB COMMON_SOURCES ./src/*.cpp ./src/utils/*.cpp)
FILE(GLOB WIN_SOURCES win32_init.cpp) FILE(GLOB WIN_SOURCES ./src/platform/win32_init.cpp)
if(WIN32) if(WIN32)
set(SOURCES ${COMMON_SOURCES} ${WIN_SOURCES}) set(SOURCES ${COMMON_SOURCES} ${WIN_SOURCES})
@ -27,6 +28,9 @@ add_executable(ncmdump
${HEADERS} ${HEADERS}
${SOURCES} ${SOURCES}
) )
target_include_directories(ncmdump PRIVATE src/include)
target_link_libraries(ncmdump tag) target_link_libraries(ncmdump tag)
target_include_directories(ncmdump PRIVATE taglib) target_include_directories(ncmdump PRIVATE taglib)
target_include_directories(ncmdump PRIVATE taglib/taglib) target_include_directories(ncmdump PRIVATE taglib/taglib)

View File

@ -77,7 +77,7 @@ int main(int argc, char **argv)
#define COMPARE_STR(s1, s2) (strcmp(s1, s2) == 0) #define COMPARE_STR(s1, s2) (strcmp(s1, s2) == 0)
#define HELP_SHORT "-h" #define HELP_SHORT "-h"
#define HELP_LONG "--help" #define HELP_LONG "--help"
#define FOLDER "-d" #define PROCESS_FOLDER "-d"
for (int i = 1; i < argc; ++i) for (int i = 1; i < argc; ++i)
{ {
if (COMPARE_STR(argv[i], HELP_SHORT) || COMPARE_STR(argv[i], HELP_LONG)) if (COMPARE_STR(argv[i], HELP_SHORT) || COMPARE_STR(argv[i], HELP_LONG))
@ -85,7 +85,7 @@ int main(int argc, char **argv)
displayHelp(); displayHelp();
return 0; return 0;
} }
else if (COMPARE_STR(argv[i], FOLDER)) else if (COMPARE_STR(argv[i], PROCESS_FOLDER))
{ {
processFolders = true; processFolders = true;
if (i + 1 < argc && argv[i + 1][0] != '-') if (i + 1 < argc && argv[i + 1][0] != '-')