Skip to content

Commit

Permalink
Squashed 'externals/nitro/' changes from d172d74a7..038069b2e
Browse files Browse the repository at this point in the history
038069b2e Merge pull request #199 from mdaus/cmake-integration2
83efec019 Fix another Github Action runner issue.
c1624a252 Fix CMake issues for Github action runners.
9de7b7826 Clean up and document CMake build changes
8947c15b4 Merge branch 'master' into cmake-integration2
d05822e9c Merge pull request #198 from mdaus/sync-externals
34b538e15 Merge commit '1262718741583c73dbf27057a7c322ea1fac0fae' into sync-externals
126271874 Squashed 'externals/coda-oss/' changes from 312e46dc..67d6362b
6a1b1946c Remove some unneeded coda-oss files
86598e258 Disable some unused parts of coda-oss
a181098c5 Update Github Actions workflows for recent CMake changes.
48e620397 Update and refactor CMake and Conan build configurations
06be9b568 Fix Conan issues on Windows
b7a62f5f0 Refactor Conan configuration and add test_package.
9a7688da6 Add preliminary Conan support.
dfe87215d Refactor CMake build.
6732f92a0 Integrate with coda-oss CMake build.
800953f46 Merge commit 'df7acfb8e80f33d2f04d0ec8c4efbd8b2317826f'
df7acfb8e Squashed 'externals/coda-oss/' changes from e26a32d6..312e46dc
9a8f5fe13 Merge pull request #197 from mdaus/bug/badly_configured_windows_path
793555754 Escape backslahes in Windows path
445c1e260 Merge pull request #195 from mdaus/bug/des_memory_leak
2906a6384 Check in Python3 bindings
4293cc465 Formatting
aa3455aac Merge pull request #190 from mdaus/bug/failing_ctors
8c7b5c7fa Better error checking
c545a423f Merge pull request #191 from mdaus/missing_field_error_message
aead30a84 Include TRE field name in error message
32e8e23be Formatting
627c183d2 typo
cabca936d Simplify error handling
2d0bb8ab7 Formatting
7f8794c37 Merge pull request #187 from mdaus/bug/tre_numeric_overflow
251bde556 Merge pull request #183 from mdaus/tre_memory_leak
d1ab7ec53 Merge pull request #185 from mdaus/bug/set_binary_tre_field
67b50288e Handle too many decimals when setting float value for TRE field
d4776de1c Use error member
86528d669 Uncomment test
a4d1acc34 Allow setField to work with binary TRE fields
0e0b0dac0 Fix memory leak

git-subtree-dir: externals/nitro
git-subtree-split: 038069b2eaea59819e6486238babfb94ead3cdda
  • Loading branch information
kdwilhelm committed Apr 29, 2020
1 parent 1c09914 commit 761b3ee
Show file tree
Hide file tree
Showing 112 changed files with 5,124 additions and 1,504 deletions.
30 changes: 19 additions & 11 deletions .github/workflows/frequent_check.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,50 @@
name: Build, unittest

on: [push]


jobs:
build-windows:
name: Windows
runs-on: [windows-latest]

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.7'
- name: configure
run: |
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=installWindows-Github ..
cmake -DCMAKE_INSTALL_PREFIX=installWindows-Github -DPYTHON_VERSION="3.7" ..
- name: make
run: |
cd build
cmake --build . -j
cmake --build . --target install
cmake --build . --config Release -j
cmake --build . --config Release --target install
- name: test
run: |
cd build
ctest
ctest -C Release
build-linux:
name: Linux
runs-on: [ubuntu-latest]

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.7'
- name: configure
run: |
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=installLinux-Github ..
cmake -DCMAKE_INSTALL_PREFIX=installLinux-Github -DPYTHON_VERSION=3.7 ..
- name: make
run: |
cd build
Expand Down
28 changes: 18 additions & 10 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,60 @@
name: Build, unittest, compress

on:
on:
push:
branches: master
pull_request:
branches: master


jobs:
build-windows:
name: Windows
runs-on: [windows-latest]

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.7'
- name: configure
run: |
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=installWindows-Github ..
cmake -DCMAKE_INSTALL_PREFIX=installWindows-Github -DPYTHON_VERSION="3.7" ..
- name: make
run: |
cd build
cmake --build . -j
cmake --build . --target install
cmake --build . --config Release -j
cmake --build . --config Release --target install
- name: test
run: |
cd build
ctest
ctest -C Release
- name: compress
run: Compress-Archive -DestinationPath installWindows-Github.zip -Path build/installWindows-Github
- name: Upload artifact
uses: actions/[email protected]
with:
name: windows_install
path: installWindows-Github.zip

build-linux:
name: Linux
runs-on: [ubuntu-latest]

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.7'
- name: configure
run: |
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=installLinux-Github ..
cmake -DCMAKE_INSTALL_PREFIX=installLinux-Github -DPYTHON_VERSION=3.7 ..
- name: make
run: |
cd build
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

# Build artifacts
target/
test_package/build/
*.pyc
*.swp
.depproj
Expand Down
35 changes: 0 additions & 35 deletions CMakeLists-CODA.txt

This file was deleted.

95 changes: 47 additions & 48 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,51 +1,50 @@
# CODA_OSS uses FetchContent, which requires 3.11, in the zlib build
# It might be possible to rework if this has to work with older CMakes
cmake_minimum_required(VERSION 3.11)

project("nitro")

include(common_build.cmake)

if(PYTHON_HOME)
set(Python_ROOT_DIR ${PYTHON_HOME})
endif()

find_package(Python COMPONENTS Interpreter Development NumPy)
list(APPEND coda_modules except-c++ io-c++ sys-c++ mt-c++ str-c++
math-c++ xml.lite-c++ JPEG J2K)

