From 297202d622757abe724db920de6b5292c0aa43a4 Mon Sep 17 00:00:00 2001
From: Jihadist <tomasiche@gmail.com>
Date: Mon, 21 Nov 2022 13:42:32 +0300
Subject: [PATCH] add github actions

---
 .github/workflows/cmake.yml | 104 ++++++++++++++++++++++++++++++++++++
 CMakeLists.txt              |   4 +-
 2 files changed, 106 insertions(+), 2 deletions(-)
 create mode 100644 .github/workflows/cmake.yml

diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml
new file mode 100644
index 0000000..78daa03
--- /dev/null
+++ b/.github/workflows/cmake.yml
@@ -0,0 +1,104 @@
+name: CMake
+
+on:
+  push:
+    branches: [ "master" ]
+  pull_request:
+    branches: [ "master" ]
+
+env:
+  # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
+  BUILD_TYPE: Release
+
+jobs:
+  build:
+    runs-on: ubuntu-${{ matrix.ubuntu_version }}
+    name: Ubuntu-${{ matrix.ubuntu_version }}-mt-${{ matrix.mt }}
+    strategy:
+      fail-fast: false
+      matrix:
+        ubuntu_version: [20.04, 22.04]
+        mt: [ON, OFF]
+
+    steps:
+    - name: Checkout
+      uses: actions/checkout@v3
+                     
+    - name: Configure CMake
+      run: cmake -DCMAKE_BUILD_TYPE="${{env.BUILD_TYPE}}" -DBUILD_MT_LIBS=${{ matrix.mt }} -DBUILD_CPP=ON -DBUILD_EXAMPLES=ON -DBUILD_F2C=ON -B "${{github.workspace}}/build" 
+
+    - name: Build
+      run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
+      
+  MSVC:
+    name: windows-${{ matrix.win_version }}-mt-${{ matrix.mt }}
+    runs-on: windows-${{ matrix.win_version }}
+    strategy:
+      fail-fast: false
+      matrix:
+        win_version: [2019, 2022]
+        mt: [ON, OFF]
+
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v3   
+
+      - name: Configure CMake
+        run: cmake -DCMAKE_BUILD_TYPE="${{env.BUILD_TYPE}}" -DBUILD_MT_LIBS=${{ matrix.mt }} -DBUILD_CPP=ON -DBUILD_DYNRT_LIBS=ON -B "${{github.workspace}}/build" 
+
+      - name: Build
+        run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
+
+  MinGW-w64:
+    runs-on: windows-2022
+    name: msys2-${{ matrix.msystem }}-mt-${{ matrix.mt }}
+    strategy:
+      fail-fast: false
+      matrix:
+        msystem: [UCRT64, CLANG64]
+        mt: [ON, OFF]
+    defaults:
+      run:
+        shell: msys2 {0}
+
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v3
+
+      - name: Install MinGW-w64 packages
+        uses: msys2/setup-msys2@v2
+        with:
+          msystem: ${{ matrix.msystem }}
+          release: false
+          update: true
+          pacboy: >-
+            cc:p
+            cmake:p
+            ninja:p
+            openmp:p
+
+      - name: Configure CMake
+        run: cmake -DCMAKE_BUILD_TYPE="${{env.BUILD_TYPE}}" -DBUILD_MT_LIBS=${{ matrix.mt }} -DBUILD_CPP=ON -B "${{github.workspace}}/build"
+
+      - name: Build
+        run: cmake --build '${{github.workspace}}/build' --config ${{env.BUILD_TYPE}}
+  macos:
+    runs-on: macos-${{ matrix.macos_version }}
+    name: macos-${{ matrix.macos_version }}
+    strategy:
+      fail-fast: false
+      matrix:
+        macos_version: [11, 12]
+
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v3
+
+      - name: Install OpenMP
+        run: brew install libomp        
+     
+      - name: Configure CMake
+        run: cmake -DCMAKE_BUILD_TYPE="${{env.BUILD_TYPE}}" -DBUILD_CPP=ON -DBUILD_EXAMPLES=ON -DBUILD_F2C=ON -B "${{github.workspace}}/build"
+        
+      - name: Build
+        run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cb29cb1..745ad37 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -306,7 +306,7 @@ macro(createSingleASL name sourcedir sources)
   if(MSVC)
     if(${name} MATCHES "dynrt")
 	set_property(TARGET ${name} PROPERTY
-	    MSVC_RUNTIME_LIBRARY "MultiThreadedDLL$<$<CONFIG:Debug>:Debug>")
+            MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
     else()
 	set_property(TARGET ${name} PROPERTY
 	    MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
@@ -433,4 +433,4 @@ if(NOT ASL_SKIP_INSTALL)
       install(TARGETS aslcpp EXPORT ampl-asl-config DESTINATION lib  COMPONENT asl)
   endif()
   install(EXPORT ampl-asl-config DESTINATION share/ampl-asl COMPONENT asl)
-endif()
\ No newline at end of file
+endif()