Skip to content

Commit

Permalink
CMake and CI overhaul (#1072)
Browse files Browse the repository at this point in the history
I prototyped all this stuff in OIIO over the last month, and now am
finally porting the methodology to OSL. Major changes:

* Bump CMake minimum to 3.12

* Massive refactor of cmake files to move to modern idioms and best
  practices. Beware some changed conventions for controlling the build:
    - CMAKE_CXX_STANDARD instead of USE_CPP
    - CXX_VISIBILITY_PRESET instead of HIDESYMBOLS
    - BUILD_SHARED_LIBS instead of BUILDSTATIC
    - Package_ROOT to hint where to find dependencies, instead of
      some random selection of PACKAGEHOME, PACKAGE_ROOT_DIR, etc.

* Start using GitHub CI.
  • Loading branch information
lgritz committed Nov 7, 2019
1 parent c042d24 commit d3206b9
Show file tree
Hide file tree
Showing 54 changed files with 2,475 additions and 1,422 deletions.
119 changes: 119 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
Language: Cpp
BasedOnStyle: WebKit
SpaceBeforeParens: ControlStatements

#AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
#AlignConsecutiveDeclarations: false
#AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
#AllowShortFunctionsOnASingleLine: All
#AllowShortIfStatementsOnASingleLine: false
#AllowShortLoopsOnASingleLine: false
#AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: TopLevel
#AlwaysBreakBeforeMultilineStrings: false
#AlwaysBreakTemplateDeclarations: MultiLine
#BinPackArguments: true
#BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
#BreakBeforeBinaryOperators: All
#BreakBeforeBraces: WebKit
#BreakBeforeInheritanceComma: false
#BreakInheritanceList: BeforeColon
#BreakBeforeTernaryOperators: true
#BreakConstructorInitializersBeforeComma: false
#BreakConstructorInitializers: BeforeComma
#BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: false
ColumnLimit: 80
#CommentPragmas: '^ IWYU pragma:'
#CompactNamespaces: false
#ConstructorInitializerAllOnOneLineOrOnePerLine: false
#ConstructorInitializerIndentWidth: 4
#ContinuationIndentWidth: 4
#Cpp11BracedListStyle: false
#DerivePointerAlignment: true
#DisableFormat: false
#ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
#ForEachMacros:
# - foreach
# - Q_FOREACH
# - BOOST_FOREACH
#IncludeBlocks: Preserve
#IncludeCategories:
# - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
# Priority: 2
# - Regex: '^(<|"(gtest|gmock|isl|json)/)'
# Priority: 3
# - Regex: '.*'
# Priority: 1
#IncludeIsMainRegex: '(Test)?$'
#IndentCaseLabels: false
IndentPPDirectives: AfterHash
#IndentWidth: 4
#IndentWrappedFunctionNames: false
#JavaScriptQuotes: Leave
#JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
#MacroBlockBegin: ''
#MacroBlockEnd: ''
MaxEmptyLinesToKeep: 3
#NamespaceIndentation: Inner
#ObjCBinPackProtocolList: Auto
#ObjCBlockIndentWidth: 4
#ObjCSpaceAfterProperty: true
#ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 40
PenaltyBreakBeforeFirstCallParameter: 100
#PenaltyBreakComment: 300
#PenaltyBreakFirstLessLess: 120
#PenaltyBreakString: 1000
#PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 75
PenaltyReturnTypeOnItsOwnLine: 50
#PointerAlignment: Left
ReflowComments: false
#SortIncludes: true
#SortUsingDeclarations: true
#SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: false
#SpaceBeforeAssignmentOperators: true
#SpaceBeforeCpp11BracedList: true
#SpaceBeforeCtorInitializerColon: true
#SpaceBeforeInheritanceColon: true
#SpaceBeforeParens: ControlStatements
#SpaceBeforeRangeBasedForLoopColon: true
#SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
#SpacesInAngles: false
#SpacesInContainerLiterals: true
#SpacesInCStyleCastParentheses: false
#SpacesInParentheses: false
#SpacesInSquareBrackets: false
#Standard: Cpp11
#TabWidth: 8
#UseTab: Never
#...

203 changes: 203 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
name: CI
on: [push, pull_request]


jobs:
linux-2018:
name: "Linux VFX 2018-ish: gcc6, C++11, llvm7, OIIO 2.0, sse2, exr2.2"
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: all
env:
CXX: g++-6
USE_CPP: 11
CMAKE_CXX_STANDARD: 11
LLVM_VERSION: 7.0.1
OPENEXR_BRANCH: v2.2.0
OPENIMAGEIO_BRANCH: RB-2.0
USE_SIMD: sse2
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps.bash
source src/build-scripts/ci-build-and-test.bash
linux-2019:
name: "Linux VFX 2019-ish: gcc6, C++14, llvm8, OIIO master, sse4, exr2.3"
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: all
env:
CXX: g++-6
USE_CPP: 14
CMAKE_CXX_STANDARD: 14
LLVM_VERSION: 8.0.0
OPENEXR_BRANCH: v2.3.0
OPENIMAGEIO_BRANCH: master
USE_SIMD: sse4.2
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps.bash
source src/build-scripts/ci-build-and-test.bash
# linux-debug-gcc7:
# name: "Linux debug, gcc7, C++14, avx, exr2.3"
# runs-on: ubuntu-18.04
# steps:
# - uses: actions/checkout@v1
# - name: all
# env:
# CXX: g++-7
# CMAKE_CXX_STANDARD: 14
# USE_SIMD: avx
# DEBUG: 1
# run: |
# source src/build-scripts/ci-startup.bash
# source src/build-scripts/gh-installdeps.bash
# source src/build-scripts/ci-build-and-test.bash
#
# linux-gcc8-llvm8:
# name: "Linux next: gcc8, C++14, avx2, exr2.4"
# runs-on: ubuntu-18.04
# steps:
# - uses: actions/checkout@v1
# - name: all
# env:
# CXX: g++-8
# CMAKE_CXX_STANDARD: 14
# USE_SIMD: avx2,f16c
# OPENEXR_BRANCH: v2.4.0
# run: |
# source src/build-scripts/ci-startup.bash
# source src/build-scripts/gh-installdeps.bash
# source src/build-scripts/ci-build-and-test.bash


linux-2020ish-gcc8-llvm9:
name: "Linux gcc8, C++14, llvm9, oiio master, avx2, exr2.4"
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: all
env:
CXX: g++-8
USE_CPP: 14
CMAKE_CXX_STANDARD: 14
LLVM_VERSION: 9.0.0
USE_SIMD: avx2,f16c
OPENEXR_BRANCH: v2.4.0
OPENIMAGEIO_BRANCH: master
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps.bash
source src/build-scripts/ci-build-and-test.bash
linux-bleeding:
name: "Linux bleeding edge: gcc8, C++17, llvm9, oiio master, avx2, exr2.4"
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: all
env:
CXX: g++-8
USE_CPP: 17
CMAKE_CXX_STANDARD: 17
LLVM_VERSION: 9.0.0
USE_SIMD: avx2,f16c
OPENEXR_BRANCH: v2.4.0
OPENIMAGEIO_BRANCH: master
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps.bash
source src/build-scripts/ci-build-and-test.bash
macos-py37:
name: "Mac py37"
runs-on: macOS-10.14
steps:
- uses: actions/checkout@v1
- name: all
env:
CXX: clang++
PYTHON_VERSION: 3.7
LLVM_BC_GENERATOR: /usr/bin/clang++
# ^^ Force bitcode compiles to use the system clang compiler by
# preemptively telling it the LLVM_BC_GENERATOR, to avoid some
# library mismatches we tend to see on GH CI's Mac images.
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/install_homebrew_deps.bash
OPENIMAGEIO_CMAKE_FLAGS="-DOIIO_BUILD_TESTS=0 -DUSE_PYTHON=0 -DUSE_OPENGL=0"
source src/build-scripts/build_openimageio.bash
source src/build-scripts/ci-build-and-test.bash
# windows:
# name: "Windows"
# runs-on: windows-2019
# steps:
# - uses: actions/checkout@v1
# - name: Setup Nuget.exe
# uses: warrenbuckley/Setup-Nuget@v1
# - name: all
# shell: bash
# env:
# PYTHON_VERSION: 3.6
# CMAKE_GENERATOR: "Visual Studio 16 2019"
# OPENEXR_BRANCH: v2.4.0
# run: |
# source src/build-scripts/ci-startup.bash
# source src/build-scripts/gh-win-installdeps.bash
# source src/build-scripts/ci-build-and-test.bash

# sanitizer:
# name: "Sanitizers"
# runs-on: ubuntu-18.04
# if: github.event_name == 'pull_request' || contains(github.ref, 'san') || contains(github.ref, 'RB') || contains(github.ref, 'release') || contains(github.ref, 'master') || contains(github.ref, 'gh')
# steps:
# - uses: actions/checkout@v1
# #- uses: docker://aswfstaging/ci-base:2019
# - name: all
# env:
# CXX: g++-7
# CMAKE_CXX_STANDARD: 14
# SANITIZE: address
# USE_PYTHON: 0
# run: |
# source src/build-scripts/ci-startup.bash
# source src/build-scripts/gh-installdeps.bash
# source src/build-scripts/ci-build-and-test.bash

# linux-static:
# name: "Linux static libs: gcc7, C++14, exr2.3"
# runs-on: ubuntu-18.04
# steps:
# - uses: actions/checkout@v1
# #- uses: docker://aswfstaging/ci-base:2019
# - name: all
# env:
# CXX: g++-7
# CMAKE_CXX_STANDARD: 14
# BUILD_SHARED_LIBS: OFF
# run: |
# source src/build-scripts/ci-startup.bash
# source src/build-scripts/gh-installdeps.bash
# source src/build-scripts/ci-build-and-test.bash

# We don't clang-format this project... yet
# clang-format:
# name: "clang-format verification"
# runs-on: macOS-10.14
# steps:
# - uses: actions/checkout@v1
# - name: all
# env:
# CXX: clang++
# BUILDTARGET: clang-format
# SKIP_TESTS: 1
# BUILD_MISSING_DEPS: 0
# run: |
# source src/build-scripts/ci-startup.bash
# source src/build-scripts/install_homebrew_deps.bash
# source src/build-scripts/build_openimageio.bash
# source src/build-scripts/ci-build-and-test.bash
Loading

0 comments on commit d3206b9

Please sign in to comment.