Skip to content

Commit

Permalink
SUM Remove x86 Support
Browse files Browse the repository at this point in the history
-- Remove x86 support.
 : For Linux and Windows.
*# Modify CMake files.
*M Modify initialization module.
*@ Modify workflows.
  • Loading branch information
ren-yc committed Mar 25, 2023
1 parent b360872 commit 6a15e9a
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 134 deletions.
33 changes: 12 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,40 @@ on: [push, pull_request]

jobs:
build:
name: Build
name: ${{ format('Build {0}-{1}', matrix.platform, matrix.config) }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
arch: [x86, x64]
config: [debug, release]
include:
- os: ubuntu-latest
cfg: linux
triplet: linux
platform: linux
triplet: x64-linux
- os: windows-latest
cfg: windows
triplet: windows-static
platform: windows
triplet: x64-windows-static
env:
pkgs: fmt jsoncpp spdlog
VCPKG_ROOT: ./vcpkg
VCPKG_ROOT: ${{ format('{0}/vcpkg', github.workspace) }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Use MSVC CLI
uses: ilammy/msvc-dev-cmd@v1
if: ${{ matrix.os == 'windows-latest' }}
with:
arch: ${{ matrix.arch }}
- name: Install cross-platform packages
if: ${{ matrix.os == 'ubuntu-latest' && matrix.arch == 'x86' }}
run: |
sudo apt update -y
sudo apt upgrade -y
sudo apt install -y gcc-multilib g++-multilib
if: ${{ matrix.platform == 'windows' }}
- name: Install CMake and Ninja
uses: lukka/get-cmake@latest
- name: Initialize vcpkg
uses: johnwason/vcpkg-action@v4
with:
pkgs: ${{ env.pkgs }}
triplet: ${{ format('{0}-{1}', matrix.arch, matrix.triplet) }}
triplet: ${{ matrix.triplet }}
token: ${{ github.token }}
- name: Run CMake
uses: lukka/run-cmake@v10
with:
configurePreset: ${{ format('{0}-{1}-release', matrix.arch, matrix.cfg) }}
configurePresetAdditionalArgs: "['-DCMAKE_TOOLCHAIN_FILE=\"./vcpkg/scripts/buildsystems/vcpkg.cmake\"']"
buildPreset: ${{ format('{0}-{1}-release', matrix.arch, matrix.cfg) }}
buildPresetAdditionalArgs: "['--config Release']"
configurePreset: ${{ format('{0}-{1}', matrix.platform, matrix.config) }}
configurePresetAdditionalArgs: ${{ format('"[\'-DCMAKE_TOOLCHAIN_FILE=\"{0}/scripts/buildsystems/vcpkg.cmake\"\']"', env.VCPKG_ROOT) }}
buildPreset: ${{ format('{0}-{1}', matrix.platform, matrix.config) }}
9 changes: 4 additions & 5 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
analyze:
name: Analyze
env:
VCPKG_ROOT: ./vcpkg
VCPKG_ROOT: ${{ format('{0}/vcpkg', github.workspace) }}
runs-on: windows-latest
permissions:
security-events: write
Expand All @@ -33,9 +33,8 @@ jobs:
- name: Run CMake
uses: lukka/run-cmake@v10
with:
configurePreset: x64-windows-release
configurePresetAdditionalArgs: "['-DCMAKE_TOOLCHAIN_FILE=\"./vcpkg/scripts/buildsystems/vcpkg.cmake\"']"
buildPreset: x64-windows-release
buildPresetAdditionalArgs: "['--config Release']"
configurePreset: windows-release
configurePresetAdditionalArgs: ${{ format('"[\'-DCMAKE_TOOLCHAIN_FILE=\"{0}/scripts/buildsystems/vcpkg.cmake\"\']"', env.VCPKG_ROOT) }}
buildPreset: windows-release
- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@v2
12 changes: 3 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,20 @@ if(MSVC)
endif()
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
target_compile_options(LF PRIVATE /W3)
set(VCPKG_TARGET_TRIPLET "x64-windows-static")
else()
target_compile_options(LF PRIVATE -Wall -Wextra -Wpedantic)
set(VCPKG_TARGET_TRIPLET "x64-linux")
endif()

if(NOT DEFINED VCPKG_ROOT)
if(DEFINED ENV{VCPKG_ROOT})
set(VCPKG_ROOT ENV{VCPKG_ROOT})
else()
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(VCPKG_ROOT "D:/vcpkg")
else()
set(VCPKG_ROOT "$ENV{HOME}/vcpkg")
endif()
message(FATAL_ERROR "VCPKG_ROOT is not defined")
endif()
endif()

include("archdetect.cmake")
target_architecture(TARGET_ARCH)
message(STATUS "Target architecture: ${TARGET_ARCH}")
add_compile_definitions(LF_Framework=\"${TARGET_ARCH}\")
include_directories("${VCPKG_ROOT}/installed/${VCPKG_TARGET_TRIPLET}/include")
find_package(jsoncpp CONFIG REQUIRED)
find_package(spdlog CONFIG REQUIRED)
Expand Down
120 changes: 24 additions & 96 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"binaryDir": "${sourceDir}/out/build/${presetName}",
"cacheVariables": {
"CMAKE_C_COMPILER": "cl.exe",
"CMAKE_CXX_COMPILER": "cl.exe",
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
"CMAKE_CXX_COMPILER": "cl.exe"
},
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
Expand All @@ -24,9 +24,9 @@
"binaryDir": "${sourceDir}/out/build/${presetName}",
"cacheVariables": {
"CMAKE_C_COMPILER": "gcc",
"CMAKE_CXX_COMPILER": "g++",
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
"CMAKE_CXX_COMPILER": "g++"
},
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
Expand All @@ -39,8 +39,8 @@
}
},
{
"name": "x64-windows-debug",
"displayName": "Windows x64 Debug",
"name": "windows-debug",
"displayName": "Windows Debug",
"inherits": "windows-base",
"architecture": {
"value": "x64",
Expand All @@ -52,8 +52,8 @@
}
},
{
"name": "x64-windows-release",
"displayName": "Windows x64 Release",
"name": "windows-release",
"displayName": "Windows Release",
"inherits": "windows-base",
"architecture": {
"value": "x64",
Expand All @@ -65,34 +65,8 @@
}
},
{
"name": "x86-windows-debug",
"displayName": "Windows x86 Debug",
"inherits": "windows-base",
"architecture": {
"value": "x86",
"strategy": "external"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"VCPKG_TARGET_TRIPLET": "x86-windows-static"
}
},
{
"name": "x86-windows-release",
"displayName": "Windows x86 Release",
"inherits": "windows-base",
"architecture": {
"value": "x86",
"strategy": "external"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"VCPKG_TARGET_TRIPLET": "x86-windows-static"
}
},
{
"name": "x64-linux-debug",
"displayName": "Linux x64 Debug",
"name": "linux-debug",
"displayName": "Linux Debug",
"inherits": "linux-base",
"architecture": {
"value": "x64",
Expand All @@ -104,8 +78,8 @@
}
},
{
"name": "x64-linux-release",
"displayName": "Linux x64 Release",
"name": "linux-release",
"displayName": "Linux Release",
"inherits": "linux-base",
"architecture": {
"value": "x64",
Expand All @@ -115,74 +89,28 @@
"CMAKE_BUILD_TYPE": "Release",
"VCPKG_TARGET_TRIPLET": "x64-linux"
}
},
{
"name": "x86-linux-debug",
"displayName": "Linux x86 Debug",
"inherits": "linux-base",
"architecture": {
"value": "x86",
"strategy": "external"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"VCPKG_TARGET_TRIPLET": "x86-linux"
}
},
{
"name": "x86-linux-release",
"displayName": "Linux x86 Release",
"inherits": "linux-base",
"architecture": {
"value": "x86",
"strategy": "external"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"VCPKG_TARGET_TRIPLET": "x86-linux"
}
}
],
"buildPresets": [
{
"name": "x64-windows-debug",
"displayName": "Windows x64 Debug",
"configurePreset": "x64-windows-debug"
},
{
"name": "x64-windows-release",
"displayName": "Windows x64 Release",
"configurePreset": "x64-windows-release"
},
{
"name": "x86-windows-debug",
"displayName": "Windows x86 Debug",
"configurePreset": "x86-windows-debug"
},
{
"name": "x86-windows-release",
"displayName": "Windows x86 Release",
"configurePreset": "x86-windows-release"
},
{
"name": "x64-linux-debug",
"displayName": "Linux x64 Debug",
"configurePreset": "x64-linux-debug"
"name": "windows-debug",
"displayName": "Windows Debug",
"configurePreset": "windows-debug"
},
{
"name": "x64-linux-release",
"displayName": "Linux x64 Release",
"configurePreset": "x64-linux-release"
"name": "windows-release",
"displayName": "Windows Release",
"configurePreset": "windows-release"
},
{
"name": "x86-linux-debug",
"displayName": "Linux x86 Debug",
"configurePreset": "x86-linux-debug"
"name": "linux-debug",
"displayName": "Linux Debug",
"configurePreset": "linux-debug"
},
{
"name": "x86-linux-release",
"displayName": "Linux x86 Release",
"configurePreset": "x86-linux-release"
"name": "linux-release",
"displayName": "Linux Release",
"configurePreset": "linux-release"
}
]
}
5 changes: 2 additions & 3 deletions modules/init.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,10 @@ void LF_Init_Log() {
#endif
LF_version.append(fmt::format(" {}", LF_VER_BUILD));
#endif
LF_version.append(fmt::format(" ({}", LF_Framework));
#ifdef _WIN32
LF_version.append(" Windows)");
LF_version.append(" (Windows)");
#elif linux
LF_version.append(" Linux)");
LF_version.append(" (Linux)");
#endif
SPDLOG_INFO(fmt::format("Starting \"Learning Focus {}\"", LF_version));
}
Expand Down

0 comments on commit 6a15e9a

Please sign in to comment.