CMakeLists.txt 1023 Bytes
Newer Older
Mozul Rémy's avatar
Mozul Rémy committed
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

cmake_minimum_required(VERSION 2.8.0)
project(Forthon Fortran C)

set(LIBRARY_OUTPUT_PATH            ${CMAKE_BINARY_DIR}/lib)
set(EXECUTABLE_OUTPUT_PATH         ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/modules)

set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR})

find_package(PythonLibs REQUIRED)
find_package(Numpy REQUIRED)
find_program(cython cython)

add_library(f_dtype mod_dtype.f90)

add_custom_target(dtypec ALL ${cython} ${CMAKE_CURRENT_SOURCE_DIR}/dtype.pyx -o ${CMAKE_CURRENT_BINARY_DIR}/dtype.c
                  DEPENDS dtype dtype.h dtype.pxd
                 )

include_directories(${PYTHON_INCLUDE_DIR} 
                    ${NUMPY_INCLUDE_DIR}
                    ${CMAKE_CURRENT_SOURCE_DIR}
                   )
add_library(dtype SHARED dtype.c)
target_link_libraries(dtype f_dtype ${PYTHON_LIBRARIES})

set_target_properties(dtype PROPERTIES PREFIX "")
set_target_properties(dtype PROPERTIES SUFFIX ".so")
set_source_files_properties(dtype.c PROPERTIES GENERATED TRUE )