Skip to content

Commit

Permalink
Squashed 'metaconfigure/' changes from d584ae2..77be710
Browse files Browse the repository at this point in the history
77be710 Merge pull request #22 from njoy/feature/cleanup
7e115a7 Merge pull request #23 from njoy/feature/c++17
4fc7d82 Adding C++17 as C++ standard option.
c2821b4 Just some small tweaks to fix spelling errors, and have no trailing whitespace on lines.
7fdf466 Merge pull request #21 from njoy/feature/signature
8d80475 Reverting some commands to make compatible wih Python 3.4
3ec3d00 Merge pull request #20 from njoy/feature/signature
61c791b Responding to Pull Request comments.
a49258c Adding ability to do configuration files.
1fadec5 Adding ability to generate a signature.
d6993d8 Making signature compatible with Python3
900549f Merge pull request #15 from njoy/feature/python3_to_python
a348df3 Merge pull request #16 from njoy/feature/WindowsyLinux
24cd40e Added subobject linkage error exception in common flags.
b3d6955 Merged.
f22bae2 Adding Windows options for Cygwin and MinGW.
41786f5 Added check in CMakeLists.txt generated by cmake.py for python version.
e72a44f Added version check of Git in constructed CMakeLists.txt.
0748844 Windows/Cygwin testing.
597ff74 Changing python3 to python.
ca6c308 Added MinGW and CYGWIN environments to metaconfigure.
ff293c6 Update cmake.py
6bda6e9 Update configuration.py
69647ab Update cmake.py
730615a Update index.md

git-subtree-dir: metaconfigure
git-subtree-split: 77be71034605196b158c64aa57a0e9b21696cf62
  • Loading branch information
