Skip to content

For developers

Maxim Klenin edited this page Dec 9, 2022 · 2 revisions

CLion

CLion includes a set of smart features, many of which rely on project-level information (included files, compiler flags, and linker options). This information allows CLion to properly parse/resolve your code and therefore highlight, autocomplete, inspect and navigate through it in an error-free and convenient way.

CLion doesn't provide its own project model for your code, but it does support a number of formats, CMake being one of them.

CMake is a meta build system that uses scripts called CMakeLists to generate build files for a particular environment (eg makefiles on Unix machines). When you create a new CMake project in CLion, a CMakeLists.txt file is automatically generated at the root of the project.

You can use the following CMakeLists.txt when developing an extension:

cmake_minimum_required(VERSION 3.16)
project(php-aeron C)

include_directories(/usr/include/php/20210902)
include_directories(/usr/include/php/20210902/main)
include_directories(/usr/include/php/20210902/Zend)
include_directories(/usr/include/php/20210902/TSRM)
include_directories(/usr/local/include)

set(SOURCE
        aeron.c
        php_aeron.h
        aeron.stub.php
        aeron_arginfo.h
        config.m4
        CREDITS
        tests/001.phpt)

add_custom_target(build
        COMMAND phpize
        COMMAND ./configure
        COMMAND make
        COMMAND sudo make install
        COMMAND phpize --clean
        DEPENDS ${SOURCE}
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
        VERBATIM USES_TERMINAL)

add_library(_ EXCLUDE_FROM_ALL ${SOURCE})

Clone this wiki locally