diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..90d3e7b --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,62 @@ +name: Build + +on: + push: + branches: [main] + pull_request: + branches: [main] + workflow_dispatch: + +jobs: + build: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + + - uses: Jimver/cuda-toolkit@v0.2.30 + id: cuda-toolkit + with: + cuda: "13.1.0" + + - name: CUDA info + run: | + echo "Installed cuda version is: ${{ steps.cuda-toolkit.outputs.cuda }}" + echo "Cuda install location: ${{ steps.cuda-toolkit.outputs.CUDA_PATH }}" + nvcc -V + + - name: Install build deps (Linux) + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y ninja-build zlib1g-dev + + - name: Configure (Linux) + if: runner.os == 'Linux' + run: | + cmake -B build -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCUPDLPX_BUILD_TESTS=OFF + + - name: Build (Linux) + if: runner.os == 'Linux' + run: | + cmake --build build --clean-first + + - name: Configure (Windows) + if: runner.os == 'Windows' + shell: pwsh + run: | + cmake -B build ` + -DCMAKE_CONFIGURATION_TYPES=Release ` + -DCUPDLPX_BUILD_TESTS=OFF + + - name: Build (Windows) + if: runner.os == 'Windows' + shell: pwsh + run: | + cmake --build build --clean-first --config Release diff --git a/CMakeLists.txt b/CMakeLists.txt index f3a3cd8..5e35150 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,10 @@ set(CUPDLPX_VERSION_PATCH 5) set(CUPDLPX_VERSION "${CUPDLPX_VERSION_MAJOR}.${CUPDLPX_VERSION_MINOR}.${CUPDLPX_VERSION_PATCH}") add_compile_definitions(CUPDLPX_VERSION="${CUPDLPX_VERSION}") +if (WIN32) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +endif() + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF) # C/C++ standards @@ -31,7 +35,12 @@ if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES) endif() # Global Compile flags (corresponding to CFLAGS/NVCCFLAGS) -add_compile_options(-O3 -Wall -Wextra -g) +if(MSVC) + add_compile_options(/O2 /W4 /Zi) +else() + add_compile_options(-O3 -Wall -Wextra -g) +endif() + if (NOT WIN32) add_compile_options(-fPIC) endif()