Skip to content

Commit 107bf91

Browse files
committed
Added CMake support for build, test, and packaging
1 parent 0807196 commit 107bf91

10 files changed

+958
-0
lines changed

CMakeLists.txt

+434
Large diffs are not rendered by default.

LICENSE.rtf

1.78 KB
Binary file not shown.

cmake/FindNSIS.cmake

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Distributed under the OSI-approved MIT License. See accompanying
2+
# file LICENSE for details.
3+
4+
#[=======================================================================[.rst:
5+
FindNSIS
6+
---------
7+
8+
Find ``makensis`` executable.
9+
10+
The module defines the following variables:
11+
12+
``NSIS_MAKE``
13+
path to the ``makensis`` program
14+
15+
``NSIS_VERSION``
16+
version of ``makensis``
17+
18+
``NSIS_FOUND``
19+
"True" if the program ``makensis`` was found
20+
21+
The minimum required version of ``NSIS`` can be specified using the
22+
standard CMake syntax, e.g. :command:`find_package(NSIS 2.1.3)`.
23+
24+
Example usage:
25+
26+
.. code-block:: cmake
27+
28+
find_package(NSIS)
29+
#]=======================================================================]
30+
31+
# Input:
32+
# Set -D "NSIS_BINARY_DIR:PATH=/Program Files (x86)/NSIS" to specify
33+
# directory containing makensis.exe
34+
set(NSIS_BINARY_DIR "/Program Files (x86)/NSIS"
35+
CACHE PATH "Directory containing makensis.exe for NSIS packaging")
36+
37+
# CMake does not allow for braces in $ENV{}, so a temporary variable must be used.
38+
set(PROGRAMFILES_X86 "ProgramFiles(x86)")
39+
40+
find_program(NSIS_MAKE
41+
NAMES makensis
42+
PATHS ${NSIS_BINARY_DIR} $ENV{PROGRAMFILES}/NSIS $ENV{${PROGRAMFILES_X86}}/NSIS
43+
DOC "Path to the makensis executable"
44+
)
45+
46+
if(EXISTS "${NSIS_MAKE}")
47+
execute_process(COMMAND "${NSIS_MAKE}" /VERSION
48+
OUTPUT_VARIABLE NSIS_MAKE_OUTPUT_VARIABLE
49+
OUTPUT_STRIP_TRAILING_WHITESPACE
50+
ERROR_QUIET)
51+
# Version string looks like ""
52+
string(REGEX REPLACE "^.*v([0-9\\.]+)" "\\1" NSIS_VERSION "${NSIS_MAKE_OUTPUT_VARIABLE}")
53+
unset(NSIS_MAKE_OUTPUT_VARIABLE)
54+
endif()
55+
56+
include(FindPackageHandleStandardArgs)
57+
#simple find_package_handle_standard_args(NSIS DEFAULT_MSG NSIS_MAKE)
58+
find_package_handle_standard_args(NSIS
59+
REQUIRED_VARS NSIS_MAKE
60+
VERSION_VAR NSIS_VERSION)
61+
62+
mark_as_advanced(
63+
NSIS_MAKE
64+
)

cmake/FindWIX.cmake

