CMake modules for common applications related to computer graphics

Overview

cgcmake

CMake modules for common applications related to computer graphics

Sample Usage

Maya Project

|-- CMakeLists.txt
|-- cgcmake
    |-- modules
        |-- FindMaya.cmake
|-- src
    |-- CMakeLists.txt
    |-- pluginMain.cpp
    |-- sampleCmd.cpp
    |-- sampleCmd.h

Root CMakeLists.txt

cmake_minimum_required(VERSION 3.1...3.15)

if(${CMAKE_VERSION} VERSION_LESS 3.12)
    cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()

cmake_policy(SET CMP0048 NEW)

project(MayaProjectName VERSION 1.0 DESCRIPTION "My Maya Plug-in" LANGUAGES CXX)

set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cgcmake/modules)

add_subdirectory(src)

src/CMakeLists.txt

set(SOURCE_FILES
    "pluginMain.cpp"
    "sampleCmd.h"
    "sampleCmd.cpp"
)

find_package(Maya REQUIRED)

add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES})

target_link_libraries(${PROJECT_NAME} PRIVATE Maya::Maya)
target_include_directories(${PROJECT_NAME} 
    PRIVATE Maya::Maya
    PUBLIC "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}"
)
MAYA_PLUGIN(${PROJECT_NAME})

install(TARGETS ${PROJECT_NAME} ${MAYA_TARGET_TYPE} DESTINATION plug-ins/${MAYA_VERSION})

Windows

In a Command Prompt from the root of the project

Pre-Maya 2020

mkdir build.2019
cd build.2019
cmake -A x64 -T v140 -DMAYA_VERSION=2019 ../
cmake --build . --target install --config Release

Maya 2020

mkdir build.2020
cd build.2020
cmake -A x64 -T v141 -DMAYA_VERSION=2020 ../
cmake --build . --target install --config Release
Comments
  • Usability improvement

    Usability improvement

    Same thing as https://github.com/chadmv/cgcmake/pull/4 but no extra stuff ADD_MAYA_PLUGIN_ENTRY has been renamed to ADD_MAYA_PLUGIN (no changes to readme)

    opened by UNDEFINED-BEHAVIOR 1
  • Usability improvement for FindMaya.cmake

    Usability improvement for FindMaya.cmake

    Hi, I've made the following changes to make FindMaya.cmake a little easier to use.

    • Configuration will fail and FindMaya no longer silently chooses Maya 2017 when MAYA_VERSION is not specified.
    • Added a new cmake function, ADD_MAYA_PLUGIN_ENTRY, that can be used in place of add_library (but target declaration only) for target that will end up as the actual plugin binary.

    Also, changed the example in the readme to demonstrate modular setup.

    opened by UNDEFINED-BEHAVIOR 1
  • Add Eigen

    Add Eigen

    Hi Chad,

    I'm hoping you'll let me add this FindEigen CMake module to the project. Eigen is stable and fast linear algebra library for C++, more information is included in my commit's message. Having the module included here will be useful for me, and hopefully someone else too!

    Thanks for taking a look! Also, I'm happy to provide any further information on Eigen if required.

    opened by ghost 1
  • error:

    error: "-fPIC": No such file or directory

    try to build it for Maya 2017 on linux machine but failed. cmake version 3.9.5 c++ (GCC) 7.2.0

    `cmake -G "Unix Makefiles" -DMAYA_VERSION=2017 ../ -- The C compiler identification is GNU 7.1.1 -- The CXX compiler identification is GNU 7.1.1 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found Maya: /usr/autodesk/maya2017/include
    -- Configuring done -- Generating done -- Build files have been written to: /T/mayaPlugInBase/build

    cmake --build . --config Release Scanning dependencies of target helloWorld [ 50%] Building CXX object src/CMakeFiles/helloWorld.dir/helloWorld.cpp.o c++: error: "-fPIC": No such file or directory make[2]: *** [src/CMakeFiles/helloWorld.dir/build.make:63: src/CMakeFiles/helloWorld.dir/helloWorld.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:86: src/CMakeFiles/helloWorld.dir/all] Error 2 make: *** [Makefile:84: all] Error 2 `

    opened by mnhan32 1
  • How to use custom maya location

    How to use custom maya location

    Hello, I am trying to figure out how to set up FindMaya to load lib from custom location without modifying FindMaya.cmake file. For example if I want to use maya developer kit instead of installing maya or for CI/CD. Is it a way to specify custom location.

    I have tried to pass MAYA_LOCATION env variable but it still looking for maya in default directory, specified in FindMaya.cmake file.

    opened by DanilAndreev 0
  • fix linux CXX_FLAGS problem

    fix linux CXX_FLAGS problem

    remove following line after line 114 set_property(TARGET Maya::Maya APPEND PROPERTY INTERFACE_COMPILE_OPTIONS $<$<PLATFORM_ID:Linux>:"-fPIC">)

    opened by mnhan32 0
  • enable choose maya version

    enable choose maya version

    I installed both, maya2017 and maya2018. Without setting NO_DEFAULT_PATH, cmake always find maya2017/include even though I have set DMAYA_VERSION=2018.

    opened by hackershi 0
