Merge pull request #2076 from RadWolfie/add-cmake-install

Implement CMake Install Support
This commit is contained in:
ergo720 2021-01-26 13:48:36 +01:00 committed by GitHub
commit f44f35f6fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 62 additions and 42 deletions

View File

@ -41,9 +41,7 @@ build_script:
on_success:
- ps: |-
If ($env:configuration -eq 'Release') {
cd bin\$env:configuration
7z u "$env:configuration.zip" ..\..\..\COPYING ..\..\..\README.md
7z u "$env:configuration.zip" cxbx.exe cxbxr-ldr.exe cxbxr-emu.dll glew32.dll subhook.dll SDL2.dll
7z u "$env:configuration.zip" cxbxr-debugger.exe capstone.dll cs_x86.dll
cmake --install . --config $env:configuration --prefix artifacts
7z a "$env:configuration.zip" ./artifacts/bin/*
Get-ChildItem .\*.zip | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
}

View File

@ -64,22 +64,16 @@ jobs:
workingDirectory: build
displayName: 'Build'
- script: cmake --install . --config %configuration% --prefix ../artifacts
workingDirectory: build
displayName: 'Prepare Files'
condition: and(succeeded(), eq(variables['Agent.JobName'], 'Release'))
- task: CopyFiles@2
displayName: 'Copy files to $(Build.ArtifactStagingDirectory)'
condition: and(succeeded(), eq(variables['Agent.JobName'], 'Release'))
inputs:
Contents: |
COPYING
README.md
build\bin\$(configuration)\cxbx.exe
build\bin\$(configuration)\cxbxr-ldr.exe
build\bin\$(configuration)\cxbxr-emu.dll
build\bin\$(configuration)\glew32.dll
build\bin\$(configuration)\subhook.dll
build\bin\$(configuration)\SDL2.dll
build\bin\$(configuration)\cxbxr-debugger.exe
build\bin\$(configuration)\capstone.dll
build\bin\$(configuration)\cx_x86.dll
Contents: artifacts\bin\**
TargetFolder: '$(Build.ArtifactStagingDirectory)'
flattenFolders: true

View File

@ -52,17 +52,13 @@ jobs:
run: cmake --build . --config ${{ matrix.configuration }} -j $env:NUMBER_OF_PROCESSORS
- name: Prepare artifacts
if: matrix.configuration == 'Release'
run: |
robocopy . artifacts COPYING README.md /r:0 /w:0
robocopy build\bin\${{ matrix.configuration }} artifacts `
cxbx.exe cxbxr-ldr.exe cxbxr-emu.dll glew32.dll subhook.dll SDL2.dll `
cxbxr-debugger.exe capstone.dll cs_x86.dll /r:0 /w:0
If ($LastExitCode -le 7) { $LastExitCode = 0 }
- uses: actions/upload-artifact@v1
working-directory: build
run: cmake --install . --config ${{ matrix.configuration }} --prefix ../artifacts
- uses: actions/upload-artifact@v2
if: matrix.configuration == 'Release'
with:
name: CxbxReloaded-${{ matrix.configuration }}-${{ matrix.vsver }}
path: artifacts
path: artifacts/bin/**
release:
if: |

View File

@ -373,30 +373,46 @@ add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/projects/cxbxr-ldr")
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/projects/cxbxr-emu")
# Issues with compile (the same with develop branch) and
# for some reason did not put the files into virtual folder?
# Might need to put the list in the source folder for workaround fix.
if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|[9][0-9])")
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/src/CxbxDebugger")
endif()
set(cxbxr_INSTALL_files "COPYING" "README.md")
# Cxbx-Reloaded project with third-party libraries
set_target_properties(cxbx cxbxr-ldr cxbxr-emu misc-batch subhook libXbSymbolDatabase libtommath libtomcrypt
PROPERTIES FOLDER Cxbx-Reloaded
)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# Configure startup project
set_property(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}" PROPERTY VS_STARTUP_PROJECT cxbx)
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])")
set_target_properties(Tests_cs_x86
PROPERTIES EXCLUDE_FROM_ALL TRUE
)
# Issues with compile (the same with develop branch) and
# 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(cxbxr-debugger cs_x86 Tests_cs_x86 capstone-shared
PROPERTIES FOLDER Cxbx-Reloaded/debugger
)
set_target_properties(Tests_cs_x86
PROPERTIES EXCLUDE_FROM_ALL TRUE
)
# 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()
# Cxbx-Reloaded project with third-party libraries
set_target_properties(cxbx cxbxr-ldr cxbxr-emu misc-batch subhook libXbSymbolDatabase libtommath libtomcrypt
PROPERTIES FOLDER Cxbx-Reloaded
install(FILES ${cxbxr_INSTALL_files}
DESTINATION bin
)
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
)

@ -1 +1 @@
Subproject commit a477ce6ad6278e1c7358a446cdd8d995a8c45d12
Subproject commit 5b8d3feb15c2edae309c1613ca0bc26e54f0c23e

@ -1 +1 @@
Subproject commit 65133408a86028ef8af20cf75a0d412549b9752c
Subproject commit 5fb27bcf6745c35d8889e48ead4314022b8ec931

View File

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

View File

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

View File

@ -64,3 +64,7 @@ endif()
target_link_libraries(cxbxr-ldr
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")
target_link_libraries(cxbxr-debugger cs_x86)
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin
)