Skip to content
Permalink
Browse files

CMake and CI overhaul (#1072)

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 d3206b99ebda6a67ceb58bf8a3b50083abb36b5f
Showing with 2,475 additions and 1,422 deletions.
  1. +119 −0 .clang-format
  2. +203 −0 .github/workflows/workflow.yml
  3. +84 −136 .travis.yml
  4. +52 −89 CMakeLists.txt
  5. +104 −129 Makefile
  6. +5 −5 appveyor.yml
  7. +58 −32 site/spi/Makefile-bits
  8. +60 −0 site/spi/README-SPI.md
  9. +1 −0 site/spi/rez/CMakeLists.txt
  10. +4 −4 site/spi/rez/package.py.in
  11. 0 src/build-scripts/build_cmake.bash
  12. +34 −0 src/build-scripts/build_llvm.bash
  13. +71 −74 src/build-scripts/build_openexr.bash
  14. +42 −11 src/build-scripts/build_openimageio.bash
  15. +66 −0 src/build-scripts/ci-build-and-test.bash
  16. +68 −0 src/build-scripts/ci-startup.bash
  17. +75 −0 src/build-scripts/gh-installdeps.bash
  18. +131 −0 src/build-scripts/gh-win-installdeps.bash
  19. +20 −13 src/build-scripts/install_homebrew_deps.bash
  20. +28 −0 src/cmake/check_is_enabled.cmake
  21. +12 −0 src/cmake/colors.cmake
  22. +350 −154 src/cmake/compiler.cmake
  23. +33 −33 src/cmake/cuda_macros.cmake
  24. +187 −207 src/cmake/externalpackages.cmake
  25. +51 −0 src/cmake/fancy_add_executable.cmake
  26. +2 −2 src/cmake/flexbison.cmake
  27. +0 −34 src/cmake/install.cmake
  28. +0 −14 src/cmake/modules/FindLLVM.cmake
  29. +35 −53 src/cmake/modules/FindOpenEXR.cmake
  30. +38 −32 src/cmake/modules/FindOpenImageIO.cmake
  31. +3 −6 src/cmake/modules/FindOptiX.cmake
  32. +2 −16 src/cmake/modules/FindPartio.cmake
  33. +5 −16 src/cmake/modules/FindPugiXML.cmake
  34. +34 −0 src/cmake/modules/FindPybind11.cmake
  35. +0 −54 src/cmake/platform.cmake
  36. +174 −0 src/cmake/pythonutils.cmake
  37. +0 −57 src/cmake/util_macros.cmake
  38. +34 −9 src/include/CMakeLists.txt
  39. +5 −5 src/include/OSL/export.h
  40. +16 −15 src/include/OSL/oslversion.h.in
  41. +28 −24 src/liboslcomp/CMakeLists.txt
  42. +1 −0 src/liboslcomp/oslcomp.cpp
  43. +5 −0 src/liboslcomp/osllex.l
  44. +98 −91 src/liboslexec/CMakeLists.txt
  45. +5 −0 src/liboslexec/osolex.l
  46. +5 −5 src/liboslexec/pointcloud.cpp
  47. +11 −11 src/liboslnoise/CMakeLists.txt
  48. +25 −19 src/liboslquery/CMakeLists.txt
  49. +29 −15 src/osl.imageio/CMakeLists.txt
  50. +8 −8 src/oslc/CMakeLists.txt
  51. +5 −3 src/osltoy/CMakeLists.txt
  52. +21 −17 src/testrender/CMakeLists.txt
  53. +25 −26 src/testshade/CMakeLists.txt
  54. +3 −3 testsuite/runtest.py
@@ -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
#...

@@ -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

0 comments on commit d3206b9

Please sign in to comment.
You can’t perform that action at this time.