Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dev/docker/cmake_ctest.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN mkdir /app
COPY ./cbflib /app/cbflib

RUN apt-get update && \
apt-get install -y build-essential git cmake default-jdk gfortran links m4 python3-dev python3-numpy-dev swig
apt-get install -y bison build-essential git cmake default-jdk gfortran links m4 python3-dev python3-numpy-dev swig

RUN cd /app/cbflib && \
cmake . && \
Expand Down
2 changes: 1 addition & 1 deletion .dev/docker/make_tests.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN mkdir /app
COPY ./cbflib /app/cbflib

RUN apt-get update && \
apt-get install -y bison build-essential git wget libjpeg-dev m4 automake libpcre2-dev liblzma-dev python3-build python3-dev python3-numpy-dev python3-setuptools python3-venv rsync gfortran libz-dev
apt-get install -y bison build-essential git wget libjpeg-dev m4 automake libpcre2-dev liblzma-dev links python3-build python3-dev python3-numpy-dev python3-setuptools python3-venv rsync gfortran libz-dev

RUN cd /app/cbflib && \
make all
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cmake_ctest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Install extra dependencies
run: |
sudo apt-get update
sudo apt-get install -y python3-numpy-dev
sudo apt-get install -y links python3-numpy-dev
- name: Build
run: |
cmake .
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/make_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Install extra dependencies
run: |
sudo apt-get update
sudo apt-get install -y libjpeg-dev liblzma-dev python3-build python3-dev python3-numpy-dev
sudo apt-get install -y libjpeg-dev liblzma-dev links python3-build python3-dev python3-numpy-dev
- name: Build
run: |
make all
Expand Down
42 changes: 35 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ if(CBF_ENABLE_FORTRAN)
endif()
endif()

option(CBF_ENABLE_DOC "Build documentation" OFF)
option(CBF_ENABLE_ULP "Enable ULP" OFF)

set (CBF_CMAKE_DEBUG "ON")
Expand Down Expand Up @@ -671,8 +672,15 @@ endif()
#
# Source files
#
# Since Bison 2.7 (2012-12-12), use of "%define api.pure full" is
# strongly encouraged.
find_package(BISON 2.7 REQUIRED)
bison_target(cbf_stx "${CBF__SRC}/cbf.stx.y" "cbf_stx.c"
DEFINES_FILE "cbf_stx.h")