jlconlin committed Feb 18, 2020
1 parent 3372fed commit 9e902dc
Show file tree
Hide file tree
Showing 10 changed files with 214 additions and 138 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ Additionally, redistribution and use in source and binary forms, with or without
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of Los Alamos National Security, LLC, Los Alamos National Laboratory, LANL, the U.S. Government, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
236 changes: 148 additions & 88 deletions cmake.py

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions collect_subprojects.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def traverse_dependencies( destination, traversed ):
"""
if not os.path.isdir( dependency_directory() ):
return

os.chdir( dependency_directory() )

for dependency in os.listdir( os.getcwd() ) :
Expand All @@ -48,14 +48,14 @@ def traverse_dependencies( destination, traversed ):

traverse_dependencies( destination, traversed )
os.chdir( ".." )

os.chdir( os.path.join( ".." ) )

def collect_subprojects():
destination = os.path.join( os.getcwd(), "subprojects" )
if not os.path.isdir( destination ):
os.makedirs( destination )

traverse_dependencies( destination, set() )

collect_subprojects()
37 changes: 30 additions & 7 deletions configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,23 @@

languages = {'c' : {}, 'c++' : {}, 'fortran' : {} }

for langauge in languages.keys():
languages[langauge]['file extension'] = {}
languages[langauge]['compiler'] = {}
for language in languages.keys():
languages[language]['file extension'] = {}
languages[language]['compiler'] = {}

languages['c']['standards'] = ['c89', 'c99', 'c11']
languages['c++']['standards'] = ['c++98', 'c++11', 'c++14']
languages['c++']['standards'] = ['c++98', 'c++11', 'c++14', 'c++17']
languages['fortran']['standards'] = ['fortran77', 'fortran90', 'fortran95', 'fortran2003', 'fortran2008']

languages['c']['file extension']['implementation files'] = ['c']
languages['c']['file extension']['header files'] = ['h']
languages['c++']['file extension']['implementation files'] = ['c++', 'cxx', 'cpp', 'cc']
languages['c']['file extension']['configure files'] = ['in']
languages['c++']['file extension']['implementation files'] = ['c++', 'cxx', 'cpp', 'cc', 'C']
languages['c++']['file extension']['header files'] = ['h++', 'hxx', 'hpp', 'hh', 'h']
languages['c++']['file extension']['configure files'] = ['in']
languages['fortran']['file extension']['implementation files'] = ['f', 'for', 'f90']

languages['fortran']['file extension']['configure files'] = ['in']

languages['c']['compiler']['gcc'] = {}
languages['c']['compiler']['llvm clang'] = {}
languages['c']['compiler']['apple clang'] = {}
Expand All @@ -25,16 +28,22 @@
languages['fortran']['compiler']['gfortran'] = {}

languages['c']['compiler']['gcc']['linux'] = {}
languages['c']['compiler']['gcc']['cygwin'] = languages['c']['compiler']['gcc']['linux']
languages['c']['compiler']['gcc']['mingw'] = languages['c']['compiler']['gcc']['linux']
languages['c']['compiler']['gcc']['osx'] = languages['c']['compiler']['gcc']['linux']
languages['c']['compiler']['gcc']['windows'] = languages['c']['compiler']['gcc']['linux']
languages['c']['compiler']['llvm clang']['linux'] = languages['c']['compiler']['gcc']['linux']
languages['c']['compiler']['llvm clang']['osx'] = languages['c']['compiler']['gcc']['linux']
languages['c']['compiler']['llvm clang']['windows'] = languages['c']['compiler']['gcc']['linux']
languages['c']['compiler']['llvm clang']['cygwin'] = languages['c']['compiler']['gcc']['linux']
languages['c']['compiler']['llvm clang']['mingw'] = languages['c']['compiler']['gcc']['linux']
languages['c']['compiler']['apple clang']['osx'] = languages['c']['compiler']['gcc']['linux']

languages['fortran']['compiler']['gfortran']['linux'] = {}
languages['fortran']['compiler']['gfortran']['osx'] = languages['fortran']['compiler']['gfortran']['linux']
languages['fortran']['compiler']['gfortran']['windows'] = languages['fortran']['compiler']['gfortran']['linux']
languages['fortran']['compiler']['gfortran']['cygwin'] = languages['fortran']['compiler']['gfortran']['linux']
languages['fortran']['compiler']['gfortran']['mingw'] = languages['fortran']['compiler']['gfortran']['linux']

languages['c']['compiler']['gcc']['linux']['standard'] = {'c89' : '-std=c90',
'c99' : '-std=c99',
Expand All @@ -43,7 +52,8 @@
languages['c++']['compiler']['g++']['linux'] = {}
languages['c++']['compiler']['g++']['linux']['standard'] = {'c++98' : '-std=c++98',
'c++11' : '-std=c++11',
'c++14' : '-std=c++14'}
'c++14' : '-std=c++14',
'c++17' : '-std=c++17'}

languages['fortran']['compiler']['gfortran']['linux']['standard'] = {'fortran77' : '-std=legacy' ,
'fortran95' : '-std=f95',
Expand Down Expand Up @@ -93,13 +103,26 @@
languages['fortran']['compiler']['gfortran']['linux']['flags']['profile use'] = languages['c']['compiler']['gcc']['linux']['flags']['profile use']

languages['c++']['compiler']['g++']['linux']['flags'] = copy.deepcopy( languages['c']['compiler']['gcc']['linux']['flags'] )
languages['c++']['compiler']['g++']['linux']['flags']['common'].append('-Wno-subobject-linkage')
languages['c++']['compiler']['g++']['osx'] = copy.deepcopy( languages['c++']['compiler']['g++']['linux'] )
languages['c++']['compiler']['g++']['cygwin'] = copy.deepcopy( languages['c++']['compiler']['g++']['linux'] )
languages['c++']['compiler']['g++']['mingw'] = copy.deepcopy( languages['c++']['compiler']['g++']['linux'] )
languages['c++']['compiler']['g++']['windows'] = languages['c++']['compiler']['g++']['linux']

languages['c++']['compiler']['llvm clang++'] = copy.deepcopy( languages['c++']['compiler']['g++'])
languages['c++']['compiler']['llvm clang++']['linux']['flags']['common'] = ['-stdlib=libstdc++']
languages['c++']['compiler']['llvm clang++']['linux']['flags']['debug'].remove('-fsignaling-nans')

languages['c++']['compiler']['llvm clang++']['cygwin']['standard'] = {'c++98' : '-std=gnu++98',
'c++11' : '-std=gnu++11',
'c++14' : '-std=gnu++14',
'c++17' : '-std=gnu++17'}

languages['c++']['compiler']['g++']['cygwin']['standard'] = {'c++98' : '-std=gnu++98',
'c++11' : '-std=gnu++11',
'c++14' : '-std=gnu++14',
'c++17' : '-std=gnu++17'}

languages['c++']['compiler']['llvm clang++']['osx']['flags'] = copy.deepcopy(languages['c++']['compiler']['llvm clang++']['linux']['flags'])
languages['c++']['compiler']['llvm clang++']['osx']['flags']['common'] = ['-stdlib=libc++']
languages['c++']['compiler']['llvm clang++']['windows'] = languages['c++']['compiler']['llvm clang++']['osx']
Expand Down
4 changes: 2 additions & 2 deletions docs/README-jekyll.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ layout: page
This repository contains the required stuff to make the NJOY website and keep it consistent across all the projects.

## Using jekyll-website
For all projects under the NJOY organization, this repository should be created as a git 'subtree' in the `docs` directory. This will ensure consistency across all the projects as well as make the documentation for each accessible from the website.
For all projects under the NJOY organization, this repository should be created as a git 'subtree' in the `docs` directory. This will ensure consistency across all the projects as well as make the documentation for each accessible from the website.

In order to prevent pushing to this repository one should set the push url for this remote in git like this:

```bash
git remote set-url --push <name> no_push
```
Here `<name>` is the name of the remote (probably `jekyll`). What this tells git is whenever you try to push to this remote, simply push to the url `no_push` which doesn't exist.
Here `<name>` is the name of the remote (probably `jekyll`). What this tells git is whenever you try to push to this remote, simply push to the url `no_push` which doesn't exist.

Alternatively, you can set the push url to the url of the remote of the real repository like:

Expand Down
12 changes: 5 additions & 7 deletions docs/Updating.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ These commands (unless otherwise specified) should be run from the top level of
```
8. Inspect resulting `CMakelists.txt` file
- Is the target of the expected type (executable, interface, or library)?
An executable target will always be accompanied by a library or interface target in the CMake files generated by metaconfigure. A library target is a collection of soruce file which are to be compiled into a library file (either static or dynamic based on configuration settings) during the build process. This impllies that the project contains one or more implementation files (excluding an implementation file for any executable driver). Those declarations look something like this:

An executable target will always be accompanied by a library or interface target in the CMake files generated by metaconfigure. A library target is a collection of source file which are to be compiled into a library file (either static or dynamic based on configuration settings) during the build process. This implies that the project contains one or more implementation files (excluding an implementation file for any executable driver). Those declarations look something like this:
```cmake
add_library( <name> ${<name>_library_linkage} <source files> )
```

For targets that lack implementation files (`.cpp` files)—such as header-only libraries—there's nothing to compile. Interface declarations look like
```cmake
add_library( <name> INTERFACE <source files> )
```
Given a driver implementation file (defaults to `main.` but can be specified in the description), you should also see an exectuable target which links to the library or interface target.

Given a driver implementation file (defaults to `main.` but can be specified in the description), you should also see an executable target which links to the library or interface target.
```cmake
add_executable( <name>_executable <driver> )
set_target_properties( <name>_executable PROPERTIES OUTPUT_NAME <name> )
Expand All @@ -59,5 +59,3 @@ These commands (unless otherwise specified) should be run from the top level of
10. Update `.travis.yml` and `.travis.sh`.
11. Push to GitHub.
12. Create pull request.


6 changes: 2 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
layout: page
title: Metaconfigure
---
## [Upating metaconfigure in a project](Updating.html)
## [Updating metaconfigure in a project](Updating.html)

## Creating signatures
Metaconfigure has the ability to create a "signature" for a project. A signature is a unique combination of the project and each of its dependencies---with their specific versions. The signature enables the ability to load a project from a point in time and ensure that you have the same version you had then.
Expand All @@ -15,8 +15,6 @@ To create a signature simply execute
This will create a JSON file that contains the signature for the project as it currently stands. The `<filename>` is optional, but allows you to specify the JSON filename that is written.

### Collecting signatures
A signature file is not automatically created. If one would like to be able to recreate a version at a specific time, you must create the signature file yourself.
A signature file is not automatically created. If one would like to be able to recreate a version at a specific time, you must create the signature file yourself.

We have created and stored some signatures in a [repository](https://github.com/njoy/signatures) on GitHub. These signatures are created every time the `master` branch is updated. Thus, it is a collection of officially supported versions of the projects.


20 changes: 10 additions & 10 deletions fetch_subprojects.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,35 +30,35 @@ def clone_submodule( relative_path ):
----------------------------------------
""".format( relative_path = relative_path ) ) )
invocation = [ "git", "submodule", "update", "-q","--init", "--", relative_path ]
if os.name == "nt":
invocation.insert( 0, "powershell" )
# if os.name == "nt":
# invocation.insert( 0, "powershell" )

