Skip to content

Commit c333f65

Browse files
authored
Add build action (#76)
* add build action * correct folder name * test * update CMakeLists.txt * update os version * update config
1 parent 9709dfe commit c333f65

2 files changed

Lines changed: 72 additions & 1 deletion

File tree

.github/workflows/build.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-latest, windows-latest]
16+
runs-on: ${{ matrix.os }}
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- uses: Jimver/cuda-toolkit@v0.2.30
22+
id: cuda-toolkit
23+
with:
24+
cuda: "13.1.0"
25+
26+
- name: CUDA info
27+
run: |
28+
echo "Installed cuda version is: ${{ steps.cuda-toolkit.outputs.cuda }}"
29+
echo "Cuda install location: ${{ steps.cuda-toolkit.outputs.CUDA_PATH }}"
30+
nvcc -V
31+
32+
- name: Install build deps (Linux)
33+
if: runner.os == 'Linux'
34+
run: |
35+
sudo apt-get update
36+
sudo apt-get install -y ninja-build zlib1g-dev
37+
38+
- name: Configure (Linux)
39+
if: runner.os == 'Linux'
40+
run: |
41+
cmake -B build -G Ninja \
42+
-DCMAKE_BUILD_TYPE=Release \
43+
-DCUPDLPX_BUILD_TESTS=OFF
44+
45+
- name: Build (Linux)
46+
if: runner.os == 'Linux'
47+
run: |
48+
cmake --build build --clean-first
49+
50+
- name: Configure (Windows)
51+
if: runner.os == 'Windows'
52+
shell: pwsh
53+
run: |
54+
cmake -B build `
55+
-DCMAKE_CONFIGURATION_TYPES=Release `
56+
-DCUPDLPX_BUILD_TESTS=OFF
57+
58+
- name: Build (Windows)
59+
if: runner.os == 'Windows'
60+
shell: pwsh
61+
run: |
62+
cmake --build build --clean-first --config Release

CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ set(CUPDLPX_VERSION_PATCH 5)
1313
set(CUPDLPX_VERSION "${CUPDLPX_VERSION_MAJOR}.${CUPDLPX_VERSION_MINOR}.${CUPDLPX_VERSION_PATCH}")
1414
add_compile_definitions(CUPDLPX_VERSION="${CUPDLPX_VERSION}")
1515

16+
if (WIN32)
17+
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
18+
endif()
19+
1620
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF)
1721

1822
# C/C++ standards
@@ -31,7 +35,12 @@ if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
3135
endif()
3236

3337
# Global Compile flags (corresponding to CFLAGS/NVCCFLAGS)
34-
add_compile_options(-O3 -Wall -Wextra -g)
38+
if(MSVC)
39+
add_compile_options(/O2 /W4 /Zi)
40+
else()
41+
add_compile_options(-O3 -Wall -Wextra -g)
42+
endif()
43+
3544
if (NOT WIN32)
3645
add_compile_options(-fPIC)
3746
endif()

0 commit comments

Comments
 (0)