Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dune-copasi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
COPASI
dune-copasi
Commits
e165c23c
Commit
e165c23c
authored
4 years ago
by
Santiago Ospina De Los Ríos
Browse files
Options
Downloads
Patches
Plain Diff
Clean up CMake targets
parent
a9d57df7
No related branches found
No related tags found
1 merge request
!49
Resolve "Finish installation and usage instruction on the documentation"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+27
-33
27 additions, 33 deletions
CMakeLists.txt
lib/CMakeLists.txt
+24
-17
24 additions, 17 deletions
lib/CMakeLists.txt
src/CMakeLists.txt
+5
-4
5 additions, 4 deletions
src/CMakeLists.txt
with
56 additions
and
54 deletions
CMakeLists.txt
+
27
−
33
View file @
e165c23c
...
...
@@ -2,19 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project
(
dune-copasi CXX
)
cmake_policy
(
SET CMP0074 NEW
)
if
(
POLICY CMP0087
)
cmake_policy
(
SET CMP0087 OLD
)
endif
()
# find dune-common
find_package
(
dune-common REQUIRED
)
# make sure to find cmake modules
list
(
APPEND CMAKE_MODULE_PATH
"
${
PROJECT_SOURCE_DIR
}
/cmake/modules"
"
${
dune-common_MODULE_PATH
}
"
)
# include macros for dune projects
include
(
DuneMacros
)
# define cmake options
option
(
DUNE_COPASI_SD_EXECUTABLE
"Build SingleDomain executable by default"
OFF
...
...
@@ -23,7 +15,6 @@ option(DUNE_COPASI_SD_LIBRARY
"Include precompiled SingleDomain objects in dune-copasi library (optional)"
${
DUNE_COPASI_SD_EXECUTABLE
}
)
option
(
DUNE_COPASI_MD_EXECUTABLE
"Build MultiDimain executable by default"
ON
...
...
@@ -32,18 +23,21 @@ option(DUNE_COPASI_MD_LIBRARY
"Include precompiled MultiDimain objects in dune-copasi library (optional)"
${
DUNE_COPASI_MD_EXECUTABLE
}
)
option
(
DUNE_COPASI_COMPILE_3D
"Compile 3D cases in libraries and executables"
OFF
)
# make sure to find our own cmake modules
list
(
APPEND CMAKE_MODULE_PATH
"
${
PROJECT_SOURCE_DIR
}
/cmake/modules"
)
# find dependencies
find_package
(
dune-common REQUIRED
)
find_package
(
muparser REQUIRED
)
find_package
(
TIFF REQUIRED
)
find_package
(
Filesystem
)
# if Filesystem is not found, using a fallback is mandatory
# if Filesystem is not found, using a fallback is mandatory
, otherwise, optional
include
(
CMakeDependentOption
)
cmake_dependent_option
(
USE_FALLBACK_FILESYSTEM
"Use bundled std::filesystem alternative (enable this for macOS older than 10.15)"
OFF
...
...
@@ -72,34 +66,37 @@ if(USE_FALLBACK_FILESYSTEM)
endif
()
endif
()
# start a dune project with information from dune.module
# include macros for dune projects
list
(
APPEND CMAKE_MODULE_PATH
"
${
dune-common_MODULE_PATH
}
"
)
include
(
DuneMacros
)
# start a dune project with information from dune.module, and find dune dependencies
dune_project
()
# main target
#
create
main target
add_library
(
dune-copasi
)
set_target_properties
(
dune-copasi PROPERTIES LIBRARY_OUTPUT_NAME dunecopasi
)
set_target_properties
(
dune-copasi PROPERTIES ARCHIVE_OUTPUT_NAME dunecopasi
)
# add dune dependencies to this target
dune_target_enable_all_packages
(
dune-copasi
)
# add dependencies
target_link_libraries
(
dune-copasi PUBLIC
${
DUNE_LIBS
}
TIFF::TIFF muparser::muparser
)
if
(
DUNE_COPASI_COMPILE_3D
)
target_compile_definitions
(
dune-copasi PUBLIC DUNE_COPASI_COMPILE_3D
)
endif
()
# include header files
add_subdirectory
(
dune
)
# include main library set up
add_subdirectory
(
lib
)
# source files for final libraries and executables
add_subdirectory
(
src
)
# documentation files
add_subdirectory
(
doc
)
# finalize the dune project: Generate and install config.h, cmake target and version file
finalize_dune_project
(
GENERATE_CONFIG_H_CMAKE
)
target_compile_definitions
(
dune-copasi INTERFACE HAVE_DUNE_COPASI_CONFIG_H
)
# main library is completely set up, define a read only 'dune::' alias for our main target
add_library
(
dune::copasi ALIAS dune-copasi
)
# install generated config in build and install directories
file
(
COPY
"
${
CMAKE_CURRENT_BINARY_DIR
}
/config.h"
DESTINATION
"
${
CMAKE_CURRENT_BINARY_DIR
}
/dune/copasi"
...
...
@@ -130,7 +127,7 @@ install(TARGETS dune-copasi
COMPONENT Development
)
# export targets to be used with
the
installed
packag
e
# export targets to be used with installed
tre
e
install
(
EXPORT dune-copasi-targets
FILE dune-copasi-targets.cmake
NAMESPACE dune-copasi::
...
...
@@ -138,15 +135,12 @@ install(EXPORT dune-copasi-targets
DESTINATION
"
${
CMAKE_INSTALL_LIBDIR
}
/cmake/dune-copasi"
)
# export targets to be used with build
directories
# export targets to be used with build
tree
export
(
EXPORT dune-copasi-targets
FILE
"
${
CMAKE_CURRENT_BINARY_DIR
}
/dune-copasi-targets.cmake"
NAMESPACE dune-copasi::
)
# library is set up, define a read only 'dune::' alias for our main target
add_library
(
dune::copasi ALIAS dune-copasi
)
# include tests as a sub project
include
(
CTest
)
if
(
BUILD_TESTING
)
...
...
This diff is collapsed.
Click to expand it.
lib/CMakeLists.txt
+
24
−
17
View file @
e165c23c
include
(
GNUInstallDirs
)
target_include_directories
(
dune-copasi
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
)
# add dune dependencies to main target
dune_target_enable_all_packages
(
dune-copasi
)
# add dependencies
target_link_libraries
(
dune-copasi PUBLIC
${
DUNE_LIBS
}
TIFF::TIFF muparser::muparser
)
if
(
DUNE_COPASI_COMPILE_3D
)
target_compile_definitions
(
dune-copasi PUBLIC DUNE_COPASI_COMPILE_3D
)
endif
()
# Set up filesystem. Where do we get it from?
if
(
USE_FALLBACK_FILESYSTEM
)
# and add ghc_filesystem to our filesystem target
target_link_libraries
(
dune-copasi PUBLIC ghcFilesystem::ghc_filesystem
)
target_compile_definitions
(
dune-copasi PUBLIC DUNE_COPASI_USE_FALLBACK_FILESYSTEM
)
else
()
# ... else we don't need a back up. Link agaist standard library
target_link_libraries
(
dune-copasi PUBLIC std::filesystem
)
endif
()
unset
(
EXPORTED_DEVELOPMENT_TARGETS
)
# define, link and install auxiliary develpment targets for dune-copasi
unset
(
AUX_DEVELOPMENT_TARGETS
)
# SingleDomain library
add_library
(
singledomain-lib
...
...
@@ -24,7 +41,7 @@ if(DUNE_COPASI_SD_LIBRARY)
set_target_properties
(
singledomain-lib PROPERTIES EXCLUDE_FROM_ALL OFF
)
target_link_libraries
(
dune-copasi INTERFACE singledomain-lib
)
target_compile_definitions
(
dune-copasi INTERFACE DUNE_COPASI_SD_LIBRARY
)
list
(
APPEND
EXPORTED
_DEVELOPMENT_TARGETS singledomain-lib
)
list
(
APPEND
AUX
_DEVELOPMENT_TARGETS singledomain-lib
)
endif
()
# MultiDomain library
...
...
@@ -45,21 +62,11 @@ if(DUNE_COPASI_MD_LIBRARY)
set_target_properties
(
multidomain-lib PROPERTIES EXCLUDE_FROM_ALL OFF
)
target_link_libraries
(
dune-copasi INTERFACE multidomain-lib
)
target_compile_definitions
(
dune-copasi INTERFACE DUNE_COPASI_MD_LIBRARY
)
list
(
APPEND EXPORTED_DEVELOPMENT_TARGETS multidomain-lib
)
endif
()
# Set up filesystem. Where do we get it from?
if
(
USE_FALLBACK_FILESYSTEM
)
# and add ghc_filesystem to our filesystem target
target_link_libraries
(
dune-copasi PUBLIC ghcFilesystem::ghc_filesystem
)
target_compile_definitions
(
dune-copasi PUBLIC DUNE_COPASI_USE_FALLBACK_FILESYSTEM
)
else
()
# ... else we don't need a back up. Link agaist standard library
target_link_libraries
(
dune-copasi PUBLIC std::filesystem
)
list
(
APPEND AUX_DEVELOPMENT_TARGETS multidomain-lib
)
endif
()
# install development targets
install
(
TARGETS
${
EXPORTED
_DEVELOPMENT_TARGETS
}
install
(
TARGETS
${
AUX
_DEVELOPMENT_TARGETS
}
EXPORT dune-copasi-targets
LIBRARY DESTINATION
"
${
CMAKE_INSTALL_LIBDIR
}
"
COMPONENT Libraries
...
...
This diff is collapsed.
Click to expand it.
src/CMakeLists.txt
+
5
−
4
View file @
e165c23c
include
(
GNUInstallDirs
)
# add source files to main library
target_sources
(
dune-copasi
PRIVATE
dune/copasi/model/base.cc
)
#
S
ingle
D
omain executable
add_executable
(
singledomain-exec EXCLUDE_FROM_ALL
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/
dune_copasi_sd.cc
"
)
#
set up s
ingle
-d
omain executable
add_executable
(
singledomain-exec EXCLUDE_FROM_ALL dune_copasi_sd.cc
)
target_link_libraries
(
singledomain-exec PRIVATE dune-copasi
)
if
(
DUNE_COPASI_SD_EXECUTABLE
)
set_target_properties
(
singledomain-exec PROPERTIES EXCLUDE_FROM_ALL OFF
)
...
...
@@ -18,8 +19,8 @@ if(DUNE_COPASI_SD_EXECUTABLE)
endif
()
set_property
(
TARGET singledomain-exec PROPERTY RUNTIME_OUTPUT_NAME dune-copasi-sd
)
#
M
ulti
D
omain executable
add_executable
(
multidomain-exec EXCLUDE_FROM_ALL
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/
dune_copasi_md.cc
"
)
#
set up m
ulti
-d
omain executable
add_executable
(
multidomain-exec EXCLUDE_FROM_ALL dune_copasi_md.cc
)
target_link_libraries
(
multidomain-exec PRIVATE dune-copasi
)
if
(
DUNE_COPASI_MD_EXECUTABLE
)
set_target_properties
(
multidomain-exec PROPERTIES EXCLUDE_FROM_ALL OFF
)
...
...
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