Skip to content

Commit

Permalink
Modified resource management
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffreygarrett committed Jun 22, 2020
1 parent 08620e1 commit fd6d083
Show file tree
Hide file tree
Showing 52 changed files with 573,246 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .conda/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
mkdir build
if errorlevel 1 exit 1
cd build
if errorlevel 1 exit 1
cmake ^
-G "Visual Studio 15 2017 Win64" ^
-DCMAKE_CXX_STANDARD=17 ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^
-DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
-DPREFIX=%LIBRARY_PREFIX% ^
..
if errorlevel 1 exit 1
cmake --build . --config RelWithDebInfo --target install
if errorlevel 1 exit 1
ctest
if errorlevel 1 exit 1
19 changes: 19 additions & 0 deletions .conda/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

mkdir build

cd build

cmake \
-DCMAKE_CXX_STANDARD=14 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_PREFIX_PATH=$PREFIX \
-DPREFIX=$PREFIX \
..

make -j2

ctest

make install
11 changes: 11 additions & 0 deletions .conda/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
channel_targets:
- tudat-team main
channel_sources:
- conda-forge
- defaults
channels:
sources: [conda-forge, defaults]
targets:
- [tudat-team, main]


63 changes: 63 additions & 0 deletions .conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package:
name: tudat-resources
version: 2.8.21

source:
path: ../
# git_rev: cef926f39134ef2c4400124294ec1385c1c97fac

build:
# A non-negative integer representing the build number of the package.
# Unlike the build string, the build_number is inspected by conda.
# Conda uses it to sort packages that have otherwise identical names
# and versions to determine the latest one. This is important because
# new builds that contain bug fixes for the way a package is built may be
# added to a repository.
number: 2
skip: true # [win and vc<14]

requirements:
build:
# Tools required to build the package. These packages are run on the build
# system and include things such as revision control systems (Git, SVN) make
# tools (GNU make, Autotool, CMake) and compilers (real cross, pseudo-cross,
# or native when not cross-compiling), and any source pre-processors.
- {{ compiler('cxx') }} # [not win]
- {{ compiler('c') }} # [not win]
- {{ compiler('m2w64_c') }} # [win]
- cmake
#
#outputs:
# - name: tudat
# build:
# ignore_run_exports:
# - m2w64-gcc-libs # [win]
# run_exports:
# - cspice-cmake
# - sofa-cmake
# detect_binary_files_with_prefix: true
# missing_dso_whitelist:
# - libgcc-ng
# - libstdcxx-ng
# - libm
# - libc
# requirements:
# host:
# # Packages that need to be specific to the target platform when the
# # target platform is not necessarily the same as the native build
# # platform
# - boost-cpp=1.64.0
# - cspice-cmake
# - sofa-cmake
# - eigen
# run:
# # Packages required to run the package. These are the dependencies
# # that are installed automatically whenever the package is installed.
# # Package names should follow the package match specifications.
# - {{ pin_compatible('boost-cpp', max_pin='x.x') }}

about:
home: http://tudat.tudelft.nl/
license: BSD
license_family: BSD
summary: A C++ platform to perform astrodynamics and space research
74 changes: 74 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#
# Private
#
# Do not track user-applications by default.
tudatApplications/

#
# CMake
#
CMakeCache.txt
CMakeLists.txt.user
CMakeFiles
CMakeScripts
Makefile
cmake_install.cmake
install_manifest.txt

#
# C++
#
# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

#
# Build and doxygen related
#
Documentation/
doc/doxygen/html/
doc/doxygen/latex/
build*/
bin/
lib/
boost/

