Skip to content

Commit 3745863

Browse files
committed
refactor: move files (part 2)
1 parent 33733df commit 3745863

11 files changed

Lines changed: 285 additions & 318 deletions

File tree

.github/workflows/maintenance.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
run: find -type f \( -name *.h -o -name *.cpp \) | xargs clang-format -style=file -i
1818

1919
- name: Glob files
20-
run: python ${{ github.workspace }}/CommonLibOB64/scripts/cmake_generate.py
20+
run: python ${{ github.workspace }}/res/scripts/cmake_generate.py
2121

2222
- uses: stefanzweifel/git-auto-commit-action@v4
2323
with:

CMakeLists.txt

Lines changed: 140 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,151 @@
11
cmake_minimum_required(VERSION 3.21)
2-
include("cmake/common.cmake")
2+
3+
include("res/cmake/common.cmake")
4+
35
option(OBSE_SUPPORT_XBYAK "Enables trampoline support for Xbyak." OFF)
6+
option(REX_OPTION_INI "Enables ini config support for REX." OFF)
7+
option(REX_OPTION_JSON "Enables json config support for REX." OFF)
8+
option(REX_OPTION_TOML "Enables toml config support for REX." OFF)
9+
10+
project(
11+
CommonLibOB64
12+
LANGUAGES CXX
13+
)
414

5-
project(umbrella)
15+
include(GNUInstallDirs)
616

717
if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
818
message(FATAL_ERROR "in-source builds are not allowed")
919
endif()
1020

