From a0704ef2404140361d5a1d5c276447e895a94b25 Mon Sep 17 00:00:00 2001 From: modeco80 Date: Tue, 22 Aug 2023 03:44:45 -0400 Subject: [PATCH] reading is hard --- CMakeLists.txt | 23 +++++++++++------------ cmake/ProjectFuncs.cmake | 16 ++++++++-------- src/main.cpp | 2 +- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 24b7a79..49d7904 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,30 +14,29 @@ find_package(Threads REQUIRED) find_package(Boost REQUIRED) # default linker -if(NOT SSXTOOLS_LINKER AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set(SSXTOOLS_LINKER "lld") -elseif(NOT SSXTOOLS_LINKER) - set(SSXTOOLS_LINKER "bfd") +if(NOT PROJECT_LINKER AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(PROJECT_LINKER "lld") +elseif(NOT PROJECT_LINKER) + set(PROJECT_LINKER "bfd") endif() include(FetchContent) -ssxtools_set_alternate_linker() +project_set_alternate_linker() -add_executable(swsf_scramble +add_executable(swsf_bruteforce src/asio_impl.cpp src/main.cpp ) -target_compile_definitions(swsf_scramble PRIVATE - #-DBOOST_ASIO_HAS_IO_URING=1 - # We compile Asio in another TU +target_compile_definitions(swsf_bruteforce PRIVATE + # We compile Asio in a separate TU (src/asio_impl.cpp) -DBOOST_ASIO_SEPARATE_COMPILATION=1 -DBOOST_ASIO_NO_DEPRECATED=1 -DBOOST_ASIO_DISABLE_BOOST_ARRAY=1 -DBOOST_ASIO_DISABLE_BOOST_BIND=1 ) -target_compile_features(swsf_scramble PRIVATE cxx_std_20) -target_include_directories(swsf_scramble PRIVATE ${PROJECT_SOURCE_DIR}/src) +target_compile_features(swsf_bruteforce PRIVATE cxx_std_20) +target_include_directories(swsf_bruteforce PRIVATE ${PROJECT_SOURCE_DIR}/src) -ssxtools_target(swsf_scramble) +project_target(swsf_bruteforce) diff --git a/cmake/ProjectFuncs.cmake b/cmake/ProjectFuncs.cmake index 218b502..f75bad4 100644 --- a/cmake/ProjectFuncs.cmake +++ b/cmake/ProjectFuncs.cmake @@ -1,5 +1,5 @@ -function(ssxtools_target target) - target_compile_definitions(${target} PRIVATE "$<$:SSXTOOLS_DEBUG>") +function(project_target target) + target_compile_definitions(${target} PRIVATE "$<$:DEBUG>") # public headers reside with a component (if they exist) if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/include) @@ -22,11 +22,11 @@ function(ssxtools_target target) if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(_CORE_COMPILE_ARGS ${_CORE_COMPILE_ARGS} -flto=thin) set(_CORE_LINKER_ARGS ${_CORE_LINKER_ARGS} -flto=thin) - target_link_options(${target} PRIVATE -fuse-ld=${SSXTOOLS_LINKER} -flto=thin) + target_link_options(${target} PRIVATE -fuse-ld=${PROJECT_LINKER} -flto=thin) else("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set(_CORE_COMPILE_ARGS ${_CORE_COMPILE_ARGS} -flto) set(_CORE_LINKER_ARGS ${_CORE_LINKER_ARGS} -flto) - target_link_options(${target} PRIVATE -fuse-ld=${SSXTOOLS_LINKER} -flto) + target_link_options(${target} PRIVATE -fuse-ld=${PROJECT_LINKER} -flto) endif() endif() @@ -60,16 +60,16 @@ function(ssxtools_target target) endif() endfunction() -function(ssxtools_header_only_target target) +function(project_header_only_target target) target_include_directories(${target} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include) target_compile_features(${target} INTERFACE cxx_std_20) endfunction() -function(ssxtools_set_alternate_linker) +function(project_set_alternate_linker) if(NOT WIN32) - find_program(LINKER_EXECUTABLE ld.${SSXTOOLS_LINKER} ${SSXTOOLS_LINKER}) + find_program(LINKER_EXECUTABLE ld.${PROJECT_LINKER} ${PROJECT_LINKER}) if(LINKER_EXECUTABLE) - message(STATUS "Using ${SSXTOOLS_LINKER} as linker for ssxtools projects") + message(STATUS "Using ${SSXTOOLS_LINKER} as linker") else() message(FATAL_ERROR "Linker ${SSXTOOLS_LINKER} does not exist on your system. Please specify one which does or omit this option from your configure command.") endif() diff --git a/src/main.cpp b/src/main.cpp index 56efbb4..0bedce7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -81,7 +81,7 @@ namespace { } std::string_view ResetLine() { - return "\33[2J"; + return "\33[2K"; } } // namespace