forked from fpde/fpde2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
78 lines (66 loc) · 2.56 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Main CMake config file for fpde2 project
# @todo move compiler selecting, flag settings stuff out of this file
# @todo design a better test machine (which will select some predefined
# types of tests for different files)
cmake_minimum_required(VERSION 2.8)
# project name and language
project( fpde2 Fortran )
# library name
set(project_lib_name "${CMAKE_PROJECT_NAME}")
# @todo add VERSION and SOVERSION of fpde2 (in future)
message(STATUS "Building up ${CMAKE_PROJECT_NAME}")
# selecting Fortran compiler
include(CMakeForceCompiler)
# commented since this instruction does not seems
# to work with cmake 2.8
# cmake_force_fortran_compiler(ifort "Intel")
# the tools for creating libraries
# selecting archiver
find_program(xiar xiar)
if(xiar)
set(CMAKE_AR "${xiar}")
set(CMAKE_RANLIB "${xiar}")
endif(xiar)
mark_as_advanced(xiar)
#SET (CMAKE_C_ARCHIVE_APPEND "echo append")
# selecting linker
find_program(xild xild)
if(xild)
set(CMAKE_LINKER "${xild}")
endif(xild)
mark_as_advanced(xild)
# printing some software info
message(STATUS "Fortran compiler: ${CMAKE_Fortran_COMPILER_ID}")
message(STATUS "Fortran compiler: ${CMAKE_Fortran_COMPILER}")
message(STATUS "Archiver: ${CMAKE_AR}")
message(STATUS "Linker: ${CMAKE_LINKER}")
message(STATUS ${os})
SET (CMAKE_Fortran_CREATE_STATIC_LIBRARY "<CMAKE_AR> cru <LINK_FLAGS> <TARGET> <OBJECTS>")
# message(STATUS "${CMAKE_Fortran_CREATE_STATIC_LIBRARY}")
# variables used in out of source build
set( LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/lib )
# .mod files output directory (fortran specific)
set( CMAKE_Fortran_MODULE_DIRECTORY ${LIBRARY_OUTPUT_PATH}/mod)
# add the above path to include path
include_directories(${LIBRARY_OUTPUT_PATH})
# Set the compiler flags using a configuration file
set(Fortran90_FLAGS "@${PROJECT_SOURCE_DIR}/config/ifort/compiler.cfg")
set(Fortran90_LFLAGS "@${PROJECT_SOURCE_DIR}/config/ifort/linker.cfg")
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/config ${CMAKE_MODULE_PATH})
# set external libraries required by this project
find_package(LuaJIT REQUIRED)
add_definitions("-Dluajit")
find_package(MKL REQUIRED)
include_directories(${MKL_INCLUDE_DIRS})
# define linker flags
set(libs ${LUAJIT_LIBRARY}; ${MKL_LIBRARIES})
# add a subdirectory with source files for the project
add_subdirectory(src)
# subdirectory with examples
add_subdirectory(example EXCLUDE_FROM_ALL)
# subdirectory with atomic tests
add_subdirectory(atomic EXCLUDE_FROM_ALL)
# subdirectory with tests
add_subdirectory(test)
include(${PROJECT_SOURCE_DIR}/test/CMakeTests.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/config/doxygen.cmake)