Skip to content

Commit

Permalink
Finish CMake conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
namazso committed Jun 24, 2023
1 parent 5ab47ee commit f82e8aa
Show file tree
Hide file tree
Showing 50 changed files with 269 additions and 1,531 deletions.
73 changes: 0 additions & 73 deletions AlgorithmsDll.sln

This file was deleted.

42 changes: 36 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,45 @@ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
string(REGEX REPLACE "/Ob1" "/Ob2" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
string(REGEX REPLACE "/Ob1" "/Ob2" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")

add_compile_options(-flto /guard:cf /guard:ehcont)

add_link_options(/guard:cf /guard:ehcont)

set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
add_compile_options(
-flto
/guard:cf
)

add_link_options(
/BREPRO
/PDBALTPATH:%_PDB%
/FILEALIGN:0x1000
/cetcompat
/guard:cf
/OPT:REF
/OPT:ICF=10
)

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})

# https://gitlab.kitware.com/cmake/cmake/-/issues/25012
# https://github.com/llvm/llvm-project/issues/63426
set(CMAKE_RC_FLAGS "-C65001")

add_subdirectory(AlgorithmsDlls)

add_subdirectory(Localization)

add_subdirectory(LegacyAlgorithms)

add_subdirectory(Benchmark)

set(CTRE_BUILD_TESTS OFF)
set(CTRE_BUILD_PACKAGE OFF)
add_subdirectory(compile-time-regular-expressions)

add_subdirectory(concurrentqueue)

add_library(tiny-json STATIC tiny-json/tiny-json.c)
target_include_directories(tiny-json PUBLIC tiny-json)

add_subdirectory(OpenHashTab)

add_subdirectory(StandaloneStub)
10 changes: 5 additions & 5 deletions Localization/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ function(lang_json_to_include JSON DEFAULT_JSON OUT_VAR)
string(JSON DEFAULT_STRINGS GET "${DEFAULT_JSON}" strings)
string(JSON STRINGS_COUNT LENGTH "${DEFAULT_STRINGS}")

set(RESULT "\nLANGUAGE ")
set(RESULT "LANGUAGE ")
string(APPEND RESULT "${LANGID}")
string(APPEND RESULT ", ")
string(APPEND RESULT "${SUBLANGID}")
string(APPEND RESULT "\nSTRINGTABLE\nBEGIN\n")
string(APPEND RESULT " \\\nSTRINGTABLE \\\nBEGIN \\\n")

math(EXPR STRINGS_MAX "${STRINGS_COUNT} - 1")

Expand All @@ -40,10 +40,10 @@ function(lang_json_to_include JSON DEFAULT_JSON OUT_VAR)
set(VALUE "${DEFAULT_VALUE}")
endif ()
sanitize_string("${VALUE}" VALUE)
string(APPEND RESULT "\tIDS_${KEY}\t\"${VALUE}\"\n")
string(APPEND RESULT "\tIDS_${KEY}\t\"${VALUE}\" \\\n")
endforeach ()

string(APPEND RESULT "END\n")
string(APPEND RESULT "END \\\n")
set(${OUT_VAR} "${RESULT}" PARENT_SCOPE)
endfunction()

Expand All @@ -52,7 +52,7 @@ file(GLOB LOCALES CONFIGURE_DEPENDS "*.json")
# TODO: Since we're using the undocumented RtlGetString, maybe the defaulting could be moved into code.
file(READ "en-us.json" DEFAULT_LOCALE_JSON)

set(LOCALE_INCLUDE_CONTENT "")
set(LOCALE_INCLUDE_CONTENT "#define LANGUAGES_IMPL \\\n")

foreach (LOCALE ${LOCALES})
file(READ "${LOCALE}" LOCALE_JSON)
Expand Down
98 changes: 0 additions & 98 deletions OpenHashTab.sln

This file was deleted.

31 changes: 31 additions & 0 deletions OpenHashTab/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
cmake_minimum_required(VERSION 3.14)

project(ShellExtension)

file(GLOB FILES CONFIGURE_DEPENDS *.h *.cpp *.rc *.manifest)

add_library(OpenHashTab SHARED ${FILES})

target_link_libraries(OpenHashTab PRIVATE
Localization
LegacyAlgorithms
ctre
concurrentqueue
tiny-json
)

target_compile_definitions(OpenHashTab PRIVATE
UNICODE
_UNICODE
_WINDLL
CI_VERSION=\"blah\"
CI_VERSION_MAJOR=1
CI_VERSION_MINOR=1
CI_VERSION_PATCH=1
)

target_compile_options(OpenHashTab PRIVATE
/EHsc
)

target_precompile_headers(OpenHashTab PRIVATE stdafx.h)
4 changes: 0 additions & 4 deletions OpenHashTab/Coordinator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,13 @@
//
// You should have received a copy of the GNU General Public License
// along with OpenHashTab. If not, see <https://www.gnu.org/licenses/>.
#include "stdafx.h"

#include "Coordinator.h"

#include "utl.h"
#include "wnd.h"
#include "Settings.h"
#include "FileHashTask.h"

#include <cassert>

Coordinator::Coordinator(std::list<std::wstring> files)
: _files_raw(std::move(files)) {}

Expand Down
2 changes: 0 additions & 2 deletions OpenHashTab/Coordinator.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#include "path.h"
#include "Settings.h"

#include <mutex>

class FileHashTask;

class Coordinator
Expand Down
5 changes: 0 additions & 5 deletions OpenHashTab/Exporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,12 @@
//
// You should have received a copy of the GNU General Public License
// along with OpenHashTab. If not, see <https://www.gnu.org/licenses/>.
#include "stdafx.h"

#include "Exporter.h"

#include "FileHashTask.h"
#include "Settings.h"
#include "utl.h"

#include <sstream>
#include <algorithm>

static std::string TimeISO8601()
{
time_t now;
Expand Down
4 changes: 1 addition & 3 deletions OpenHashTab/Exporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with OpenHashTab. If not, see <https://www.gnu.org/licenses/>.
#pragma once
#include "../AlgorithmsLoader/Hasher.h"

#include <list>
#include <Hasher.h>

class FileHashTask;
struct Settings;
Expand Down
2 changes: 0 additions & 2 deletions OpenHashTab/FileHashTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
//
// You should have received a copy of the GNU General Public License
// along with OpenHashTab. If not, see <https://www.gnu.org/licenses/>.
#include "stdafx.h"

#include "FileHashTask.h"

#include "Coordinator.h"
Expand Down
4 changes: 0 additions & 4 deletions OpenHashTab/FileHashTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@

#include "path.h"

#include <atomic>
#include <memory>
#include <array>

class Coordinator;

class FileHashTask
Expand Down
4 changes: 0 additions & 4 deletions OpenHashTab/MainDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
//
// You should have received a copy of the GNU General Public License
// along with OpenHashTab. If not, see <https://www.gnu.org/licenses/>.
#include "stdafx.h"

#include "MainDialog.h"

#include "Coordinator.h"
Expand All @@ -27,8 +25,6 @@
#include "virustotal.h"
#include "hash_colors.h"

#include <sstream>

static bool ColorLine(const Settings& settings, LPNMLVCUSTOMDRAW plvcd, HashColorType type)
{
auto& entry = HASH_COLOR_SETTING_MAP[(size_t)type];
Expand Down
Loading

0 comments on commit f82e8aa

Please sign in to comment.