Skip to content

Commit

Permalink
fixed nopython build, try to fix the macos conda-forge build
Browse files Browse the repository at this point in the history
  • Loading branch information
rikigigi committed Apr 26, 2023
1 parent 6177cb5 commit 4462745
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ jobs:
SOURCE_DIR: ${{github.workspace}}
BUILD_DIR: ${{github.workspace}}/build
PYTHONPATH: /usr/lib/python${{ matrix.python-version }}/dist-packages
- name: Build_nopython
run: |
cmake -B ${{github.workspace}}/build_nopython -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DPYTHON_INTERFACE:BOOL=OFF
cmake --build ${{github.workspace}}/build_nopython --config ${{env.BUILD_TYPE}}
ctest -C ${{env.BUILD_TYPE}}
build_windows:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
Expand Down
14 changes: 12 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,12 @@ set(BOOST_LIB boost)
endif()

add_executable(all_tests tests/src/all_tests.cpp)
target_link_libraries(all_tests ${PROJECT_NAME}_lib ${BOOST_LIB} test_fixtures ${LRT} )
target_link_libraries(all_tests PRIVATE ${PROJECT_NAME}_lib ${BOOST_LIB} test_fixtures ${LRT} )
if(PYTHON_INTERFACE)
if (${PYTHONLIBS_FOUND})
target_link_libraries(all_tests PUBLIC pybind11::embed)
endif()
endif()

set_property(TARGET all_tests PROPERTY CXX_STANDARD 17)

Expand All @@ -275,6 +280,7 @@ pybind11_add_module(pyanalisi
)
target_link_libraries(pyanalisi PRIVATE ${PROJECT_NAME}_lib ${LTR} )
set_property(TARGET pyanalisi PROPERTY CXX_STANDARD 17)
install(TARGETS pyanalisi DESTINATION ${PYTHON_SITE_PACKAGES} COMPONENT python )
endif()
endif()

Expand All @@ -291,6 +297,11 @@ endif()

if (BUILD_MMAP)
target_link_libraries(${PROJECT_NAME} PUBLIC boost_program_options "${FFTW}" "${FFTW_MT}" "${XDR_FILE}" ${LTR})
if(PYTHON_INTERFACE)
if (${PYTHONLIBS_FOUND})
target_link_libraries(${PROJECT_NAME} PUBLIC pybind11::embed)
endif()
endif()
endif()
target_link_libraries(${PROJECT_NAME}_lib PRIVATE "${FFTW}" "${FFTW_MT}" "${XDR_FILE}")
add_definitions(-DANALISI -DDEBUG)
Expand Down Expand Up @@ -350,5 +361,4 @@ CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_D
include_directories( ${CMAKE_CURRENT_BINARY_DIR} )

message(STATUS "python install library = ${PYTHON_SITE_PACKAGES}" )
install(TARGETS pyanalisi DESTINATION ${PYTHON_SITE_PACKAGES} COMPONENT python )

4 changes: 2 additions & 2 deletions lib/src/basetrajectory.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include "testtraiettoria.h"
#include "trajectory.h"
#include "trajectory_numpy.h"
#include "config.h"

template <class T>
Expand Down Expand Up @@ -91,9 +89,11 @@ size_t BaseTrajectory<T>::get_ntypes (){
}

#ifdef PYTHON_SUPPORT
#include "trajectory_numpy.h"
template class BaseTrajectory<Trajectory_numpy>;
#endif

#ifdef BUILD_MMAP
#include "trajectory.h"
template class BaseTrajectory<Trajectory>;
#endif

0 comments on commit 4462745

Please sign in to comment.