11-
function(conditionally_add_subdirectory SRC_DIR)
12-
if(NOT TARGET "${SUBDIRECTORY}")
13-
if("${ARGC}" GREATER 1)
14-
add_subdirectory("${SRC_DIR}" "${ARGV1}")
15-
else()
16-
add_subdirectory("${SRC_DIR}")
17-
endif()
18-
endif()
19-
endfunction()
21+
find_package(mmio REQUIRED CONFIG)
22+
find_package(spdlog REQUIRED CONFIG)
23+
24+
include(res/cmake/sourcelist.cmake)
25+
26+
source_group(
27+
TREE "${CMAKE_CURRENT_SOURCE_DIR}"
28+
FILES ${SOURCES}
29+
)
30+
31+
add_library(
32+
"${PROJECT_NAME}"
33+
STATIC
34+
${SOURCES}
35+
.clang-format
36+
res/commonlibob64.natvis
37+
)
38+
39+
add_library("${PROJECT_NAME}::${PROJECT_NAME}" ALIAS "${PROJECT_NAME}")
40+
41+
target_compile_definitions(
42+
"${PROJECT_NAME}"
43+
PUBLIC
44+
WINVER=0x0601 # windows 7, minimum supported version by fallout 4
45+
_WIN32_WINNT=0x0601
46+
"$<$<BOOL:${OBSE_SUPPORT_XBYAK}>:OBSE_SUPPORT_XBYAK=1>"
47+
"$<$<BOOL:${REX_OPTION_INI}>:REX_OPTION_INI=1>"
48+
"$<$<BOOL:${REX_OPTION_JSON}>:REX_OPTION_JSON=1>"
49+
"$<$<BOOL:${REX_OPTION_TOML}>:REX_OPTION_TOML=1>"
50+
)
51+
52+
target_compile_features(
53+
"${PROJECT_NAME}"
54+
PUBLIC
55+
cxx_std_23
56+
)
57+
58+
if (MSVC)
59+
target_compile_options(
60+
"${PROJECT_NAME}"
61+
PRIVATE
62+
# warnings -> errors
63+
/we4715 # 'function' : not all control paths return a value
64+
65+
# disable warnings
66+
/wd4061 # enumerator 'identifier' in switch of enum 'enumeration' is not explicitly handled by a case label
67+
/wd4200 # nonstandard extension used : zero-sized array in struct/union
68+
/wd4201 # nonstandard extension used : nameless struct/union
69+
/wd4264 # 'virtual_function' : no override available for virtual member function from base 'class'; function is hidden
70+
/wd4265 # 'type': class has virtual functions, but its non-trivial destructor is not virtual; instances of this class may not be destructed correctly
71+
/wd4266 # 'function' : no override available for virtual member function from base 'type'; function is hidden
72+
/wd4324 # 'struct_name' : structure was padded due to __declspec(align())
73+
/wd4371 # 'classname': layout of class may have changed from a previous version of the compiler due to better packing of member 'member'
74+
/wd4514 # 'function' : unreferenced inline function has been removed
75+
/wd4582 # 'type': constructor is not implicitly called
76+
/wd4583 # 'type': destructor is not implicitly called
77+
/wd4623 # 'derived class' : default constructor was implicitly defined as deleted because a base class default constructor is inaccessible or deleted
78+
/wd4625 # 'derived class' : copy constructor was implicitly defined as deleted because a base class copy constructor is inaccessible or deleted
79+
/wd4626 # 'derived class' : assignment operator was implicitly defined as deleted because a base class assignment operator is inaccessible or deleted
80+
/wd4686 # 'user-defined type' : possible change in behavior, change in UDT return calling convention
81+
/wd4702 # unreachable code
82+
/wd4710 # 'function' : function not inlined
83+
/wd4711 # function 'function' selected for inline expansion
84+
/wd4820 # 'bytes' bytes padding added after construct 'member_name'
85+
/wd5026 # 'type': move constructor was implicitly defined as deleted
86+
/wd5027 # 'type': move assignment operator was implicitly defined as deleted
87+
/wd5045 # Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
88+
/wd5053 # support for 'explicit(<expr>)' in C++17 and earlier is a vendor extension
89+
/wd5204 # 'type-name': class has virtual functions, but its trivial destructor is not virtual; instances of objects derived from this class may not be destructed correctly
90+
/wd5220 # 'member': a non-static data member with a volatile qualified type no longer implies that compiler generated copy / move constructors and copy / move assignment operators are not trivial
91+
)
92+
endif()
93+
94+
target_include_directories(
95+
"${PROJECT_NAME}"
96+
PUBLIC
97+
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
98+
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
99+
)
100+
101+
target_link_libraries(
102+
"${PROJECT_NAME}"
103+
PUBLIC
104+
advapi32.lib
105+
bcrypt.lib
106+
d3d11.lib
107+
d3dcompiler.lib
108+
dbghelp.lib
109+
dxgi.lib
110+
mmio::mmio
111+
ole32.lib
112+
spdlog::spdlog
113+
version.lib
114+
)
115+
116+
target_precompile_headers(
117+
"${PROJECT_NAME}"
118+
PRIVATE
119+
include/OBSE/Impl/PCH.h
120+
)
121+
122+
install(
123+
TARGETS "${PROJECT_NAME}"
124+
EXPORT "${PROJECT_NAME}-targets"
125+
)
126+
127+
install(
128+
EXPORT "${PROJECT_NAME}-targets"
129+
NAMESPACE "${PROJECT_NAME}::"
130+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
131+
)
20132

21-
include(CTest)
133+
configure_file(
134+
res/cmake/config.cmake.in
135+
"${PROJECT_NAME}Config.cmake"
136+
@ONLY
137+
)
22138

23-
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
139+
install(
140+
FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
141+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
142+
)
24143

25-
conditionally_add_subdirectory(CommonLibOB64)
144+
install(
145+
DIRECTORY
146+
"include/OBSE"
147+
"include/RE"
148+
"include/REL"
149+
"include/REX"
150+
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
151+
)

CommonLibOB64/.gitignore

Lines changed: 0 additions & 7 deletions
This file was deleted.

CommonLibOB64/CMakeLists.txt

Lines changed: 0 additions & 149 deletions
This file was deleted.

CommonLibOB64/vcpkg.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)