-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added CMake support for build, test, and packaging
- Loading branch information
Showing
10 changed files
with
958 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Distributed under the OSI-approved MIT License. See accompanying | ||
# file LICENSE for details. | ||
|
||
#[=======================================================================[.rst: | ||
FindNSIS | ||
--------- | ||
Find ``makensis`` executable. | ||
The module defines the following variables: | ||
``NSIS_MAKE`` | ||
path to the ``makensis`` program | ||
``NSIS_VERSION`` | ||
version of ``makensis`` | ||
``NSIS_FOUND`` | ||
"True" if the program ``makensis`` was found | ||
The minimum required version of ``NSIS`` can be specified using the | ||
standard CMake syntax, e.g. :command:`find_package(NSIS 2.1.3)`. | ||
Example usage: | ||
.. code-block:: cmake | ||
find_package(NSIS) | ||
#]=======================================================================] | ||
|
||
# Input: | ||
# Set -D "NSIS_BINARY_DIR:PATH=/Program Files (x86)/NSIS" to specify | ||
# directory containing makensis.exe | ||
set(NSIS_BINARY_DIR "/Program Files (x86)/NSIS" | ||
CACHE PATH "Directory containing makensis.exe for NSIS packaging") | ||
|
||
# CMake does not allow for braces in $ENV{}, so a temporary variable must be used. | ||
set(PROGRAMFILES_X86 "ProgramFiles(x86)") | ||
|
||
find_program(NSIS_MAKE | ||
NAMES makensis | ||
PATHS ${NSIS_BINARY_DIR} $ENV{PROGRAMFILES}/NSIS $ENV{${PROGRAMFILES_X86}}/NSIS | ||
DOC "Path to the makensis executable" | ||
) | ||
|
||
if(EXISTS "${NSIS_MAKE}") | ||
execute_process(COMMAND "${NSIS_MAKE}" /VERSION | ||
OUTPUT_VARIABLE NSIS_MAKE_OUTPUT_VARIABLE | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
ERROR_QUIET) | ||
# Version string looks like "" | ||
string(REGEX REPLACE "^.*v([0-9\\.]+)" "\\1" NSIS_VERSION "${NSIS_MAKE_OUTPUT_VARIABLE}") | ||
unset(NSIS_MAKE_OUTPUT_VARIABLE) | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
#simple find_package_handle_standard_args(NSIS DEFAULT_MSG NSIS_MAKE) | ||
find_package_handle_standard_args(NSIS | ||
REQUIRED_VARS NSIS_MAKE | ||
VERSION_VAR NSIS_VERSION) | ||
|
||
mark_as_advanced( | ||
NSIS_MAKE | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,245 @@ | ||
# Distributed under the OSI-approved MIT License. See accompanying | ||
# file LICENSE for details. | ||
|
||
#[=======================================================================[.rst: | ||
FindWIX | ||
--------- | ||
Find components of ``WIX`` package. | ||
The module defines the following variables: | ||
``WIX_FOUND`` | ||
"True" if the programs ``candle`` and ``light`` wer found | ||
``WIX_ROOT`` | ||
path to the directory containing the ``candle`` program | ||
``WIX_VERSION_STRING`` | ||
version of ``candle`` | ||
``WIX_CANDLE`` | ||
path to the ``candle`` program | ||
``WIX_LIGHT`` | ||
path to the ``light`` program | ||
``WIX_DARK`` | ||
path to the ``dark`` program | ||
``WIX_HEAT`` | ||
path to the ``heat`` program | ||
``WIX_INSIGNIA`` | ||
path to the ``insignia`` program | ||
``WIX_LIT`` | ||
path to the ``lit`` program | ||
``WIX_LUX`` | ||
path to the ``lux`` program | ||
``WIX_MELT`` | ||
path to the ``melt`` program | ||
``WIX_NIT`` | ||
path to the ``nit`` program | ||
``WIX_PYRO`` | ||
path to the ``pyro`` program | ||
``WIX_SHINE`` | ||
path to the ``shine`` program | ||
``WIX_SMOKE`` | ||
path to the ``smoke`` program | ||
``WIX_THMVIEWER`` | ||
path to the ``ThmViewer`` program | ||
``WIX_TORCH`` | ||
path to the ``torch`` program | ||
``WIX_WIXCOP`` | ||
path to the ``WixCop`` program | ||
The minimum required version of ``WIX`` can be specified using the | ||
standard CMake syntax, e.g. :command:`find_package(WIX 2.1.3)`. | ||
Example usage: | ||
.. code-block:: cmake | ||
find_package(WIX) | ||
#]=======================================================================] | ||
|
||
# Original coding | ||
# 2009/02 Petr Pytelka (pyta at lightcomp.cz) | ||
# Retrieved from https://gitlab.kitware.com/cmake/community/-/wikis/contrib/modules/FindWix | ||
# | ||
# WIX homepage has moved to https://wixtoolset.org/ | ||
# -- Bob Apthorpe (bob.apthorpe at gmail.com) 20200620 | ||
# Cleaned syntax and logic | ||
# -- Bob Apthorpe (bob.apthorpe at gmail.com) 20201012 | ||
# Substantially revised and modernized; removeed legacy macros | ||
# -- Bob Apthorpe (bob.apthorpe at gmail.com) 20201020 | ||
# | ||
# - Try to find Windows Installer XML | ||
# See http://wix.sourceforge.net | ||
# | ||
# The follwoing variables are optionally searched for defaults | ||
# WIX_ROOT_DIR: Base directory of WIX2 tree to use. | ||
# | ||
# The following are set after configuration is done: | ||
# WIX_FOUND | ||
# WIX_ROOT | ||
# WIX_VERSION_STRING | ||
# WIX_CANDLE | ||
# WIX_LIGHT | ||
# WIX_DARK | ||
# WIX_HEAT | ||
# WIX_INSIGNIA | ||
# WIX_LIT | ||
# WIX_LUX | ||
# WIX_MELT | ||
# WIX_NIT | ||
# WIX_PYRO | ||
# WIX_SHINE | ||
# WIX_SMOKE | ||
# WIX_THMVIEWER | ||
# WIX_TORCH | ||
# WIX_WIXCOP | ||
|
||
# Typical root dirs of installations, exactly one of them is used | ||
set(WIX_POSSIBLE_BIN_DIRS | ||
"${WIX_BINARY_DIR}" | ||
"${WIX_ROOT_DIR}/bin" | ||
"$ENV{WIX}/bin" | ||
"$ENV{WIX_ROOT_DIR}/bin" | ||
"$ENV{ProgramFiles}/Windows Installer XML/bin" | ||
"$ENV{ProgramFiles}/WiX Toolset v3.11/bin" | ||
) | ||
|
||
# WiX functionality requires at least candle.exe and light.exe | ||
|
||
find_program(WIX_CANDLE | ||
NAMES candle | ||
PATHS ${WIX_POSSIBLE_BIN_DIRS} | ||
) | ||
|
||
if(EXISTS "${WIX_CANDLE}") | ||
execute_process(COMMAND "${WIX_CANDLE}" -help | ||
OUTPUT_VARIABLE WIX_CANDLE_OUTPUT_VARIABLE | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
ERROR_QUIET) | ||
# First line of help output looks like | ||
# "Windows Installer XML Toolset Compiler version 3.11.2.4516" | ||
# Remaining lines can be dropped; regex fragment ' *\n.*' trims output | ||
string(REGEX REPLACE "^Windows.*version ([0-9\\.]+) *\n.*" "\\1" | ||
WIX_VERSION_STRING "${WIX_CANDLE_OUTPUT_VARIABLE}") | ||
unset(WIX_CANDLE_OUTPUT_VARIABLE) | ||
endif() | ||
|
||
# Lesser tools | ||
find_program(WIX_LIGHT | ||
NAMES light | ||
PATHS ${WIX_POSSIBLE_BIN_DIRS} | ||
) | ||
|
||
find_program(WIX_DARK | ||
NAMES dark | ||
PATHS ${WIX_POSSIBLE_BIN_DIRS} | ||
) | ||
|
||
find_program(WIX_HEAT | ||
NAMES heat | ||
PATHS ${WIX_POSSIBLE_BIN_DIRS} | ||
) | ||
|
||
find_program(WIX_INSIGNIA | ||
NAMES insignia | ||
PATHS ${WIX_POSSIBLE_BIN_DIRS} | ||
) | ||
|
||
find_program(WIX_LIT | ||
NAMES lit | ||
PATHS ${WIX_POSSIBLE_BIN_DIRS} | ||
) | ||
|
||
find_program(WIX_LUX | ||
NAMES lux | ||
PATHS ${WIX_POSSIBLE_BIN_DIRS} | ||
) | ||
|
||
find_program(WIX_MELT | ||
NAMES melt | ||
PATHS ${WIX_POSSIBLE_BIN_DIRS} | ||
) | ||
|
||
find_program(WIX_NIT | ||
NAMES nit | ||
PATHS ${WIX_POSSIBLE_BIN_DIRS} | ||
) | ||
|
||
find_program(WIX_PYRO | ||
NAMES pyro | ||
PATHS ${WIX_POSSIBLE_BIN_DIRS} | ||
) | ||
|
||
find_program(WIX_SHINE | ||
NAMES shine | ||
PATHS ${WIX_POSSIBLE_BIN_DIRS} | ||
) | ||
|
||
find_program(WIX_SMOKE | ||
NAMES smoke | ||
PATHS ${WIX_POSSIBLE_BIN_DIRS} | ||
) | ||
|
||
find_program(WIX_THMVIEWER | ||
NAMES ThmViewer | ||
PATHS ${WIX_POSSIBLE_BIN_DIRS} | ||
) | ||
|
||
find_program(WIX_TORCH | ||
NAMES torch | ||
PATHS ${WIX_POSSIBLE_BIN_DIRS} | ||
) | ||
|
||
find_program(WIX_WIXCOP | ||
NAMES WixCop | ||
PATHS ${WIX_POSSIBLE_BIN_DIRS} | ||
) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
# find_package_handle_standard_args(WIX DEFAULT_MSG | ||
# WIX_CANDLE WIX_LIGHT) | ||
find_package_handle_standard_args(WIX | ||
REQUIRED_VARS WIX_CANDLE WIX_LIGHT | ||
VERSION_VAR WIX_VERSION_STRING) | ||
|
||
# Set WiX root directory based on location of candle.exe | ||
if(WIX_FOUND) | ||
# message(STATUS "WiX version: ${WIX_VERSION_STRING}") | ||
get_filename_component(WIX_BINARY_DIR_ "${WIX_CANDLE}" DIRECTORY) | ||
get_filename_component(WIX_ROOT "${WIX_BINARY_DIR_}/.." ABSOLUTE) | ||
endif() | ||
|
||
mark_as_advanced( | ||
WIX_ROOT | ||
WIX_CANDLE | ||
WIX_LIGHT | ||
WIX_DARK | ||
WIX_HEAT | ||
WIX_INSIGNIA | ||
WIX_LIT | ||
WIX_LUX | ||
WIX_MELT | ||
WIX_NIT | ||
WIX_PYRO | ||
WIX_SHINE | ||
WIX_SMOKE | ||
WIX_THMVIEWER | ||
WIX_TORCH | ||
WIX_WIXCOP | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Detect available compiler options | ||
include(CheckFortranCompilerFlag) | ||
|
||
# Set variable name fcopt_name to $fc_flag and fcopt_allowed to 1 (True) | ||
# if $fc_flag is a legal, quiet option to the Fortran compiler | ||
function(set_fcopt fcopt_allowed fcopt_name fc_flag) | ||
check_fortran_compiler_flag("${fc_flag}" ${fcopt_allowed}) | ||
if(${${fcopt_allowed}}) | ||
set(${fcopt_name} "${fc_flag}" PARENT_SCOPE) | ||
else() | ||
set(${fcopt_name} "" PARENT_SCOPE) | ||
endif() | ||
endfunction() | ||
|
||
# Set option flag visibility and values | ||
set_fcopt(FC_ALLOWS_NO_OPTIMIZATION FCOPT_NO_OPTIMIZATION "-O0") | ||
set_fcopt(FC_ALLOWS_DEBUG_OPTIMIZATION FCOPT_DEBUG_OPTIMIZATION "-Og") | ||
# set_fcopt(FC_ALLOWS_STD_LEGACY FCOPT_STD_LEGACY "--std=legacy") | ||
set_fcopt(FC_ALLOWS_WALL FCOPT_WALL "-Wall") | ||
set_fcopt(FC_ALLOWS_BACKTRACE FCOPT_BACKTRACE "-fbacktrace") | ||
set_fcopt(FC_ALLOWS_DEBUG FCOPT_DEBUG "-g") | ||
set_fcopt(FC_ALLOWS_SAVE FCOPT_SAVE "-fno-automatic") | ||
set_fcopt(FC_ALLOWS_FCHECKALL FCOPT_FCHECKALL "-fcheck=all") | ||
|
||
set_fcopt(FC_ALLOWS_STD_F2008 FCOPT_STD_F2008 "--std=f2008") | ||
# set_fcopt(FC_ALLOWS_STD_F2018 FCOPT_STD_F2018 "--std=f2018") | ||
|
||
# Code coverage options - experimental | ||
set_fcopt(FC_ALLOWS_COVERAGE FCOPT_COVERAGE "--coverage") | ||
set_fcopt(FC_ALLOWS_PROFILE_ARCS FCOPT_PROFILE_ARCS "-fprofile-arcs") | ||
set_fcopt(FC_ALLOWS_TEST_COVERAGE FCOPT_TEST_COVERAGE "-ftest-coverage") | ||
|
||
# Add Fortran_MODULE_DIRECTORY for each Fortran library included in a | ||
# target | ||
function(link_fortran_libraries my_target) | ||
target_link_libraries(${my_target} ${ARGN}) | ||
foreach(f_lib IN LISTS ARGN) | ||
target_include_directories(${my_target} PUBLIC $<TARGET_PROPERTY:${f_lib},Fortran_MODULE_DIRECTORY>) | ||
endforeach() | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
x= 1.0000000000000000 4.0000000000000000 | ||
y= 2.0000000000000000 5.0000000000000000 | ||
z= 3.0000000000000000 6.0000000000000000 | ||
t= T F |
Oops, something went wrong.