Skip to content

Commit

Permalink
chore: update workflows, remove CPM.cmake (#252)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThirdEyeSqueegee authored Jul 23, 2024
1 parent f5f725b commit a5810a6
Show file tree
Hide file tree
Showing 35 changed files with 127 additions and 1,505 deletions.
43 changes: 0 additions & 43 deletions .github/update-registry.ps1

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/main_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ jobs:
uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: x64
toolset: 14.37
toolset: 14.40

- name: Build
run: |
${{ github.workspace }}/scripts/build-release-${{ matrix.compiler }}-cpm-test.bat
${{ github.workspace }}/scripts/build-release-${{ matrix.compiler }}-test.bat
6 changes: 3 additions & 3 deletions .github/workflows/main_ci_xmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ jobs:
uses: actions/checkout@v4

- name: Setup XMake
uses: xmake-io/github-action-setup-xmake@v1.0.13
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: "2.8.2"
xmake-version: "latest"

- name: Configure
run: xmake config -y --mode=${{ matrix.mode }} --vs_toolset=14.37
run: xmake config -y --mode=${{ matrix.mode }} --vs_toolset=14.40

- name: Build
run: xmake build -y -vD
23 changes: 3 additions & 20 deletions .github/workflows/maintenance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,17 @@ jobs:
run: "& ${{ github.workspace }}/.github/make-directives.ps1 ${{ github.workspace }}/CommonLibSF"

- name: Run clang-format
uses: DoozyX/clang-format-lint-action@v0.16.2
uses: DoozyX/clang-format-lint-action@v0.17
with:
source: "."
exclude: "./docs"
extensions: "c,cc,cpp,cppm,cxx,h,hpp,hxx,inl,inc,ixx,mxx"
clangFormatVersion: 16
clangFormatVersion: 17
inplace: True

- name: Update vcpkg port version
id: versioning
shell: pwsh
run: "& ${{ github.workspace }}/.github/update-registry.ps1 ${{ github.workspace }}"

- name: Check failure
run: exit 1
if: ${{ steps.versioning.outputs.VCPKG_SUCCESS == 'false' }}

- name: Add & Commit
id: registry
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: "ci: maintenance `${{ steps.versioning.outputs.VCPKG_VERSION }}`"

- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.VCPKG_HELPER_TOKEN }}
repository: ${{ github.repository_owner }}/Starfield-RE-vcpkg
event-type: update-event
client-payload: '{"sha": "${{ steps.registry.outputs.commit_long_sha }}", "vcpkg-version": "${{ steps.versioning.outputs.VCPKG_VERSION }}"}'
message: "ci: maintenance"
2 changes: 1 addition & 1 deletion .github/workflows/update_pdb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: x64
toolset: 14.37
toolset: 14.40

- name: Build
run: |
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ graph_info.json
/CommonLibSF/.vs
/CommonLibSF/out
/vsxmake*

.idea
*ReSharper*
142 changes: 52 additions & 90 deletions CommonLibSF/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,7 @@ if(${PROJECT_SOURCE_DIR} STREQUAL ${PROJECT_BINARY_DIR})
endif()

# dependencies
if(USING_VCPKG)
find_package(spdlog CONFIG REQUIRED)
else()
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/CPM.cmake")

set(CPM_SOURCE_CACHE "${CMAKE_CURRENT_BINARY_DIR}/.cpm")

CPMAddPackage(
GITHUB_REPOSITORY gabime/spdlog
VERSION 1.12.0
OPTIONS "SPDLOG_USE_STD_FORMAT ON"
)
endif()
find_package(spdlog CONFIG REQUIRED)

