add src/opt/python/setup.py.in + update cmake project name + remove static cnorxz lib

This commit is contained in:
Christian Zimmermann 2022-11-24 02:08:04 +01:00
parent 7acc5c86ee
commit 25abf5e1b0
3 changed files with 68 additions and 10 deletions

View file

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.0)
project(multi_array)
project(cnorxz)
if(CMAKE_COMPILER_IS_GNUCXX)
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 7.0)
@ -22,7 +22,7 @@ else()
#set(INSTALL_PATH ${CMAKE_SOURCE_DIR}/install)
get_filename_component(INSTALL_PATH ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_PREFIX} ABSOLUTE)
endif()
message(WARNING "found absolute install path '${INSTALL_PATH}'")
message(STATUS "found absolute install path '${INSTALL_PATH}'")
find_package( GTest REQUIRED )
if(GTest_FOUND)

View file

@ -19,15 +19,15 @@ add_library(cnorxz SHARED
)
set_target_properties(cnorxz PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
add_library(cnorxz_static
$<TARGET_OBJECTS:cnorxz_obj>
)
set_target_properties(cnorxz_obj PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
#add_library(cnorxz_static
# $<TARGET_OBJECTS:cnorxz_obj>
# )
#set_target_properties(cnorxz_obj PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
install(TARGETS cnorxz
ARCHIVE DESTINATION ${INSTALL_PATH}/lib
LIBRARY DESTINATION ${INSTALL_PATH}/lib)
install(TARGETS cnorxz_static
ARCHIVE DESTINATION ${INSTALL_PATH}/lib
LIBRARY DESTINATION ${INSTALL_PATH}/lib)
#install(TARGETS cnorxz_static
# ARCHIVE DESTINATION ${INSTALL_PATH}/lib
# LIBRARY DESTINATION ${INSTALL_PATH}/lib)

View file

@ -0,0 +1,58 @@
#!/usr/bin/env python
import Cython.Build
import setuptools
libname = "@CMAKE_PROJECT_NAME@"
version = "@GIT_TAG_VERSION@"
author = "Christian Zimmermann"
author_email = "chizeta@f3l.de"
inc_dirs = list()
inc_dirs.append( "@INSTALL_PATH@/include" )
lib_dirs = list()
lib_dirs.append( "/usr/lib" )
lib_dirs.append( "/usr/local/lib" )
lib_dirs.append( "@INSTALL_PATH@/lib" )
default_extension_args = dict(
language = "c++",
include_dirs = inc_dirs,
libraries = [libname],
library_dirs = lib_dirs,
extra_compile_args = "@CMAKE_CXX_FLAGS@".split(),
)
if __name__ == "__main__":
print("Version:")
print("\t",version)
print("Include directories:")
for d in inc_dirs:
print("\t",d)
print("Library directories:")
for d in lib_dirs:
print("\t",d)
extensions = list()
extensions.append(
setuptools.Extension(
name = libname + ".base",
sources = [
"base/ranges.pys",
"base/array.pys",
],
**default_extension_args
)
)
# append further extensions (cereal, hdf5, mpi ...) here
setuptools.setup(
name = libname,
packages = setuptools.find_packages(),
version = version,
include_dirs = inc_dirs,
ext_modules = Cython.Build.cythonize(extensions),
author = author,
author_email = author_email,
)