Skip to content

Commit

Permalink
v3.4.0 (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
TysonRayJones authored Oct 10, 2021
2 parents df2861f + a1494e0 commit e539ef3
Show file tree
Hide file tree
Showing 16 changed files with 744 additions and 246 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/windows-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Windows build

on:
push:
branches:
- master
- develop
pull_request:
branches:
- '**'

jobs:

gnumake-build:
name: GNUMake test of demo on Windows MSVC
runs-on: windows-latest
strategy:
matrix:
float-precision: [2]

steps:
- uses: actions/checkout@v2
- uses: ilammy/msvc-dev-cmd@v1
- name: get example code
shell: cmd
run: |
copy examples\makefile .
copy examples\tutorial_example.c .
- name: compile example
shell: cmd
run: make COMPILER=cl COMPILER_TYPE=MSVC WINDOWS_ARCH=64 EXE=demotest PRECISION=${{matrix.float-precision}}
- name: run example
shell: cmd
run: demotest.exe

cmake-nmake-build:
name: CMake with NMake test of demo on Windows MSVC
runs-on: windows-latest
strategy:
matrix:
float-precision: [2]

steps:
- uses: actions/checkout@v2
- uses: ilammy/msvc-dev-cmd@v1
- name: make build directory
shell: cmd
run: mkdir build_dir
- name: cmake configure
shell: cmd
run: cmake .. -G "NMake Makefiles" -DOUTPUT_EXE="demotest.exe" -DPRECISION:STRING=${{matrix.float-precision}}
working-directory: build_dir
- name: nmake build
shell: cmd
run: nmake
working-directory: build_dir
39 changes: 24 additions & 15 deletions QuEST/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ if (${MULTITHREADED} AND NOT ${GPUACCELERATED})
set(OpenMP_C_VERSION ${OpenMP_C_VERSION} CACHE STRING "OpenMP C version")

# MSVC, for instance, only implements OpenMP 2.0 (as of 2019)
if (OpenMP_C_VERSION VERSION_LESS "3.1") # todo find the real minimum required
if (OpenMP_C_VERSION VERSION_LESS "2.0") # todo find the real minimum required
set(MULTITHREADED 0)
message(WARNING "Found OpenMP ${OpenMP_C_VERSION} but this is too \
old. Turning OpenMP support OFF.")
Expand Down Expand Up @@ -173,9 +173,7 @@ endif()
# ----- C COMPILER FLAGS --------------------------------------------------

# set C flags that are common between compilers and build types
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \
-std=c99"
)
set (CMAKE_C_STANDARD 99)

# Use -O2 for all but debug mode by default
if (NOT("${CMAKE_BUILD_TYPE}" STREQUAL "Debug"))
Expand All @@ -184,16 +182,19 @@ if (NOT("${CMAKE_BUILD_TYPE}" STREQUAL "Debug"))
)
endif()

# Set c flags to use in debug mode

if (NOT("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC"))
set(CMAKE_C_FLAGS_DEBUG
"-g"
)
endif()

# Set c flags for release
set(CMAKE_C_FLAGS_RELEASE
"-O2"
)

# Set c flags to use in debug mode
set(CMAKE_C_FLAGS_DEBUG
"-g"
)

# TODO standardize
# set C compiler flags based on compiler type
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
Expand All @@ -213,14 +214,17 @@ elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel")
)
elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
# using Visual Studio
string(REGEX REPLACE "/W3" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
string(REGEX REPLACE "-W3" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \
-w"
)
endif()

# ----- C++ COMPILER FLAGS --------------------------------------------------

# set C++ flags that are common between compilers and build types
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
-std=c++98 -Wall"
)
set (CMAKE_CXX_STANDARD 98)

# Use -O2 for all but debug mode by default
if (NOT("${CMAKE_BUILD_TYPE}" STREQUAL "Debug"))
Expand All @@ -243,20 +247,25 @@ set(CMAKE_CXX_FLAGS_DEBUG
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# using Clang
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
-mavx"
-mavx -Wall"
)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# using GCC
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
-mavx"
-mavx -Wall"
)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
# using Intel
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
-xAVX -axCORE-AVX2 -diag-disable -cpu-dispatch"
-xAVX -axCORE-AVX2 -diag-disable -cpu-dispatch -Wall"
)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# using Visual Studio
string(REGEX REPLACE "/W3" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
string(REGEX REPLACE "-W3" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
-w"
)
endif()

if (VERBOSE_CMAKE)
Expand Down
Loading

0 comments on commit e539ef3

Please sign in to comment.