-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
42 lines (33 loc) · 1.29 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# This project uses pybind11 to create python binding for the NeoPZ library.
# Author: Gustavo Batistela
# Date: 13/09/2019
cmake_minimum_required (VERSION 3.11.0)
set (CMAKE_VERBOSE_MAKEFILE ON)
project (neopz-python)
# NeoPZ
IF (WIN32)
# Prevents timespec redefinition problem with Visual Studio 2015
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_STRUCT_TIMESPEC")
find_package(PZ PATHS "C:/Program Files/PZ" REQUIRED NO_DEFAULT_PATH)
ELSE ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-narrowing")
find_package(PZ REQUIRED)
ENDIF()
include_directories(${PZ_INCLUDE_DIRS})
# pybind11
find_package(pybind11)
# Project related sources
set(SOURCE_DIR "src")
pybind11_add_module(neopz ${SOURCES} "${SOURCE_DIR}/neopz_bindings.cpp")
IF(APPLE)
target_link_libraries(neopz PRIVATE ${PZ_LIBRARIES})
ELSE()
IF(${PZ_USING_MKL})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-narrowing -Wl,--no-as-needed")
find_library(MKL_LIB_DEF NAMES libmkl_def.so libmkl_def.dylib PATHS ${SEARCH_DIRS} /opt/intel/mkl/lib /opt/intel/mkl/lib/intel64/ /softwares/intel/mkl/lib /softwares/intel/mkl/lib/intel64/)
target_link_libraries(neopz PRIVATE ${PZ_LIBRARIES} ${MKL_LIB_DEF})
ELSE()
target_link_libraries(neopz PRIVATE ${PZ_LIBRARIES})
ENDIF()
ENDIF()