Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
452c3c3b
Commit
452c3c3b
authored
Jan 04, 2018
by
zhujiashun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refine obj files
parent
16871a89
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
32 deletions
+26
-32
CMakeLists.txt
CMakeLists.txt
+5
-14
CMakeLists.txt
src/CMakeLists.txt
+10
-5
CMakeLists.txt
test/CMakeLists.txt
+11
-13
No files found.
CMakeLists.txt
View file @
452c3c3b
...
...
@@ -16,18 +16,18 @@ else()
endif
()
option
(
WITH_GLOG
"With glog"
OFF
)
option
(
BRPC_DEBUG
"With debug symbol"
ON
)
option
(
DEBUG
"Print debug logs"
OFF
)
option
(
WITH_DEBUG_SYMBOLS
"With debug symbols"
OFF
)
option
(
BUILD_EXAMPLE
"Whether building examples"
OFF
)
option
(
BUILD_UNIT_TESTS
"Whether building unit tests"
OFF
)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
set
(
WITH_GLOG_VAL
"0"
)
if
(
WITH_GLOG
)
set
(
WITH_GLOG_VAL
"1"
)
else
()
set
(
WITH_GLOG_VAL
"0"
)
endif
()
if
(
BRPC_DEBUG
)
if
(
WITH_DEBUG_SYMBOLS
)
set
(
DEBUG_SYMBOL
"-g"
)
endif
()
...
...
@@ -272,7 +272,7 @@ set(SOURCES
${
BRPC_SOURCES4
}
${
PROTO_SRCS
}
)
ADD_SUBDIRECTORY
(
src
)
if
(
BUILD_EXAMPLE
)
ADD_SUBDIRECTORY
(
example
)
...
...
@@ -281,18 +281,9 @@ if(BUILD_UNIT_TESTS)
ADD_SUBDIRECTORY
(
test
)
endif
()
#install directory
# cmake -DCMAKE_INSTALL_PREFIX=/usr
install
(
DIRECTORY
${
CMAKE_SOURCE_DIR
}
/src/
DESTINATION include
FILES_MATCHING
PATTERN
"*.h"
PATTERN
"*.hpp"
)
install
(
DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
DESTINATION include
FILES_MATCHING
PATTERN
"*.h"
PATTERN
"*.hpp"
)
src/CMakeLists.txt
View file @
452c3c3b
if
(
BUILD_UNIT_TESTS
)
return
()
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-DUNIT_TEST -DBVAR_NOT_LINK_DEFAULT_VARIABLES"
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-DUNIT_TEST"
)
elseif
(
NOT DEBUG
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-DNDEBUG"
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-DNDEBUG"
)
endif
()
include_directories
(
${
CMAKE_CURRENT_BINARY_DIR
}
)
include_directories
(
${
CMAKE_SOURCE_DIR
}
/src
)
add_library
(
OBJ_LIB OBJECT
${
BUTIL_SOURCES
}
${
SOURCES
}
)
add_library
(
BUTIL_LIB OBJECT
${
BUTIL_SOURCES
}
)
add_library
(
OBJ_LIB OBJECT
${
SOURCES
}
)
# shared libraries need PIC
set_property
(
TARGET
${
OBJ_LIB
}
PROPERTY POSITION_INDEPENDENT_CODE 1
)
set_property
(
TARGET
${
BUTIL_LIB
}
PROPERTY POSITION_INDEPENDENT_CODE 1
)
add_library
(
brpc SHARED $<TARGET_OBJECTS:OBJ_LIB>
)
add_library
(
brpc_static STATIC $<TARGET_OBJECTS:OBJ_LIB>
)
add_library
(
brpc SHARED $<TARGET_OBJECTS:
BUTIL_LIB> $<TARGET_OBJECTS:
OBJ_LIB>
)
add_library
(
brpc_static STATIC $<TARGET_OBJECTS:
BUTIL_LIB> $<TARGET_OBJECTS:
OBJ_LIB>
)
target_link_libraries
(
brpc
${
DYNAMIC_LIB
}
)
...
...
test/CMakeLists.txt
View file @
452c3c3b
...
...
@@ -141,31 +141,29 @@ SET(TEST_BUTIL_SOURCES
# -DBVAR_NOT_LINK_DEFAULT_VARIABLES not work for gcc >= 5.0, just remove the file to prevent linking into unit tests
set
(
BVAR_SOURCE
${
BVAR_SOURCES1
}
${
BVAR_SOURCES2
}
)
list
(
REMOVE_ITEM BVAR_SOURCE
${
CMAKE_SOURCE_DIR
}
/src/bvar/default_variables.cpp
)
add_library
(
BUTIL_DEBUG_LIB OBJECT
${
BUTIL_SOURCES
}
)
add_library
(
OBJ_DEBUG_LIB OBJECT
${
SOURCES
}
)
file
(
GLOB TEST_BVAR_SRCS
"bvar_*_unittest.cpp"
)
add_executable
(
test_bvar $<TARGET_OBJECTS:BUTIL_
DEBUG_
LIB>
add_executable
(
test_bvar $<TARGET_OBJECTS:BUTIL_LIB>
${
BVAR_SOURCE
}
${
TEST_BVAR_SRCS
}
)
target_link_libraries
(
test_bvar
${
GTEST_LIB
}
${
GPERFTOOLS_LIBRARIES
}
${
DYNAMIC_LIB
}
)
add_library
(
PROTO_OBJ OBJECT
${
TEST_PROTO_SRCS
}
)
add_library
(
TEST_
PROTO_OBJ OBJECT
${
TEST_PROTO_SRCS
}
)
add_executable
(
test_butil
${
TEST_BUTIL_SOURCES
}
$<TARGET_OBJECTS:PROTO_OBJ>
$<TARGET_OBJECTS:BUTIL_
DEBUG_
LIB>
$<TARGET_OBJECTS:OBJ_
DEBUG_
LIB>
)
$<TARGET_OBJECTS:
TEST_
PROTO_OBJ>
$<TARGET_OBJECTS:BUTIL_LIB>
$<TARGET_OBJECTS:OBJ_LIB>
)
target_link_libraries
(
test_butil
${
GTEST_LIB
}
${
GPERFTOOLS_LIBRARIES
}
${
DYNAMIC_LIB
}
)
file
(
GLOB BTHREAD_UNITTESTS
"bthread*unittest.cpp"
)
foreach
(
BTHREAD_UT
${
BTHREAD_UNITTESTS
}
)
get_filename_component
(
BTHREAD_UT_WE
${
BTHREAD_UT
}
NAME_WE
)
add_executable
(
${
BTHREAD_UT_WE
}
${
BTHREAD_UT
}
$<TARGET_OBJECTS:PROTO_OBJ>
$<TARGET_OBJECTS:BUTIL_
DEBUG_
LIB>
$<TARGET_OBJECTS:OBJ_
DEBUG_
LIB>
)
$<TARGET_OBJECTS:
TEST_
PROTO_OBJ>
$<TARGET_OBJECTS:BUTIL_LIB>
$<TARGET_OBJECTS:OBJ_LIB>
)
target_link_libraries
(
${
BTHREAD_UT_WE
}
${
GTEST_MAIN_LIB
}
${
GTEST_LIB
}
...
...
@@ -177,9 +175,9 @@ file(GLOB BRPC_UNITTESTS "brpc_*_unittest.cpp")
foreach
(
BRPC_UT
${
BRPC_UNITTESTS
}
)
get_filename_component
(
BRPC_UT_WE
${
BRPC_UT
}
NAME_WE
)
add_executable
(
${
BRPC_UT_WE
}
${
BRPC_UT
}
$<TARGET_OBJECTS:PROTO_OBJ>
$<TARGET_OBJECTS:BUTIL_
DEBUG_
LIB>
$<TARGET_OBJECTS:OBJ_
DEBUG_
LIB>
)
$<TARGET_OBJECTS:
TEST_
PROTO_OBJ>
$<TARGET_OBJECTS:BUTIL_LIB>
$<TARGET_OBJECTS:OBJ_LIB>
)
target_link_libraries
(
${
BRPC_UT_WE
}
${
GTEST_MAIN_LIB
}
${
GPERFTOOLS_LIBRARIES
}
...
...
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