mirror of
https://github.com/CachyOS/New-Cli-Installer.git
synced 2025-01-23 14:32:22 +08:00
🚧 fix static build
This commit is contained in:
parent
c7e2cdb996
commit
a70e641e36
@ -87,6 +87,7 @@ endif()
|
||||
# Builds as statically linked
|
||||
option(COS_BUILD_STATIC "Build all static" OFF)
|
||||
if(COS_BUILD_STATIC)
|
||||
add_definitions(-DCOS_BUILD_STATIC)
|
||||
set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "" FORCE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")# -static")
|
||||
endif()
|
||||
|
@ -8,6 +8,12 @@ project(gucc
|
||||
VERSION 0.0.1
|
||||
LANGUAGES CXX)
|
||||
|
||||
|
||||
set(GUCC_LOGGER_FILES "")
|
||||
if(NOT COS_BUILD_STATIC)
|
||||
set(GUCC_LOGGER_FILES "src/logger.cpp include/gucc/logger.hpp")
|
||||
endif()
|
||||
|
||||
add_library(${PROJECT_NAME} #SHARED
|
||||
#src/utils.cpp src/utils.hpp
|
||||
src/io_utils.cpp include/gucc/io_utils.hpp
|
||||
@ -31,8 +37,8 @@ add_library(${PROJECT_NAME} #SHARED
|
||||
src/umount_partitions.cpp include/gucc/umount_partitions.hpp
|
||||
src/hwclock.cpp include/gucc/hwclock.hpp
|
||||
src/package_profiles.cpp include/gucc/package_profiles.hpp
|
||||
src/logger.cpp include/gucc/logger.hpp
|
||||
src/fetch_file.cpp include/gucc/fetch_file.hpp
|
||||
${GUCC_LOGGER_FILES}
|
||||
#src/chwd_profiles.cpp src/chwd_profiles.hpp
|
||||
#src/disk.cpp src/disk.hpp
|
||||
)
|
||||
|
@ -5,7 +5,9 @@
|
||||
|
||||
// import gucc
|
||||
#include "gucc/io_utils.hpp"
|
||||
#ifndef COS_BUILD_STATIC
|
||||
#include "gucc/logger.hpp"
|
||||
#endif
|
||||
|
||||
#include <chrono> // for seconds
|
||||
#include <regex> // for regex_search, match_result...
|
||||
@ -45,8 +47,10 @@ int main() {
|
||||
spdlog::set_level(spdlog::level::debug);
|
||||
spdlog::flush_every(std::chrono::seconds(5));
|
||||
|
||||
#ifndef COS_BUILD_STATIC
|
||||
// Set gucc logger.
|
||||
gucc::logger::set_logger(logger);
|
||||
#endif
|
||||
|
||||
if (!utils::handle_connection()) {
|
||||
error_inter("An active network connection could not be detected, please connect and restart the installer.\n");
|
||||
|
Loading…
Reference in New Issue
Block a user