Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GeoModelTools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
GeoModelDev
GeoModelTools
Commits
195e14ca
Commit
195e14ca
authored
5 years ago
by
Attila Krasznahorkay
Browse files
Options
Downloads
Patches
Plain Diff
Taught the project how to build nlohmann_json on its own if necessary.
parent
2c567db3
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!1
CMake Build Configuration Updates, master branch (2020.03.12.)
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CMakeLists.txt
+1
-1
1 addition, 1 deletion
CMakeLists.txt
JSONParser/CMakeLists.txt
+4
-5
4 additions, 5 deletions
JSONParser/CMakeLists.txt
cmake/SetupJSON.cmake
+55
-0
55 additions, 0 deletions
cmake/SetupJSON.cmake
cmake/SetupXercesC.cmake
+2
-0
2 additions, 0 deletions
cmake/SetupXercesC.cmake
with
62 additions
and
6 deletions
CMakeLists.txt
+
1
−
1
View file @
195e14ca
...
@@ -17,11 +17,11 @@ include( GNUInstallDirs )
...
@@ -17,11 +17,11 @@ include( GNUInstallDirs )
# Set up the "optional" dependencies.
# Set up the "optional" dependencies.
include
(
SetupXercesC
)
include
(
SetupXercesC
)
include
(
SetupJSON
)
# Find the externals needed by the project.
# Find the externals needed by the project.
find_package
(
GeoModelCore REQUIRED
)
find_package
(
GeoModelCore REQUIRED
)
find_package
(
GeoModelIO REQUIRED
)
find_package
(
GeoModelIO REQUIRED
)
find_package
(
nlohmann_json
)
# Set up the build of the libraries of the project.
# Set up the build of the libraries of the project.
add_subdirectory
(
XMLParser
)
add_subdirectory
(
XMLParser
)
...
...
This diff is collapsed.
Click to expand it.
JSONParser/CMakeLists.txt
+
4
−
5
View file @
195e14ca
...
@@ -6,11 +6,7 @@ file( GLOB HEADERS JSONParser/*.h )
...
@@ -6,11 +6,7 @@ file( GLOB HEADERS JSONParser/*.h )
# Create the library.
# Create the library.
add_library
(
JSONParser SHARED
${
HEADERS
}
${
SOURCES
}
)
add_library
(
JSONParser SHARED
${
HEADERS
}
${
SOURCES
}
)
if
(
nlohmann_json_FOUND
)
target_link_libraries
(
JSONParser PUBLIC nlohmann_json::nlohmann_json
)
target_link_libraries
(
JSONParser PUBLIC nlohmann_json::nlohmann_json
)
else
()
message
(
WARNING
"'nlohmann_json' not found by CMake! The build may fail."
)
endif
()
target_include_directories
(
JSONParser PUBLIC
target_include_directories
(
JSONParser PUBLIC
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
>
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
>
$<INSTALL_INTERFACE:
${
CMAKE_INSTALL_INCLUDEDIR
}
>
)
$<INSTALL_INTERFACE:
${
CMAKE_INSTALL_INCLUDEDIR
}
>
)
...
@@ -19,6 +15,9 @@ source_group( "src" FILES ${SOURCES} )
...
@@ -19,6 +15,9 @@ source_group( "src" FILES ${SOURCES} )
set_target_properties
(
JSONParser PROPERTIES
set_target_properties
(
JSONParser PROPERTIES
VERSION
${
PROJECT_VERSION
}
VERSION
${
PROJECT_VERSION
}
SOVERSION
${
PROJECT_VERSION_MAJOR
}
)
SOVERSION
${
PROJECT_VERSION_MAJOR
}
)
if
(
GEOMODEL_USE_BUILTIN_JSON
)
add_dependencies
(
JSONParser JSON
)
endif
()
# Install the library.
# Install the library.
install
(
TARGETS JSONParser
install
(
TARGETS JSONParser
...
...
This diff is collapsed.
Click to expand it.
cmake/SetupJSON.cmake
0 → 100644
+
55
−
0
View file @
195e14ca
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
#
# This module is used to set up nlohmann_json for the project. Either by
# looking for it on the build machine, or by downloading it during the build
# itself.
#
# Configuration option for how XercesC should be used.
option
(
GEOMODEL_USE_BUILTIN_JSON
"Download a version of nlohmann_json during the build"
FALSE
)
# Now do what was requested.
if
(
GEOMODEL_USE_BUILTIN_JSON
)
# Tell the user what's happening.
message
(
STATUS
"Building nlohmann_json as part of the project"
)
# The include directory and library that will be produced.
set
(
nlohmann_json_INCLUDE_DIR
"
${
CMAKE_BINARY_DIR
}${
CMAKE_FILES_DIRECTORY
}
/JSONInstall/
${
CMAKE_INSTALL_INCLUDEDIR
}
"
)
set
(
nlohmann_json_INCLUDE_DIRS
"
${
nlohmann_json_INCLUDE_DIR
}
"
)
# Create the include directory already, otherwise CMake refuses to
# create the imported target.
file
(
MAKE_DIRECTORY
"
${
nlohmann_json_INCLUDE_DIR
}
"
)
# Build/install nlohmann_json using ExternalProject_Add(...).
include
(
ExternalProject
)
ExternalProject_Add
(
JSON
PREFIX
${
CMAKE_BINARY_DIR
}${
CMAKE_FILES_DIRECTORY
}
/JSONBuild
INSTALL_DIR
${
CMAKE_BINARY_DIR
}${
CMAKE_FILES_DIRECTORY
}
/JSONInstall
URL
"https://cern.ch/lcgpackages/tarFiles/sources/json-3.6.1.tar.gz"
URL_MD5
"c53592d55e7fec787cf0a406d36098a3"
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
-DCMAKE_BUILD_TYPE:STRING=
${
CMAKE_BUILD_TYPE
}
-DCMAKE_CXX_STANDARD:STRING=
${
CMAKE_CXX_STANDARD
}
-DJSON_BuildTests:BOOL=OFF -DJSON_MultipleHeaders:BOOL=ON
BUILD_BYPRODUCTS
"
${
nlohmann_json_INCLUDE_DIR
}
"
)
install
(
DIRECTORY
${
CMAKE_BINARY_DIR
}${
CMAKE_FILES_DIRECTORY
}
/JSONInstall/
DESTINATION .
COMPONENT Development
USE_SOURCE_PERMISSIONS
)
# Set up nlohmann_json's imported target.
add_library
(
nlohmann_json::nlohmann_json INTERFACE IMPORTED
)
set_target_properties
(
nlohmann_json::nlohmann_json PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES
"
${
nlohmann_json_INCLUDE_DIR
}
"
)
else
()
# Just find an existing installation of nlohmann_json.
find_package
(
nlohmann_json
)
endif
()
This diff is collapsed.
Click to expand it.
cmake/SetupXercesC.cmake
+
2
−
0
View file @
195e14ca
...
@@ -22,6 +22,8 @@ if( GEOMODEL_USE_BUILTIN_XERCESC )
...
@@ -22,6 +22,8 @@ if( GEOMODEL_USE_BUILTIN_XERCESC )
"
${
CMAKE_BINARY_DIR
}${
CMAKE_FILES_DIRECTORY
}
/XercesCInstall/
${
CMAKE_INSTALL_LIBDIR
}
/
${
CMAKE_SHARED_LIBRARY_PREFIX
}
xerces-c
${
CMAKE_SHARED_LIBRARY_SUFFIX
}
"
)
"
${
CMAKE_BINARY_DIR
}${
CMAKE_FILES_DIRECTORY
}
/XercesCInstall/
${
CMAKE_INSTALL_LIBDIR
}
/
${
CMAKE_SHARED_LIBRARY_PREFIX
}
xerces-c
${
CMAKE_SHARED_LIBRARY_SUFFIX
}
"
)
set
(
XercesC_LIBRARIES
"
${
XercesC_LIBRARY
}
"
)
set
(
XercesC_LIBRARIES
"
${
XercesC_LIBRARY
}
"
)
# Create the include directory already, otherwise CMake refuses to
# create the imported target.
file
(
MAKE_DIRECTORY
"
${
XercesC_INCLUDE_DIR
}
"
)
file
(
MAKE_DIRECTORY
"
${
XercesC_INCLUDE_DIR
}
"
)
# Build/install Eigen3 using ExternalProject_Add(...).
# Build/install Eigen3 using ExternalProject_Add(...).
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment