CMake conversion, further steps: Now it compiles on Visual Studio 2013.

This commit is contained in:
bubnikv 2017-08-17 18:27:51 +02:00
parent bb36e78428
commit c0f099c2cf
4 changed files with 45 additions and 15 deletions

View file

@ -74,12 +74,13 @@ target_compile_definitions(XS PRIVATE -DSLIC3RXS)
set_target_properties(XS PROPERTIES PREFIX "") # Prevent cmake from generating libXS.so instead of XS.so
if (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -DBOOST_THREAD_DONT_USE_CHRONO -DBOOST_NO_CXX11_RVALUE_REFERENCES -DBOOST_THREAD_USES_MOVE")
# add_compile_options(-stdlib=libc++)
# add_definitions(-DBOOST_THREAD_DONT_USE_CHRONO -DBOOST_NO_CXX11_RVALUE_REFERENCES -DBOOST_THREAD_USES_MOVE)
target_link_libraries(XS -framework IOKit -framework CoreFoundation -lc++)
elseif (MSVC)
target_link_libraries(XS )
else ()
target_link_libraries(XS -lc++)
target_link_libraries(XS -lstdc++)
endif ()
# Windows specific stuff
@ -113,7 +114,12 @@ find_package(PerlLibs REQUIRED)
set(PerlEmbed_DEBUG 1)
find_package(PerlEmbed REQUIRED)
target_include_directories(XS PRIVATE ${PERL_INCLUDE_PATH})
target_compile_options(XS PRIVATE ${PerlEmbed_CCLAGS})
target_compile_options(XS PRIVATE ${PerlEmbed_CCFLAGS})
# If the Perl is compiled with optimization off, disable optimization over the whole project.
if ("-Od" IN_LIST PerlEmbed_CCFLAGS OR "/Od" IN_LIST PerlEmbed_CCFLAGS)
set(CMAKE_CXX_FLAGS_RELEASE /Od)
set(CMAKE_C_FLAGS_RELEASE /Od)
endif()
target_link_libraries(XS ${PERL_LIBRARY})
## REQUIRED packages
@ -136,12 +142,18 @@ if (Boost_FOUND)
endif ()
# Find and configure intel-tbb
if(SLIC3R_STATIC)
set(TBB_STATIC 1)
endif()
set(TBB_DEBUG 1)
find_package(TBB REQUIRED)
if (TBB_FOUND)
include_directories(${TBB_INCLUDE_DIRS})
add_definitions(${TBB_DEFINITIONS})
target_link_libraries(XS ${TBB_LIBRARIES})
endif ()
include_directories(${TBB_INCLUDE_DIRS})
add_definitions(${TBB_DEFINITIONS})
if(MSVC)
# Suppress implicit linking of the TBB libraries by the Visual Studio compiler.
add_definitions(-D__TBB_NO_IMPLICIT_LINKAGE)
endif()
target_link_libraries(XS ${TBB_LIBRARIES})
# Find and configure wxWidgets
if (SLIC3R_PRUSACONTROL)
@ -149,8 +161,8 @@ if (SLIC3R_PRUSACONTROL)
if (wxWidgets_UseAlienWx)
set(AlienWx_DEBUG 1)
find_package(AlienWx REQUIRED COMPONENTS base)
include_directories(${AlienWx_INCLUDE_DIR})
string(APPEND CMAKE_CXX_FLAGS " ${AlienWx_CXX_FLAGS}")
include_directories(${AlienWx_INCLUDE_DIRS})
#add_compile_options(${AlienWx_CXX_FLAGS})
add_definitions(${AlienWx_DEFINITIONS})
target_link_libraries(XS ${AlienWx_LIBRARIES})
else ()