Owner
Chad Vernon
Chad Vernon
Fluid simulation engine for computer graphics applications

Fluid Engine Dev - Jet Jet framework is a fluid simulation engine SDK for computer graphics applications that was created by Doyub Kim as part of the

Doyub Kim 1.4k Sep 20, 2022
A repository that includes common helper functions for writing applications in the DPDK. I will be using this for my future projects in the DPDK.

The DPDK Common (WIP) Description This project includes helpful functions and global variables for developing applications using the DPDK. I am using

Christian Deacon 13 Sep 14, 2022
CMake-based build system for node.js native modules

Node CMake A CMake-based build system for Node.js native modules, for CMake >= v3.1. Newly rewritten for 2.0! New Features Drop-in execution compatibi

Colin Taylor 76 Aug 14, 2022
PLP Project Programming Language | Programming for projects and computer science and research on computer and programming.

PLPv2b PLP Project Programming Language Programming Language for projects and computer science and research on computer and programming. What is PLP L

PLP Language 5 Aug 20, 2022
A PIC/FLIP fluid simulation based on the methods found in Robert Bridson's "Fluid Simulation for Computer Graphics"

GridFluidSim3d This program is an implementation of a PIC/FLIP liquid fluid simulation written in C++11 based on methods described in Robert Bridson's

Ryan Guy 723 Sep 19, 2022
F Graphics Library (FGL) is a small graphics C++ portable library for LCD displays on embedded systems

F Graphics Library (FGL) Full documentation: fgl.docsforge.com (By Filipe Chagas) F Graphics Library is a C++ library that I created for use in embedd

Filipe Chagas 8 Dec 14, 2021
GraphicsFuzz provides tools for automatically finding and simplifying bugs in graphics drivers, specifically graphics shader compilers.

GraphicsFuzz GraphicsFuzz is a set of tools for testing shader compilers GraphicsFuzz provides tools for automatically finding and simplifying bugs in

Google 502 Sep 9, 2022
Visualization Library is a C++ middleware for high-performance 2D and 3D graphics applications based on OpenGL 1.x-4.x supporting Windows, Linux and Mac OS X.

Visualization Library 2.2 Gallery About Visualization Library is a C++ middleware for high-performance 2D and 3D graphics applications based on the in

Michele 308 Sep 15, 2022
Cmake check - Static analysis for CMake files.

cmake_check Cmake_check is a linter for the CMake language. It takes a set of user-defined rules and reports violations for CMakeLists.txt files and C

Dael 20 Mar 22, 2020
Not related to software bugs and exploits; this repo contains snippets of code that demonstrate some interesting functionality or a handy trick.

Proof-of-Concept Not related to software bugs and exploits; this repo contains snippets of code that demonstrate some interesting functionality or a h

Alisa Esage 31 May 29, 2022
Code and material related to PICO-8 and other products by Lexaloffle Games LLP

lexaloffle This is a miscellaneous collection of code and material related to products by Lexaloffle Games LLP. This collection is maintained for the

Dan Sanderson 18 Sep 15, 2022
Flutter plugin serving utilities related to Windows taskbar. 💙

windows_taskbar Flutter plugin serving utilities related to Windows taskbar ?? Install dependencies: windows_taskbar: ^0.0.1 Demo Checkout the exam

Hitesh Kumar Saini 94 Sep 21, 2022
AX.25 protocol (packet radio and APRS) interface / bridging / switching / terminal related software for Linux

CB3ROB-AX25-TOOLS-LINUX 2021-11-23T00:58:49Z (TUESDAY) cb3rob-kiss-tcp-attach.c links ax0 interface to KISS-TCP TNC, soundmodem (direwolf), or multipl

CB3ROB TACTICAL SYSTEMS 1 Jan 1, 2022
stfl with Newsboat-related bugfixes

This is a low-key fork. It's maintained to the extent necessary for Newsboat. PRs and additional maintainers are welcome! The original README follows.

Newsboat 5 Aug 25, 2022
A C library for macOS-related shenanigans.

LibVolcano LibVolcano (or simply, Volcano) is a C library for macOS-related shenanigans. Performing low-level tasks such as reading and writing proces

Jon Palmisciano 4 Jan 4, 2022
Contribute all levels of C++ related codes for Hacktoberfest 2021!

Everything-C++ Contribute all levels of C++ related codes for Hacktoberfest 2021! About This repository contains C++ programs on various topics. What

null 18 Jul 18, 2022
Projects related to sync'ing esphome devices with other protocols: DDP, E131, etc...

esphome sync This project is due to a desire to leverage WLED's new virtual strip (via DDP) feature or software like xLights or LEDFx to controls ESP

tony 8 Sep 2, 2022
General repository for all software (emulators, dev tools, etc) related to Vircon32 but not running on console itself

Vircon32: Computer software This is a general repository containing source code related to Vircon32 implementation, this is, software that does NOT ru

Vircon32 10 Sep 22, 2022