if (Python_NumPy_FOUND AND NOT MSVC)
list(APPEND coda_modules numpyutils-c++)
endif()
if (Python_FOUND)
set(PYTHON ${Python_EXECUTABLE})
else()
set(PYTHON python)
cmake_minimum_required(VERSION 3.14)
project(nitro)

set(CMAKE_C_STANDARD 90)
set(CMAKE_CXX_STANDARD 11)

if (${CMAKE_PROJECT_NAME} STREQUAL nitro)
# we are the top-level project and are responsible for configuration

# set up warnings
if (MSVC)
# set warning level to /W3
string(REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REGEX REPLACE "/W[0-4]" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
add_compile_options(/W3 /wd4290 /wd4512)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
elseif (UNIX)
add_compile_options(
-Wno-deprecated
-Wno-unused-value
-Wno-unused-but-set-variable
)
endif()

if (EXISTS "${CMAKE_BINARY_DIR}/conan_paths.cmake")
# use pre-built coda-oss from conan package
include("${CMAKE_BINARY_DIR}/conan_paths.cmake")
find_package(coda-oss REQUIRED)
include(CodaBuild)
coda_initialize_build()
else()
# build coda-oss ourselves

# disable some unneeded drivers from coda-oss
set(ENABLE_PCRE OFF CACHE BOOL "enable PCRE library" FORCE)
set(ENABLE_UUID OFF CACHE BOOL "enable uuid library" FORCE)
set(ENABLE_ZIP OFF CACHE BOOL "enable ZIP library" FORCE)

list(APPEND CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/externals/coda-oss/cmake")
include(CodaBuild)
coda_initialize_build()
add_subdirectory("externals/coda-oss")
endif()
endif()

if (NOT DEFINED CODA_INSTALL_DIR)
include(CMakeLists-CODA.txt)
else()
add_library(coda-oss INTERFACE)
endif()

foreach(module ${coda_modules})
add_coda_module(${module})
endforeach()

add_library(coda_oss_config INTERFACE)
target_include_directories(coda_oss_config INTERFACE ${CODA_DIR}/target/moudules/c++/config/include/)
add_dependencies(coda_oss_config coda-oss)

# Everyone can include coda's headers
include_directories(${CODA_INSTALL_DIR}/include)

enable_testing()
set(NITRO_C_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/modules/c)
add_subdirectory(modules/c)
add_subdirectory(modules/c++)
if (NOT MSVC)
add_subdirectory(modules/python)
endif()
add_subdirectory(modules/java)
add_subdirectory(modules/mex)
add_subdirectory("modules")

coda_generate_package_config()
28 changes: 16 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,41 @@
Building NITRO
---------------

CMake is the preferred build method. Version 3.11 or better is required.
CMake is the preferred build method. Version 3.14 or better is required.

Sample Build Scenario
---------------------

mkdir build;
cd build;
mkdir build
cd build
cmake ..
cmake --build . -j
cmake --build . --target install
ctest

Problems and Configurations
---------------------------

- The Python layer will not build on Windows
- Nothing will build on WSL
- Both these problems are due to how coda-oss's waf talks to Python. They will
be addressed once CODA-OSS is building with CMake.
- If your system compiler does not fully support C++11, you may have to
specify a different one during the configure step. e.g.

cmake -DCMAKE_C_COMPILER=/some/path/gcc/4.9.1/bin/gcc -DCMAKE_CXX_COMPILER=/...../bin/g++ ..

- NITRO will construct a default local install location for you. Pass -DCMAKE_INSTALL_PREFIX to override.
- Pass -DCMAKE_INSTALL_PREFIX to set the install location.

- Java, MATLAB, Python, C++ bindings all build. Just make sure the relevant tools
are on your PATH

- Debug symbols are available by default. Configure release type with [-DCMAKE_BUILD_TYPE](https://cmake.org/cmake/help/v3.0/variable/CMAKE_BUILD_TYPE.html)
- See the [coda-oss CMake build README](externals/coda-oss/cmake/README.md)
for further build configuration information, particularly for Python-related
details. The same options there may be passed to Nitro.

- Build types `Release`, `RelWithDebInfo`, and `Debug` may be chosen
- On Linux, debug symbols are available by default (`RelWithDebInfo`). Configure build type with [-DCMAKE_BUILD_TYPE](https://cmake.org/cmake/help/v3.0/variable/CMAKE_BUILD_TYPE.html)
- On Windows, release type should be configured during the build and install steps

cmake --build . --config Release -j
cmake --build . --config Release --target install
The CMake default build type `Debug` may not work with Python, unless the Python installation includes debug versions of the Python libraries.
- If the CMake build system does not support a required feature that Waf does, create
an issue or a pull request!

Expand Down Expand Up @@ -217,11 +221,11 @@ to make sure NITRO can find them.

* If you are building from source, the location will be compiled in, and
you don't have to do anything extra.

* If you are working from a binary release, you will have to tell
NITRO where the plugins are by setting the `NITF_PLUGIN_PATH`
enviornment variable.
This should look something like `<install>/share/nitf/plugins`.

* If you wish to use a custom TRE location, you can also specify that
with `NITF_PLUGIN_PATH`.
8 changes: 8 additions & 0 deletions cmake/nitroConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@PACKAGE_INIT@

# import coda-oss targets from its package
include(CMakeFindDependencyMacro)
find_dependency(coda-oss)

# import nitro targets
include("${CMAKE_CURRENT_LIST_DIR}/nitroTargets.cmake")
Loading

0 comments on commit 761b3ee

Please sign in to comment.