set(
CBF_C_SOURCES
"${BISON_cbf_stx_OUTPUTS}"
${CBF__SRC}/cbf.c
"${CBF__SRC}/cbf_airy_disk.c"
${CBF__SRC}/cbf_alloc.c
Expand All @@ -698,7 +706,6 @@ set(
${CBF__SRC}/cbf_read_mime.c
${CBF__SRC}/cbf_simple.c
${CBF__SRC}/cbf_string.c
${CBF__SRC}/cbf_stx.c
${CBF__SRC}/cbf_tree.c
${CBF__SRC}/cbf_uncompressed.c
${CBF__SRC}/cbf_write.c
Expand Down Expand Up @@ -759,7 +766,6 @@ set(
${CBF__INCLUDE}/cbf_read_mime.h
${CBF__INCLUDE}/cbf_simple.h
${CBF__INCLUDE}/cbf_string.h
${CBF__INCLUDE}/cbf_stx.h
${CBF__INCLUDE}/cbf_tree.h
${CBF__INCLUDE}/cbf_uncompressed.h
${CBF__INCLUDE}/cbf_write.h
Expand Down Expand Up @@ -809,11 +815,6 @@ set(
CACHE STRING ""
)

# Set up the necessary includes

include_directories(BEFORE SYSTEM
${CBFlib_SOURCE_DIR}/include)


#
# Build the static and shared CBF libraries
Expand All @@ -835,6 +836,11 @@ endif()
set_target_properties(cbf PROPERTIES OUTPUT_NAME "cbf")
set_target_properties(cbf PROPERTIES LINKER_LANGUAGE C)
set_target_properties(cbf PROPERTIES SOVERSION "${SOVERSION}")
target_include_directories(cbf
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
target_link_libraries(cbf
PUBLIC hdf5
PRIVATE pcre2-posix
Expand All @@ -847,6 +853,10 @@ target_link_libraries(cbf
add_library(img "${CBF__SRC}/img.c")
set_target_properties(img PROPERTIES OUTPUT_NAME "img")
set_target_properties(img PROPERTIES LINKER_LANGUAGE C)
target_include_directories(img
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")


#
Expand Down Expand Up @@ -1045,6 +1055,24 @@ if(CBF_ENABLE_PYTHON)
TARGETS pycbf
COMPONENT "Runtime"
DESTINATION "${Python_SITEARCH}")

if(CBF_ENABLE_DOC)
find_program(PDFLATEX pdflatex REQUIRED)
add_custom_command(
OUTPUT "pycbf.pdf"
COMMAND "${PDFLATEX}"
-interaction batchmode
-output-directory "${CMAKE_CURRENT_BINARY_DIR}"
"pycbf.tex"
COMMAND "${PDFLATEX}"
-interaction batchmode
-output-directory "${CMAKE_CURRENT_BINARY_DIR}"
"pycbf.tex"
MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/pycbf/pycbf.tex"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/pycbf")
add_custom_target(pdf ALL
DEPENDS "pycbf.pdf")
endif()
endif()


Expand Down
72 changes: 34 additions & 38 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1771,10 +1771,8 @@ $(MINICBF_TESTS):
#
# Parser
#
$(SRC)/cbf_stx.c: $(SRC)/cbf.stx.y
bison $(SRC)/cbf.stx.y -o $(SRC)/cbf.stx.tab.c -d
mv $(SRC)/cbf.stx.tab.c $(SRC)/cbf_stx.c
mv $(SRC)/cbf.stx.tab.h $(INCLUDE)/cbf_stx.h
$(INCLUDE)/cbf_stx.h $(SRC)/cbf_stx.c &: $(SRC)/cbf.stx.y
bison -H$(INCLUDE)/cbf_stx.h -o$(SRC)/cbf_stx.c $(SRC)/cbf.stx.y

#
# CBF library
Expand Down Expand Up @@ -1904,18 +1902,14 @@ $(PY2CBF)/pycbf_test4.py \
$(PY2CBF)/pycbf_testfelaxes.py \
$(PY2CBF)/xmas/readmarheader.py \
$(PY2CBF)/xmas/xmasheaders.py \
$(PY2CBF)/xmas/xmas_cif_template.cif : $(NUWEB_DEP) $(NUWEB_DEP2) $(PY2CBF)/pycbf.w
(cd $(PY2CBF); $(NUWEB) pycbf.w )
$(PY2CBF)/xmas/xmas_cif_template.cif &: $(NUWEB_DEP) $(NUWEB_DEP2) $(PY2CBF)/pycbf.w
(cd $(PY2CBF); $(NUWEB) -t pycbf )

$(PY2CBF)/_py2cbf.$(PY2CBFEXT): $(PY2CBF) shared \
$(PY2CBF)/py2setup.py \
$(PY2CBF)/pycbf.i \
$(PY2CBF)/cbfhandlewrappers.i \
$(PY2CBF)/cbfdetectorwrappers.i \
$(PY2CBF)/cbfgenericwrappers.i \
$(PY2CBF)/cbfgoniometerwrappers.i
$(PY2CBF)/pycbf_wrap.c
-cp $(SOLIB)/*.$(SO_EXT) $(LIB)
(cd $(PY2CBF); $(PYTHON2) py2setup.py build $(PY2CBFBOPT); cp build/lib*/_py2cbf*.$(PY2CBFEXT) .)
(cd $(PY2CBF); $(PYTHON2) py2setup.py build $(PY2CBFBOPT); cp build/lib*/_py2cbf*.$(PY2CBFEXT) _py2cbf.$(PY2CBFEXT))

$(PY2CBF)/py2cbfinstall: $(PY2CBF)/pycbf.py
(cd $(PY2CBF); $(PYTHON2) $(PY2INSTALLSETUP_PY) install $(PY2CBFIOPT) --prefix=$(CBF_PREFIX))
Expand All @@ -1939,19 +1933,22 @@ $(LIB)/_py2cbf.$(PY2CBFEXT): $(PY2CBF)/_py2cbf.$(PY2CBFEXT)

$(PY2CBF)/pycbf.pdf: $(NUWEB_DEP) $(NUWEB_DEP2) $(PY2CBF)/pycbf.w
(cd $(PY2CBF); \
$(NUWEB) pycbf; \
latex pycbf; \
$(NUWEB) pycbf; \
latex pycbf; \
dvipdfm pycbf )
$(NUWEB) -o pycbf; \
pdflatex -interaction batchmode pycbf; \
pdflatex -interaction batchmode pycbf; \
$(NUWEB) -o pycbf; \
pdflatex -interaction batchmode pycbf )

$(PY2CBF)/CBFlib.txt: $(DOC)/CBFlib.html
links -dump $(DOC)/CBFlib.html > $(PY2CBF)/CBFlib.txt

$(PY2CBF)/pycbf.py: $(PY2CBF)/pycbf.pdf $(PY2CBF)/cbfdetectorwrappers.i \
$(PY2CBF)/cbfgenericwrappers.i \
$(PY2CBF)/cbfgoniometerwrappers.i \
$(PY2CBF)/CBFlib.txt $(PY2CBF)/make_pycbf.py
$(PY2CBF)/cbfdetectorwrappers.i \
$(PY2CBF)/cbfgenericwrappers.i \
$(PY2CBF)/cbfgoniometerwrappers.i \
$(PY2CBF)/cbfhandlewrappers.i \
$(PY2CBF)/cbfpositionerwrappers.i \
$(PY2CBF)/pycbf.py \
$(PY2CBF)/pycbf_wrap.c &: $(PY2CBF)/CBFlib.txt $(PY2CBF)/make_pycbf.py $(PY2CBF)/pycbf.i
(cd $(PY2CBF); $(PYTHON2) make_pycbf.py; $(PYSWIG) -module py2cbf pycbf.i; \
$(PYTHON2) py2setup.py build; mv pycbf.py rawpycbf.py; \
cat rawpycbf.py | sed "s/ _pycbf/ _py2cbf/" > pycbf.py )
Expand All @@ -1975,19 +1972,15 @@ $(PY3CBF)/pycbf_test4.py \
$(PY3CBF)/pycbf_testfelaxes.py \
$(PY3CBF)/xmas/readmarheader.py \
$(PY3CBF)/xmas/xmasheaders.py \
$(PY3CBF)/xmas/xmas_cif_template.cif: $(NUWEB_DEP) $(NUWEB_DEP2) $(PY3CBF)/pycbf.w
(cd $(PY3CBF); $(NUWEB) pycbf.w )
$(PY3CBF)/xmas/xmas_cif_template.cif &: $(NUWEB_DEP) $(NUWEB_DEP2) $(PY3CBF)/pycbf.w
(cd $(PY3CBF); $(NUWEB) -t pycbf )


$(PY3CBF)/_pycbf.$(PY3CBFEXT): $(PY3CBF) shared \
$(PY3CBF)/py3setup.py \
$(PY3CBF)/pycbf.i \
$(PY3CBF)/cbfhandlewrappers.i \
$(PY3CBF)/cbfdetectorwrappers.i \
$(PY3CBF)/cbfgenericwrappers.i \
$(PY3CBF)/cbfgoniometerwrappers.i
$(PY3CBF)/pycbf_wrap.c
-cp $(SOLIB)/*.$(SO_EXT) $(LIB)
(cd $(PY3CBF); $(PYTHON3) py3setup.py build $(PY3CBFBOPT); cp build/lib*/_pycbf*.$(PY3CBFEXT) .)
(cd $(PY3CBF); $(PYTHON3) py3setup.py build $(PY3CBFBOPT); cp build/lib*/_pycbf*.$(PY3CBFEXT) _pycbf.$(PY3CBFEXT))

$(PY3CBF)/py3cbfinstall: $(PY3CBF)/pycbf.py
(cd $(PY3CBF); $(PYTHON3) $(PY3INSTALLSETUP_PY) install $(PY3CBFIOPT) --prefix=$(CBF_PREFIX))
Expand All @@ -2011,19 +2004,22 @@ $(LIB)/_pycbf.$(PY3CBFEXT): $(PY3CBF)/_pycbf.$(PY3CBFEXT)

$(PY3CBF)/pycbf.pdf: $(NUWEB_DEP) $(NUWEB_DEP2) $(PY3CBF)/pycbf.w
(cd $(PY3CBF); \
$(NUWEB) pycbf; \
latex pycbf; \
$(NUWEB) pycbf; \
latex pycbf; \
dvipdfm pycbf )
$(NUWEB) -o pycbf; \
pdflatex -interaction batchmode pycbf; \
pdflatex -interaction batchmode pycbf; \
$(NUWEB) -o pycbf; \
pdflatex -interaction batchmode pycbf )

$(PY3CBF)/CBFlib.txt: $(DOC)/CBFlib.html
links -dump $(DOC)/CBFlib.html > $(PY3CBF)/CBFlib.txt

$(PY3CBF)/pycbf.py: $(PY3CBF)/pycbf.pdf $(PY3CBF)/cbfdetectorwrappers.i \
$(PY3CBF)/cbfgenericwrappers.i \
$(PY3CBF)/cbfgoniometerwrappers.i \
$(PY3CBF)/CBFlib.txt $(PY3CBF)/make_pycbf.py
$(PY3CBF)/cbfdetectorwrappers.i \
$(PY3CBF)/cbfgenericwrappers.i \
$(PY3CBF)/cbfgoniometerwrappers.i \
$(PY3CBF)/cbfhandlewrappers.i \
$(PY3CBF)/cbfpositionerwrappers.i \
$(PY3CBF)/pycbf.py \
$(PY3CBF)/pycbf_wrap.c &: $(PY3CBF)/CBFlib.txt $(PY3CBF)/make_pycbf.py $(PY3CBF)/pycbf.i
(cd $(PY3CBF); $(PYTHON3) make_pycbf.py; $(PYSWIG) pycbf.i; \
$(PYTHON3) py3setup.py build; mv pycbf.py rawpycbf.py; \
echo "# coding=utf-8" | cat - rawpycbf.py > pycbf.py)
Expand Down
72 changes: 34 additions & 38 deletions Makefile_LINUX
Original file line number Diff line number Diff line change
Expand Up @@ -1767,10 +1767,8 @@ $(MINICBF_TESTS):
#
# Parser
#
$(SRC)/cbf_stx.c: $(SRC)/cbf.stx.y
bison $(SRC)/cbf.stx.y -o $(SRC)/cbf.stx.tab.c -d
mv $(SRC)/cbf.stx.tab.c $(SRC)/cbf_stx.c
mv $(SRC)/cbf.stx.tab.h $(INCLUDE)/cbf_stx.h
$(INCLUDE)/cbf_stx.h $(SRC)/cbf_stx.c &: $(SRC)/cbf.stx.y
bison -H$(INCLUDE)/cbf_stx.h -o$(SRC)/cbf_stx.c $(SRC)/cbf.stx.y

#
# CBF library
Expand Down Expand Up @@ -1900,18 +1898,14 @@ $(PY2CBF)/pycbf_test4.py \
$(PY2CBF)/pycbf_testfelaxes.py \
$(PY2CBF)/xmas/readmarheader.py \
$(PY2CBF)/xmas/xmasheaders.py \
$(PY2CBF)/xmas/xmas_cif_template.cif : $(NUWEB_DEP) $(NUWEB_DEP2) $(PY2CBF)/pycbf.w
(cd $(PY2CBF); $(NUWEB) pycbf.w )
$(PY2CBF)/xmas/xmas_cif_template.cif &: $(NUWEB_DEP) $(NUWEB_DEP2) $(PY2CBF)/pycbf.w
(cd $(PY2CBF); $(NUWEB) -t pycbf )

$(PY2CBF)/_py2cbf.$(PY2CBFEXT): $(PY2CBF) shared \
$(PY2CBF)/py2setup.py \
$(PY2CBF)/pycbf.i \
$(PY2CBF)/cbfhandlewrappers.i \
$(PY2CBF)/cbfdetectorwrappers.i \
$(PY2CBF)/cbfgenericwrappers.i \
$(PY2CBF)/cbfgoniometerwrappers.i
$(PY2CBF)/pycbf_wrap.c
-cp $(SOLIB)/*.$(SO_EXT) $(LIB)
(cd $(PY2CBF); $(PYTHON2) py2setup.py build $(PY2CBFBOPT); cp build/lib*/_py2cbf*.$(PY2CBFEXT) .)
(cd $(PY2CBF); $(PYTHON2) py2setup.py build $(PY2CBFBOPT); cp build/lib*/_py2cbf*.$(PY2CBFEXT) _py2cbf.$(PY2CBFEXT))

$(PY2CBF)/py2cbfinstall: $(PY2CBF)/pycbf.py
(cd $(PY2CBF); $(PYTHON2) $(PY2INSTALLSETUP_PY) install $(PY2CBFIOPT) --prefix=$(CBF_PREFIX))
Expand All @@ -1935,19 +1929,22 @@ $(LIB)/_py2cbf.$(PY2CBFEXT): $(PY2CBF)/_py2cbf.$(PY2CBFEXT)

$(PY2CBF)/pycbf.pdf: $(NUWEB_DEP) $(NUWEB_DEP2) $(PY2CBF)/pycbf.w
(cd $(PY2CBF); \
$(NUWEB) pycbf; \
latex pycbf; \
$(NUWEB) pycbf; \
latex pycbf; \
dvipdfm pycbf )
$(NUWEB) -o pycbf; \
pdflatex -interaction batchmode pycbf; \
pdflatex -interaction batchmode pycbf; \
$(NUWEB) -o pycbf; \
pdflatex -interaction batchmode pycbf )

