CMake: Add option for a syntax-only build
This commit is contained in:
parent
18f14482d0
commit
4cb5c2a21b
3 changed files with 20 additions and 2 deletions
|
@ -27,6 +27,7 @@ option(SLIC3R_MSVC_COMPILE_PARALLEL "Compile on Visual Studio in parallel" 1)
|
|||
option(SLIC3R_MSVC_PDB "Generate PDB files on MSVC in Release mode" 1)
|
||||
option(SLIC3R_PERL_XS "Compile XS Perl module and enable Perl unit and integration tests" 0)
|
||||
option(SLIC3R_ASAN "Enable ASan on Clang and GCC" 0)
|
||||
option(SLIC3R_SYNTAXONLY "Only perform source code correctness checking, no binary output (UNIX only)" 0)
|
||||
|
||||
# Proposal for C++ unit tests and sandboxes
|
||||
option(SLIC3R_BUILD_SANDBOXES "Build development sandboxes" OFF)
|
||||
|
@ -96,6 +97,19 @@ endif()
|
|||
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUXX)
|
||||
# Adding -fext-numeric-literals to enable GCC extensions on definitions of quad float literals, which are required by Boost.
|
||||
add_compile_options(-fext-numeric-literals)
|
||||
|
||||
if (SLIC3R_SYNTAXONLY)
|
||||
set(CMAKE_CXX_ARCHIVE_CREATE "true")
|
||||
set(CMAKE_C_ARCHIVE_CREATE "true")
|
||||
set(CMAKE_CXX_ARCHIVE_APPEND "true")
|
||||
set(CMAKE_C_ARCHIVE_APPEND "true")
|
||||
set(CMAKE_RANLIB "true")
|
||||
set(CMAKE_C_LINK_EXECUTABLE "true")
|
||||
set(CMAKE_CXX_LINK_EXECUTABLE "true")
|
||||
|
||||
set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> -fsyntax-only <DEFINES> <INCLUDES> <FLAGS> -c <SOURCE> && touch <OBJECT>")
|
||||
set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> -fsyntax-only <DEFINES> <INCLUDES> <FLAGS> -c <SOURCE> && touch <OBJECT>")
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
|
|
|
@ -168,7 +168,9 @@ add_library(libslic3r STATIC
|
|||
SLA/SLASpatIndex.hpp
|
||||
)
|
||||
|
||||
add_precompiled_header(libslic3r pchheader.hpp FORCEINCLUDE)
|
||||
if (NOT SLIC3R_SYNTAXONLY)
|
||||
add_precompiled_header(libslic3r pchheader.hpp FORCEINCLUDE)
|
||||
endif ()
|
||||
|
||||
target_compile_definitions(libslic3r PUBLIC -DUSE_TBB ${PNG_DEFINITIONS})
|
||||
target_include_directories(libslic3r PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${LIBNEST2D_INCLUDES} ${PNG_INCLUDE_DIRS})
|
||||
|
|
|
@ -126,4 +126,6 @@ add_library(libslic3r_gui STATIC
|
|||
)
|
||||
|
||||
target_link_libraries(libslic3r_gui libslic3r avrdude)
|
||||
add_precompiled_header(libslic3r_gui pchheader.hpp FORCEINCLUDE)
|
||||
if (NOT SLIC3R_SYNTAXONLY)
|
||||
add_precompiled_header(libslic3r_gui pchheader.hpp FORCEINCLUDE)
|
||||
endif ()
|
||||
|
|
Loading…
Reference in a new issue