forked from NREL/ROSCO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
42 lines (36 loc) · 1.36 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
cmake_minimum_required(VERSION 3.6)
project(ROSCO VERSION 2.1.0 LANGUAGES Fortran)
set(CMAKE_Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/ftnmods")
if (NOT CMAKE_BUILD_TYPE)
# Sets the optimization level to -O2 and includes -g for debugging
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the build type: Debug RelWithDebInfo Release" FORCE)
endif()
message(STATUS "CMAKE_Fortran_COMPILER_ID = ${CMAKE_Fortran_COMPILER_ID}")
if(APPLE OR UNIX)
# Enable .dll export
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -DIMPLICIT_DLLEXPORT -r8 -double_size 64")
else()
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -DIMPLICIT_DLLEXPORT -ffree-line-length-0 -fdefault-real-8 -fdefault-double-8")
endif()
elseif(WIN32 AND MINGW)
# Ensure static linking to avoid requiring Fortran runtime dependencies
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-line-length-0 -static-libgcc -static-libgfortran -static")
endif()
set(SOURCES
src/Constants.f90
src/ControllerBlocks.f90
src/Controllers.f90
src/DISCON.F90
src/ROSCO_Types.f90
src/Filters.f90
src/Functions.f90
src/ReadSetParameters.f90
)
add_library(discon SHARED ${SOURCES})
install(TARGETS discon
EXPORT "${CMAKE_PROJECT_NAME}Libraries"
RUNTIME DESTINATION lib
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)