$(PY2CBF)/CBFlib.txt: $(DOC)/CBFlib.html
links -dump $(DOC)/CBFlib.html > $(PY2CBF)/CBFlib.txt

$(PY2CBF)/pycbf.py: $(PY2CBF)/pycbf.pdf $(PY2CBF)/cbfdetectorwrappers.i \
$(PY2CBF)/cbfgenericwrappers.i \
$(PY2CBF)/cbfgoniometerwrappers.i \
$(PY2CBF)/CBFlib.txt $(PY2CBF)/make_pycbf.py
$(PY2CBF)/cbfdetectorwrappers.i \
$(PY2CBF)/cbfgenericwrappers.i \
$(PY2CBF)/cbfgoniometerwrappers.i \
$(PY2CBF)/cbfhandlewrappers.i \
$(PY2CBF)/cbfpositionerwrappers.i \
$(PY2CBF)/pycbf.py \
$(PY2CBF)/pycbf_wrap.c &: $(PY2CBF)/CBFlib.txt $(PY2CBF)/make_pycbf.py $(PY2CBF)/pycbf.i
(cd $(PY2CBF); $(PYTHON2) make_pycbf.py; $(PYSWIG) -module py2cbf pycbf.i; \
$(PYTHON2) py2setup.py build; mv pycbf.py rawpycbf.py; \
cat rawpycbf.py | sed "s/ _pycbf/ _py2cbf/" > pycbf.py )
Expand All @@ -1971,19 +1968,15 @@ $(PY3CBF)/pycbf_test4.py \
$(PY3CBF)/pycbf_testfelaxes.py \
$(PY3CBF)/xmas/readmarheader.py \
$(PY3CBF)/xmas/xmasheaders.py \
$(PY3CBF)/xmas/xmas_cif_template.cif: $(NUWEB_DEP) $(NUWEB_DEP2) $(PY3CBF)/pycbf.w
(cd $(PY3CBF); $(NUWEB) pycbf.w )
$(PY3CBF)/xmas/xmas_cif_template.cif &: $(NUWEB_DEP) $(NUWEB_DEP2) $(PY3CBF)/pycbf.w
(cd $(PY3CBF); $(NUWEB) -t pycbf )


