cmake: add CMake install method

This commit is contained in:
RadWolfie 2020-11-04 23:21:29 -06:00
parent 6f62ec001b
commit ab01047450
5 changed files with 48 additions and 16 deletions

View File

@ -377,30 +377,46 @@ add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/projects/cxbxr-ldr")
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/projects/cxbxr-emu") add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/projects/cxbxr-emu")
# Issues with compile (the same with develop branch) and set(cxbxr_INSTALL_files "COPYING" "README.md")
# for some reason did not put the files into virtual folder?
# Might need to put the list in the source folder for workaround fix. # Cxbx-Reloaded project with third-party libraries
if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|[9][0-9])") set_target_properties(cxbx cxbxr-ldr cxbxr-emu misc-batch subhook libXbSymbolDatabase libtommath libtomcrypt
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/src/CxbxDebugger") PROPERTIES FOLDER Cxbx-Reloaded
endif() )
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# Configure startup project # Configure startup project
set_property(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}" PROPERTY VS_STARTUP_PROJECT cxbx) set_property(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}" PROPERTY VS_STARTUP_PROJECT cxbx)
endif() endif()
# Check if generator is Visual Studio then enable Cxbxr-Debugger project.
# Since C# is currently supported with Visual Studio for now.
if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|[9][0-9])") if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|[9][0-9])")
set_target_properties(Tests_cs_x86 # Issues with compile (the same with develop branch) and
PROPERTIES EXCLUDE_FROM_ALL TRUE # for some reason did not put the files into virtual folder?
) # Might need to put the list in the source folder for workaround fix.
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/src/CxbxDebugger")
# Cxbx-Debugger project with third-party libraries set_target_properties(Tests_cs_x86
set_target_properties(cxbxr-debugger cs_x86 Tests_cs_x86 capstone-shared PROPERTIES EXCLUDE_FROM_ALL TRUE
PROPERTIES FOLDER Cxbx-Reloaded/debugger )
)
# Cxbx-Debugger project with third-party libraries
set_target_properties(cxbxr-debugger cs_x86 Tests_cs_x86 capstone-shared
PROPERTIES FOLDER Cxbx-Reloaded/debugger
)
endif() endif()
# Cxbx-Reloaded project with third-party libraries install(FILES ${cxbxr_INSTALL_files}
set_target_properties(cxbx cxbxr-ldr cxbxr-emu misc-batch subhook libXbSymbolDatabase libtommath libtomcrypt DESTINATION bin
PROPERTIES FOLDER Cxbx-Reloaded )
set(cxbxr_GLEW_DLL "${CMAKE_SOURCE_DIR}/import/glew-2.0.0/bin/Release/Win32/glew32.dll")
install(PROGRAMS ${cxbxr_GLEW_DLL}
DESTINATION bin
)
install(PROGRAMS $<TARGET_FILE_DIR:cxbx>/${CMAKE_SHARED_LIBRARY_PREFIX}subhook${CMAKE_SHARED_LIBRARY_SUFFIX}
DESTINATION bin
) )

View File

@ -187,6 +187,10 @@ target_link_libraries(cxbx
${WINS_LIB} ${WINS_LIB}
) )
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin
)
if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|[9][0-9])") if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|[9][0-9])")
add_dependencies(cxbx cxbxr-debugger) add_dependencies(cxbx cxbxr-debugger)
endif() endif()

View File

@ -161,4 +161,8 @@ target_link_libraries(cxbxr-emu
${WINS_LIB} ${WINS_LIB}
) )
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin
)
add_dependencies(cxbxr-emu cxbxr-ldr misc-batch) add_dependencies(cxbxr-emu cxbxr-ldr misc-batch)

View File

@ -65,3 +65,7 @@ endif()
target_link_libraries(cxbxr-ldr target_link_libraries(cxbxr-ldr
PUBLIC kernel32.lib PUBLIC kernel32.lib
) )
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin
)

View File

@ -140,3 +140,7 @@ set_target_properties(cxbxr-debugger PROPERTIES
set_property(TARGET cxbxr-debugger PROPERTY DOTNET_TARGET_FRAMEWORK_VERSION "v4.5") set_property(TARGET cxbxr-debugger PROPERTY DOTNET_TARGET_FRAMEWORK_VERSION "v4.5")
target_link_libraries(cxbxr-debugger cs_x86) target_link_libraries(cxbxr-debugger cs_x86)
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin
)