Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
a59c6de8
Commit
a59c6de8
authored
Jul 22, 2020
by
Henry Schreiner
Committed by
Henry Schreiner
Jul 23, 2020
Browse files
test: allow MSVC/Xcode to run the embed test
parent
49007b7f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
tests/CMakeLists.txt
tests/CMakeLists.txt
+2
-2
tests/test_embed/CMakeLists.txt
tests/test_embed/CMakeLists.txt
+10
-6
No files found.
tests/CMakeLists.txt
View file @
a59c6de8
...
...
@@ -211,10 +211,10 @@ foreach(target ${test_targets})
# Always write the output file directly into the 'tests' directory (even on MSVC)
if
(
NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY
)
set_target_properties
(
${
target
}
PROPERTIES LIBRARY_OUTPUT_DIRECTORY
${
testdir
}
)
set_target_properties
(
${
target
}
PROPERTIES LIBRARY_OUTPUT_DIRECTORY
"
${
testdir
}
"
)
foreach
(
config
${
CMAKE_CONFIGURATION_TYPES
}
)
string
(
TOUPPER
${
config
}
config
)
set_target_properties
(
${
target
}
PROPERTIES LIBRARY_OUTPUT_DIRECTORY_
${
config
}
${
testdir
}
)
set_target_properties
(
${
target
}
PROPERTIES LIBRARY_OUTPUT_DIRECTORY_
${
config
}
"
${
testdir
}
"
)
endforeach
()
endif
()
endforeach
()
...
...
tests/test_embed/CMakeLists.txt
View file @
a59c6de8
...
...
@@ -17,25 +17,29 @@ add_executable(test_embed
catch.cpp
test_interpreter.cpp
)
target_include_directories
(
test_embed PRIVATE
${
CATCH_INCLUDE_DIR
}
)
target_include_directories
(
test_embed PRIVATE
"
${
CATCH_INCLUDE_DIR
}
"
)
pybind11_enable_warnings
(
test_embed
)
if
(
NOT CMAKE_VERSION VERSION_LESS 3.0
)
target_link_libraries
(
test_embed PRIVATE pybind11::embed
)
else
()
target_include_directories
(
test_embed PRIVATE
${
PYBIND11_INCLUDE_DIR
}
${
PYTHON_INCLUDE_DIRS
}
)
target_compile_options
(
test_embed PRIVATE
${
PYBIND11_CPP_STANDARD
}
)
target_link_libraries
(
test_embed PRIVATE
${
PYTHON_LIBRARIES
}
)
target_include_directories
(
test_embed PRIVATE
"
${
PYBIND11_INCLUDE_DIR
}
"
"
${
PYTHON_INCLUDE_DIRS
}
"
)
target_compile_options
(
test_embed PRIVATE
"
${
PYBIND11_CPP_STANDARD
}
"
)
target_link_libraries
(
test_embed PRIVATE
"
${
PYTHON_LIBRARIES
}
"
)
endif
()
find_package
(
Threads REQUIRED
)
target_link_libraries
(
test_embed PUBLIC
${
CMAKE_THREAD_LIBS_INIT
}
)
add_custom_target
(
cpptest COMMAND $<TARGET_FILE:test_embed>
WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
)
WORKING_DIRECTORY
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
)
pybind11_add_module
(
external_module THIN_LTO external_module.cpp
)
set_target_properties
(
external_module PROPERTIES LIBRARY_OUTPUT_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
)
set_target_properties
(
external_module PROPERTIES LIBRARY_OUTPUT_DIRECTORY
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
)
foreach
(
config
${
CMAKE_CONFIGURATION_TYPES
}
)
string
(
TOUPPER
${
config
}
config
)
set_target_properties
(
external_module PROPERTIES LIBRARY_OUTPUT_DIRECTORY_
${
config
}
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
)
endforeach
()
add_dependencies
(
cpptest external_module
)
add_dependencies
(
check cpptest
)
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