-
Notifications
You must be signed in to change notification settings - Fork 8
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
1 parent
2000c3e
commit 82590ed
Showing
2 changed files
with
20 additions
and
39 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 |
---|---|---|
|
@@ -16,20 +16,22 @@ set(CMAKE_OPTIMIZE_DEPENDENCIES ON) | |
|
||
include(GNUInstallDirs) | ||
|
||
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/CPM.cmake") | ||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/CPM.cmake) | ||
|
||
set(CPM_SOURCE_CACHE ${CMAKE_CURRENT_BINARY_DIR}/.cpm) | ||
|
||
CPMAddPackage("gh:Starfield-Reverse-Engineering/CommonLibSF#main") | ||
CPMAddPackage("gh:brofield/[email protected]") | ||
|
||
include("${CommonLibSF_SOURCE_DIR}/CommonLibSF/cmake/CommonLibSF.cmake") | ||
include(${CommonLibSF_SOURCE_DIR}/CommonLibSF/cmake/CommonLibSF.cmake) | ||
|
||
configure_file( | ||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/version.rc.in | ||
${CMAKE_CURRENT_BINARY_DIR}/version.rc | ||
@ONLY | ||
) | ||
|
||
set(PUBLIC_HEADER_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/${PROJECT_NAME}") | ||
set(PUBLIC_HEADER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include/${PROJECT_NAME}) | ||
|
||
set( | ||
headers | ||
|
@@ -59,7 +61,7 @@ add_commonlibsf_plugin( | |
SOURCES ${headers} ${sources} | ||
) | ||
|
||
add_library("${PROJECT_NAME}::${PROJECT_NAME}" ALIAS "${PROJECT_NAME}") | ||
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) | ||
|
||
target_include_directories( | ||
${PROJECT_NAME} | ||
|
@@ -80,61 +82,41 @@ target_precompile_headers( | |
) | ||
|
||
install( | ||
DIRECTORY "${PUBLIC_HEADER_DIR}" | ||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" | ||
DIRECTORY ${PUBLIC_HEADER_DIR} | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
) | ||
|
||
install( | ||
TARGETS ${PROJECT_NAME} | ||
DESTINATION "${CMAKE_INSTALL_LIBDIR}" | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
) | ||
|
||
######################################################################################################################## | ||
## Automatic plugin deployment | ||
######################################################################################################################## | ||
if(CMAKE_BUILD_TYPE STREQUAL "Debug") | ||
set(BUILD_NAME "Debug") | ||
if(CMAKE_BUILD_TYPE STREQUAL Debug) | ||
set(BUILD_NAME Debug) | ||
else() | ||
set(BUILD_NAME "Release") | ||
set(BUILD_NAME Release) | ||
endif() | ||
|
||
add_custom_command( | ||
TARGET ${PROJECT_NAME} | ||
POST_BUILD | ||
COMMAND | ||
${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Plugin${BUILD_NAME}/sfse/plugins" | ||
) | ||
add_custom_command( | ||
TARGET ${PROJECT_NAME} | ||
POST_BUILD | ||
${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_SOURCE_DIR}/contrib/Plugin${BUILD_NAME}/sfse/plugins | ||
COMMAND | ||
${CMAKE_COMMAND} -E copy $<TARGET_FILE:${PROJECT_NAME}> "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Plugin${BUILD_NAME}/sfse/plugins" | ||
) | ||
add_custom_command( | ||
TARGET ${PROJECT_NAME} | ||
POST_BUILD | ||
${CMAKE_COMMAND} -E copy $<TARGET_FILE:${PROJECT_NAME}> ${CMAKE_CURRENT_SOURCE_DIR}/contrib/Plugin${BUILD_NAME}/sfse/plugins | ||
COMMAND | ||
${CMAKE_COMMAND} -E copy $<TARGET_PDB_FILE:${PROJECT_NAME}> "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Plugin${BUILD_NAME}/sfse/plugins" | ||
) | ||
add_custom_command( | ||
TARGET ${PROJECT_NAME} | ||
POST_BUILD | ||
${CMAKE_COMMAND} -E copy $<TARGET_PDB_FILE:${PROJECT_NAME}> ${CMAKE_CURRENT_SOURCE_DIR}/contrib/Plugin${BUILD_NAME}/sfse/plugins | ||
COMMAND | ||
${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Config/${PROJECT_NAME}.ini" "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Plugin${BUILD_NAME}/sfse/plugins" | ||
${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/contrib/Config/${PROJECT_NAME}.ini ${CMAKE_CURRENT_SOURCE_DIR}/contrib/Plugin${BUILD_NAME}/sfse/plugins | ||
) | ||
|
||
file(GLOB_RECURSE OUTPUT_DLLS "${CMAKE_CURRENT_SOURCE_DIR}/contrib/**/*.dll") | ||
file(GLOB_RECURSE OUTPUT_PDBS "${CMAKE_CURRENT_SOURCE_DIR}/contrib/**/*.pdb") | ||
file(GLOB_RECURSE OUTPUT_DLLS ${CMAKE_CURRENT_SOURCE_DIR}/contrib/**/*.dll) | ||
file(GLOB_RECURSE OUTPUT_PDBS ${CMAKE_CURRENT_SOURCE_DIR}/contrib/**/*.pdb) | ||
|
||
set_property( | ||
TARGET ${PROJECT_NAME} | ||
APPEND PROPERTY ADDITIONAL_CLEAN_FILES "${OUTPUT_DLLS}" | ||
) | ||
set_property( | ||
TARGET ${PROJECT_NAME} | ||
APPEND PROPERTY ADDITIONAL_CLEAN_FILES "${OUTPUT_PDBS}" | ||
) | ||
set_property( | ||
TARGET ${PROJECT_NAME} | ||
APPEND PROPERTY ADDITIONAL_CLEAN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/build/.cpm" | ||
APPEND PROPERTY ADDITIONAL_CLEAN_FILES ${OUTPUT_DLLS} ${OUTPUT_PDBS} ${CPM_SOURCE_CACHE} ${CMAKE_CURRENT_BINARY_DIR}/_deps | ||
) |
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