forked from henjo/libpsf
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fix table of contents extraction bug for non-transient simulations - Reconfigure build to use cmake - solves issues with libpsf.la builds - Automate tests with ctest - Use static libpsf.la for python bindings to prevent rpath issue and make build wheels portable
- Loading branch information
Showing
42 changed files
with
360 additions
and
1,723 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,5 @@ | ||
*.lo | ||
*.la | ||
.vscode/ | ||
build/ | ||
*.o | ||
*.so | ||
.deps | ||
.libs | ||
aclocal.m4 | ||
autom4te.cache | ||
configure | ||
Makefile | ||
Makefile.in | ||
INSTALL | ||
m4 | ||
py-compile | ||
config.* | ||
src/psftest | ||
test/test_psfdataset | ||
missing | ||
ltmain.sh | ||
libtool | ||
libpsf.pc | ||
libpsf-uninstalled.pc | ||
depcomp | ||
*~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# https://stackoverflow.com/questions/17511496/how-to-create-a-shared-library-with-cmake | ||
# https://github.com/giuliopaci/cmake-tutorial/blob/master/CMakeLists.txt | ||
|
||
cmake_minimum_required(VERSION 3.12) | ||
|
||
project(libpsf VERSION 0.3 | ||
DESCRIPTION "Load Cadence Spectre PSF simulation data" | ||
LANGUAGES CXX) | ||
|
||
option(WITH_PYTHON "Build python bindings" ON) | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED True) | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
|
||
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) | ||
include(CTest) | ||
endif() | ||
|
||
add_subdirectory(src) | ||
add_subdirectory(test) | ||
|
||
if(WITH_PYTHON) | ||
add_subdirectory(bindings) | ||
endif() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
add_subdirectory(python) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
libpsf.cpp | ||
libpsf.h | ||
*.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
find_package(Python COMPONENTS Interpreter Development) | ||
find_program(CYTHON_EXECUTABLE NAMES cython cython3 | ||
HINTS ${_python_path}) | ||
# find_program(Python REQUIRED COMPONENTS Interpreter Development NumPy) | ||
# https://bloerg.net/posts/cmake-and-distutils/ | ||
if( Python_EXECUTABLE AND CYTHON_EXECUTABLE) | ||
MESSAGE( STATUS "numpy headers found at: ${Python_NumPy_INCLUDE_DIRS}") | ||
MESSAGE( STATUS "cython found at: ${CYTHON_EXECUTABLE}") | ||
|
||
# set variables for setup.py.in | ||
get_target_property(LIBPSF_BUILD_DIR psf BINARY_DIR) | ||
get_target_property(LIBPSF_INCLUDE psf INCLUDE_DIRECTORIES) | ||
|
||
set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in") | ||
set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py") | ||
set(DEPS setup.py.in psfpython.h psfpython.cc libpsf.pyx cpp_defs.pxd) | ||
set(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/build/timestamp") | ||
configure_file(${SETUP_PY_IN} ${SETUP_PY}) | ||
# build commands | ||
add_custom_command(OUTPUT ${OUTPUT} | ||
COMMAND ${Python_EXECUTABLE} ${SETUP_PY} build_ext --inplace | ||
COMMAND ${Python_EXECUTABLE} ${SETUP_PY} bdist_wheel | ||
COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT} | ||
DEPENDS ${DEPS}) | ||
|
||
add_custom_target(python_binding ALL DEPENDS ${OUTPUT}) | ||
add_dependencies(python_binding psf) | ||
# install binding | ||
install(CODE "execute_process(COMMAND ${Python_EXECUTABLE} ${SETUP_PY} install)") | ||
|
||
|
||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dist | ||
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}) | ||
|
||
# tests | ||
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) | ||
add_test(NAME python_test | ||
COMMAND ${Python_EXECUTABLE} -m unittest test_psfdataset.py -v | ||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/tests") | ||
set_tests_properties(python_test PROPERTIES | ||
ENVIRONMENT PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}:$ENV{PYTHONPATH}) | ||
endif() | ||
|
||
else() | ||
MESSAGE( WARNING "python/numpy/cython include not found, skipping python bindings") | ||
endif() |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.