Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/Simulation/Simulators/SparseSimulator/Native/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
cmake_minimum_required(VERSION 3.10)
project(SparseQuantumSimulator)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# Set OpenMp if it is available
find_package(OpenMP REQUIRED)
if(OpenMP_CXX_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
if (OpenMP_CXX_VERSION_MAJOR GREATER_EQUAL 3)
target_compile_definitions(SparseQuantumSimulator PRIVATE DOMP_GE_V3=1)
endif()
endif()



set(CMAKE_MACOSX_RPATH 1)
# Main build files
add_library(SparseQuantumSimulator SHARED factory.cpp capi.cpp)

# Windows adds a special dllexport command which must be defined
if (WIN32)
target_compile_options(SparseQuantumSimulator PUBLIC -fdeclspec)
target_compile_definitions(SparseQuantumSimulator PRIVATE BUILD_DLL=1)
endif()
# Try to optimize with gcc
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(SparseQuantumSimulator PUBLIC -O3 -ftree-vectorize -mavx2 -mfma -fopenmp)
endif()

# Sets NDEBUG to true for all non-debug settings
if (NOT (CMAKE_BUILD_TYPE:STRING STREQUAL "Debug"))
target_compile_definitions(SparseQuantumSimulator PRIVATE NDEBUG=1)
endif()

message("Compiler flags: ${CMAKE_CXX_FLAGS_RELEASE}")
Loading