clone = subprocess.Popen( invocation )
clone.communicate()

def update_repository( git ):
"""
A function to update a submodule to lastest commit of the master branch
A function to update a submodule to latest commit of the master branch
"""
if project_name() not in git:
print("Updating to master branch...\n")
invocation = ["git", "pull", "-q", "origin", "master"]
else:
print("Checking out revision {}...\n".format( git[ project_name() ] ) )
invocation = ["git", "pull", "-q", "origin", git[ project_name() ] ]
if os.name == "nt":
invocation.insert( 0, "powershell" )
# if os.name == "nt":
# invocation.insert( 0, "powershell" )
update = subprocess.Popen( invocation )
update.communicate()

def traverse_dependencies( destination, traversed, git ):
"""
Clone and update dependencies uniquely and collect links to dependency projects
in a destination folder
"""
if not os.path.isdir( dependency_directory() ):
return

os.chdir( dependency_directory() )

for dependency in os.listdir( os.getcwd() ) :
Expand All @@ -83,17 +83,17 @@ def traverse_dependencies( destination, traversed, git ):

traverse_dependencies( destination, traversed, git )
os.chdir( ".." )

os.chdir( os.path.join( ".." ) )

def collect_subprojects( git ):
if git:
update_repository( git )

destination = os.path.join( os.getcwd(), "subprojects" )
if not os.path.isdir( destination ):
os.makedirs( destination )