#
# Editor related
#
*~
*#
.#*
*.autosave
*.~?~
*.save
.DS_Store
.idea/*
cmake-build-debug/*
install_test/*
/cmake-build-debug/
181 changes: 181 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
# Copyright (c) 2010-2019, Delft University of Technology
# All rigths reserved
#
# This file is part of the Tudat. Redistribution and use in source and
# binary forms, with or without modification, are permitted exclusively
# under the terms of the Modified BSD license. You should have received
# a copy of the license with this file. If not, please or visit:
# http://tudat.tudelft.nl/LICENSE.

# Specify minimum cmake version required to compile Tudat.
cmake_minimum_required(VERSION 3.3)

# Trick for recompiling changes for BUILD-TREE.
if (EXISTS "${CMAKE_BINARY_DIR}/CMakeCache.txt")
file(REMOVE "${CMAKE_BINARY_DIR}/CMakeCache.txt")
endif ()

# Set cmake policy.
cmake_policy(SET CMP0069 NEW)

# Get version from file.
file(READ "version" TudatResources_VERSION)

# Specific project name.
project(TudatResources VERSION ${TudatResources_VERSION} LANGUAGES C CXX)

# Get lower string name of PROJECT_NAME for directory configuration.
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPER)
set(CMAKE_POSITION_INDEPENDENT_CODE True)

# +============================================================================
# INSTALL TREE CONFIGURATION (Project name independent)
# Offer the user the choice of overriding the installation directories.
# +============================================================================
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib/" CACHE PATH "Installation directory for libraries")
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin/" CACHE PATH "Installation directory for executables")
set(INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include/" CACHE PATH "Installation directory for header files")
set(INSTALL_DATA_DIR "${CMAKE_INSTALL_PREFIX}/resource/" CACHE PATH "Installation directory for data files")
set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/" CACHE PATH "Installation directory for man documentation")
set(INSTALL_CMAKE_DIR "${INSTALL_LIB_DIR}/cmake/${PROJECT_NAME_LOWER}" CACHE PATH "Installation directory for cmake config files")

# Make relative paths absolute (needed later on)
foreach (p LIB BIN INCLUDE DATA CMAKE)
set(var INSTALL_${p}_DIR)
set(RELATIVE_INSTALL_${p}_DIR ${INSTALL_${p}_DIR})
if (NOT IS_ABSOLUTE "${${var}}")
set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
endif ()
endforeach ()

# Find relative paths for cmake-config file. (for find_package)
file(RELATIVE_PATH rel_include_dir "${INSTALL_CMAKE_DIR}" "${INSTALL_INCLUDE_DIR}")
file(RELATIVE_PATH rel_lib_dir "${INSTALL_CMAKE_DIR}" "${INSTALL_LIB_DIR}")
file(RELATIVE_PATH rel_data_dir "${INSTALL_CMAKE_DIR}" "${INSTALL_DATA_DIR}")
file(RELATIVE_PATH rel_bin_dir "${INSTALL_CMAKE_DIR}" "${INSTALL_BIN_DIR}")
file(RELATIVE_PATH rel_man_dir "${INSTALL_CMAKE_DIR}" "${INSTALL_MAN_DIR}")

# Set relative paths for config.cmake.
foreach (p include lib data bin man)
string(TOUPPER ${p} P)
set(RELATIVE_INSTALL_${P}_DIR ${rel_${p}_dir})
endforeach ()

# +============================================================================
# INSTALL TREE
#
# +============================================================================
#add_library(tudat_resource STATIC ${CMAKE_CURRENT_SOURCE_DIR}/src/resource.cpp)

#target_include_directories(tudat_resource PUBLIC
# $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
# $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
# $<INSTALL_INTERFACE:include>)
#
#set_target_properties(tudat_resource
# PROPERTIES
# LINKER_LANGUAGE CXX
# ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib"
# LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib"
# RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin"
# )

add_executable(test_paths test/test_paths.cpp)

set_target_properties(test_paths
PROPERTIES
LINKER_LANGUAGE CXX
ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib"
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin"
)

target_include_directories(test_paths PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>)
add_test(test_paths bin/test_paths)

install(DIRECTORY include/ DESTINATION "${INSTALL_INCLUDE_DIR}")
install(DIRECTORY resource/ DESTINATION "${INSTALL_DATA_DIR}")

# CONFIGURE
configure_file( # Really dirty trick, and should be removed.
"${PROJECT_SOURCE_DIR}/config.hpp.in"
"${PROJECT_BINARY_DIR}/include/tudat/resource/config.hpp" @ONLY
)

install(FILES
"${PROJECT_BINARY_DIR}/include/tudat/resource/config.hpp"
DESTINATION ${INSTALL_INCLUDE_DIR}/tudat/resource)

# Installation of the library.
#install(TARGETS tudat_resource
# EXPORT tudatresources_export
# LIBRARY DESTINATION "${INSTALL_LIB_DIR}"
# ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
# RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
# )

# Set <project>_LIBRARIES for <project>-config.cmake.
#set(Tudat_RESOURCE_LIBRARY tudat_resource)

# Add all targets to the build-tree export set
#export(TARGETS tudat_resource NAMESPACE ${PROJECT_NAME}:: FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LOWER}_export.cmake")

# Installation of the export modules.
#install(EXPORT ${PROJECT_NAME_LOWER}_export NAMESPACE ${PROJECT_NAME}:: DESTINATION "${RELATIVE_INSTALL_CMAKE_DIR}")

# Export the package for use from the build-tree
# (this registers the build-tree with a global CMake-registry)
set(CMAKE_EXPORT_PACKAGE_REGISTRY ON)
export(PACKAGE ${PROJECT_NAME})

# +============================================================================
# PROJECT CONFIG
# For external use of project.
# +============================================================================
include(CMakePackageConfigHelpers)

configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME_LOWER}-config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config.cmake"
INSTALL_DESTINATION "${INSTALL_CMAKE_DIR}")

install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config.cmake"
DESTINATION "${INSTALL_CMAKE_DIR}"
)

# NOTE: SameMinorVersion available only
# since CMake 3.11.
if (${CMAKE_VERSION} VERSION_LESS "3.11.0")
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config-version.cmake" VERSION ${${PROJECT_NAME}_VERSION}
COMPATIBILITY SameMajorVersion)
else ()
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config-version.cmake" VERSION ${${PROJECT_NAME}_VERSION}
COMPATIBILITY SameMinorVersion)
endif ()
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config-version.cmake" DESTINATION "${INSTALL_CMAKE_DIR}")

# +============================================================================
# CLEAN UP (Project name independent)
# Cleanup in case project is not top level.
# +============================================================================
unset(INSTALL_LIB_DIR)
unset(INSTALL_BIN_DIR)
unset(INSTALL_INCLUDE_DIR)
unset(INSTALL_DATA_DIR)
unset(INSTALL_MAN_DIR)
unset(INSTALL_TESTS_DIR)
unset(INSTALL_CMAKE_DIR)

unset(RELATIVE_INSTALL_LIB_DIR)
unset(RELATIVE_INSTALL_BIN_DIR)
unset(RELATIVE_INSTALL_INCLUDE_DIR)
unset(RELATIVE_INSTALL_DATA_DIR)
unset(RELATIVE_INSTALL_MAN_DIR)
unset(RELATIVE_INSTALL_TESTS_DIR)
unset(RELATIVE_INSTALL_CMAKE_DIR)
7 changes: 7 additions & 0 deletions config.hpp.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

#ifndef TUDATRESOURCES_PATHS_HPP
#define TUDATRESOURCES_PATHS_HPP

#define Tudat_RESOURCE_DIR "@CMAKE_INSTALL_PREFIX@/resource"

#endif //TUDATRESOURCES_PATHS_HPP
Loading

0 comments on commit fd6d083

Please sign in to comment.