ftnlf

Check-in [a7938cc2b8]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Factor out ftnlf library (need to test under Windows).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:a7938cc2b861c74285a817f7188fce1034914340
User & Date: vadim 2018-05-08 10:38:19
Context
2018-05-08
15:47
Make public FA metatable id. check-in: 9fe618515b user: vadim tags: trunk
10:38
Factor out ftnlf library (need to test under Windows). check-in: a7938cc2b8 user: vadim tags: trunk
2018-05-07
08:31
Merge "multi" version. check-in: 524d1fe4c9 user: vadim tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to CMakeLists.txt.

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
..
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
if(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
	set (LFLAGS "-mkl -static-intel")
	if(CMAKE_BUILD_TYPE STREQUAL "Release")
		set (FCFLAGS "-fp-model precise -xHOST -O2") 
	else()
		set (FCFLAGS "-fp-model precise -g -O0 -C -traceback")
	endif()
	set (FCFLAGS90 "-warn -ipo")
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
	if(MINGW)
		#	set (LFLAGS "-static-libgcc -static-libgfortran -Wl,-s")
		set (LFLAGS "-static-libgcc -static-libgfortran")
	else()		
		set (LFLAGS "")
	endif()
................................................................................

add_custom_command(
	OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/luaf_conf.fi
	COMMAND genconf > luaf_conf.fi
	DEPENDS genconf
	)

set (src
	test.f90
	ftnlf.f90
	ftnlf_fxcore.f90
	luaf/luaf.f90
	luaf/luafe.f90
	${CMAKE_CURRENT_BINARY_DIR}/luaf_conf.fi
	)









add_executable(ftnlf_test ${src})
# Link static
target_link_libraries(ftnlf_test ${LUA_STATIC_LIB} ${CMAKE_DL_LIBS})
# Link dynamic
# target_link_libraries(ftnlf ${LUA_LIBRARIES})
set_target_properties(ftnlf_test PROPERTIES COMPILE_FLAGS "${FCFLAGS} ${FCFLAGS90}")
set_target_properties(ftnlf_test PROPERTIES LINK_FLAGS "${LFLAGS}")


# set_target_properties(ftnlf PROPERTIES PREFIX "")

# Ad-hoc
set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "")
set(CMAKE_Fortran_FLAGS_RELEASE "")







|







 







|
<







>
>
>
>
>
>
>
>
|

|




>
>





19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
..
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
79
80
81
82
if(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
	set (LFLAGS "-mkl -static-intel")
	if(CMAKE_BUILD_TYPE STREQUAL "Release")
		set (FCFLAGS "-fp-model precise -xHOST -O2") 
	else()
		set (FCFLAGS "-fp-model precise -g -O0 -C -traceback")
	endif()
	set (FCFLAGS90 "-warn")
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
	if(MINGW)
		#	set (LFLAGS "-static-libgcc -static-libgfortran -Wl,-s")
		set (LFLAGS "-static-libgcc -static-libgfortran")
	else()		
		set (LFLAGS "")
	endif()
................................................................................

add_custom_command(
	OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/luaf_conf.fi
	COMMAND genconf > luaf_conf.fi
	DEPENDS genconf
	)

set (src_lib

	ftnlf.f90
	ftnlf_fxcore.f90
	luaf/luaf.f90
	luaf/luafe.f90
	${CMAKE_CURRENT_BINARY_DIR}/luaf_conf.fi
	)

set (src_test
	test.f90
	)

add_library(ftnlf STATIC ${src_lib})
set_target_properties(ftnlf PROPERTIES COMPILE_FLAGS "${FCFLAGS} ${FCFLAGS90}")
set_target_properties(ftnlf PROPERTIES INTERPROCEDURAL_OPTIMIZATION 1)

add_executable(ftnlf_test ${src_test})
# Link static
target_link_libraries(ftnlf_test ftnlf ${LUA_STATIC_LIB} ${CMAKE_DL_LIBS})
# Link dynamic
# target_link_libraries(ftnlf ${LUA_LIBRARIES})
set_target_properties(ftnlf_test PROPERTIES COMPILE_FLAGS "${FCFLAGS} ${FCFLAGS90}")
set_target_properties(ftnlf_test PROPERTIES LINK_FLAGS "${LFLAGS}")
# set_target_properties(ftnlf PROPERTIES PREFIX "")

# set_target_properties(ftnlf PROPERTIES PREFIX "")

# Ad-hoc
set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "")
set(CMAKE_Fortran_FLAGS_RELEASE "")

Changes to ftnlf_fxcore.f90.

218
219
220
221
222
223
224

225
226
227
228
229
230
231
                call lua_pop(L, 1)
                s = nargs
                ! push size
                call lua_pushinteger(L, s)
            elseif (typ == LUA_TNUMBER) then
                s = lua_tointeger(L, -1)
            else

                r = luaL_argerror(L, nlast, F_C_STR('invalid value'))
            end if
            
            ! create new Fortran array of requested size
            call lua_pushcfunction(L, c_funloc(l_fa_new))
            call lua_insert(L, -2)
            call lua_call(L, 1, 1)







>







218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
                call lua_pop(L, 1)
                s = nargs
                ! push size
                call lua_pushinteger(L, s)
            elseif (typ == LUA_TNUMBER) then
                s = lua_tointeger(L, -1)
            else
                s = 0
                r = luaL_argerror(L, nlast, F_C_STR('invalid value'))
            end if
            
            ! create new Fortran array of requested size
            call lua_pushcfunction(L, c_funloc(l_fa_new))
            call lua_insert(L, -2)
            call lua_call(L, 1, 1)