Skip to content

Commit b9070f7

Browse files
authored
Merge pull request #14 from jcarpent/devel
Try Windows without CppADCodeGen
2 parents d215aad + c4ba2e4 commit b9070f7

File tree

9 files changed

+101
-17
lines changed

9 files changed

+101
-17
lines changed

.github/workflows/ci-ubuntu-macos.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ name: PyCppAD CI for MacOS/Linux
33
on:
44
pull_request:
55
push:
6-
branches:
7-
- master
8-
- devel
9-
106

117
env:
128
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
@@ -56,7 +52,6 @@ jobs:
5652
5753
cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DPYTHON_EXECUTABLE=$(which python3) -DBUILD_WITH_CPPAD_CODEGEN_BINDINGS=ON
5854
make
59-
make build_tests
6055
export CTEST_OUTPUT_ON_FAILURE=1
6156
make test
6257
make install
@@ -65,4 +60,4 @@ jobs:
6560
shell: bash -l {0}
6661
run: |
6762
cd build
68-
make uninstall
63+
make uninstall

.github/workflows/ci-windows.yml_bk renamed to .github/workflows/ci-windows-clang.yml.to_be_fixed

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
name: PyCppAD CI for Windows
1+
name: PyCppAD CI for Windows - Clang
22
on:
33
pull_request:
44
push:
5-
branches:
6-
- master
7-
- devel
85

96
env:
107
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
@@ -63,7 +60,7 @@ jobs:
6360
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ^
6461
-DPYTHON_SITELIB=%CONDA_PREFIX%\Lib\site-packages ^
6562
-DPYTHON_EXECUTABLE=%CONDA_PREFIX%\python.exe ^
66-
-DBUILD_WITH_CPPAD_CODEGEN_BINDINGS=ON ^
63+
-DBUILD_WITH_CPPAD_CODEGEN_BINDINGS=OFF ^
6764
..
6865

6966
:: Build

.github/workflows/ci-windows-v142.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: PyCppAD CI for Windows - (v142)
2+
on:
3+
pull_request:
4+
push:
5+
6+
env:
7+
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
8+
BUILD_TYPE: Release
9+
10+
jobs:
11+
build:
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
fail-fast: true
15+
matrix:
16+
name: [windows-latest]
17+
18+
include:
19+
- name: windows-latest
20+
os: windows-2019
21+
22+
steps:
23+
- uses: actions/checkout@v2
24+
- name: Checkout submodules
25+
run: |
26+
git submodule update --init
27+
- uses: goanpeca/setup-miniconda@v1
28+
env:
29+
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
30+
with:
31+
activate-environment: pycppad
32+
environment-file: .github/workflows/conda/conda-env.yml
33+
python-version: 3.7
34+
- name: Install cmake and update conda
35+
run: |
36+
conda install cmake -c main
37+
38+
- name: Build PyCppAD
39+
shell: cmd /C CALL {0}
40+
env:
41+
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
42+
run: |
43+
:: unset extra Boost envs
44+
set Boost_ROOT=
45+
set BOOST_ROOT_1_69_0=
46+
set BOOST_ROOT_1_72_0=
47+
set PATH=%PATH:C:\hostedtoolcache\windows\Boost\1.72.0;=%
48+
49+
call "%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
50+
51+
:: Create build directory
52+
mkdir build
53+
pushd build
54+
55+
:: Configure
56+
cmake ^
57+
-G "Visual Studio 16 2019" -T "v142" -DCMAKE_GENERATOR_PLATFORM=x64 ^
58+
-DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\Library ^
59+
-DPYTHON_SITELIB=%CONDA_PREFIX%\Lib\site-packages ^
60+
-DPYTHON_EXECUTABLE=%CONDA_PREFIX%\python.exe ^
61+
-DBUILD_WITH_CPPAD_CODEGEN_BINDINGS=OFF ^
62+
..
63+
64+
:: Build
65+
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target install
66+
67+
:: Testing
68+
set PATH=%PATH%;%CONDA_PREFIX%\Lib\site-packages\pycppad
69+
ctest --output-on-failure -C Release -V
70+
71+
:: Test Python import
72+
cd ..
73+
python -c "import pycppad"

CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,21 @@ IF(BUILD_WITH_CPPAD_CODEGEN_BINDINGS)
9999
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${CMAKE_DL_LIBS})
100100
ENDIF(BUILD_WITH_CPPAD_CODEGEN_BINDINGS)
101101

102+
IF(MSVC)
103+
TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PUBLIC "/bigobj")
104+
ENDIF()
105+
106+
# Do not report:
107+
# -Wconversion as the BOOST_PYTHON_FUNCTION_OVERLOADS implicitly converts.
108+
# -Wcomment as latex equations have multi-line comments.
109+
IF(NOT WIN32)
110+
TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE -Wno-conversion -Wno-comment)
111+
ENDIF(NOT WIN32)
112+
IF(WIN32)
113+
TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PRIVATE -DNOMINMAX)
114+
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${PYTHON_LIBRARY})
115+
ENDIF(WIN32)
116+
102117
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME}
103118
SYSTEM PUBLIC
104119
${Boost_INCLUDE_DIRS}

include/pycppad/cppad.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
#ifndef __pycppad_cppad_hpp__
66
#define __pycppad_cppad_hpp__
77

8+
#include "pycppad/fwd.hpp"
89

910
namespace pycppad
1011
{
1112

1213
template<typename Scalar>
1314
void exposeCppADScalar();
1415

15-
void enablePyCppAD();
16+
PYCPPAD_DLLAPI void enablePyCppAD();
1617
}
1718

1819
#endif // #ifndef __pycppad_cppad_hpp__

python/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,16 @@ IF(IS_ABSOLUTE ${PYTHON_SITELIB})
2525
ELSE()
2626
SET(${PYWRAP}_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITELIB}/${PROJECT_NAME})
2727
ENDIF()
28+
IF(WIN32)
29+
TARGET_COMPILE_DEFINITIONS(${PYWRAP} PRIVATE -DNOMINMAX)
30+
TARGET_LINK_LIBRARIES(${PYWRAP} PUBLIC ${PYTHON_LIBRARY})
31+
ENDIF(WIN32)
2832

2933
SET_TARGET_PROPERTIES(${PYWRAP}
3034
PROPERTIES
3135
PREFIX ""
3236
SUFFIX ${PYTHON_EXT_SUFFIX}
33-
OUTPUT_NAME "${PROJECT_NAME}"
37+
OUTPUT_NAME "${PYWRAP}"
3438
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/python/${PROJECT_NAME}"
3539
)
3640

python/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ inline std::string printVersion(const std::string & delimiter = ".")
2323

2424
namespace bp = boost::python;
2525

26-
BOOST_PYTHON_MODULE(pycppad)
26+
BOOST_PYTHON_MODULE(pycppad_pywrap)
2727
{
2828
bp::docstring_options module_docstring_options(true,true,false);
2929

python/pycppad/__init__.py

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

5-
from .pycppad import *
6-
#from .pycppad import __version__, __raw_version__
5+
from .pycppad_pywrap import *
6+
from .pycppad_pywrap import __version__, __raw_version__

src/cppad.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include "pycppad/cppad.hpp"
1010
#include "pycppad/cppad-scalar.hpp"
1111

12-
1312
namespace pycppad
1413
{
1514

0 commit comments

Comments
 (0)