summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Niklas Hasse <jhasse@bixense.com>2020-01-18 12:53:28 +0100
committerGitHub <noreply@github.com>2020-01-18 12:53:28 +0100
commite6d5140022ca8a634ab50fb135e52d84bb1762b5 (patch)
tree3b95c22dbee817e70ea709f92edda0949f0ddbe2
parentd986e4db5630cf1c5547e69b5556f006f7d3444a (diff)
parente0f4e3406d173a82ed62afd09ff063ae98ecf17a (diff)
downloadninja-e6d5140022ca8a634ab50fb135e52d84bb1762b5.tar.gz
Merge pull request #1719 from jhasse/cmake-static-msvc
CMake: Use static MSVC runtime, fixes #1692
-rw-r--r--.github/workflows/macos.yml (renamed from .github/workflows/release-ninja-binaries.yml)27
-rw-r--r--.github/workflows/windows.yml49
-rw-r--r--CMakeLists.txt4
3 files changed, 58 insertions, 22 deletions
diff --git a/.github/workflows/release-ninja-binaries.yml b/.github/workflows/macos.yml
index 8c1e0af..2a7c100 100644
--- a/.github/workflows/release-ninja-binaries.yml
+++ b/.github/workflows/macos.yml
@@ -1,4 +1,4 @@
-name: Release Ninja Binaries
+name: macOS
on:
pull_request:
@@ -8,26 +8,13 @@ on:
jobs:
build:
- runs-on: ${{ matrix.os }}
- strategy:
- matrix:
- os: [macOS-latest, windows-latest]
- include:
- - os: macOS-latest
- zip_name: ninja-mac
- - os: windows-latest
- zip_name: ninja-win
+ runs-on: macOS-latest
steps:
- uses: actions/checkout@v1
- # Install OS specific dependencies
- - name: Install macOS dependencies
- if: matrix.os == 'macOS-latest'
+ - name: Install dependencies
run: brew install re2c p7zip cmake
- - name: Install Windows dependencies
- if: matrix.os == 'windows-latest'
- run: choco install re2c
- name: Build ninja
shell: bash
@@ -39,11 +26,9 @@ jobs:
- name: Create ninja archive
shell: bash
- env:
- ZIP_NAME: ${{ matrix.zip_name }}
run: |
mkdir artifact
- 7z a artifact/${ZIP_NAME}.zip $(find ./build -name ninja -or -name ninja.exe)
+ 7z a artifact/ninja-mac.zip ./build/ninja
# Upload ninja binary archive as an artifact
- name: Upload artifact
@@ -59,6 +44,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
- asset_path: ./artifact/${{ matrix.zip_name }}.zip
- asset_name: ${{ matrix.zip_name }}.zip
+ asset_path: ./artifact/ninja-mac.zip
+ asset_name: ninja-mac.zip
asset_content_type: application/zip
diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml
new file mode 100644
index 0000000..bdec6c9
--- /dev/null
+++ b/.github/workflows/windows.yml
@@ -0,0 +1,49 @@
+name: Windows
+
+on:
+ pull_request:
+ push:
+ release:
+ types: published
+
+jobs:
+ build:
+ runs-on: windows-latest
+
+ steps:
+ - uses: actions/checkout@v1
+
+ - name: Install dependencies
+ run: choco install re2c
+
+ - name: Build ninja
+ shell: bash
+ run: |
+ mkdir build && cd build
+ cmake -DCMAKE_BUILD_TYPE=Release ..
+ cmake --build . --parallel --config Release
+ ctest -vv
+
+ - name: Create ninja archive
+ shell: bash
+ run: |
+ mkdir artifact
+ 7z a artifact/ninja-win.zip ./build/Release/ninja.exe
+
+ # Upload ninja binary archive as an artifact
+ - name: Upload artifact
+ uses: actions/upload-artifact@v1
+ with:
+ name: ninja-binary-archives
+ path: artifact
+
+ - name: Upload release asset
+ if: github.event.action == 'published'
+ uses: actions/upload-release-asset@v1.0.1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ upload_url: ${{ github.event.release.upload_url }}
+ asset_path: ./artifact/ninja-win.zip
+ asset_name: ninja-win.zip
+ asset_content_type: application/zip
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e9f6563..60fd8a1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,5 @@
-cmake_minimum_required(VERSION 3.12)
+cmake_minimum_required(VERSION 3.15)
+cmake_policy(SET CMP0091 NEW)
project(ninja)
if(CMAKE_BUILD_TYPE MATCHES "Release")
@@ -15,6 +16,7 @@ if(CMAKE_BUILD_TYPE MATCHES "Release")
endif()
if(MSVC)
+ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /GR- /Zc:__cplusplus")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -fdiagnostics-color")