......@@ -4,11 +4,6 @@ stages:
- build-img
- test
variables:
CONAN_LOGIN_USERNAME: ci_user
CONAN_PASSWORD: ${CI_JOB_TOKEN}
REPO: gitlab
build-img:
stage: build-img
image:
......@@ -22,21 +17,53 @@ build-img:
- docker
.package: &package_template
###### Test jobs #####
.test:cmake: &cmake_def
stage: test
image: $CI_REGISTRY_IMAGE:latest
needs: ['build-img']
script:
- GIT_SHA=$(git rev-parse HEAD)
- conan config install settings.yml
- conan create . exa/stable -s compiler=${COMPILER} -s compiler.version=${CVERSION} -s compiler.libcxx=${LIBCXX}
- git clone --depth 1 --branch v2.13.7 https://github.com/catchorg/Catch2
- cmake -SCatch2 -Bbuild-catch2 -GNinja
- cmake --build build-catch2 --target install
- wget https://gmplib.org/download/gmp/gmp-6.2.1.tar.lz
- tar xf gmp-6.2.1.tar.lz
- pushd gmp-6.2.1
- ./configure
- make install
- popd
- wget https://www.mpfr.org/mpfr-current/mpfr-4.1.0.tar.xz
- tar xf mpfr-4.1.0.tar.xz
- pushd mpfr-4.1.0
- ./configure
- make install
- popd
- git clone --depth 1 --branch v5.3 https://github.com/CGAL/cgal
- cmake -Scgal -Bbuild-cgal -GNinja
- cmake --build build-cgal --target install
- git clone --branch 3.2.2 https://github.com/taocpp/PEGTL
- cmake -SPEGTL -Bbuild-pegtl -GNinja
- cmake --build build-pegtl --target install
- cmake -S. -Bbuild -GNinja -DCMAKE_BUILD_TYPE=$BUILD_TYPE
- cmake --build build --target unit_tests_csg
- cd build
- ctest
tags:
- docker
test:cmake:debug:
variables:
BUILD_TYPE: "Debug"
<<: *cmake_def
package:gcc:
test:cmake:release:
variables:
COMPILER: gcc
CVERSION: 9
LIBCXX: libstdc++
<<: *package_template
BUILD_TYPE: "Release"
allow_failure: true
<<: *cmake_def
[submodule "subprojects/cmake-conan"]
path = subprojects/cmake-conan
url = https://github.com/conan-io/cmake-conan
......@@ -10,69 +10,19 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
include(${CMAKE_CURRENT_SOURCE_DIR}/subprojects/cmake-conan/conan.cmake)
find_program(CONAN_EXECUTABLE conan)
if(NOT CONAN_EXECUTABLE)
message(WARNING "
Did not find conan in PATH. Recommend installing with 'pip install conan'.
Will try downloading Conan with PMM <https://github.com/vector-of-bool/pmm>")
include(pmm.cmake)
pmm(CONAN)
endif()
message(STATUS "Installing conan settings for csg-eb")
execute_process(
COMMAND ${CONAN_EXECUTABLE} config install ${CMAKE_CURRENT_SOURCE_DIR}/settings.yml
COMMAND_ERROR_IS_FATAL ANY
)
conan_cmake_configure(REQUIRES
catch2/2.13.7
GENERATORS cmake_find_package)
if(CONAN_SETTINGS)
set(settings ${CONAN_SETTINGS})
else()
conan_cmake_autodetect(settings)
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set( CMAKE_CXX_COMPILER_LAUNCHER ccache )
endif()
conan_cmake_install(PATH_OR_REFERENCE ${CMAKE_CURRENT_BINARY_DIR}/conanfile.txt
BUILD missing
SETTINGS ${settings})
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_BINARY_DIR})
find_package(Catch2 REQUIRED)
find_package(pegtl REQUIRED)
find_package(CGAL REQUIRED)
execute_process(
COMMAND git rev-parse HEAD
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE CSGEB_SHA
ERROR_VARIABLE err
)
if(err)
message(WARNING "Failed to retrieve CSG-EB Git commit")
else()
string(STRIP ${CSGEB_SHA} CSGEB_SHA)
message(STATUS "CSG-EB commit: ${CSGEB_SHA}")
endif()
message(STATUS "Disabling mfix-gitlab remote (if it exists)")
execute_process(
COMMAND ${CONAN_EXECUTABLE} remote disable mfix-gitlab
)
add_subdirectory(src/csg)
execute_process(
COMMAND ${CONAN_EXECUTABLE} create --build=missing ${CMAKE_CURRENT_SOURCE_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND_ERROR_IS_FATAL ANY
target_include_directories(csg-eb
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
)
conan_cmake_configure(REQUIRES
csg-eb/${CSGEB_SHA}
GENERATORS cmake_find_package)
conan_cmake_install(PATH_OR_REFERENCE ${CMAKE_CURRENT_BINARY_DIR}/conanfile.txt
BUILD missing
SETTINGS ${settings})
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_BINARY_DIR})
find_package(csg-eb REQUIRED)
target_compile_features(csg-eb PRIVATE cxx_std_17)
......@@ -8,17 +8,21 @@ ENV DEBIAN_FRONTEND noninteractive
RUN apt-get -qq update \
&& apt-get -qq -y install --no-install-recommends \
autoconf=2.* \
build-essential=12.* \
git=1:2.* \
libboost-all-dev=1.* \
lunzip=1.* \
m4=1.* \
openscad=2019.* \
pkg-config=0.29.* \
python3-pip=20.* \
python3-venv=3.8.* \
wget=1.* \
&& apt-get clean && rm -rf /var/lib/apt/lists/* \
&& pip3 install --no-cache-dir \
cmake==3.* \
conan==1.* \
ninja==1.*
CMD [ "/bin/bash" ]
......@@ -25,12 +25,6 @@ Dependencies:
- C++17 compiler (GCC >=7.x, Clang >=5.x)
- CMake >=3.14
- Conan (CMake will try to install Conan if `conan` is not in `PATH`)
CMake will try to install [Conan](https://conan.io) if `conan` is not in `PATH`.
However, installing Conan (`pip install conan`) is recommended for faster builds.
#### Build
```shell
> cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
......
......
import sys
from conans import ConanFile, Meson, tools
class CsgEbConan(ConanFile):
name = "csg-eb"
license = "<Put the package license here>"
author = "Deepak Rangarajan <Deepak.Rangarajan@netl.doe.gov>"
url = "https://mfix.netl.doe.gov/gitlab/exa/csg-eb"
description = "Library for reading CSG geometry files"
topics = ("<Put some tag here>", "<here>", "<and here>")
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False]}
default_options = {"shared": False}
generators = "pkg_config"
requires = ("catch2/2.13.7", "cgal/5.2.1", "taocpp-pegtl/3.2.1")
build_requires = ("meson/0.60.0", "pkgconf/1.7.4", "ninja/1.10.2")
exports_sources = "meson.build", "include/*", "src/*"
def set_version(self):
git = tools.Git(folder=self.recipe_folder)
self.version = git.get_revision()
def build(self):
meson = Meson(self)
args = ["-Dcpp_std=vc++latest"] if sys.platform in ("win32", "cygwin") else []
meson.configure(build_folder="build", args=args)
meson.build()
meson.meson_test(args=["--verbose", "--print-errorlog"])
def package(self):
self.copy("*.hpp", dst="include", src="include", keep_path=False)
self.copy("*.a", dst="lib", keep_path=False)
def package_info(self):
self.cpp_info.includedirs = ["include"]
self.cpp_info.libs = ["csg-eb"]
self.cpp_info.defines = ["CSG_EB=1"]
project(
'csg-eb', 'cpp',
version : '0.1',
default_options : [
'warning_level=1',
'cpp_std=c++17'
]
)
pegtl = dependency('taocpp-pegtl', method: 'pkg-config')
catch2 = dependency('catch2', method: 'pkg-config')
cgal = dependency('cgal', method: 'pkg-config')
parser_inc = include_directories('include', 'src')
subdir('src/csg')
parser_dep = declare_dependency(
include_directories: parser_inc,
link_with: lib_csg_parser,
dependencies: [cgal],
)
# Only for cross building, 'os_build/arch_build' is the system that runs Conan
os_build: [Windows, WindowsStore, Linux, Macos, FreeBSD, SunOS, AIX]
arch_build: [x86, x86_64, ppc32be, ppc32, ppc64le, ppc64, armv5el, armv5hf, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr, s390, s390x, sh4le, e2k-v2, e2k-v3, e2k-v4, e2k-v5, e2k-v6, e2k-v7]
# Only for building cross compilation tools, 'os_target/arch_target' is the system for
# which the tools generate code
os_target: [Windows, Linux, Macos, Android, iOS, watchOS, tvOS, FreeBSD, SunOS, AIX, Arduino, Neutrino]
arch_target: [x86, x86_64, ppc32be, ppc32, ppc64le, ppc64, armv5el, armv5hf, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr, s390, s390x, asm.js, wasm, sh4le, e2k-v2, e2k-v3, e2k-v4, e2k-v5, e2k-v6, e2k-v7, xtensalx6, xtensalx106]
# Rest of the settings are "host" settings:
# - For native building/cross building: Where the library/program will run.
# - For building cross compilation tools: Where the cross compiler will run.
os:
Windows:
subsystem: [None, cygwin, msys, msys2, wsl]
WindowsStore:
version: ["8.1", "10.0"]
WindowsCE:
platform: ANY
version: ["5.0", "6.0", "7.0", "8.0"]
Linux:
Macos:
version: [None, "10.6", "10.7", "10.8", "10.9", "10.10", "10.11", "10.12", "10.13", "10.14", "10.15", "11.0", "13.0"]
sdk: [None, "macosx"]
subsystem: [None, catalyst]
Android:
api_level: ANY
iOS:
version: ["7.0", "7.1", "8.0", "8.1", "8.2", "8.3", "9.0", "9.1", "9.2", "9.3", "10.0", "10.1", "10.2", "10.3", "11.0", "11.1", "11.2", "11.3", "11.4", "12.0", "12.1", "12.2", "12.3", "12.4", "13.0", "13.1", "13.2", "13.3", "13.4", "13.5", "13.6"]
sdk: [None, "iphoneos", "iphonesimulator"]
watchOS:
version: ["4.0", "4.1", "4.2", "4.3", "5.0", "5.1", "5.2", "5.3", "6.0", "6.1"]
sdk: [None, "watchos", "watchsimulator"]
tvOS:
version: ["11.0", "11.1", "11.2", "11.3", "11.4", "12.0", "12.1", "12.2", "12.3", "12.4", "13.0"]
sdk: [None, "appletvos", "appletvsimulator"]
FreeBSD:
SunOS:
AIX:
Arduino:
board: ANY
Emscripten:
Neutrino:
version: ["6.4", "6.5", "6.6", "7.0", "7.1"]
arch: [x86, x86_64, ppc32be, ppc32, ppc64le, ppc64, armv4, armv4i, armv5el, armv5hf, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr, s390, s390x, asm.js, wasm, sh4le, e2k-v2, e2k-v3, e2k-v4, e2k-v5, e2k-v6, e2k-v7, xtensalx6, xtensalx106]
compiler:
sun-cc:
version: ["5.10", "5.11", "5.12", "5.13", "5.14", "5.15"]
threads: [None, posix]
libcxx: [libCstd, libstdcxx, libstlport, libstdc++]
gcc: &gcc
version: ["4.1", "4.4", "4.5", "4.6", "4.7", "4.8", "4.9",
"5", "5.1", "5.2", "5.3", "5.4", "5.5",
"6", "6.1", "6.2", "6.3", "6.4", "6.5",
"7", "7.1", "7.2", "7.3", "7.4", "7.5",
"8", "8.1", "8.2", "8.3", "8.4",
"9", "9.1", "9.2", "9.3",
"10", "10.1", "10.2", "10.3",
"11", "11.1"]
libcxx: [libstdc++, libstdc++11]
threads: [None, posix, win32] # Windows MinGW
exception: [None, dwarf2, sjlj, seh] # Windows MinGW
cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23]
Visual Studio: &visual_studio
runtime: [MD, MT, MTd, MDd]
version: ["8", "9", "10", "11", "12", "14", "15", "16", "17"]
toolset: [None, v90, v100, v110, v110_xp, v120, v120_xp,
v140, v140_xp, v140_clang_c2, LLVM-vs2012, LLVM-vs2012_xp,
LLVM-vs2013, LLVM-vs2013_xp, LLVM-vs2014, LLVM-vs2014_xp,
LLVM-vs2017, LLVM-vs2017_xp, v141, v141_xp, v141_clang_c2, v142,
llvm, ClangCL, v143]
cppstd: [None, 14, 17, 20]
msvc:
version: ["19.0",
"19.1", "19.10", "19.11", "19.12", "19.13", "19.14", "19.15", "19.16",
"19.2", "19.20", "19.21", "19.22", "19.23", "19.24", "19.25", "19.26", "19.27", "19.28", "19.29",
"19.3", "19.30"]
runtime: [static, dynamic]
runtime_type: [Debug, Release]
cppstd: [14, 17, 20, 23]
clang:
version: ["3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "4.0",
"5.0", "6.0", "7.0", "7.1",
"8", "9", "10", "11", "12", "13"]
libcxx: [None, libstdc++, libstdc++11, libc++, c++_shared, c++_static]
cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23]
runtime: [None, MD, MT, MTd, MDd]
apple-clang: &apple_clang
version: ["5.0", "5.1", "6.0", "6.1", "7.0", "7.3", "8.0", "8.1", "9.0", "9.1", "10.0", "11.0", "12.0", "13.0"]
libcxx: [libstdc++, libc++]
cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20]
intel:
version: ["11", "12", "13", "14", "15", "16", "17", "18", "19", "19.1"]
update: [None, ANY]
base:
gcc:
<<: *gcc
threads: [None]
exception: [None]
Visual Studio:
<<: *visual_studio
apple-clang:
<<: *apple_clang
intel-cc:
version: ["2021.1", "2021.2", "2021.3"]
update: [None, ANY]
mode: ["icx", "classic", "dpcpp"]
libcxx: [None, libstdc++, libstdc++11, libc++]
cppstd: [None, 98, gnu98, 03, gnu03, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23]
runtime: [None, static, dynamic]
runtime_type: [None, Debug, Release]
qcc:
version: ["4.4", "5.4", "8.3"]
libcxx: [cxx, gpp, cpp, cpp-ne, accp, acpp-ne, ecpp, ecpp-ne]
cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17]
mcst-lcc:
version: ["1.19", "1.20", "1.21", "1.22", "1.23", "1.24", "1.25"]
base:
gcc:
<<: *gcc
threads: [None]
exceptions: [None]
build_type: [None, Debug, Release, RelWithDebInfo, MinSizeRel]
cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23] # Deprecated, use compiler.cppstd
################################################################################
# CSG Parser
################################################################################
add_library(csg
add_library(csg-eb
cgal_helper_polygon.cpp
cgal_helper_polyhedron.cpp
csg.cpp
......@@ -12,10 +12,9 @@ add_library(csg
exception.cpp
)
target_link_libraries(csg PRIVATE
target_link_libraries(csg-eb PRIVATE
stdc++fs
CGAL::CGAL
taocpp::taocpp
taocpp::pegtl
)
add_subdirectory(tests)
lib_csg_parser = static_library('csg-eb',
'cgal_helper_polygon.cpp',
'cgal_helper_polyhedron.cpp',
'csg.cpp',
'levelset_2d.cpp',
'levelset_3d.cpp',
'matrix_functions.cpp',
'parser.cpp',
'exception.cpp',
include_directories: parser_inc,
dependencies: [pegtl, cgal],
install : true)
subdir('tests')
......@@ -25,10 +25,11 @@ target_include_directories(unit_tests_csg
PRIVATE ${CMAKE_SOURCE_DIR}/src
)
find_package(Catch2 REQUIRED)
include(Catch)
target_link_libraries(unit_tests_csg
csg
csg-eb
Catch2::Catch2
CGAL::CGAL
)
catch_discover_tests(unit_tests_csg)
test_csg = executable('unit_tests_csg',
'levelset/boolean.t.cpp',
'levelset/extrude.t.cpp',
'levelset/internal_flow.t.cpp',
'levelset/primitives.t.cpp',
'levelset/transform.t.cpp',
'parser/boolean.t.cpp',
'parser/extrude.t.cpp',
'parser/nest.cpp',
'parser/other.t.cpp',
'parser/primitives.t.cpp',
'parser/transform.t.cpp',
'unit_tests_csg.main.cpp',
include_directories: [parser_inc],
dependencies: [catch2, cgal],
link_with: lib_csg_parser,
)
test('unit_test_csg', test_csg)
Subproject commit f166ec12c615da39365b4a7f63958f7ed352a620