+245
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
# Distributed under the OSI-approved MIT License. See accompanying
2+
# file LICENSE for details.
3+
4+
#[=======================================================================[.rst:
5+
FindWIX
6+
---------
7+
8+
Find components of ``WIX`` package.
9+
10+
The module defines the following variables:
11+
12+
``WIX_FOUND``
13+
"True" if the programs ``candle`` and ``light`` wer found
14+
15+
``WIX_ROOT``
16+
path to the directory containing the ``candle`` program
17+
18+
``WIX_VERSION_STRING``
19+
version of ``candle``
20+
21+
``WIX_CANDLE``
22+
path to the ``candle`` program
23+
24+
``WIX_LIGHT``
25+
path to the ``light`` program
26+
27+
``WIX_DARK``
28+
path to the ``dark`` program
29+
30+
``WIX_HEAT``
31+
path to the ``heat`` program
32+
33+
``WIX_INSIGNIA``
34+
path to the ``insignia`` program
35+
36+
``WIX_LIT``
37+
path to the ``lit`` program
38+
39+
``WIX_LUX``
40+
path to the ``lux`` program
41+
42+
``WIX_MELT``
43+
path to the ``melt`` program
44+
45+
``WIX_NIT``
46+
path to the ``nit`` program
47+
48+
``WIX_PYRO``
49+
path to the ``pyro`` program
50+
51+
``WIX_SHINE``
52+
path to the ``shine`` program
53+
54+
``WIX_SMOKE``
55+
path to the ``smoke`` program
56+
57+
``WIX_THMVIEWER``
58+
path to the ``ThmViewer`` program
59+
60+
``WIX_TORCH``
61+
path to the ``torch`` program
62+
63+
``WIX_WIXCOP``
64+
path to the ``WixCop`` program
65+
66+
The minimum required version of ``WIX`` can be specified using the
67+
standard CMake syntax, e.g. :command:`find_package(WIX 2.1.3)`.
68+
69+
Example usage:
70+
71+
.. code-block:: cmake
72+
73+
find_package(WIX)
74+
#]=======================================================================]
75+
76+
# Original coding
77+
# 2009/02 Petr Pytelka (pyta at lightcomp.cz)
78+
# Retrieved from https://gitlab.kitware.com/cmake/community/-/wikis/contrib/modules/FindWix
79+
#
80+
# WIX homepage has moved to https://wixtoolset.org/
81+
# -- Bob Apthorpe (bob.apthorpe at gmail.com) 20200620
82+
# Cleaned syntax and logic
83+
# -- Bob Apthorpe (bob.apthorpe at gmail.com) 20201012
84+
# Substantially revised and modernized; removeed legacy macros
85+
# -- Bob Apthorpe (bob.apthorpe at gmail.com) 20201020
86+
#
87+
# - Try to find Windows Installer XML
88+
# See http://wix.sourceforge.net
89+
#
90+
# The follwoing variables are optionally searched for defaults
91+
# WIX_ROOT_DIR: Base directory of WIX2 tree to use.
92+
#
93+
# The following are set after configuration is done:
94+
# WIX_FOUND
95+
# WIX_ROOT
96+
# WIX_VERSION_STRING
97+
# WIX_CANDLE
98+
# WIX_LIGHT
99+
# WIX_DARK
100+
# WIX_HEAT
101+
# WIX_INSIGNIA
102+
# WIX_LIT
103+
# WIX_LUX
104+
# WIX_MELT
105+
# WIX_NIT
106+
# WIX_PYRO
107+
# WIX_SHINE
108+
# WIX_SMOKE
109+
# WIX_THMVIEWER
110+
# WIX_TORCH
111+
# WIX_WIXCOP
112+
113+
# Typical root dirs of installations, exactly one of them is used
114+
set(WIX_POSSIBLE_BIN_DIRS
115+
"${WIX_BINARY_DIR}"
116+
"${WIX_ROOT_DIR}/bin"
117+
"$ENV{WIX}/bin"
118+
"$ENV{WIX_ROOT_DIR}/bin"
119+
"$ENV{ProgramFiles}/Windows Installer XML/bin"
120+
"$ENV{ProgramFiles}/WiX Toolset v3.11/bin"
121+
)
122+
123+
# WiX functionality requires at least candle.exe and light.exe
124+
125+
find_program(WIX_CANDLE
126+
NAMES candle
127+
PATHS ${WIX_POSSIBLE_BIN_DIRS}
128+
)
129+
130+
if(EXISTS "${WIX_CANDLE}")
131+
execute_process(COMMAND "${WIX_CANDLE}" -help
132+
OUTPUT_VARIABLE WIX_CANDLE_OUTPUT_VARIABLE
133+
OUTPUT_STRIP_TRAILING_WHITESPACE
134+
ERROR_QUIET)
135+
# First line of help output looks like
136+
# "Windows Installer XML Toolset Compiler version 3.11.2.4516"
137+
# Remaining lines can be dropped; regex fragment ' *\n.*' trims output
138+
string(REGEX REPLACE "^Windows.*version ([0-9\\.]+) *\n.*" "\\1"
139+
WIX_VERSION_STRING "${WIX_CANDLE_OUTPUT_VARIABLE}")
140+
unset(WIX_CANDLE_OUTPUT_VARIABLE)
141+
endif()
142+
143+
# Lesser tools
144+
find_program(WIX_LIGHT
145+
NAMES light
146+
PATHS ${WIX_POSSIBLE_BIN_DIRS}
147+
)
148+
149+
find_program(WIX_DARK
150+
NAMES dark
151+
PATHS ${WIX_POSSIBLE_BIN_DIRS}
152+
)
153+
154+
find_program(WIX_HEAT
155+
NAMES heat
156+
PATHS ${WIX_POSSIBLE_BIN_DIRS}
157+
)
158+
159+
find_program(WIX_INSIGNIA
160+
NAMES insignia
161+
PATHS ${WIX_POSSIBLE_BIN_DIRS}
162+
)
163+
164+
find_program(WIX_LIT
165+
NAMES lit
166+
PATHS ${WIX_POSSIBLE_BIN_DIRS}
167+
)
168+
169+
find_program(WIX_LUX
170+
NAMES lux
171+
PATHS ${WIX_POSSIBLE_BIN_DIRS}
172+
)
173+
174+
find_program(WIX_MELT
175+
NAMES melt
176+
PATHS ${WIX_POSSIBLE_BIN_DIRS}
177+
)
178+
179+
find_program(WIX_NIT
180+
NAMES nit
181+
PATHS ${WIX_POSSIBLE_BIN_DIRS}
182+
)
183+
184+
find_program(WIX_PYRO
185+
NAMES pyro
186+
PATHS ${WIX_POSSIBLE_BIN_DIRS}
187+
)
188+
189+
find_program(WIX_SHINE
190+
NAMES shine
191+
PATHS ${WIX_POSSIBLE_BIN_DIRS}
192+
)
193+
194+
find_program(WIX_SMOKE
195+
NAMES smoke
196+
PATHS ${WIX_POSSIBLE_BIN_DIRS}
197+
)
198+
199+
find_program(WIX_THMVIEWER
200+
NAMES ThmViewer
201+
PATHS ${WIX_POSSIBLE_BIN_DIRS}
202+
)
203+
204+
find_program(WIX_TORCH
205+
NAMES torch
206+
PATHS ${WIX_POSSIBLE_BIN_DIRS}
207+
)
208+
209+
find_program(WIX_WIXCOP
210+
NAMES WixCop
211+
PATHS ${WIX_POSSIBLE_BIN_DIRS}
212+
)
213+
214+
include(FindPackageHandleStandardArgs)
215+
# find_package_handle_standard_args(WIX DEFAULT_MSG
216+
# WIX_CANDLE WIX_LIGHT)
217+
find_package_handle_standard_args(WIX
218+
REQUIRED_VARS WIX_CANDLE WIX_LIGHT
219+
VERSION_VAR WIX_VERSION_STRING)
220+
221+
# Set WiX root directory based on location of candle.exe
222+
if(WIX_FOUND)
223+
# message(STATUS "WiX version: ${WIX_VERSION_STRING}")
224+
get_filename_component(WIX_BINARY_DIR_ "${WIX_CANDLE}" DIRECTORY)
225+
get_filename_component(WIX_ROOT "${WIX_BINARY_DIR_}/.." ABSOLUTE)
226+
endif()
227+
228+
mark_as_advanced(
229+
WIX_ROOT
230+
WIX_CANDLE
231+
WIX_LIGHT
232+
WIX_DARK
233+
WIX_HEAT
234+
WIX_INSIGNIA
235+
WIX_LIT
236+
WIX_LUX
237+
WIX_MELT
238+
WIX_NIT
239+
WIX_PYRO
240+
WIX_SHINE
241+
WIX_SMOKE
242+
WIX_THMVIEWER
243+
WIX_TORCH
244+
WIX_WIXCOP
245+
)

