diff --git a/CMakeLists.txt b/CMakeLists.txt index 660ce6f9..c731fd5c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -163,6 +163,7 @@ endif() -DPROJECT_REQUIRE_ALPINE=${PROJECT_REQUIRE_ALPINE} -DPROJECT_REVISION_VERSION=${PROJECT_REVISION_VERSION} -DPROJECT_STATIC_LINK=${PROJECT_STATIC_LINK} + -DPROJECT_SUPPORT_DIR=${PROJECT_SUPPORT_DIR} -DPROJECT_TOOLCHAIN_FILE_CMAKE=${PROJECT_TOOLCHAIN_FILE_CMAKE} -DPROJECT_TOOLCHAIN_FILE_MESON=${PROJECT_TOOLCHAIN_FILE_MESON} -DPROJECT_URL=${PROJECT_URL} diff --git a/cmake/functions.cmake b/cmake/functions.cmake index a62dac0a..0db385c9 100644 --- a/cmake/functions.cmake +++ b/cmake/functions.cmake @@ -105,7 +105,7 @@ function(add_project_test_executable name dependencies libraries) enable_testing() file(GLOB_RECURSE headers - ${PROJECT_3RD_PARTY_DIR}/test/include/*.hpp + ${PROJECT_SUPPORT_DIR}/test/include/*.hpp ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}/${name}/include/*.h ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}/${name}/include/*.hh ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}/${name}/include/${name}/include/*.hpp @@ -113,7 +113,7 @@ function(add_project_test_executable name dependencies libraries) ) file(GLOB_RECURSE sources - ${PROJECT_3RD_PARTY_DIR}/test/src/*.cpp + ${PROJECT_SUPPORT_DIR}/test/src/*.cpp ${additional_sources} ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}/${name}/src/*.c ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}/${name}/src/*.cc @@ -130,7 +130,7 @@ function(add_project_test_executable name dependencies libraries) ) target_include_directories(${name} AFTER PRIVATE - ${PROJECT_3RD_PARTY_DIR}/test/include + ${PROJECT_SUPPORT_DIR}/test/include ) target_link_libraries(${name} PRIVATE diff --git a/cmake/settings.cmake b/cmake/settings.cmake index f233f413..8a0898b8 100644 --- a/cmake/settings.cmake +++ b/cmake/settings.cmake @@ -41,7 +41,7 @@ if(PROJECT_IS_MINGW) endif() include_directories(BEFORE SYSTEM - ${PROJECT_3RD_PARTY_DIR}/include + ${PROJECT_SUPPORT_DIR}/include ${PROJECT_EXTERNAL_BUILD_ROOT}/include ) diff --git a/scripts/env.sh b/scripts/env.sh index 9466c4f4..a312cd75 100755 --- a/scripts/env.sh +++ b/scripts/env.sh @@ -193,7 +193,8 @@ fi PROJECT_DIST_DIR=${PROJECT_DIST_DIR}/${PROJECT_NAME} PROJECT_EXTERNAL_BUILD_ROOT=${PROJECT_BUILD_DIR}/deps -PROJECT_3RD_PARTY_DIR=${PROJECT_SOURCE_DIR}/support/3rd_party +PROJECT_SUPPORT_DIR=${PROJECT_SOURCE_DIR}/support +PROJECT_3RD_PARTY_DIR=${PROJECT_SUPPORT_DIR}/3rd_party if [ "${PROJECT_ENABLE_OPENSSL}" == "ON" ]; then if [ "${PROJECT_IS_MINGW}" == "1" ] && [ "${PROJECT_IS_MINGW_UNIX}" == "1" ]; then @@ -237,6 +238,7 @@ PROJECT_CMAKE_OPTS="-DPROJECT_RELEASE_NUM=${PROJECT_RELEASE_NUM} ${PROJECT_CMAKE PROJECT_CMAKE_OPTS="-DPROJECT_REQUIRE_ALPINE=${PROJECT_REQUIRE_ALPINE} ${PROJECT_CMAKE_OPTS}" PROJECT_CMAKE_OPTS="-DPROJECT_REVISION_VERSION=${PROJECT_REVISION_VERSION} ${PROJECT_CMAKE_OPTS}" PROJECT_CMAKE_OPTS="-DPROJECT_STATIC_LINK=${PROJECT_STATIC_LINK} ${PROJECT_CMAKE_OPTS}" +PROJECT_CMAKE_OPTS="-DPROJECT_SUPPORT_DIR=${PROJECT_SUPPORT_DIR} ${PROJECT_CMAKE_OPTS}" PROJECT_CMAKE_OPTS="-DPROJECT_TOOLCHAIN_FILE_CMAKE=${PROJECT_TOOLCHAIN_FILE_CMAKE} ${PROJECT_CMAKE_OPTS}" PROJECT_CMAKE_OPTS="-DPROJECT_TOOLCHAIN_FILE_MESON=${PROJECT_TOOLCHAIN_FILE_MESON} ${PROJECT_CMAKE_OPTS}" @@ -310,6 +312,7 @@ export PROJECT_REQUIRE_ALPINE export PROJECT_REVISION_VERSION export PROJECT_SOURCE_DIR export PROJECT_STATIC_LINK +export PROJECT_SUPPORT_DIR export PROJECT_TOOLCHAIN_FILE_CMAKE export PROJECT_TOOLCHAIN_FILE_MESON export PROJECT_URL @@ -354,6 +357,7 @@ echo " PATH: ${PATH}" echo " PKG_CONFIG_PATH: ${PKG_CONFIG_PATH}" echo " Require Alpine: ${PROJECT_REQUIRE_ALPINE}" echo " Static link: ${PROJECT_STATIC_LINK}" +echo " Support dir: ${PROJECT_SUPPORT_DIR}" echo " Third-party dir: ${PROJECT_3RD_PARTY_DIR}" echo " Unit testing enabled: ${PROJECT_ENABLE_TESTING}" echo " URL: ${PROJECT_URL}" diff --git a/scripts/options.sh b/scripts/options.sh index cb82506b..d88aba19 100755 --- a/scripts/options.sh +++ b/scripts/options.sh @@ -19,16 +19,16 @@ PROJECT_LIBRARIES=( declare -A PROJECT_CLEANUP PROJECT_CLEANUP[BACKWARD_CPP]="include/backward.hpp:src/backward.cpp" -PROJECT_CLEANUP[BOOST]="boost_*" -PROJECT_CLEANUP[CPP_HTTPLIB]="cpp-httplib-*" -PROJECT_CLEANUP[CURL]="curl-*" -PROJECT_CLEANUP[JSON]="json-*" -PROJECT_CLEANUP[LIBBITCOIN_SYSTEM_ON]="boost_1_85_*" -PROJECT_CLEANUP[LIBSODIUM]="libsodium*" -PROJECT_CLEANUP[OPENSSL]="openssl-*" -PROJECT_CLEANUP[PUGIXML]="pugixml-*" -PROJECT_CLEANUP[SPDLOG]="spdlog-*" -PROJECT_CLEANUP[SQLITE]="sqlite*" -PROJECT_CLEANUP[STDUUID]="stduuid-*" -PROJECT_CLEANUP[TESTING]="googletest-*" -PROJECT_CLEANUP[WINFSP]="winfsp-*" +PROJECT_CLEANUP[BOOST]="3rd_party/boost_*" +PROJECT_CLEANUP[CPP_HTTPLIB]="3rd_party/cpp-httplib-*" +PROJECT_CLEANUP[CURL]="3rd_party/curl-*" +PROJECT_CLEANUP[JSON]="3rd_party/json-*" +PROJECT_CLEANUP[LIBBITCOIN_SYSTEM_ON]="3rd_party/boost_1_85_*" +PROJECT_CLEANUP[LIBSODIUM]="3rd_party/libsodium*" +PROJECT_CLEANUP[OPENSSL]="3rd_party/openssl-*" +PROJECT_CLEANUP[PUGIXML]="3rd_party/pugixml-*" +PROJECT_CLEANUP[SPDLOG]="3rd_party/spdlog-*" +PROJECT_CLEANUP[SQLITE]="3rd_party/sqlite*" +PROJECT_CLEANUP[STDUUID]="3rd_party/stduuid-*" +PROJECT_CLEANUP[TESTING]="3rd_party/googletest-*" +PROJECT_CLEANUP[WINFSP]="3rd_party/winfsp-*" diff --git a/support/3rd_party/include/backward.hpp b/support/include/backward.hpp similarity index 100% rename from support/3rd_party/include/backward.hpp rename to support/include/backward.hpp diff --git a/support/3rd_party/include/utils/all.hpp b/support/include/utils/all.hpp similarity index 100% rename from support/3rd_party/include/utils/all.hpp rename to support/include/utils/all.hpp diff --git a/support/3rd_party/include/utils/base64.hpp b/support/include/utils/base64.hpp similarity index 100% rename from support/3rd_party/include/utils/base64.hpp rename to support/include/utils/base64.hpp diff --git a/support/3rd_party/include/utils/collection.hpp b/support/include/utils/collection.hpp similarity index 100% rename from support/3rd_party/include/utils/collection.hpp rename to support/include/utils/collection.hpp diff --git a/support/3rd_party/include/utils/com_init_wrapper.hpp b/support/include/utils/com_init_wrapper.hpp similarity index 100% rename from support/3rd_party/include/utils/com_init_wrapper.hpp rename to support/include/utils/com_init_wrapper.hpp diff --git a/support/3rd_party/include/utils/common.hpp b/support/include/utils/common.hpp similarity index 100% rename from support/3rd_party/include/utils/common.hpp rename to support/include/utils/common.hpp diff --git a/support/3rd_party/include/utils/config.hpp b/support/include/utils/config.hpp similarity index 100% rename from support/3rd_party/include/utils/config.hpp rename to support/include/utils/config.hpp diff --git a/support/3rd_party/include/utils/encryption.hpp b/support/include/utils/encryption.hpp similarity index 100% rename from support/3rd_party/include/utils/encryption.hpp rename to support/include/utils/encryption.hpp diff --git a/support/3rd_party/include/utils/error.hpp b/support/include/utils/error.hpp similarity index 100% rename from support/3rd_party/include/utils/error.hpp rename to support/include/utils/error.hpp diff --git a/support/3rd_party/include/utils/file.hpp b/support/include/utils/file.hpp similarity index 100% rename from support/3rd_party/include/utils/file.hpp rename to support/include/utils/file.hpp diff --git a/support/3rd_party/include/utils/path.hpp b/support/include/utils/path.hpp similarity index 100% rename from support/3rd_party/include/utils/path.hpp rename to support/include/utils/path.hpp diff --git a/support/3rd_party/include/utils/string.hpp b/support/include/utils/string.hpp similarity index 100% rename from support/3rd_party/include/utils/string.hpp rename to support/include/utils/string.hpp diff --git a/support/3rd_party/include/utils/time.hpp b/support/include/utils/time.hpp similarity index 100% rename from support/3rd_party/include/utils/time.hpp rename to support/include/utils/time.hpp diff --git a/support/3rd_party/include/utils/unix.hpp b/support/include/utils/unix.hpp similarity index 100% rename from support/3rd_party/include/utils/unix.hpp rename to support/include/utils/unix.hpp diff --git a/support/3rd_party/include/utils/windows.hpp b/support/include/utils/windows.hpp similarity index 100% rename from support/3rd_party/include/utils/windows.hpp rename to support/include/utils/windows.hpp diff --git a/support/3rd_party/src/backward.cpp b/support/src/backward.cpp similarity index 100% rename from support/3rd_party/src/backward.cpp rename to support/src/backward.cpp diff --git a/support/3rd_party/src/utils/common.cpp b/support/src/utils/common.cpp similarity index 100% rename from support/3rd_party/src/utils/common.cpp rename to support/src/utils/common.cpp diff --git a/support/3rd_party/src/utils/encryption.cpp b/support/src/utils/encryption.cpp similarity index 100% rename from support/3rd_party/src/utils/encryption.cpp rename to support/src/utils/encryption.cpp diff --git a/support/3rd_party/src/utils/error.cpp b/support/src/utils/error.cpp similarity index 100% rename from support/3rd_party/src/utils/error.cpp rename to support/src/utils/error.cpp diff --git a/support/3rd_party/src/utils/file.cpp b/support/src/utils/file.cpp similarity index 98% rename from support/3rd_party/src/utils/file.cpp rename to support/src/utils/file.cpp index c5b74af2..fc28ca3f 100644 --- a/support/3rd_party/src/utils/file.cpp +++ b/support/src/utils/file.cpp @@ -215,7 +215,7 @@ auto is_directory(std::string_view path) -> bool { auto abs_path = utils::path::absolute(path); #if defined(_WIN32) - return ::PathIsDirectory(abs_path.c_str()) != 0; + return ::PathIsDirectoryA(abs_path.c_str()) != 0; #else // !defined(_WIN32) struct stat st {}; return (stat(abs_path.c_str(), &st) == 0 && S_ISDIR(st.st_mode)); @@ -230,8 +230,8 @@ auto is_file(std::string_view path) -> bool { auto abs_path = utils::path::absolute(path); #if defined(_WIN32) - return (::PathFileExists(abs_path.c_str()) && - not ::PathIsDirectory(abs_path.c_str())); + return (::PathFileExistsA(abs_path.c_str()) && + not ::PathIsDirectoryA(abs_path.c_str())); #else // !defined(_WIN32) struct stat st {}; return (stat(abs_path.c_str(), &st) == 0 && not S_ISDIR(st.st_mode)); diff --git a/support/3rd_party/src/utils/path.cpp b/support/src/utils/path.cpp similarity index 98% rename from support/3rd_party/src/utils/path.cpp rename to support/src/utils/path.cpp index 5f7e758a..f5d56787 100644 --- a/support/3rd_party/src/utils/path.cpp +++ b/support/src/utils/path.cpp @@ -69,7 +69,7 @@ namespace repertory::utils::path { auto absolute(std::string_view path) -> std::string { std::string abs_path{path}; #if defined(_WIN32) - if (not abs_path.empty() && ::PathIsRelative(abs_path.c_str())) { + if (not abs_path.empty() && ::PathIsRelativeA(abs_path.c_str())) { std::string temp; temp.resize(MAX_PATH + 1); abs_path = _fullpath(temp.data(), abs_path.c_str(), MAX_PATH); @@ -200,7 +200,7 @@ auto remove_file_name(std::string_view path) -> std::string { auto abs_path = absolute(path); #if defined(_WIN32) - ::PathRemoveFileSpec(abs_path.data()); + ::PathRemoveFileSpecA(abs_path.data()); abs_path = abs_path.c_str(); #else // !defined(_WIN32) if (abs_path != "/") { @@ -218,7 +218,7 @@ auto remove_file_name(std::string_view path) -> std::string { auto strip_to_file_name(std::string path) -> std::string { #if defined(_WIN32) - return ::PathFindFileName(path.c_str()); + return ::PathFindFileNameA(path.c_str()); #else // !defined(_WIN32) return utils::string::contains(path, "/") ? basename(path.data()) : path; #endif // defined(_WIN32) diff --git a/support/3rd_party/src/utils/string.cpp b/support/src/utils/string.cpp similarity index 100% rename from support/3rd_party/src/utils/string.cpp rename to support/src/utils/string.cpp diff --git a/support/3rd_party/src/utils/time.cpp b/support/src/utils/time.cpp similarity index 100% rename from support/3rd_party/src/utils/time.cpp rename to support/src/utils/time.cpp diff --git a/support/3rd_party/src/utils/unix.cpp b/support/src/utils/unix.cpp similarity index 100% rename from support/3rd_party/src/utils/unix.cpp rename to support/src/utils/unix.cpp diff --git a/support/3rd_party/src/utils/windows.cpp b/support/src/utils/windows.cpp similarity index 96% rename from support/3rd_party/src/utils/windows.cpp rename to support/src/utils/windows.cpp index 5e745499..3b19af33 100644 --- a/support/3rd_party/src/utils/windows.cpp +++ b/support/src/utils/windows.cpp @@ -78,8 +78,8 @@ auto run_process_elevated(std::vector args) -> int { std::string full_path; full_path.resize(MAX_PATH + 1); - if (::GetModuleFileName(nullptr, full_path.data(), MAX_PATH)) { - SHELLEXECUTEINFO sei{}; + if (::GetModuleFileNameA(nullptr, full_path.data(), MAX_PATH)) { + SHELLEXECUTEINFOA sei{}; sei.fMask = SEE_MASK_NOCLOSEPROCESS; sei.cbSize = sizeof(sei); sei.lpVerb = "runas"; @@ -87,7 +87,7 @@ auto run_process_elevated(std::vector args) -> int { sei.lpParameters = parameters.c_str(); sei.hwnd = nullptr; sei.nShow = SW_NORMAL; - if (::ShellExecuteEx(&sei)) { + if (::ShellExecuteExA(&sei)) { ::WaitForSingleObject(sei.hProcess, INFINITE); DWORD exit_code{}; ::GetExitCodeProcess(sei.hProcess, &exit_code); diff --git a/support/3rd_party/test/src/utils/common_test.cpp b/support/test/src/utils/common_test.cpp similarity index 100% rename from support/3rd_party/test/src/utils/common_test.cpp rename to support/test/src/utils/common_test.cpp diff --git a/support/3rd_party/test/src/utils/encryption_test.cpp b/support/test/src/utils/encryption_test.cpp similarity index 100% rename from support/3rd_party/test/src/utils/encryption_test.cpp rename to support/test/src/utils/encryption_test.cpp diff --git a/support/3rd_party/test/src/utils/path_test.cpp b/support/test/src/utils/path_test.cpp similarity index 100% rename from support/3rd_party/test/src/utils/path_test.cpp rename to support/test/src/utils/path_test.cpp diff --git a/support/3rd_party/test/src/utils/string_test.cpp b/support/test/src/utils/string_test.cpp similarity index 100% rename from support/3rd_party/test/src/utils/string_test.cpp rename to support/test/src/utils/string_test.cpp