Skip to content

Commit

Permalink
Upgrade TBB and ANTLR (#1714)
Browse files Browse the repository at this point in the history
Co-authored-by: Spitz <noella.spitz@ndw2544mac.isis.cclrc.ac.uk>
Co-authored-by: Adam Washington <adam.washington@stfc.ac.uk>
  • Loading branch information
3 people committed Jan 8, 2024
1 parent ab5581e commit f986a8f
Show file tree
Hide file tree
Showing 212 changed files with 637 additions and 503 deletions.
24 changes: 11 additions & 13 deletions .github/workflows/build/osx/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,15 @@ runs:
with:
python-version: ${{ env.pythonVersion }}

- name: Install Homebrew Dependencies
if: ${{ inputs.cacheOnly == 'false' }}
- name: Install Homebrew Dependencies for Intel
if: ${{ inputs.cacheOnly == 'false' && env.OSX_CMAKE_TARGET == 'x86_64' }}
shell: bash
run: |
set -ex
brew update-reset
brew install ftgl ninja
- name: Acquire ANTLR Java
if: ${{ inputs.cacheOnly == 'false' }}
shell: bash
run: |
set -ex
curl https://raw.githubusercontent.com/antlr/website-antlr4/gh-pages/download/antlr-4.9.3-complete.jar --output antlr.jar
brew install antlr
- name: Install Python Dependencies
shell: bash
Expand Down Expand Up @@ -70,6 +65,7 @@ runs:
~/.conan
~/.conancache
- name: Install Conan Dependencies
shell: bash
run: |
Expand All @@ -80,7 +76,8 @@ runs:
mkdir build && cd build
conan config set storage.download_cache="${GITHUB_WORKSPACE}/.conancache"
conan install .. --build missing
conan install .. --build missing -s arch=${{ env.OSX_CONAN_TARGET }}

- name: Build
if: ${{ inputs.cacheOnly == 'false' }}
Expand All @@ -92,18 +89,19 @@ runs:
export PATH="$(python3 -m site --user-base)/bin:$PATH"
Qt6_DIR=${{ runner.temp }}/qt/${{ env.qtVersion }}/macos/lib/cmake/Qt6
QT_BASE_DIR=${{ runner.temp }}/qt/${{ env.qtVersion }}/macos
ANTLR_EXE=`pwd`/antlr.jar
ANTLR_EXE=/usr/local/Cellar/antlr/${{ env.antlrVersion }}/antlr-${{ env.antlrVersion }}-complete.jar
echo "Detected ANTLR exe as [$ANTLR_EXE]"
echo "JAVA HOME: $JAVA_HOME_21_X64"
# Build
cd build
cmake -G Ninja -DGUI:bool=true -DMULTI_THREADING:bool=${{ inputs.threading }} -DANTLR_EXECUTABLE:string=$ANTLR_EXE ${{ inputs.extraCMakeFlags }} -DQT_BASE_DIR=$QT_BASE_DIR ../
cmake -G Ninja -DGUI:bool=true -DMULTI_THREADING:bool=${{ inputs.threading }} -DJava_JAVA_EXECUTABLE:path=$JAVA_HOME_21_X64/bin/java -DANTLR_EXECUTABLE:string=$ANTLR_EXE -DCMAKE_OSX_ARCHITECTURES:string="${{ env.OSX_CMAKE_TARGET }}" ${{ inputs.extraCMakeFlags }} -DQT_BASE_DIR=$QT_BASE_DIR ../
cmake --build . --config Release
cd ../
# Deploy Conan dependencies for ease
mkdir deploy && cd deploy
conan install .. -g deploy
conan install .. -g deploy -s arch=${{ env.OSX_CONAN_TARGET }}
- name: Upload Raw Build Artifacts
if: ${{ inputs.cacheOnly == 'false' }}
Expand Down
16 changes: 14 additions & 2 deletions .github/workflows/build/windows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ runs:

- name: Install Chocolatey Dependencies
shell: bash
run: choco install -y antlr4 ninja wget
run: choco install -y ninja wget

- name: Install Python Dependencies
shell: bash
Expand Down Expand Up @@ -123,6 +123,16 @@ runs:
cmake ../ftgl-latest -G Ninja -DCMAKE_BUILD_TYPE:STRING="Release" -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DCMAKE_INSTALL_PREFIX:path=../ftgl-install
cmake --build . --target install --config Release
- name: Get ANTLR and Java
working-directory: ${{ runner.temp }}
shell: bash
run: |
set -ex
wget https://www.antlr.org/download/antlr-${{ env.antlrVersion }}-complete.jar -Oantlr-${{ env.antlrVersion }}-complete.jar
wget https://download.oracle.com/java/21/latest/jdk-21_windows-x64_bin.zip -Ojava.zip
unzip java.zip
#
# Main Build
#
Expand Down Expand Up @@ -157,15 +167,17 @@ runs:
run: |
# Setup environment
Qt6_DIR="${RUNNER_TEMP}\qt\${{ env.qtVersion }}\msvc2019_64"
ANTLR_EXE="${RUNNER_TEMP}\antlr-${{ env.antlrVersion }}-complete.jar"
export PATH="${Qt6_DIR}\bin;$PATH"
INCLUDE="${RUNNER_TEMP}\freetype-latest;$INCLUDE"
LIB="${RUNNER_TEMP}\freetype-install\lib;${RUNNER_TEMP}\freetype-install\bin;$LIB"
INCLUDE="${RUNNER_TEMP}\ftgl-latest\src;$INCLUDE"
LIB="${RUNNER_TEMP}\ftgl-install\lib;$LIB"
JAVA_EXE="${JAVA_HOME_21_X64}\bin\java.exe"
# Build
cd build
cmake ../ -G Ninja -DCMAKE_BUILD_TYPE:STRING="Release" -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DMULTI_THREADING:bool=${{ inputs.threading }} -DGUI:bool=true ${{ inputs.extraCMakeFlags }}
cmake ../ -G Ninja -DCMAKE_BUILD_TYPE:STRING="Release" -DCMAKE_C_COMPILER=cl -DANTLR_EXECUTABLE:string=$ANTLR_EXE -DJava_JAVA_EXECUTABLE:string=$JAVA_EXE -DCMAKE_CXX_COMPILER=cl -DMULTI_THREADING:bool=${{ inputs.threading }} -DGUI:bool=true ${{ inputs.extraCMakeFlags }}
cmake --build . --config Release --target keywordWidgets
cmake --build . --config Release
cd ../
Expand Down
24 changes: 22 additions & 2 deletions .github/workflows/continuous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,18 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest]
include:
- os: macos-latest
osx_cmake_target: arm64
osx_conan_target: armv8
- os: macos-latest
osx_cmake_target: x86_64
osx_conan_target: x86_64
- os: windows-latest
runs-on: ${{ matrix.os }}
env:
OSX_CMAKE_TARGET: ${{ matrix.osx_cmake_target }}
OSX_CONAN_TARGET: ${{ matrix.osx_conan_target }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -69,8 +79,18 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest]
include:
- os: macos-latest
osx_cmake_target: arm64
osx_conan_target: armv8
- os: macos-latest
osx_cmake_target: x86_64
osx_conan_target: x86_64
- os: windows-latest
runs-on: ${{ matrix.os }}
env:
OSX_CMAKE_TARGET: ${{ matrix.osx_cmake_target }}
OSX_CONAN_TARGET: ${{ matrix.osx_conan_target }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/package/osx/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,17 @@ runs:
Qt6_ROOT=${{ runner.temp }}/qt/${{ env.qtVersion }}/macos/
export PATH="$(python3 -m site --user-base)/bin:$PATH"
# Handle ANTLR
cp ./deploy/antlr4-cppruntime/lib/*.dylib /usr/local/lib/
cp ./deploy/tbb/lib/*.dylib /usr/local/lib/
# Handle ANTLR & TBB
cp ./deploy/antlr4-cppruntime/lib/libantlr4-runtime.*.dylib /usr/local/lib
cp ./deploy/antlr4-cppruntime/lib/libantlr4-runtime.dylib /usr/local/lib/libantlr4-runtime.dylib
for FILE in ./deploy/onetbb/lib/*.dylib; do
FILENAME=$(basename $FILE)
cp ./deploy/onetbb/lib/$FILENAME /usr/local/lib/$FILENAME
done
install_name_tool -add_rpath "@executable_path/../Frameworks/" build/bin/dissolve-gui.app/Contents/MacOS/dissolve-gui
install_name_tool -add_rpath "/usr/local/lib" build/bin/dissolve-gui.app/Contents/MacOS/dissolve-gui
./prep-dmg -a Dissolve-GUI -v ${{ env.dissolveVersion }} -b build/bin/dissolve-gui.app/Contents/MacOS/dissolve-gui -d ${Qt6_ROOT} -i icon/icon-1024x1024.png -p build/bin/dissolve-gui.app/Contents/Info.plist -L /usr/local/lib
- name: Create Disk Image
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,15 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest]
include:
- os: macos-latest
osx_cmake_target: x86_64
osx_conan_target: x86_64
- os: windows-latest
runs-on: ${{ matrix.os }}
env:
OSX_CMAKE_TARGET: ${{ matrix.osx_cmake_target }}
OSX_CONAN_TARGET: ${{ matrix.osx_conan_target }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -69,8 +76,11 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest]
os: [ macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
env:
OSX_CMAKE_TARGET: ${{ matrix.osx_cmake_target }}
OSX_CONAN_TARGET: ${{ matrix.osx_conan_target }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
18 changes: 16 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,15 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest]
include:
- os: macos-latest
osx_cmake_target: x86_64
osx_conan_target: x86_64
- os: windows-latest
runs-on: ${{ matrix.os }}
env:
OSX_CMAKE_TARGET: ${{ matrix.osx_cmake_target }}
OSX_CONAN_TARGET: ${{ matrix.osx_conan_target }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -67,8 +74,15 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest]
include:
- os: macos-latest
osx_cmake_target: x86_64
osx_conan_target: x86_64
- os: windows-latest
runs-on: ${{ matrix.os }}
env:
OSX_CMAKE_TARGET: ${{ matrix.osx_cmake_target }}
OSX_CONAN_TARGET: ${{ matrix.osx_conan_target }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ runs:
echo "dissolveMajorVersion=${DISSOLVE_MAJOR}" >> ${GITHUB_ENV}
echo "dissolveMinorVersion=${DISSOLVE_MINOR}" >> ${GITHUB_ENV}
echo "dissolvePatchVersion=${DISSOLVE_PATCH}" >> ${GITHUB_ENV}
- name: Get package versions
shell: bash
run: |
ANTLR_VERSION=$(cat conanfile.txt | sed -n -e 's%^.*antlr4-cppruntime/%%p')
echo "antlrVersion=${ANTLR_VERSION}" >> ${GITHUB_ENV}
- name: Install Dependencies (OSX)
if: ${{ runner.os == 'macos' }}
Expand Down
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ option(MULTI_THREADING "Enable threading using tbb" ON)
if(MULTI_THREADING)
add_definitions("-DMULTITHREADING")
if(CONAN)
set(THREADING_LINK_LIBS ${THREADING_LINK_LIBS} CONAN_PKG::tbb)
include_directories(CONAN_INCLUDE_DIRS_ONETBB)
include_directories(CONAN_INCLUDE_DIRS_ONEDPL)
set(THREADING_LINK_LIBS ${THREADING_LINK_LIBS} CONAN_PKG::onetbb)
if(WIN32)
set(THREADING_LINK_LIBS ${THREADING_LINK_LIBS} CONAN_PKG::onedpl)
endif(WIN32)
else(CONAN)
set(THREADING_LINK_LIBS ${THREADING_LINK_LIBS} $ENV{THREADING_LINK_LIBS})
endif(CONAN)
Expand Down Expand Up @@ -95,6 +100,7 @@ if(GUI)
)
find_package(FTGL REQUIRED)
find_package(Freetype REQUIRED)
add_definitions(-DQT_NO_KEYWORDS)

# Make sure CMake won't try to generate rules for moc (we will do it ourselves)
set(CMAKE_AUTOMOC ON)
Expand Down Expand Up @@ -265,7 +271,6 @@ set(BASIC_LINK_LIBS
# Set linker options for complete/no archive
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(WHOLE_ARCHIVE_FLAG "-Wl,-all_load")
set(NO_WHOLE_ARCHIVE_FLAG "-Wl,-noall_load")
else()
set(WHOLE_ARCHIVE_FLAG "-Wl,-whole-archive")
set(NO_WHOLE_ARCHIVE_FLAG "-Wl,-no-whole-archive")
Expand Down
7 changes: 4 additions & 3 deletions ci/windows/dissolve-gui.iss
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ Source: "{#QtDir}\plugins\imageformats\*.dll"; DestDir: "{app}\bin\imageformats"
; Windows 10
Source: "C:\Windows\System32\D3DCompiler_47.dll"; DestDir: "{app}\bin"; Flags: ignoreversion
; Conan Dependencies
Source: "{#DeployDir}\tbb\bin\tbb.dll"; DestDir: "{app}\bin"
Source: "{#DeployDir}\tbb\bin\tbbmalloc.dll"; DestDir: "{app}\bin"
Source: "{#DeployDir}\tbb\bin\tbbmalloc_proxy.dll"; DestDir: "{app}\bin"
Source: "{#DeployDir}\onetbb\bin\tbb12.dll"; DestDir: "{app}\bin"
Source: "{#DeployDir}\onetbb\bin\tbbmalloc.dll"; DestDir: "{app}\bin"
Source: "{#DeployDir}\onetbb\bin\tbbmalloc_proxy.dll"; DestDir: "{app}\bin"
Source: "{#DeployDir}\onetbb\bin\tbbbind_2_5.dll"; DestDir: "{app}\bin"
Source: "{#DeployDir}\antlr4-cppruntime\bin\antlr4-runtime.dll"; DestDir: "{app}\bin"

[Icons]
Expand Down
6 changes: 3 additions & 3 deletions cmake/Modules/FindANTLR.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# - From https://github.com/antlr/antlr4/ at 6ad9646
# - Modified by TGAY to find and use JPackage antlr4 script if present

find_package(Java QUIET COMPONENTS Runtime)
find_package(Java 11 QUIET COMPONENTS Runtime)

if(NOT ANTLR_EXECUTABLE)
find_program(ANTLR_EXECUTABLE
NAMES antlr4 antlr.jar antlr4.jar antlr-4.jar antlr-4.8-complete.jar)
NAMES antlr4 antlr.jar antlr4.jar antlr-4.jar)
endif()

# Set command to run
Expand All @@ -32,7 +32,7 @@ if(ANTLR_EXECUTABLE AND Java_JAVA_EXECUTABLE)
message(
SEND_ERROR
"Command '${ANTLR_COMMAND_TO_RUN} ${ANTLR_COMMAND_ARGS}'"
"failed with the output '${ANTLR_COMMAND_ERROR}'")
"failed with the output '${ANTLR_COMMAND_OUTPUT}' '${ANTLR_COMMAND_ERROR}'")
endif()

macro(ANTLR_TARGET Name InputFile)
Expand Down
7 changes: 3 additions & 4 deletions conanfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ cli11/1.9.1
fmt/8.1.1
gtest/1.10.0
pugixml/1.11
tbb/2020.3
onedpl/20200330
onetbb/2021.10.0
onedpl/2021.7.0
toml11/3.7.0
antlr4-cppruntime/4.9.3
antlr4-cppruntime/4.13.1

[generators]
cmake

[options]
fmt:header_only=True
pugixml:header_only=False
tbb:shared=True
antlr4-cppruntime:shared=True

0 comments on commit f986a8f

Please sign in to comment.