Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 233910d
Showing
13 changed files
with
475 additions
and
0 deletions.
There are no files selected for viewing
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,54 @@ | ||
# Compiled Object files | ||
*.slo | ||
*.lo | ||
*.o | ||
|
||
# Compiled Dynamic libraries | ||
*.so | ||
|
||
# Compiled Static libraries | ||
*.lai | ||
*.la | ||
*.a | ||
|
||
# Python | ||
*.pyc | ||
|
||
# Compiled Doxygen documentation | ||
/doxygen/html | ||
|
||
# For projects that use Waf for building: http://code.google.com/p/waf/ | ||
waf-* | ||
.waf-* | ||
.lock-* | ||
build | ||
bundle_dependencies | ||
|
||
# Gnu Global tag files | ||
GPATH | ||
GRTAGS | ||
GSYMS | ||
GTAGS | ||
|
||
# Emacs temp / auto save | ||
\#*# | ||
*.#* | ||
*~ | ||
|
||
#Eclipse ignore | ||
.cproject | ||
.project | ||
.metadata | ||
local.properties | ||
.classpath | ||
|
||
# Visual Studio ignore | ||
*.bat | ||
*.sln | ||
*.suo | ||
*.user | ||
*.ncb | ||
*.sdf | ||
*.opensdf | ||
*.log | ||
VSProjects |
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,27 @@ | ||
Copyright (c) 2016, Steinwurf ApS | ||
|
||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
* 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. | ||
* Neither the name of endian 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 THE COPYRIGHT HOLDERS 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 THE COPYRIGHT OWNER 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 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,9 @@ | ||
News for endian | ||
=============== | ||
|
||
This file lists the major changes between versions. For a more detailed list of | ||
every change, see the Git log. | ||
|
||
Latest | ||
------ | ||
* tbd |
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,13 @@ | ||
====== | ||
endian | ||
====== | ||
|
||
This is the default description, please change it. | ||
|
||
.. contents:: Table of Contents: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
Here is how you use it... |
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,74 @@ | ||
#!/usr/bin/env python | ||
# encoding: utf-8 | ||
|
||
import urllib2 | ||
import traceback | ||
import sys | ||
|
||
project_name = 'endian' | ||
project_dependencies = \ | ||
[ | ||
'waf-tools', | ||
'gtest', | ||
] | ||
|
||
# Importing a dynamically generated module | ||
# Python recipe from http://code.activestate.com/recipes/82234 | ||
|
||
|
||
def importCode(code, name, add_to_sys_modules=0): | ||
""" | ||
Import dynamically generated code as a module. code is the | ||
object containing the code (a string, a file handle or an | ||
actual compiled code object, same types as accepted by an | ||
exec statement). The name is the name to give to the module, | ||
and the final argument says wheter to add it to sys.modules | ||
or not. If it is added, a subsequent import statement using | ||
name will return this module. If it is not added to sys.modules | ||
import will try to load it in the normal fashion. | ||
import foo | ||
is equivalent to | ||
foofile = open("/path/to/foo.py") | ||
foo = importCode(foofile,"foo",1) | ||
Returns a newly generated module. | ||
""" | ||
import imp | ||
|
||
module = imp.new_module(name) | ||
|
||
exec code in module.__dict__ | ||
if add_to_sys_modules: | ||
sys.modules[name] = module | ||
|
||
return module | ||
|
||
|
||
if __name__ == '__main__': | ||
print('Updating Smart Project Config Tool...') | ||
|
||
url = "https://raw.github.com/steinwurf/steinwurf-labs/" \ | ||
"master/config_helper/config-impl.py" | ||
|
||
try: | ||
# Fetch the code file from the given url | ||
req = urllib2.Request(url) | ||
response = urllib2.urlopen(req) | ||
code = response.read() | ||
print("Update complete. Code size: {}\n".format(len(code))) | ||
try: | ||
# Import the code string as a module | ||
mod = importCode(code, "config_helper") | ||
# Run the actual config tool from the dynamic module | ||
mod.config_tool(project_dependencies) | ||
except: | ||
print("Unexpected error:") | ||
print traceback.format_exc() | ||
except Exception as e: | ||
print("Could not fetch code file from:\n\t{}".format(url)) | ||
print(e) | ||
|
||
raw_input('Press ENTER to exit...') |
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,20 @@ | ||
// Copyright (c) Steinwurf ApS 2016. | ||
// All Rights Reserved | ||
// | ||
// Distributed under the "BSD License". See the accompanying LICENSE.rst file. | ||
|
||
#include <endian/some.hpp> | ||
|
||
#include <iostream> | ||
|
||
int main() | ||
{ | ||
endian::some s; | ||
|
||
if (s.some_method()) | ||
{ | ||
std::cout << "Hello endian!" << std::endl; | ||
} | ||
|
||
return 0; | ||
} |
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,7 @@ | ||
# encoding: utf-8 | ||
|
||
bld.program( | ||
features='cxx', | ||
source=['example.cpp'], | ||
target='example', | ||
use=['endian']) |
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,9 @@ | ||
# encoding: utf-8 | ||
|
||
bld.stlib( | ||
features='cxx', | ||
source=bld.path.ant_glob('**/*.cpp'), | ||
target='endian', | ||
use=[], | ||
export_includes=['..'] | ||
) |
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,17 @@ | ||
// Copyright (c) Steinwurf ApS 2016. | ||
// All Rights Reserved | ||
// | ||
// Distributed under the "BSD License". See the accompanying LICENSE.rst file. | ||
|
||
#include <cstdint> | ||
#include <ctime> | ||
|
||
#include <gtest/gtest.h> | ||
|
||
GTEST_API_ int main(int argc, char **argv) | ||
{ | ||
srand(static_cast<uint32_t>(time(0))); | ||
|
||
testing::InitGoogleTest(&argc, argv); | ||
return RUN_ALL_TESTS(); | ||
} |
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,13 @@ | ||
// Copyright (c) Steinwurf ApS 2016. | ||
// All Rights Reserved | ||
// | ||
// Distributed under the "BSD License". See the accompanying LICENSE.rst file. | ||
|
||
#include <endian/some.hpp> | ||
#include <gtest/gtest.h> | ||
|
||
TEST(test_some, return_value_of_some_method) | ||
{ | ||
endian::some s; | ||
EXPECT_TRUE(s.some_method()); | ||
} |
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,7 @@ | ||
# encoding: utf-8 | ||
|
||
bld.program( | ||
features='cxx test', | ||
source=['endian_tests.cpp'] + bld.path.ant_glob('src/*.cpp'), | ||
target='endian_tests', | ||
use=['endian', 'gtest']) |
Oops, something went wrong.