$(PY3CBF)/_pycbf.$(PY3CBFEXT): $(PY3CBF) shared \
$(PY3CBF)/py3setup.py \
$(PY3CBF)/pycbf.i \
$(PY3CBF)/cbfhandlewrappers.i \
$(PY3CBF)/cbfdetectorwrappers.i \
$(PY3CBF)/cbfgenericwrappers.i \
$(PY3CBF)/cbfgoniometerwrappers.i
$(PY3CBF)/pycbf_wrap.c
-cp $(SOLIB)/*.$(SO_EXT) $(LIB)
(cd $(PY3CBF); $(PYTHON3) py3setup.py build $(PY3CBFBOPT); cp build/lib*/_pycbf*.$(PY3CBFEXT) .)
(cd $(PY3CBF); $(PYTHON3) py3setup.py build $(PY3CBFBOPT); cp build/lib*/_pycbf*.$(PY3CBFEXT) _pycbf.$(PY3CBFEXT))

$(PY3CBF)/py3cbfinstall: $(PY3CBF)/pycbf.py
(cd $(PY3CBF); $(PYTHON3) $(PY3INSTALLSETUP_PY) install $(PY3CBFIOPT) --prefix=$(CBF_PREFIX))
Expand All @@ -2007,19 +2000,22 @@ $(LIB)/_pycbf.$(PY3CBFEXT): $(PY3CBF)/_pycbf.$(PY3CBFEXT)

$(PY3CBF)/pycbf.pdf: $(NUWEB_DEP) $(NUWEB_DEP2) $(PY3CBF)/pycbf.w
(cd $(PY3CBF); \
$(NUWEB) pycbf; \
latex pycbf; \
$(NUWEB) pycbf; \
latex pycbf; \
dvipdfm pycbf )
$(NUWEB) -o pycbf; \
pdflatex -interaction batchmode pycbf; \
pdflatex -interaction batchmode pycbf; \
$(NUWEB) -o pycbf; \
pdflatex -interaction batchmode pycbf )

$(PY3CBF)/CBFlib.txt: $(DOC)/CBFlib.html
links -dump $(DOC)/CBFlib.html > $(PY3CBF)/CBFlib.txt

$(PY3CBF)/pycbf.py: $(PY3CBF)/pycbf.pdf $(PY3CBF)/cbfdetectorwrappers.i \
$(PY3CBF)/cbfgenericwrappers.i \
$(PY3CBF)/cbfgoniometerwrappers.i \
$(PY3CBF)/CBFlib.txt $(PY3CBF)/make_pycbf.py
$(PY3CBF)/cbfdetectorwrappers.i \
$(PY3CBF)/cbfgenericwrappers.i \
$(PY3CBF)/cbfgoniometerwrappers.i \
$(PY3CBF)/cbfhandlewrappers.i \
$(PY3CBF)/cbfpositionerwrappers.i \
$(PY3CBF)/pycbf.py \
$(PY3CBF)/pycbf_wrap.c &: $(PY3CBF)/CBFlib.txt $(PY3CBF)/make_pycbf.py $(PY3CBF)/pycbf.i
(cd $(PY3CBF); $(PYTHON3) make_pycbf.py; $(PYSWIG) pycbf.i; \
$(PYTHON3) py3setup.py build; mv pycbf.py rawpycbf.py; \
echo "# coding=utf-8" | cat - rawpycbf.py > pycbf.py)
Expand Down
Loading