-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
126 lines (103 loc) · 3.93 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# The Long Path patch for any x86/x64 .exe
# Copyright (c) 2012-2020 HALX99.
# Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
# http://opensource.org/licenses/MIT
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
cmake_minimum_required(VERSION 3.10)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT /O2" CACHE STRING "")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MDd /Od /Zi" CACHE STRING "")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT /O2 /Bv" CACHE STRING "")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd /Od /Zi /Bv" CACHE STRING "")
project(wsls)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_CXX_STANDARD 17)
MARK_AS_ADVANCED(WSLS_PROJECT_DIR)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
set(CMAKE_INSTALL_BINDIR ${CMAKE_CURRENT_SOURCE_DIR}/dists)
add_definitions(-DUNICODE -D_UNICODE)
add_link_options("/Brepro")
# print all cmake builtin variables
# get_cmake_property(_variableNames VARIABLES)
# foreach (_variableName ${_variableNames})
# message(STATUS "== ${_variableName}=${${_variableName}}")
# endforeach()
# minhook
set(MINHOOK_SRC minhook/src/trampoline.c
minhook/src/buffer.c
minhook/src/hook.c)
if(${MSVC_C_ARCHITECTURE_ID} STREQUAL "X86")
set(MINHOOK_SRC ${MINHOOK_SRC}
minhook/src/hde/hde32.c)
set(WSLS_ARCH "x86")
else()
set(MINHOOK_SRC ${MINHOOK_SRC}
minhook/src/hde/hde64.c)
set(WSLS_ARCH "x64")
endif()
add_library(minhook STATIC ${MINHOOK_SRC})
target_compile_definitions(minhook PRIVATE STRICT)
target_include_directories(minhook PUBLIC "minhook/include")
# libwsls
add_library(libwsls STATIC libwsls/libwsls.cpp)
target_include_directories(libwsls PUBLIC libwsls/)
# wsls-core
add_library(wsls-core SHARED wsls-core/wsls-core.cpp wsls-core/dllmain.cpp)
target_link_libraries(wsls-core libwsls minhook)
set_target_properties(wsls-core PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS")
# wsls-shell
add_executable(wsls-shell wsls-shell/wsls-shell.cpp)
target_link_libraries(wsls-shell libwsls)
# wow64helper
add_executable(wow64helper wow64helper/wow64helper.cpp)
set_target_properties(wow64helper PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS")
# ---- commands
# wsls-copy
add_executable(wsls-copy wsls-copy/wsls-copy.cpp)
target_link_libraries(wsls-copy libwsls)
set_target_properties(wsls-copy
PROPERTIES
FOLDER "commands"
)
# wsls-del
add_executable(wsls-del wsls-del/wsls-del.cpp)
target_link_libraries(wsls-del libwsls)
set_target_properties(wsls-del
PROPERTIES
FOLDER "commands"
)
# wsls-echo
add_executable(wsls-echo wsls-echo/wsls-echo.cpp)
target_link_libraries(wsls-echo libwsls)
set_target_properties(wsls-echo
PROPERTIES
FOLDER "commands"
)
# wsls-md
add_executable(wsls-md wsls-md/wsls-md.cpp)
target_link_libraries(wsls-md libwsls)
set_target_properties(wsls-md
PROPERTIES
FOLDER "commands"
)
# ---- tools
add_executable(wsls-arch wsls-arch/wsls-arch.cpp)
set_target_properties(wsls-arch
PROPERTIES
FOLDER "tools"
)
add_executable(wsls-hash wsls-hash/wsls-hash.cpp wsls-hash/xxhash.c)
set_target_properties(wsls-hash
PROPERTIES
FOLDER "tools"
)
install(TARGETS wow64helper wsls-core wsls-shell wsls-copy wsls-del wsls-md wsls-echo
DESTINATION ${CMAKE_INSTALL_BINDIR}/${WSLS_ARCH}
)
if(${MSVC_C_ARCHITECTURE_ID} STREQUAL "X86")
install(TARGETS wsls-arch wsls-hash
DESTINATION ${CMAKE_INSTALL_BINDIR}/
)
endif()