Skip to content

Commit b8402fe

Browse files
committed
cmake: Fix running test in build directory on Windows
1 parent f48e6e8 commit b8402fe

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

example/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1+
function(ADD_WINDOWS_DLL_PATH_TO_TEST TEST_NAME)
2+
if(WIN32)
3+
get_test_property(${TEST_NAME} ENVIRONMENT ENV_VARIABLES)
4+
list(APPEND ENV_VARIABLES
5+
"PYCPPAD_WINDOWS_DLL_PATH=$<TARGET_FILE_DIR:${PROJECT_NAME}>")
6+
set_tests_properties(${TEST_NAME} PROPERTIES ENVIRONMENT "${ENV_VARIABLES}")
7+
endif()
8+
endfunction()
9+
110
ADD_PYTHON_UNIT_TEST("${PROJECT_NAME}-add_eq" "example/add_eq.py" "python")
11+
ADD_WINDOWS_DLL_PATH_TO_TEST(${PROJECT_NAME}-add_eq)
212
IF(BUILD_WITH_CPPAD_CODEGEN_BINDINGS)
313
ADD_PYTHON_UNIT_TEST("${PROJECT_NAME}-cppadcg_c_codegen" "example/cppadcg_c_codegen.py" "python")
14+
ADD_WINDOWS_DLL_PATH_TO_TEST(${PROJECT_NAME}-cppadcg_c_codegen)
415
ENDIF()

python/pycppad/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
# Copyright 2021 INRIA
33
#
44

5-
from .pycppad_pywrap import *
6-
from .pycppad_pywrap import __version__, __raw_version__
7-
85
# On Windows, if pycppad.dll is not in the same directory than
96
# the .pyd, it will not be loaded.
107
# We first try to load pycppad, then, if it fail and we are on Windows:

0 commit comments

Comments
 (0)