Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
5b07ea3e
Commit
5b07ea3e
authored
Apr 08, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify dependencies of static libs
parent
c58ee73e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
75 deletions
+65
-75
CMakeLists.txt
CMakeLists.txt
+29
-57
libcaf_core/CMakeLists.txt
libcaf_core/CMakeLists.txt
+23
-9
libcaf_io/CMakeLists.txt
libcaf_io/CMakeLists.txt
+13
-9
No files found.
CMakeLists.txt
View file @
5b07ea3e
...
...
@@ -182,6 +182,17 @@ endif(ENABLE_ADDRESS_SANITIZER)
if
(
NOT APPLE AND NOT WIN32
)
set
(
EXTRA_FLAGS
"
${
EXTRA_FLAGS
}
-pthread"
)
endif
()
# -fPIC generates warnings on MinGW plus extra setup steps needed on MinGW
if
(
MINGW
)
add_definitions
(
-D_WIN32_WINNT=0x0600
)
add_definitions
(
-DWIN32
)
include
(
GenerateExportHeader
)
set
(
LD_FLAGS
"ws2_32 -liphlpapi"
)
# build static to avoid runtime dependencies to GCC libraries
set
(
EXTRA_FLAGS
"
${
EXTRA_FLAGS
}
-static"
)
else
()
set
(
EXTRA_FLAGS
"
${
EXTRA_FLAGS
}
-fPIC"
)
endif
()
# check if the user provided CXXFLAGS, set defaults otherwise
if
(
CMAKE_CXX_FLAGS
)
set
(
CMAKE_CXX_FLAGS_DEBUG
""
)
...
...
@@ -189,7 +200,7 @@ if(CMAKE_CXX_FLAGS)
set
(
CMAKE_CXX_FLAGS_RELEASE
""
)
set
(
CMAKE_CXX_FLAGS_RELWITHDEBINFO
""
)
else
()
set
(
CMAKE_CXX_FLAGS
"-std=c++11 -Wextra -Wall -pedantic
-fPIC
${
EXTRA_FLAGS
}
"
)
set
(
CMAKE_CXX_FLAGS
"-std=c++11 -Wextra -Wall -pedantic
${
EXTRA_FLAGS
}
"
)
set
(
CMAKE_CXX_FLAGS_DEBUG
"-O0 -g"
)
set
(
CMAKE_CXX_FLAGS_MINSIZEREL
"-Os"
)
set
(
CMAKE_CXX_FLAGS_RELEASE
"-O3 -DNDEBUG"
)
...
...
@@ -199,13 +210,6 @@ endif()
if
(
NOT CMAKE_BUILD_TYPE
)
set
(
CMAKE_BUILD_TYPE RelWithDebInfo
)
endif
()
# extra setup steps needed on MinGW
if
(
MINGW
)
add_definitions
(
-D_WIN32_WINNT=0x0600
)
add_definitions
(
-DWIN32
)
include
(
GenerateExportHeader
)
set
(
LD_FLAGS
"ws2_32 -liphlpapi"
)
endif
()
# needed by subprojects
set
(
LD_FLAGS
${
LD_FLAGS
}
${
CMAKE_LD_LIBS
}
)
...
...
@@ -282,17 +286,17 @@ message(STATUS "Enter subdirectory libcaf_core")
add_subdirectory
(
libcaf_core
)
# set core lib for sub directories
if
(
NOT CAF_BUILD_STATIC_ONLY
)
set
(
LIBCAF_CORE_LIBRARY libcaf_core
)
set
(
LIBCAF_CORE_LIBRARY libcaf_core
_shared
)
else
()
set
(
LIBCAF_CORE_LIBRARY libcaf_core
S
tatic
)
set
(
LIBCAF_CORE_LIBRARY libcaf_core
_s
tatic
)
endif
()
message
(
STATUS
"Enter subdirectory libcaf_io"
)
add_subdirectory
(
libcaf_io
)
# set io lib for sub directories
if
(
NOT CAF_BUILD_STATIC_ONLY
)
set
(
LIBCAF_IO_LIBRARY libcaf_io
)
set
(
LIBCAF_IO_LIBRARY libcaf_io
_shared
)
else
()
set
(
LIBCAF_IO_LIBRARY libcaf_io
S
tatic
)
set
(
LIBCAF_IO_LIBRARY libcaf_io
_s
tatic
)
endif
()
# set opencl lib for sub directories if not told otherwise
if
(
NOT CAF_NO_OPENCL AND EXISTS
"
${
CMAKE_SOURCE_DIR
}
/libcaf_opencl/CMakeLists.txt"
)
...
...
@@ -300,18 +304,13 @@ if(NOT CAF_NO_OPENCL AND EXISTS "${CMAKE_SOURCE_DIR}/libcaf_opencl/CMakeLists.tx
find_package
(
OPENCL REQUIRED
)
add_subdirectory
(
libcaf_opencl
)
if
(
NOT CAF_BUILD_STATIC_ONLY
)
set
(
LIBCAF_OPENCL_LIBRARY libcaf_opencl
)
set
(
LIBCAF_OPENCL_LIBRARY libcaf_opencl
_shared
)
else
()
set
(
LIBCAF_OPENCL_LIBRARY libcaf_opencl
S
tatic
)
set
(
LIBCAF_OPENCL_LIBRARY libcaf_opencl
_s
tatic
)
endif
()
endif
()
# tell CMake caf_io depends on caf_core
if
(
CAF_BUILD_STATIC_ONLY OR CAF_BUILD_STATIC
)
add_dependencies
(
libcaf_ioStatic libcaf_coreStatic
)
endif
()
if
(
NOT CAF_BUILD_STATIC_ONLY
)
add_dependencies
(
libcaf_io libcaf_core
)
endif
()
add_dependencies
(
libcaf_io libcaf_core
)
# set LIBCAF_LIBRARIES for other subprojects
set
(
LIBCAF_LIBRARIES
"
${
LIBCAF_CORE_LIBRARY
}
"
"
${
LIBCAF_IO_LIBRARY
}
"
...
...
@@ -321,11 +320,7 @@ if(NOT CAF_NO_UNIT_TESTS)
enable_testing
()
message
(
STATUS
"Enter subdirectory unit_testing"
)
add_subdirectory
(
unit_testing
)
if
(
NOT CAF_BUILD_STATIC_ONLY
)
add_dependencies
(
all_unit_tests libcaf_io
)
else
()
add_dependencies
(
all_unit_tests libcaf_ioStatic
)
endif
()
add_dependencies
(
all_unit_tests libcaf_core libcaf_io
)
if
(
NOT CAF_NO_OPENCL AND EXISTS
"
${
CMAKE_SOURCE_DIR
}
/libcaf_opencl/CMakeLists.txt"
)
add_subdirectory
(
libcaf_opencl/unit_testing
)
endif
()
...
...
@@ -334,32 +329,21 @@ endif()
if
(
NOT CAF_NO_EXAMPLES
)
message
(
STATUS
"Enter subdirectory examples"
)
add_subdirectory
(
examples
)
if
(
NOT CAF_BUILD_STATIC_ONLY
)
add_dependencies
(
all_examples libcaf_io
)
else
()
add_dependencies
(
all_examples libcaf_ioStatic
)
endif
()
add_dependencies
(
all_examples libcaf_core libcaf_io
)
if
(
NOT CAF_NO_OPENCL AND EXISTS
"
${
CMAKE_SOURCE_DIR
}
/libcaf_opencl/CMakeLists.txt"
)
add_subdirectory
(
libcaf_opencl/examples
)
if
(
NOT CAF_BUILD_STATIC_ONLY
)
add_dependencies
(
opencl_examples libcaf_opencl
)
else
()
add_dependencies
(
opencl_examples libcaf_openclStatic
)
endif
()
add_dependencies
(
opencl_examples libcaf_opencl
)
endif
()
endif
()
# build RIAC if not being told otherwise
if
(
NOT CAF_NO_RIAC AND EXISTS
"
${
CMAKE_SOURCE_DIR
}
/libcaf_riac/CMakeLists.txt"
)
message
(
STATUS
"Enter subdirectory probe"
)
add_subdirectory
(
libcaf_riac
)
if
(
CAF_BUILD_STATIC_ONLY OR CAF_BUILD_STATIC
)
add_dependencies
(
libcaf_riacStatic libcaf_ioStatic
)
endif
()
if
(
CAF_BUILD_STATIC_ONLY
)
set
(
LIBCAF_LIBRARIES
"
${
LIBCAF_LIBRARIES
}
"
libcaf_riacStatic
)
add_dependencies
(
libcaf_riac libcaf_core libcaf_io
)
if
(
NOT CAF_BUILD_STATIC_ONLY
)
set
(
LIBCAF_LIBRARIES
"
${
LIBCAF_LIBRARIES
}
"
libcaf_riac_shared
)
else
()
add_dependencies
(
libcaf_riac libcaf_io
)
set
(
LIBCAF_LIBRARIES
"
${
LIBCAF_LIBRARIES
}
"
libcaf_riac
)
set
(
LIBCAF_LIBRARIES
"
${
LIBCAF_LIBRARIES
}
"
libcaf_riac_static
)
endif
()
# add headers to include directories so other subprojects can use RIAC
include_directories
(
"
${
LIBCAF_INCLUDE_DIRS
}
"
"
${
CMAKE_SOURCE_DIR
}
/libcaf_riac"
)
...
...
@@ -376,11 +360,7 @@ if(NOT CAF_NO_NEXUS AND EXISTS "${CMAKE_SOURCE_DIR}/nexus/CMakeLists.txt")
else
()
message
(
STATUS
"Enter subdirectory nexus"
)
add_subdirectory
(
nexus
)
if
(
CAF_BUILD_STATIC_ONLY
)
add_dependencies
(
nexus libcaf_riacStatic
)
else
()
add_dependencies
(
nexus libcaf_riac
)
endif
()
add_dependencies
(
nexus libcaf_riac
)
set
(
CAF_NO_NEXUS no
)
endif
()
else
()
...
...
@@ -395,11 +375,7 @@ if(NOT CAF_NO_CASH AND EXISTS "${CMAKE_SOURCE_DIR}/cash/CMakeLists.txt")
else
()
message
(
STATUS
"Enter subdirectory cash"
)
add_subdirectory
(
cash
)
if
(
CAF_BUILD_STATIC_ONLY
)
add_dependencies
(
cash libcaf_riacStatic
)
else
()
add_dependencies
(
cash libcaf_riac
)
endif
()
add_dependencies
(
cash libcaf_riac
)
set
(
CAF_NO_CASH no
)
endif
()
else
()
...
...
@@ -410,11 +386,7 @@ endif()
if
(
NOT CAF_NO_BENCHMARKS AND EXISTS
"
${
CMAKE_SOURCE_DIR
}
/benchmarks/CMakeLists.txt"
)
message
(
STATUS
"Enter subdirectory benchmarks"
)
add_subdirectory
(
benchmarks
)
if
(
CAF_BUILD_STATIC_ONLY
)
add_dependencies
(
all_benchmarks libcaf_ioStatic
)
else
()
add_dependencies
(
all_benchmarks libcaf_io
)
endif
()
add_dependencies
(
all_benchmarks libcaf_io
)
else
()
# make sure variable is set for build log
set
(
CAF_NO_BENCHMARKS yes
)
...
...
libcaf_core/CMakeLists.txt
View file @
5b07ea3e
...
...
@@ -3,6 +3,14 @@ project(caf_core C CXX)
set
(
CMAKE_MODULE_PATH
${
CMAKE_CURRENT_SOURCE_DIR
}
)
set
(
CMAKE_CXX_FLAGS
"-std=c++11 -Wextra -Wall -pedantic
${
EXTRA_FLAGS
}
"
)
include_directories
(
.
)
# get header files; only needed by CMake generators,
...
...
@@ -81,28 +89,34 @@ set (LIBCAF_CORE_SRCS
src/uniform_type_info.cpp
src/uniform_type_info_map.cpp
)
add_custom_target
(
libcaf_core
)
# build shared library if not compiling static only
if
(
NOT
"
${
CAF_BUILD_STATIC_ONLY
}
"
STREQUAL
"yes"
)
add_library
(
libcaf_core SHARED
${
LIBCAF_CORE_SRCS
}
${
LIBCAF_CORE_HDRS
}
)
target_link_libraries
(
libcaf_core
${
LD_FLAGS
}
)
if
(
NOT
CAF_BUILD_STATIC_ONLY
)
add_library
(
libcaf_core
_shared
SHARED
${
LIBCAF_CORE_SRCS
}
${
LIBCAF_CORE_HDRS
}
)
target_link_libraries
(
libcaf_core
_shared
${
LD_FLAGS
}
)
set
(
LIBRARY_SOVERSION
${
CAF_VERSION_MAJOR
}
)
set_target_properties
(
libcaf_core
set_target_properties
(
libcaf_core
_shared
PROPERTIES
SOVERSION
${
LIBRARY_SOVERSION
}
VERSION
${
CAF_VERSION
}
OUTPUT_NAME caf_core
)
if
(
NOT WIN32
)
install
(
TARGETS libcaf_core LIBRARY DESTINATION lib
)
install
(
TARGETS libcaf_core
_shared
LIBRARY DESTINATION lib
)
endif
()
add_dependencies
(
libcaf_core_shared libcaf_core
)
endif
()
# build static library only if --build-static or --build-static-only was set
if
(
"
${
CAF_BUILD_STATIC_ONLY
}
"
STREQUAL
"yes"
OR
"
${
CAF_BUILD_STATIC
}
"
STREQUAL
"yes"
)
add_library
(
libcaf_coreStatic STATIC
${
LIBCAF_CORE_HDRS
}
${
LIBCAF_CORE_SRCS
}
)
set_target_properties
(
libcaf_coreStatic PROPERTIES OUTPUT_NAME caf_core_static
)
if
(
CAF_BUILD_STATIC_ONLY OR CAF_BUILD_STATIC
)
add_library
(
libcaf_core_static STATIC
${
LIBCAF_CORE_HDRS
}
${
LIBCAF_CORE_SRCS
}
)
target_link_libraries
(
libcaf_core_static
${
LD_FLAGS
}
)
set_target_properties
(
libcaf_core_static PROPERTIES OUTPUT_NAME caf_core_static
)
if
(
NOT WIN32
)
install
(
TARGETS libcaf_core
S
tatic ARCHIVE DESTINATION lib
)
install
(
TARGETS libcaf_core
_s
tatic ARCHIVE DESTINATION lib
)
endif
()
add_dependencies
(
libcaf_core_static libcaf_core
)
endif
()
link_directories
(
${
LD_DIRS
}
)
include_directories
(
.
${
INCLUDE_DIRS
}
)
libcaf_io/CMakeLists.txt
View file @
5b07ea3e
...
...
@@ -24,28 +24,32 @@ set (LIBCAF_IO_SRCS
src/acceptor_manager.cpp
src/multiplexer.cpp
)
add_custom_target
(
libcaf_io
)
# build shared library if not compiling static only
if
(
NOT
"
${
CAF_BUILD_STATIC_ONLY
}
"
STREQUAL
"yes"
)
add_library
(
libcaf_io SHARED
${
LIBCAF_IO_SRCS
}
${
LIBCAF_IO_HDRS
}
)
target_link_libraries
(
libcaf_io
${
LD_FLAGS
}
${
LIBCAF_CORE_LIBRARY
}
)
if
(
NOT
CAF_BUILD_STATIC_ONLY
)
add_library
(
libcaf_io
_shared
SHARED
${
LIBCAF_IO_SRCS
}
${
LIBCAF_IO_HDRS
}
)
target_link_libraries
(
libcaf_io
_shared
${
LD_FLAGS
}
${
LIBCAF_CORE_LIBRARY
}
)
set
(
LIBRARY_SOVERSION
${
CAF_VERSION_MAJOR
}
)
set_target_properties
(
libcaf_io
set_target_properties
(
libcaf_io
_shared
PROPERTIES
SOVERSION
${
LIBRARY_SOVERSION
}
VERSION
${
CAF_VERSION
}
OUTPUT_NAME caf_io
)
if
(
NOT WIN32
)
install
(
TARGETS libcaf_io LIBRARY DESTINATION lib
)
install
(
TARGETS libcaf_io
_shared
LIBRARY DESTINATION lib
)
endif
()
add_dependencies
(
libcaf_io_shared libcaf_io
)
endif
()
# build static library only if --build-static or --build-static-only was set
if
(
"
${
CAF_BUILD_STATIC_ONLY
}
"
STREQUAL
"yes"
OR
"
${
CAF_BUILD_STATIC
}
"
STREQUAL
"yes"
)
add_library
(
libcaf_io
S
tatic STATIC
${
LIBCAF_IO_HDRS
}
${
LIBCAF_IO_SRCS
}
)
set_target_properties
(
libcaf_io
S
tatic PROPERTIES OUTPUT_NAME caf_io_static
)
if
(
CAF_BUILD_STATIC_ONLY OR CAF_BUILD_STATIC
)
add_library
(
libcaf_io
_s
tatic STATIC
${
LIBCAF_IO_HDRS
}
${
LIBCAF_IO_SRCS
}
)
set_target_properties
(
libcaf_io
_s
tatic PROPERTIES OUTPUT_NAME caf_io_static
)
if
(
NOT WIN32
)
install
(
TARGETS libcaf_io
S
tatic ARCHIVE DESTINATION lib
)
install
(
TARGETS libcaf_io
_s
tatic ARCHIVE DESTINATION lib
)
endif
()
add_dependencies
(
libcaf_io_static libcaf_io
)
endif
()
link_directories
(
${
LD_DIRS
}
)
...
...
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