Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libcifpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
libcifpp
Commits
0ca04bed
Unverified
Commit
0ca04bed
authored
Aug 23, 2021
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated cmake file, configurable data dir
parent
89850de6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
11 deletions
+31
-11
CMakeLists.txt
+18
-8
include/cif++/CifUtils.hpp
+2
-3
src/CifUtils.cpp
+11
-0
No files found.
CMakeLists.txt
View file @
0ca04bed
...
...
@@ -30,7 +30,7 @@ endif()
option
(
BUILD_SHARED_LIBS
"Build a shared library instead of a static one"
ON
)
set
(
CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON
)
set
(
CMAKE_DEBUG_POSTFIX d
)
#
set(CMAKE_DEBUG_POSTFIX d)
if
(
MSVC
)
# make msvc standards compliant...
...
...
@@ -69,8 +69,16 @@ if(MSVC)
set
(
COFF_SPEC
"--coff=
${
COFF_TYPE
}
"
)
endif
()
if
(
LINUX
)
# On Linux, install in the $HOME/.local folder by default
if
(
CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT
)
message
(
WARNING
"The library and auxiliary files will be installed in $ENV{HOME}/.local"
)
set
(
CMAKE_INSTALL_PREFIX
"$ENV{HOME}/.local"
CACHE PATH
"..."
FORCE
)
endif
()
endif
()
# Optionally use mrc to create resources
find_program
(
MRC mrc HINTS
"$ENV{LOCALAPPDATA}/mrc"
"
${
CMAKE_INSTALL_PREFIX
}
/../mrc"
"/usr/local/bin"
)
find_program
(
MRC mrc HINTS
"$ENV{LOCALAPPDATA}/mrc"
"$
ENV{HOME}/.local/bin"
"
$
{
CMAKE_INSTALL_PREFIX
}
/../mrc"
"/usr/local/bin"
)
if
(
MRC
)
option
(
USE_RSRC
"Use mrc to create resources"
ON
)
...
...
@@ -159,6 +167,7 @@ set(project_headers
)
add_library
(
cifpp
${
project_sources
}
${
project_headers
}
)
set_target_properties
(
cifpp PROPERTIES POSITION_INDEPENDENT_CODE ON
)
target_include_directories
(
cifpp
PUBLIC
...
...
@@ -215,7 +224,8 @@ add_compile_definitions(
# CACHE_DIR="${CMAKE_INSTALL_PREFIX}/${SHARE_INSTALL_DIR}"
DATA_DIR=
"
${
CMAKE_INSTALL_PREFIX
}
/
${
SHARE_INSTALL_DIR
}
"
)
generate_export_header
(
cifpp
)
generate_export_header
(
cifpp
EXPORT_FILE_NAME cif++/Cif++Export.hpp
)
# Install rules
...
...
@@ -226,9 +236,10 @@ install(TARGETS cifpp
RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
INCLUDES DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
)
export
(
EXPORT cifppTargets
FILE
"
${
CMAKE_CURRENT_BINARY_DIR
}
/cmake/
cifppTargets.cmake"
install
(
EXPORT cifppTargets
FILE
"cifppTargets.cmake"
NAMESPACE cifpp::
DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
/cmake/cifpp
)
install
(
...
...
@@ -238,7 +249,7 @@ install(
)
install
(
FILES
"
${
CMAKE_CURRENT_BINARY_DIR
}
/cif
pp_export.h
"
FILES
"
${
CMAKE_CURRENT_BINARY_DIR
}
/cif
++/Cif++Export.hpp
"
DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
/cif++
COMPONENT Devel
)
...
...
@@ -338,4 +349,4 @@ if(CIFPP_BUILD_TESTS)
endif
()
message
(
"Still to do: libcifpp.pc, package, tools, create symop_Data"
)
\ No newline at end of file
message
(
"Still to do: libcifpp.pc, package, tools, create symop_Data"
)
include/cif++/CifUtils.hpp
View file @
0ca04bed
...
...
@@ -45,7 +45,7 @@
#include <unistd.h>
#endif
#include "cif
pp_export.h
"
#include "cif
++/Cif++Export.hpp
"
#if _MSC_VER
# pragma warning (disable : 4355) // this is used in Base Initializer list
...
...
@@ -221,7 +221,6 @@ class Progress
std
::
unique_ptr
<
std
::
istream
>
loadResource
(
std
::
filesystem
::
path
name
);
void
addFileResource
(
const
std
::
string
&
name
,
std
::
filesystem
::
path
dataFile
);
void
addDataDirectory
(
std
::
filesystem
::
path
dataDir
);
}
src/CifUtils.cpp
View file @
0ca04bed
...
...
@@ -1227,6 +1227,14 @@ namespace cif
// --------------------------------------------------------------------
std
::
map
<
std
::
string
,
std
::
filesystem
::
path
>
gLocalResources
;
std
::
filesystem
::
path
gDataDir
;
void
addDataDirectory
(
std
::
filesystem
::
path
dataDir
)
{
if
(
VERBOSE
and
not
fs
::
exists
(
dataDir
))
std
::
cerr
<<
"The specified data directory "
<<
dataDir
<<
" does not exist"
<<
std
::
endl
;
gDataDir
=
dataDir
;
}
void
addFileResource
(
const
std
::
string
&
name
,
std
::
filesystem
::
path
dataFile
)
{
...
...
@@ -1246,6 +1254,9 @@ std::unique_ptr<std::istream> loadResource(std::filesystem::path name)
result
.
reset
(
file
.
release
());
}
if
(
not
result
and
not
fs
::
exists
(
p
)
and
not
gDataDir
.
empty
())
p
=
gDataDir
/
name
;
#if defined(CACHE_DIR)
if
(
not
result
and
not
fs
::
exists
(
p
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment