Skip to content

Commit

Permalink
Merge branch 'develop' into 'main'
Browse files Browse the repository at this point in the history
Update main branch to GDX release 7.11.2 (should propagate to products and GitHub)

See merge request devel/gdx!49
  • Loading branch information
0x17 committed Mar 26, 2024
2 parents 0726d06 + ca96380 commit eb490d6
Show file tree
Hide file tree
Showing 115 changed files with 26,075 additions and 2,273 deletions.
31 changes: 21 additions & 10 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ test-leg:
needs: [build-leg,install-gamsdist-leg]
script:
- GAMS_PATH=/cache/gams-installs/`cat gams_folder_leg.txt`/
- PATH=$GAMS_PATH:$PATH LD_LIBRARY_PATH="$GAMS_PATH" GMSPYTHONLIB="$GAMS_PATH/GMSPython/lib/libpython3.8.so" ./gdxtest --reporters=junit --out=doctest_results_linux.xml
- PATH=$GAMS_PATH:$PATH LD_LIBRARY_PATH="$GAMS_PATH" GMSPYTHONLIB="$GAMS_PATH/GMSPython/lib/libpython3.12.so" ./gdxtest --reporters=junit --out=doctest_results_linux.xml
- LD_LIBRARY_PATH=`pwd` ./gdxwraptest --reporters=junit --out=doctest_results_wrap_linux.xml
artifacts:
name: unittest-results-linux
Expand All @@ -228,7 +228,7 @@ test-deg:
needs: [build-deg,install-gamsdist-deg]
script:
- GAMS_PATH=$HOME/cache/gams-installs/`cat gams_folder_deg.txt`
- PATH=$GAMS_PATH:$PATH DYLD_LIBRARY_PATH=$(pwd)/lib:$GAMS_PATH GMSPYTHONLIB=$GAMS_PATH/GMSPython/lib/libpython3.8.dylib ./gdxtest --reporters=junit --out=doctest_results_deg.xml
- PATH=$GAMS_PATH:$PATH DYLD_LIBRARY_PATH=$(pwd)/lib:$GAMS_PATH GMSPYTHONLIB=$GAMS_PATH/GMSPython/lib/libpython3.12.dylib ./gdxtest --reporters=junit --out=doctest_results_deg.xml
- ./gdxwraptest --reporters=junit --out=doctest_results_wrap_deg.xml
artifacts:
name: unittest-results-deg
Expand All @@ -241,7 +241,8 @@ test-dac:
tags: [macos-arm64]
needs: [build-dac,install-gamsdist-dac]
script:
- ./gdxtest --reporters=junit --out=doctest_results_dac.xml
- GAMS_PATH=$HOME/cache/gams-installs/`cat gams_folder_dac.txt`
- PATH=$GAMS_PATH:$PATH DYLD_LIBRARY_PATH=$(pwd)/lib:$GAMS_PATH GMSPYTHONLIB=$GAMS_PATH/GMSPython/lib/libpython3.12.dylib ./gdxtest --reporters=junit --out=doctest_results_dac.xml
- ./gdxwraptest --reporters=junit --out=doctest_results_wrap_dac.xml
artifacts:
name: unittest-results-dac
Expand Down Expand Up @@ -279,8 +280,8 @@ leak-check-leg:
needs: [fetch-ci-scripts,build-debug-leg,install-gamsdist-leg]
script:
- GAMS_PATH=/cache/gams-installs/`cat gams_folder_leg.txt`/
- PATH=$GAMS_PATH:$PATH LD_LIBRARY_PATH="$GAMS_PATH" GMSPYTHONLIB="$GAMS_PATH/GMSPython/lib/libpython3.8.so" valgrind --leak-check=yes ./gdxtest_dbg
- valgrind --leak-check=yes --xml=yes --xml-file=valgrind_out.xml ./gdxtest_dbg
- PATH=$GAMS_PATH:$PATH LD_LIBRARY_PATH="$GAMS_PATH" GMSPYTHONLIB="$GAMS_PATH/GMSPython/lib/libpython3.12.so" valgrind --leak-check=yes ./gdxtest_dbg
- PATH=$GAMS_PATH:$PATH LD_LIBRARY_PATH="$GAMS_PATH" GMSPYTHONLIB="$GAMS_PATH/GMSPython/lib/libpython3.12.so" valgrind --leak-check=yes --xml=yes --xml-file=valgrind_out.xml ./gdxtest_dbg
- PYTHONPATH=$PYTHONPATH:valgrind-codequality python3 -m valgrind_codequality --input-file valgrind_out.xml --output-file valgrind_out.json
- python3 ci/codechecker_to_xml.py valgrind_out.json valgrind_junit.xml
artifacts:
Expand Down Expand Up @@ -312,13 +313,23 @@ perf-check-leg:
- cp libgdxcclib64.so mygamsdist
- GAMS_PATH=`pwd`/mygamsdist/
- ${GAMS_PATH}apilib gdxperf
- PATH=$GAMS_PATH:$PATH LD_LIBRARY_PATH="$GAMS_PATH" GMSPYTHONLIB="$GAMS_PATH/GMSPython/lib/libpython3.8.so" ${PERF_CALL} | tee cppgdx.log
- rm -rf mygamsdist
- python3 ci/fetch_gams.py fetch_and_install dist43 $SSH_KEY_PORTING
- python3 ci/fetch_gams.py version $PF_CUSTOM_BRANCH $SSH_KEY_PORTING > gams43_folder_leg.txt
- GAMS_PATH=/cache/gams-installs/`cat gams43_folder_leg.txt`/
- PATH=$GAMS_PATH:$PATH LD_LIBRARY_PATH="$GAMS_PATH" GMSPYTHONLIB="$GAMS_PATH/GMSPython/lib/libpython3.12.so" ${PERF_CALL} | tee cppgdx.log
# - python3 ci/fetch_gams.py fetch_and_install dist43 $SSH_KEY_PORTING
# - python3 ci/fetch_gams.py version $PF_CUSTOM_BRANCH $SSH_KEY_PORTING > gams43_folder_leg.txt
# - GAMS_PATH=/cache/gams-installs/`cat gams43_folder_leg.txt`/
- G43_ARCHIVE="gamsdist43.tar.bz2"
- G43_CLOUD_URL="https://cloud.gams.com/s/o4Jyt46eZra5ctc/download/gamsdist43.tar.bz2"
- curl $G43_CLOUD_URL > $G43_ARCHIVE # fetch from web
- G43_DIR=gamsdist43_tmp
- G43_PATH=/cache/gams-installs/$G43_DIR
- mkdir -p $G43_PATH
- tar -xjf $G43_ARCHIVE -C $G43_PATH # extract
- rm $G43_ARCHIVE # clean zip
- GAMS_PATH=$G43_PATH/gams43.4_linux_x64_64_sfx/
- cp /builds/devel/gdx/mygamsdist/gamslice.txt $GAMS_PATH
- ${GAMS_PATH}apilib gdxperf
- PATH=$GAMS_PATH:$PATH LD_LIBRARY_PATH="$GAMS_PATH" GMSPYTHONLIB="$GAMS_PATH/GMSPython/lib/libpython3.8.so" ${PERF_CALL} | tee delphigdx.log
- rm -rf mygamsdist $G43_PATH # clean GAMS 43 system dir
- python3 ci/perflogparse.py | tee perf.json
artifacts:
name: gdxperf-logs
Expand Down
187 changes: 65 additions & 122 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,149 +3,92 @@ project(gdx)
set(CMAKE_CXX_STANDARD 17)