traverse_dependencies( destination, set(), git )

git = {}
Expand Down
2 changes: 1 addition & 1 deletion generate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/env python3
#! /usr/bin/env python

import sys

Expand Down
27 changes: 12 additions & 15 deletions signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,30 @@
import sys
import time

def project_signature( git ):
project_name = os.path.split( os.getcwd() )[1]
def project_signature():
invocation = [ "git", "rev-parse", "HEAD" ]
if os.name == "nt":
invocation.insert( 0, "powershell" )

process = subprocess.Popen( invocation, stdout=subprocess.PIPE )
hash_value = process.communicate()
git[ project_name ] = str(hash_value[0].strip())
return hash_value[0].strip().decode("utf-8")

def generate( name = None ):

project_name = os.path.split( os.getcwd() )[1]
if name is None:
project_name = os.path.split( os.getcwd() )[1]
name = project_name + str( time.time() )

git = {}
project_signature( git )
if os.path.isdir( os.path.join( os.getcwd(), 'subprojects' ) ):
os.chdir( 'subprojects' )
root = os.getcwd()
for subproject in os.listdir( os.getcwd() ):
if os.path.isdir( os.path.join( os.getcwd(), subproject ) ):
os.chdir( subproject )
project_signature( git )
os.chdir( root )

os.chdir( '..' )
git[ project_name ] = project_signature()
root = os.getcwd()

if os.path.isdir( "subprojects" ):
for subproject in os.listdir( "subprojects" ):
os.chdir(os.path.join("subprojects", subproject))
git[subproject] = project_signature()
os.chdir(root)

with open ( name + ".json", "w" ) as json_file:
json_file.write( json.dumps( { 'git' : git }, indent=0 ) )
Expand Down

0 comments on commit 9e902dc

Please sign in to comment.