cmake/FortranHelper.cmake

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Detect available compiler options
2+
include(CheckFortranCompilerFlag)
3+
4+
# Set variable name fcopt_name to $fc_flag and fcopt_allowed to 1 (True)
5+
# if $fc_flag is a legal, quiet option to the Fortran compiler
6+
function(set_fcopt fcopt_allowed fcopt_name fc_flag)
7+
check_fortran_compiler_flag("${fc_flag}" ${fcopt_allowed})
8+
if(${${fcopt_allowed}})
9+
set(${fcopt_name} "${fc_flag}" PARENT_SCOPE)
10+
else()
11+
set(${fcopt_name} "" PARENT_SCOPE)
12+
endif()
13+
endfunction()
14+
15+
# Set option flag visibility and values
16+
set_fcopt(FC_ALLOWS_NO_OPTIMIZATION FCOPT_NO_OPTIMIZATION "-O0")
17+
set_fcopt(FC_ALLOWS_DEBUG_OPTIMIZATION FCOPT_DEBUG_OPTIMIZATION "-Og")
18+
# set_fcopt(FC_ALLOWS_STD_LEGACY FCOPT_STD_LEGACY "--std=legacy")
19+
set_fcopt(FC_ALLOWS_WALL FCOPT_WALL "-Wall")
20+
set_fcopt(FC_ALLOWS_BACKTRACE FCOPT_BACKTRACE "-fbacktrace")
21+
set_fcopt(FC_ALLOWS_DEBUG FCOPT_DEBUG "-g")
22+
set_fcopt(FC_ALLOWS_SAVE FCOPT_SAVE "-fno-automatic")
23+
set_fcopt(FC_ALLOWS_FCHECKALL FCOPT_FCHECKALL "-fcheck=all")
24+
25+
set_fcopt(FC_ALLOWS_STD_F2008 FCOPT_STD_F2008 "--std=f2008")
26+
# set_fcopt(FC_ALLOWS_STD_F2018 FCOPT_STD_F2018 "--std=f2018")
27+
28+
# Code coverage options - experimental
29+
set_fcopt(FC_ALLOWS_COVERAGE FCOPT_COVERAGE "--coverage")
30+
set_fcopt(FC_ALLOWS_PROFILE_ARCS FCOPT_PROFILE_ARCS "-fprofile-arcs")
31+
set_fcopt(FC_ALLOWS_TEST_COVERAGE FCOPT_TEST_COVERAGE "-ftest-coverage")
32+
33+
# Add Fortran_MODULE_DIRECTORY for each Fortran library included in a
34+
# target
35+
function(link_fortran_libraries my_target)
36+
target_link_libraries(${my_target} ${ARGN})
37+
foreach(f_lib IN LISTS ARGN)
38+
target_include_directories(${my_target} PUBLIC $<TARGET_PROPERTY:${f_lib},Fortran_MODULE_DIRECTORY>)
39+
endforeach()
40+
endfunction()

files/csv_read_test.out.ref

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
x= 1.0000000000000000 4.0000000000000000
2+
y= 2.0000000000000000 5.0000000000000000
3+
z= 3.0000000000000000 6.0000000000000000
4+
t= T F

0 commit comments

Comments
 (0)