find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)
if (CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif (CCACHE_FOUND)

set(mylibs dl pthread m)

set(CMAKE_SKIP_RPATH FALSE)
set(CMAKE_SKIP_BUILD_RPATH FALSE)

if ((APPLE OR CMAKE_C_COMPILER_ID STREQUAL "Clang") AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 14)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-non-prototype")
endif ()

if (APPLE)
set(CMAKE_BUILD_RPATH @executable_path/.)
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 14)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-non-prototype")
endif ()
else()
set(CMAKE_BUILD_RPATH $ORIGIN)
set(CMAKE_BUILD_RPATH @executable_path/.)
else ()
set(CMAKE_BUILD_RPATH $ORIGIN)
endif (APPLE)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGC_NO_MUTEX")
if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17 /W3 /EHs /D_CRT_SECURE_NO_WARNINGS /wd4267 /wd4996")
set(mylibs "")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17 /W3 /EHs /D_CRT_SECURE_NO_WARNINGS /wd4267 /wd4996")
set(mylibs "")
endif (MSVC)

if (UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wreturn-type -Wmissing-declarations -Wno-unknown-pragmas")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DZ_HAVE_UNISTD_H")
if(NOT APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat-truncation=0")
endif (NOT APPLE)
# -fsanitize=undefined
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wreturn-type -Wmissing-declarations -Wno-unknown-pragmas")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DZ_HAVE_UNISTD_H")
if (NOT APPLE AND NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat-truncation=0")
endif ()
endif (UNIX)

set(common
src/gmsstrm.h src/gmsstrm.cpp
src/gmsdata.h
src/batchalloc.h
src/datastorage.h
src/strhash.h
src/gmsobj.h
src/utils.h src/utils.cpp
src/gxfile.h src/gxfile.cpp
src/gdx.h
# ZLIB modules
# missing? run in project root: git clone https://github.com/madler/zlib zlib
zlib/adler32.c zlib/compress.c zlib/crc32.c zlib/deflate.c zlib/gzclose.c zlib/gzlib.c zlib/gzread.c
zlib/gzwrite.c zlib/infback.c zlib/inffast.c zlib/inflate.c zlib/inftrees.c zlib/trees.c zlib/uncompr.c
zlib/zutil.c
include(base-units.cmake)

set(zlib-units
# ZLIB modules
# missing? run in project root: git clone https://github.com/madler/zlib zlib
zlib/adler32.c zlib/compress.c zlib/crc32.c zlib/deflate.c zlib/gzclose.c zlib/gzlib.c zlib/gzread.c
zlib/gzwrite.c zlib/infback.c zlib/inffast.c zlib/inflate.c zlib/inftrees.c zlib/trees.c zlib/uncompr.c
zlib/zutil.c
)

set(gdx-core
# gdlib essential units
src/gdlib/gmsstrm.cpp
src/gdlib/gmsstrm.h
src/gdlib/utils.h
src/gdlib/utils.cpp

# GDX specific units
src/gxfile.h
src/gxfile.cpp
src/gdx.h

${zlib-units}
)

set(tests
src/tests/doctestmain.cpp
src/tests/gdxtests.cpp
src/tests/gxfiletests.cpp
src/tests/doctestmain.cpp

src/tests/gdxtests.h
src/tests/utilstests.cpp
src/tests/gmsobjtests.cpp
src/tests/gmsdatatests.cpp
src/tests/strhashtests.cpp
src/tests/datastoragetests.cpp
src/tests/gdxtests.cpp
src/tests/gxfiletests.cpp

src/tests/gdlib/datastoragetests.cpp
src/tests/gdlib/glookuptests.cpp
src/tests/gdlib/gmacrotests.cpp
src/tests/gdlib/gmsdatatests.cpp
src/tests/gdlib/gmsheapnewtests.cpp
src/tests/gdlib/gmsobjtests.cpp
src/tests/gdlib/gmsstrmtests.cpp
src/tests/gdlib/obfuscatestrtests.cpp
src/tests/gdlib/strhashtests.cpp
src/tests/gdlib/strutilxtests.cpp
src/tests/gdlib/utilstests.cpp
src/tests/gdlib/xcompresstests.cpp

src/tests/rtl/p3iotests.cpp
src/tests/rtl/p3utilstests.cpp
src/tests/rtl/stdthreadtests.cpp
src/tests/rtl/sysutilsp3tests.cpp
)

set(inc-dirs zlib src generated)

# Dynamic library / shared object
add_library(gdxcclib64 SHARED ${common} generated/gdxcclib.cpp )
if(UNIX)
target_compile_options(gdxcclib64 PRIVATE -fvisibility=hidden)
endif()
target_include_directories(gdxcclib64 PRIVATE ${inc-dirs})
if (APPLE)
set(cclib-link-options "-Bdynamic")
elseif(UNIX) # Linux
set(cclib-link-options "-Bdynamic -Wl,-Bsymbolic")
else() # Windows
set(cclib-link-options "")
endif()
target_link_libraries(gdxcclib64 ${mylibs} ${cclib-link-options})
set_property(TARGET gdxcclib64 PROPERTY POSITION_INDEPENDENT_CODE ON)

# Static library
add_library(gdx-static STATIC ${common})
target_include_directories(gdx-static PRIVATE ${inc-dirs})
set_property(TARGET gdx-static PROPERTY POSITION_INDEPENDENT_CODE ON)

# Unit test suite (against statically compiled GDX)
add_executable(gdxtest ${tests})
target_include_directories(gdxtest PRIVATE ${inc-dirs})
target_link_libraries(gdxtest gdx-static ${mylibs})

# Unit test suite (against GDX dynamic library)
add_executable(gdxwraptest src/tests/doctestmain.cpp src/tests/gdxtests.cpp generated/gdxcc.c)
target_link_libraries(gdxwraptest ${mylibs})
target_include_directories(gdxwraptest PRIVATE src generated)
target_compile_options(gdxwraptest PRIVATE -DGXFILE_CPPWRAP -DGC_NO_MUTEX)

# Quickly run "include what you use" (https://include-what-you-use.org/) over project
#find_program(iwyu_path NAMES include-what-you-use iwyu REQUIRED)
#set_property(TARGET gdxcclib64 PROPERTY CXX_INCLUDE_WHAT_YOU_USE ${iwyu_path})
#set_property(TARGET gdxtest PROPERTY CXX_INCLUDE_WHAT_YOU_USE ${iwyu_path})

# Standalone GDX example program 1
add_executable(xp_example1 ${common} src/examples/xp_example1.cpp)
target_include_directories(xp_example1 PRIVATE ${inc-dirs})
target_link_libraries(xp_example1 ${mylibs})

# Standalone GDX example program 2
add_executable(xp_example2 ${common} src/examples/xp_example2.cpp generated/optcc.c)
target_include_directories(xp_example2 PRIVATE ${inc-dirs})
target_link_libraries(xp_example2 ${mylibs})

# Standalone GDX example program 3 (associative "supply.demand" str -> double (level))
add_executable(xp_associative ${common} src/examples/xp_associative.cpp)
target_include_directories(xp_associative PRIVATE ${inc-dirs})
target_link_libraries(xp_associative ${mylibs})

# Standalone GDX example program 4 (associative {supply,demand} vector -> double (level))
add_executable(xp_associative_vec ${common} src/examples/xp_associative_vec.cpp)
target_include_directories(xp_associative_vec PRIVATE ${inc-dirs})
target_link_libraries(xp_associative_vec ${mylibs})

# Standalone GDX example program 5 (data write)
# Needs path to GAMS distribution in environment variable GAMSDIR
# (either directly or as first entry of semicolon separated list)
if(DEFINED ENV{GAMSDIR})
set(ENTRIES $ENV{GAMSDIR})
string(FIND "${ENTRIES}" ";" index)
if(index GREATER -1) # contains multiple semicolon separated entries
string(REPLACE ";" "\n" ENTRIES "${ENTRIES}")
string(REGEX MATCH "^([^\n]*)" FIRST_ENTRY "${ENTRIES}")
string(REPLACE "\\" "/" FIRST_ENTRY "${FIRST_ENTRY}")
set(cur-apifiles-path ${FIRST_ENTRY})
else() # just one entry
set(cur-apifiles-path ${ENTRIES})
endif()
string(APPEND cur-apifiles-path "/apifiles/C/api/")
if(EXISTS ${cur-apifiles-path}gmdcc.c)
message(STATUS "Found expert-level API sources and headers in ${cur-apifiles-path}")
add_executable(xp_dataWrite ${common} src/examples/xp_dataWrite.cpp ${cur-apifiles-path}gmdcc.c)
target_include_directories(xp_dataWrite PRIVATE ${inc-dirs} ${cur-apifiles-path})
target_link_libraries(xp_dataWrite ${mylibs})
if(UNIX)
target_compile_options(xp_dataWrite PRIVATE -DGC_NO_MUTEX)
endif()
endif()
endif()
include(targets.cmake)
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GAMS - General Algebraic Modeling System GDX API

Copyright (c) 2017-2023 GAMS Software GmbH <[email protected]>
Copyright (c) 2017-2023 GAMS Development Corp. <[email protected]>
Copyright (c) 2017-2024 GAMS Software GmbH <[email protected]>
Copyright (c) 2017-2024 GAMS Development Corp. <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
82 changes: 82 additions & 0 deletions base-units.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
set(base-units
# runtime library
src/rtl/p3library.cpp
src/rtl/p3library.h
src/rtl/p3process.cpp
src/rtl/p3process.h
src/rtl/stdthread.cpp
src/rtl/stdthread.h
src/rtl/p3utils.cpp
src/rtl/p3utils.h
src/rtl/sysutils_p3.cpp
src/rtl/sysutils_p3.h
src/rtl/p3platform.cpp
src/rtl/p3platform.h
src/rtl/math_p3.cpp
src/rtl/math_p3.h
src/rtl/idglobal_p3.cpp
src/rtl/idglobal_p3.h
src/rtl/p3io.cpp
src/rtl/p3io.h
src/rtl/dtoaLoc.c
src/rtl/dtoaLoc.h

# global
src/global/ctvproc.cpp
src/global/ctvproc.h
src/global/delphitypes.h
src/global/gmslibname.cpp
src/global/gmslibname.h
src/global/gmsspecs.cpp
src/global/gmsspecs.h
src/global/unit.h
src/global/modhead.cpp
src/global/modhead.h

# gdlib
src/gdlib/batchalloc.h
src/gdlib/charmaps.cpp
src/gdlib/charmaps.h
src/gdlib/cmdpar.cpp
src/gdlib/cmdpar.h
src/gdlib/datastorage.cpp
src/gdlib/datastorage.h
src/gdlib/dblutil.cpp
src/gdlib/dblutil.h
src/gdlib/gamsdirs.cpp
src/gdlib/gamsdirs.h
src/gdlib/gfileopen.cpp
src/gdlib/gfileopen.h
src/gdlib/glookup.cpp
src/gdlib/glookup.h
src/gdlib/gmacro.cpp
src/gdlib/gmacro.h
src/gdlib/gmsdata.cpp
src/gdlib/gmsdata.h
src/gdlib/gmsgen.h
src/gdlib/gmsglob.cpp
src/gdlib/gmsglob.h
src/gdlib/gmslist.cpp
src/gdlib/gmslist.h
src/gdlib/gmsobj.cpp
src/gdlib/gmsobj.h
src/gdlib/obfuscatestr.cpp
src/gdlib/obfuscatestr.h
src/gdlib/runner.cpp
src/gdlib/runner.h
src/gdlib/statlib.cpp
src/gdlib/statlib.h
src/gdlib/statlibobj.cpp
src/gdlib/statlibobj.h
src/gdlib/stattypes.h
src/gdlib/xcompress.cpp
src/gdlib/xcompress.h
src/gdlib/gmsheapnew.cpp
src/gdlib/gmsheapnew.h
src/gdlib/strutilx.cpp
src/gdlib/strutilx.h
src/gdlib/strhash.cpp
src/gdlib/strhash.h
src/gdlib/gmsonly.h
src/gdlib/gmsonly.cpp
)
4 changes: 4 additions & 0 deletions changelog.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
---
- 7.11.2:
- Added multiple auxiliary classes as preparation for soon to be released GDX related utilities.
- Fixed memory alignment in custom memory allocator.
- Prevent signed integer overflow in internally used hashmap class.
- 7.11.1:
- gdxUMUelGet was modified to accept a NULL pointer for the user UEL index mapping "UelMap".
- Added two new example programs xp_associative(_vec) and xp_dataWrite.
Expand Down
Loading

0 comments on commit eb490d6

Please sign in to comment.