# source files
execute_process(
Expand All @@ -59,95 +47,85 @@ source_group(
FILES ${SOURCES}
)

function (configure_target TARGET_NAME)
function(configure_target TARGET_NAME)
target_compile_definitions(
${TARGET_NAME}
PUBLIC
WINVER=0x0A00 # windows 10, minimum supported version by starfield
_WIN32_WINNT=0x0A00
"$<$<BOOL:${SFSE_SUPPORT_XBYAK}>:SFSE_SUPPORT_XBYAK=1>"
WINVER=0x0A00 # windows 10, minimum supported version by starfield
_WIN32_WINNT=0x0A00
"$<$<BOOL:${SFSE_SUPPORT_XBYAK}>:SFSE_SUPPORT_XBYAK=1>"
)

# FIXME: https://gitlab.kitware.com/cmake/cmake/-/issues/24922
set_property(
TARGET ${TARGET_NAME}
PROPERTY VS_USER_PROPS
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/build_stl_modules.props"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/build_stl_modules.props"
)

if(MSVC)
target_compile_options(
${TARGET_NAME}
PUBLIC
/bigobj # support large object file format
/utf-8 # assume UTF-8 sources even without a BOM
/bigobj # support large object file format
/utf-8 # assume UTF-8 sources even without a BOM

# warnings -> errors
/we4715 # 'function' : not all control paths return a value
/we4715 # 'function' : not all control paths return a value

# disable warnings
/wd4005 # macro redefinition
/wd4061 # enumerator 'identifier' in switch of enum 'enumeration' is not explicitly handled by a case label
/wd4068 # unknown pragma
/wd4200 # nonstandard extension used : zero-sized array in struct/union
/wd4201 # nonstandard extension used : nameless struct/union
/wd4265 # 'type': class has virtual functions, but its non-trivial destructor is not virtual; instances of this class may not be destructed correctly
/wd4266 # 'function' : no override available for virtual member function from base 'type'; function is hidden
/wd4267 # 'var' : conversion from 'size_t' to 'type', possible loss of data
/wd4371 # 'classname': layout of class may have changed from a previous version of the compiler due to better packing of member 'member'
/wd4514 # 'function' : unreferenced inline function has been removed
/wd4582 # 'type': constructor is not implicitly called
/wd4583 # 'type': destructor is not implicitly called
/wd4623 # 'derived class' : default constructor was implicitly defined as deleted because a base class default constructor is inaccessible or deleted
/wd4625 # 'derived class' : copy constructor was implicitly defined as deleted because a base class copy constructor is inaccessible or deleted
/wd4626 # 'derived class' : assignment operator was implicitly defined as deleted because a base class assignment operator is inaccessible or deleted
/wd4710 # 'function' : function not inlined
/wd4711 # function 'function' selected for inline expansion
/wd4820 # 'bytes' bytes padding added after construct 'member_name'
/wd4996
/wd5026 # 'type': move constructor was implicitly defined as deleted
/wd5027 # 'type': move assignment operator was implicitly defined as deleted
/wd5045 # Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
/wd5053 # support for 'explicit(<expr>)' in C++17 and earlier is a vendor extension
/wd5204 # 'type-name': class has virtual functions, but its trivial destructor is not virtual; instances of objects derived from this class may not be destructed correctly
/wd5220 # 'member': a non-static data member with a volatile qualified type no longer implies that compiler generated copy / move constructors and copy / move assignment operators are not trivial
/wd4005 # macro redefinition
/wd4061 # enumerator 'identifier' in switch of enum 'enumeration' is not explicitly handled by a case label
/wd4068 # unknown pragma
/wd4200 # nonstandard extension used : zero-sized array in struct/union
/wd4201 # nonstandard extension used : nameless struct/union
/wd4265 # 'type': class has virtual functions, but its non-trivial destructor is not virtual; instances of this class may not be destructed correctly
/wd4266 # 'function' : no override available for virtual member function from base 'type'; function is hidden
/wd4267 # 'var' : conversion from 'size_t' to 'type', possible loss of data
/wd4371 # 'classname': layout of class may have changed from a previous version of the compiler due to better packing of member 'member'
/wd4514 # 'function' : unreferenced inline function has been removed
/wd4582 # 'type': constructor is not implicitly called
/wd4583 # 'type': destructor is not implicitly called
/wd4623 # 'derived class' : default constructor was implicitly defined as deleted because a base class default constructor is inaccessible or deleted
/wd4625 # 'derived class' : copy constructor was implicitly defined as deleted because a base class copy constructor is inaccessible or deleted
/wd4626 # 'derived class' : assignment operator was implicitly defined as deleted because a base class assignment operator is inaccessible or deleted
/wd4710 # 'function' : function not inlined
/wd4711 # function 'function' selected for inline expansion
/wd4820 # 'bytes' bytes padding added after construct 'member_name'
/wd4996
/wd5026 # 'type': move constructor was implicitly defined as deleted
/wd5027 # 'type': move assignment operator was implicitly defined as deleted
/wd5045 # Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
/wd5053 # support for 'explicit(<expr>)' in C++17 and earlier is a vendor extension
/wd5204 # 'type-name': class has virtual functions, but its trivial destructor is not virtual; instances of objects derived from this class may not be destructed correctly
/wd5220 # 'member': a non-static data member with a volatile qualified type no longer implies that compiler generated copy / move constructors and copy / move assignment operators are not trivial
)
endif()

target_include_directories(
${TARGET_NAME}
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)

target_link_libraries(
${TARGET_NAME}
PUBLIC
spdlog::spdlog
Version.lib
Dbghelp.lib
Ws2_32.lib
spdlog::spdlog
Version.lib
Dbghelp.lib
Ws2_32.lib
)

if(SFSE_SUPPORT_XBYAK)
if(USING_VCPKG)
find_package(xbyak CONFIG REQUIRED)
else()
CPMAddPackage("gh:herumi/[email protected]")
endif()

target_link_libraries(
${TARGET_NAME}
PUBLIC
xbyak::xbyak
)
find_package(xbyak CONFIG REQUIRED)
endif()

target_precompile_headers(
${TARGET_NAME}
PRIVATE
include/SFSE/Impl/PCH.h
include/SFSE/Impl/PCH.h
)
endfunction()

Expand All @@ -156,34 +134,25 @@ if(SFSE_BUILD_TESTS)
add_library(
${PROJECT_NAME}-test
STATIC
${SOURCES}
.clang-format
${CMAKE_CURRENT_SOURCE_DIR}/test/test.cpp
${SOURCES}
${CMAKE_CURRENT_SOURCE_DIR}/test/test.cpp
)
configure_target(${PROJECT_NAME}-test)
set(PROJECT_NAME ${PROJECT_NAME}-test)
else()
add_library(
${PROJECT_NAME}
STATIC
${SOURCES}
.clang-format
${SOURCES}
)
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
configure_target(${PROJECT_NAME})
endif()

if(USING_VCPKG)
install(
TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}-targets
)
else()
install(
TARGETS ${PROJECT_NAME} spdlog
EXPORT ${PROJECT_NAME}-targets
)
endif()
install(
TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}-targets
)

install(
EXPORT ${PROJECT_NAME}-targets
Expand All @@ -209,15 +178,8 @@ install(

install(
DIRECTORY
include/RE
include/REL
include/SFSE
include/RE
include/REL
include/SFSE
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

if(NOT USING_VCPKG)
set_property(
TARGET ${PROJECT_NAME}
APPEND PROPERTY ADDITIONAL_CLEAN_FILES ${CPM_SOURCE_CACHE} ${CMAKE_CURRENT_BINARY_DIR}/_deps
)
endif()
Loading

0 comments on commit a5810a6

Please sign in to comment.