Files
gMod/CMakeLists.txt
T
DubbleClick f07e180b53 1.5.6, severely improve memory footprint and loading speed (#13)
* remove more unnecessary code

* todo?

* 1.5.5.0

* change GetHash from in_out parameter to return the hash

* remove ForceReload bool for textures

* remove textureserver, place logic in textureclient, not yet finished
next up change FileToMod and shit to use modded_textures map

* fix debug compilation errors

* fix typo

* should_update boolean, replace the entire MergeUpdate logic later

* tidy up d3d9_dll.cpp and bits (#12)

* define `ASSERT`
Added minhook lib to tidy up hooks
Remove cruft from dx9_dll.cpp

* Bug fix

* Another typo

---------

Co-authored-by: Jon <>

* gitignore

* Proxy functions, cache dx9 device type

* simplify LoadModsFromFile

* move minhook dependency to fetch content

* Make it work

* Tweaked debug for file reads

* Fixed inverse check

* unordered_map

* set should_update (yikes)

* simplify libzippp.cmake

* remove unnecessary code

* rename project files (keep uMod_ prefix only for d3d9 classes)

* remove unused Nothing() function

* remove unnecessary fields

* remove some code duplication

refactor methods together

* refactor SwitchTextures and UnswitchTextures together

* move loaded_size into function

* enable libzippp encryption again

* copy data from opened zipentry and then delete the entry

* fix hash bug in volume textures

* const

* change uMod_TextureClient to TextureClient

* revert libzippp.cmake

* 1.5.6
2023-11-22 21:50:11 +01:00

91 lines
2.5 KiB
CMake

cmake_minimum_required(VERSION 3.16)
set(CMAKE_GENERATOR_PLATFORM win32)
project(gMod)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
if(NOT(CMAKE_SIZEOF_VOID_P EQUAL 4))
message(FATAL_ERROR "You are configuring a non 32-bit build, this is not supported. Run cmake with `-A Win32`")
endif()
option(CLEAN "Cleans third party libraries and recompiles them" OFF)
if(${CLEAN} MATCHES "ON")
message("Removing directory: ${PROJECT_SOURCE_DIR}/bin/install")
file(REMOVE_RECURSE ${PROJECT_SOURCE_DIR}/bin/install)
endif()
set(VERSION_MAJOR 1)
set(VERSION_MINOR 5)
set(VERSION_PATCH 6)
set(VERSION_TWEAK 0)
set(VERSION_RC "${CMAKE_CURRENT_BINARY_DIR}/version.rc")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/version.rc.in" "${VERSION_RC}" @ONLY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin")
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR}/bin/install)
add_compile_options(/MP /permissive-)
find_library(D3D9_LIB NAMES d3d9 PATHS $ENV{DXSDK_DIR}/lib/x86 NO_DEFAULT_PATH)
find_library(D3DX9_LIB NAMES d3dx9 PATHS $ENV{DXSDK_DIR}/lib/x86 NO_DEFAULT_PATH)
find_library(DXGUID_LIB NAMES dxguid PATHS $ENV{DXSDK_DIR}/lib/x86 NO_DEFAULT_PATH)
if(NOT D3D9_LIB)
find_library(D3D9_LIB NAMES d3d9 PATHS ${CMAKE_SOURCE_DIR}/Lib)
endif()
if(NOT D3DX9_LIB)
find_library(D3DX9_LIB NAMES d3dx9 PATHS ${CMAKE_SOURCE_DIR}/Lib)
endif()
if(NOT DXGUID_LIB)
find_library(DXGUID_LIB NAMES dxguid PATHS ${CMAKE_SOURCE_DIR}/Lib)
endif()
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include(libzippp)
include(minhook)
add_library(gMod SHARED)
file(GLOB SOURCES
"header/*.h"
"source/*.cpp"
${VERSION_RC}
)
target_include_directories(gMod PRIVATE $ENV{DXSDK_DIR}/Include)
target_include_directories(gMod PUBLIC
"header"
${CMAKE_INSTALL_PREFIX}/include
)
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES ${SOURCES})
target_sources(gMod PRIVATE ${SOURCES})
target_link_libraries(gMod PRIVATE
${D3D9_LIB}
${D3DX9_LIB}
${DXGUID_LIB}
libzippp
psapi
minhook
)
target_link_options(gMod PRIVATE
"$<$<CONFIG:DEBUG>:/NODEFAULTLIB:LIBCMT>"
)
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES ${SOURCES})
target_sources(gMod PRIVATE ${SOURCES})
target_compile_definitions(gMod PRIVATE
"NOMINMAX"
"_WIN32_WINNT=_WIN32_WINNT_WIN7"
"WIN32_LEAN_AND_MEAN"
"VC_EXTRALEAN"
DIRECT_INJECTION
LOG_MESSAGE
)