-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
91 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,89 @@ | ||
cmake_minimum_required(VERSION 3.14 FATAL_ERROR) | ||
|
||
if(POLICY CMP0092) | ||
cmake_policy(SET CMP0092 NEW) # Don't add -W3 warning level by default. | ||
endif() | ||
|
||
|
||
project(polyhook VERSION 1.0.0.0 DESCRIPTION "PolyHook Plugin" HOMEPAGE_URL "https://github.com/untrustedmodders/polyhook" LANGUAGES CXX) | ||
|
||
set(CMAKE_CXX_STANDARD 20) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>") | ||
|
||
if(NOT CMAKE_BUILD_TYPE) | ||
set(CMAKE_BUILD_TYPE Debug) | ||
endif() | ||
|
||
if(UNIX AND NOT APPLE) | ||
set(LINUX TRUE) | ||
endif() | ||
|
||
# | ||
# Format | ||
# | ||
include(cmake/compat_format.cmake) | ||
|
||
# | ||
# Polyhook | ||
# | ||
include(cmake/polyhook.cmake) | ||
|
||
# | ||
# Plugin | ||
# | ||
file(GLOB_RECURSE PLUGIN_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp") | ||
|
||
add_library(${PROJECT_NAME} SHARED ${PLUGIN_SOURCES}) | ||
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) | ||
|
||
target_link_libraries(${PROJECT_NAME} PRIVATE PolyHook_2) | ||
target_include_directories(${PROJECT_NAME} PRIVATE ${PolyHook_2_SOURCE_DIR}) | ||
|
||
if(MSVC) | ||
target_compile_options(asmjit PUBLIC /wd5054) | ||
elseif(MINGW) | ||
target_compile_options(asmjit PUBLIC -Wno-deprecated-enum-enum-conversion) | ||
else() | ||
target_compile_options(asmjit PUBLIC -Wno-deprecated-anon-enum-enum-conversion -Wno-deprecated-enum-enum-conversion) | ||
endif() | ||
|
||
if(MSVC) | ||
#target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX) | ||
else() | ||
#target_compile_options(${PROJECT_NAME} PRIVATE -Wextra -Wshadow -Wconversion -Wpedantic -Werror) | ||
endif() | ||
|
||
include(GenerateExportHeader) | ||
generate_export_header(${PROJECT_NAME} EXPORT_MACRO_NAME PLUGIN_API EXPORT_FILE_NAME ${CMAKE_BINARY_DIR}/exports/plugin_export.h) | ||
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_BINARY_DIR}/exports) | ||
|
||
if(APPLE) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE "-Wl,-exported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/sym/exported_symbols.lds") | ||
elseif(UNIX) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE "-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/sym/version_script.lds") | ||
endif() | ||
|
||
if(LINUX) | ||
target_compile_definitions(${PROJECT_NAME} PRIVATE _GLIBCXX_USE_CXX11_ABI=0) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE -static-libstdc++ -static-libgcc) | ||
endif() | ||
|
||
target_compile_definitions(${PROJECT_NAME} PRIVATE | ||
PLUGIFY_FORMAT_SUPPORT=$<BOOL:${COMPILER_SUPPORTS_FORMAT}> | ||
PLUGIFY_IS_DEBUG=$<STREQUAL:${CMAKE_BUILD_TYPE},Debug>) | ||
if(NOT COMPILER_SUPPORTS_FORMAT) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt-header-only) | ||
endif() | ||
|
||
set(POLYHOOK_VERSION "0" CACHE STRING "Set version name") | ||
set(POLYHOOK_PACKAGE "polyhook" CACHE STRING "Set package name") | ||
|
||
configure_file( | ||
${CMAKE_SOURCE_DIR}/polyhook.pplugin.in | ||
${CMAKE_BINARY_DIR}/polyhook.pplugin | ||
cmake_minimum_required(VERSION 3.14 FATAL_ERROR) | ||
|
||
if(POLICY CMP0092) | ||
cmake_policy(SET CMP0092 NEW) # Don't add -W3 warning level by default. | ||
endif() | ||
|
||
|
||
project(polyhook VERSION 1.0.0.0 DESCRIPTION "PolyHook Plugin" HOMEPAGE_URL "https://github.com/untrustedmodders/polyhook" LANGUAGES CXX) | ||
|
||
set(CMAKE_CXX_STANDARD 20) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>") | ||
|
||
if(NOT CMAKE_BUILD_TYPE) | ||
set(CMAKE_BUILD_TYPE Debug) | ||
endif() | ||
|
||
if(UNIX AND NOT APPLE) | ||
set(LINUX TRUE) | ||
endif() | ||
|
||
# | ||
# Format | ||
# | ||
include(cmake/compat_format.cmake) | ||
|
||
# | ||
# Polyhook | ||
# | ||
include(cmake/polyhook.cmake) | ||
|
||
# | ||
# Plugin | ||
# | ||
file(GLOB_RECURSE PLUGIN_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp") | ||
|
||
add_library(${PROJECT_NAME} SHARED ${PLUGIN_SOURCES}) | ||
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) | ||
|
||
target_link_libraries(${PROJECT_NAME} PRIVATE PolyHook_2) | ||
target_include_directories(${PROJECT_NAME} PRIVATE ${PolyHook_2_SOURCE_DIR}) | ||
|
||
if(MSVC) | ||
target_compile_options(asmjit PUBLIC /wd5054) | ||
elseif(MINGW) | ||
target_compile_options(asmjit PUBLIC -Wno-deprecated-enum-enum-conversion) | ||
else() | ||
target_compile_options(asmjit PUBLIC -Wno-deprecated-anon-enum-enum-conversion -Wno-deprecated-enum-enum-conversion) | ||
endif() | ||
|
||
if(MSVC) | ||
#target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX) | ||
else() | ||
#target_compile_options(${PROJECT_NAME} PRIVATE -Wextra -Wshadow -Wconversion -Wpedantic -Werror) | ||
endif() | ||
|
||
include(GenerateExportHeader) | ||
generate_export_header(${PROJECT_NAME} EXPORT_MACRO_NAME PLUGIN_API EXPORT_FILE_NAME ${CMAKE_BINARY_DIR}/exports/plugin_export.h) | ||
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_BINARY_DIR}/exports) | ||
|
||
if(APPLE) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE "-Wl,-exported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/sym/exported_symbols.lds") | ||
elseif(UNIX) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE "-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/sym/version_script.lds") | ||
endif() | ||
|
||
if(LINUX) | ||
target_compile_definitions(${PROJECT_NAME} PRIVATE _GLIBCXX_USE_CXX11_ABI=0) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE -static-libstdc++ -static-libgcc) | ||
endif() | ||
|
||
target_compile_definitions(${PROJECT_NAME} PRIVATE | ||
PLUGIFY_FORMAT_SUPPORT=$<BOOL:${COMPILER_SUPPORTS_FORMAT}> | ||
PLUGIFY_IS_DEBUG=$<STREQUAL:${CMAKE_BUILD_TYPE},Debug> | ||
PLUGIFY_IS_RELEASE=$<STREQUAL:${CMAKE_BUILD_TYPE},Release> | ||
) | ||
if(NOT COMPILER_SUPPORTS_FORMAT) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt-header-only) | ||
endif() | ||
|
||
set(POLYHOOK_VERSION "0" CACHE STRING "Set version name") | ||
set(POLYHOOK_PACKAGE "polyhook" CACHE STRING "Set package name") | ||
|
||
configure_file( | ||
${CMAKE_SOURCE_DIR}/polyhook.pplugin.in | ||
${CMAKE_BINARY_DIR}/polyhook.pplugin | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters