Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,32 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
config: [Release, Debug]
standalone: [OFF, ON]
toolchain: [linux-gnu, linux-clang]
isPR:
- ${{ github.event_name == 'pull_request' }}
exclude:
- isPR: true
standalone: OFF
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get install cmake ninja-build libbz2-dev
- name: Build
run: |
cmake -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE=Release
cmake -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DPRISM_STANDALONE=${{ matrix.standalone }} -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain/${{ matrix.toolchain }}.cmake
cmake --build build-cmake -j
- name: Create Package
if: ${{ matrix.config == 'Release' && matrix.standalone == 'ON' && matrix.toolchain == 'linux-gnu' }}
run: |
mkdir prism-release
cp build-cmake/prism prism-release/
cp "$(ldconfig -p | grep libbz2.so.1.0 | tr ' ' '\n' | grep /| head -n1)" prism-release/
- name: Publish packaged artifacts
if: ${{ matrix.config == 'Release' && matrix.standalone == 'ON' && matrix.toolchain == 'linux-gnu' }}
uses: actions/upload-artifact@v4
with:
name: prism-linux-x64
Expand Down
24 changes: 23 additions & 1 deletion .github/workflows/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,41 @@ on:
jobs:
build:
runs-on: macOS-latest
strategy:
matrix:
config: [Release, Debug]
standalone: [OFF, ON]
toolchain: [macos-clang, macos-gnu] # remove temporary macos-clang-llvm
isPR:
- ${{ github.event_name == 'pull_request' }}
exclude:
- isPR: true
standalone: OFF
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: brew install cmake ninja xcodes
- name: Download llvm
if: ${{ matrix.toolchain == 'macos-clang-llvm' }}
run: |
brew install llvm lld
echo "/opt/homebrew/opt/llvm/bin" >> $GITHUB_PATH
- name: Download gnu
if: ${{ matrix.toolchain == 'macos-gnu' }}
run: |
brew install gcc
echo "/opt/homebrew/opt/gcc/bin" >> $GITHUB_PATH
- name: Build
run: |
cmake -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE=Release
cmake -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DPRISM_STANDALONE=${{ matrix.standalone }} -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain/${{ matrix.toolchain }}.cmake
cmake --build build-cmake -j
- name: Create Package
if: ${{ matrix.config == 'Release' && matrix.standalone == 'ON' && matrix.toolchain == 'macos-clang' }}
run: |
mkdir prism-release
cp build-cmake/prism prism-release/
- name: Publish packaged artifacts
if: ${{ matrix.config == 'Release' && matrix.standalone == 'ON' && matrix.toolchain == 'macos-clang' }}
uses: actions/upload-artifact@v4
with:
name: prism-mac-bin
Expand Down
40 changes: 33 additions & 7 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,47 @@ on:
jobs:
build:
runs-on: windows-2022
strategy:
matrix:
config: [Release, Debug]
toolchain: [windows-msvc, windows-clang-cl]
standalone: [OFF, ON]
generate: [Visual Studio 17 2022, Ninja]
arch: [x64, Win32]
isPR:
- ${{ github.event_name == 'pull_request' }}
exclude:
- toolchain: windows-clang-cl
arch: Win32
- isPR: true
standalone: OFF
steps:
- uses: actions/checkout@v4
- name: Build
- name: Build Visual Studio
if: ${{ matrix.generate == 'Visual Studio 17 2022' }}
run: |
cmake -S . -B "build/x64" -G "Visual Studio 17 2022" -T v142 -A x64 -DCMAKE_BUILD_TYPE:STRING=Release
cmake --build ./build/x64
cmake -S . -B "build/${{ matrix.arch }}" -G "${{ matrix.generate }}" -DCMAKE_TOOLCHAIN_FILE="cmake/toolchain/${{ matrix.toolchain }}.cmake" -DCMAKE_GENERATOR_PLATFORM=${{ matrix.arch }} -DCMAKE_BUILD_TYPE:STRING=${{ matrix.config }} -DPRISM_STANDALONE=${{ matrix.standalone }}
cmake --build ./build/${{ matrix.arch }}
- name: Setup Variables
if: ${{ matrix.generate == 'Ninja' }}
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
- name: Build Ninja
if: ${{ matrix.generate == 'Ninja' }}
run: |
cmake -S . -B "build/${{ matrix.arch }}" -G "${{ matrix.generate }}" -DCMAKE_TOOLCHAIN_FILE="cmake/toolchain/${{ matrix.toolchain }}.cmake" -DCMAKE_BUILD_TYPE:STRING=${{ matrix.config }} -DPRISM_STANDALONE=${{ matrix.standalone }}
cmake --build ./build/${{ matrix.arch }}
- name: Publish packaged artifacts
if: ${{ matrix.config == 'Release' && matrix.generate == 'Visual Studio 17 2022' && matrix.standalone == 'ON' }}
uses: actions/upload-artifact@v4
with:
name: prism-windows-x64
path: build/x64/Debug/prism.exe
name: prism-windows-${{ matrix.arch }}-${{ matrix.config }}
path: build/${{ matrix.arch }}/${{ matrix.config }}/prism.exe
- name: Test
continue-on-error: true
run: |
cd build/x64
cd build/${{ matrix.arch }}
ctest -j -C Debug
- name: Echo Test Results
run: cat build-cmake/Testing/Temporary/LastTest.log
run: cat build/${{ matrix.arch }}/Testing/Temporary/LastTest.log
18 changes: 14 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ if (DEBUG_PARSE)
add_definitions(-DDEBUG_PARSE)
endif()

if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
if(NOT MSVC)
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_CXX_FLAGS "-Wno-narrowing")
Expand All @@ -73,7 +73,6 @@ else()
/W3;
/${LINK_TYPE}
>
/bigobj
/permissive-;
/MP;
${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT};
Expand All @@ -89,11 +88,14 @@ else()
/INCREMENTAL:NO;
/FORCE:MULTIPLE
>
/bigobj;
/MANIFEST:NO;
/DEBUG;
/SUBSYSTEM:CONSOLE
)
if (NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
target_compile_options(${PROJECT_NAME} PRIVATE /bigobj)
target_link_options(${PROJECT_NAME} PRIVATE /bigobj)
endif()

set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
Expand Down Expand Up @@ -121,7 +123,15 @@ if(PRISM_STANDALONE)
target_link_libraries(${PROJECT_NAME} PRIVATE spdlog)
else()
find_package(spdlog QUIET)
target_link_libraries(${PROJECT_NAME} PUBLIC spdlog::spdlog)
if (NOT spdlog_FOUND)
FetchContent_Declare(
spdlog
GIT_REPOSITORY https://github.com/gabime/spdlog.git
GIT_TAG 7e635fca68d014934b4af8a1cf874f63989352b7
)
FetchContent_MakeAvailable(spdlog)
endif()
target_link_libraries(${PROJECT_NAME} PUBLIC spdlog::spdlog)
endif()

if(NOT PRISM_STANDALONE)
Expand Down
3 changes: 3 additions & 0 deletions cmake/toolchain/linux-clang.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set(CMAKE_C_COMPILER /usr/bin/clang)
set(CMAKE_CXX_COMPILER /usr/bin/clang++)
set(CMAKE_LINKER /usr/bin/ld)
3 changes: 3 additions & 0 deletions cmake/toolchain/linux-gnu.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set(CMAKE_C_COMPILER /usr/bin/gcc)
set(CMAKE_CXX_COMPILER /usr/bin/g++)
set(CMAKE_LINKER /usr/bin/ld)
3 changes: 3 additions & 0 deletions cmake/toolchain/macos-clang-llvm.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set(CMAKE_C_COMPILER /opt/homebrew/opt/llvm/bin/clang)
set(CMAKE_CXX_COMPILER /opt/homebrew/opt/llvm/bin/clang++)
set(CMAKE_LINKER /opt/homebrew/opt/lld/bin/lld-link)
Empty file.
2 changes: 2 additions & 0 deletions cmake/toolchain/macos-gnu.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
set(CMAKE_C_COMPILER /usr/bin/gcc)
set(CMAKE_CXX_COMPILER /usr/bin/g++)
7 changes: 7 additions & 0 deletions cmake/toolchain/windows-clang-cl.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
if (CMAKE_GENERATOR MATCHES "Visual Studio")
set(CMAKE_GENERATOR_TOOLSET "clangcl")
else()
set(CMAKE_C_COMPILER clang-cl.exe)
set(CMAKE_CXX_COMPILER clang-cl.exe)
set(CMAKE_LINKER lld-link.exe)
endif()
3 changes: 3 additions & 0 deletions cmake/toolchain/windows-msvc.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
if (CMAKE_GENERATOR MATCHES "Visual Studio")
set(CMAKE_GENERATOR_TOOLSET "v143")
endif()
Loading