CMake conversion, further steps: Now it compiles on Visual Studio 2013.
This commit is contained in:
parent
bb36e78428
commit
c0f099c2cf
@ -17,8 +17,7 @@ option(SLIC3R_HAS_BROKEN_CROAK "Compile Slic3r for a broken Strawberry Perl 64b
|
||||
option(SLIC3R_MSVC_COMPILE_PARALLEL "Compile on Visual Studio in parallel" 1)
|
||||
|
||||
if (MSVC AND SLIC3R_MSVC_COMPILE_PARALLEL)
|
||||
set(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS} /MP)
|
||||
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} /MP)
|
||||
add_compile_options(/MP)
|
||||
endif ()
|
||||
|
||||
add_subdirectory(xs)
|
||||
|
@ -69,7 +69,7 @@ cmake_set_var('INCLUDE_DIRS', \$include_path);
|
||||
\$libraries =~ s/ -L/ -LIBPATH:/g if \$msvc;
|
||||
cmake_set_var('LIBRARIES', \$libraries);
|
||||
#cmake_set_var('LIBRARY_DIRS', );
|
||||
\$defines =~ s/ -D/ /g;
|
||||
#\$defines =~ s/ -D/ /g;
|
||||
cmake_set_var('DEFINITIONS', \$defines);
|
||||
#cmake_set_var('DEFINITIONS_DEBUG', );
|
||||
cmake_set_var('CXX_FLAGS', \$cflags);
|
||||
|
@ -46,6 +46,9 @@
|
||||
# tbb_preview, or tbb_preview_debug.
|
||||
# * TBB_USE_DEBUG_BUILD - The debug version of tbb libraries, if present, will
|
||||
# be used instead of the release version.
|
||||
# * TBB_STATIC - Static linking of libraries with a _static suffix.
|
||||
# For example, on Windows a tbb_static.lib will be searched for
|
||||
# instead of tbb.lib.
|
||||
#
|
||||
# Users may modify the behavior of this module with the following environment
|
||||
# variables:
|
||||
@ -204,17 +207,21 @@ if(NOT TBB_FOUND)
|
||||
set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc_proxy tbbmalloc tbb)
|
||||
endif()
|
||||
|
||||
if(TBB_STATIC)
|
||||
set(TBB_STATIC_SUFFIX "_static")
|
||||
endif()
|
||||
|
||||
# Find each component
|
||||
foreach(_comp ${TBB_SEARCH_COMPOMPONENTS})
|
||||
if(";${TBB_FIND_COMPONENTS};tbb;" MATCHES ";${_comp};")
|
||||
|
||||
# Search for the libraries
|
||||
find_library(TBB_${_comp}_LIBRARY_RELEASE ${_comp}
|
||||
find_library(TBB_${_comp}_LIBRARY_RELEASE ${_comp}${TBB_STATIC_SUFFIX}
|
||||
HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR}
|
||||
PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH
|
||||
PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX})
|
||||
|
||||
find_library(TBB_${_comp}_LIBRARY_DEBUG ${_comp}_debug
|
||||
find_library(TBB_${_comp}_LIBRARY_DEBUG ${_comp}${TBB_STATIC_SUFFIX}_debug
|
||||
HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR}
|
||||
PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH
|
||||
PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX})
|
||||
@ -243,6 +250,8 @@ if(NOT TBB_FOUND)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
unset(TBB_STATIC_SUFFIX)
|
||||
|
||||
##################################
|
||||
# Set compile flags and libraries
|
||||
##################################
|
||||
@ -300,4 +309,14 @@ if(NOT TBB_FOUND)
|
||||
unset(TBB_LIB_PATH_SUFFIX)
|
||||
unset(TBB_DEFAULT_SEARCH_DIR)
|
||||
|
||||
if(TBB_DEBUG)
|
||||
message(STATUS " TBB_INCLUDE_DIRS = ${TBB_INCLUDE_DIRS}")
|
||||
message(STATUS " TBB_DEFINITIONS = ${TBB_DEFINITIONS}")
|
||||
message(STATUS " TBB_LIBRARIES = ${TBB_LIBRARIES}")
|
||||
message(STATUS " TBB_DEFINITIONS_DEBUG = ${TBB_DEFINITIONS_DEBUG}")
|
||||
message(STATUS " TBB_LIBRARIES_DEBUG = ${TBB_LIBRARIES_DEBUG}")
|
||||
message(STATUS " TBB_DEFINITIONS_RELEASE = ${TBB_DEFINITIONS_RELEASE}")
|
||||
message(STATUS " TBB_LIBRARIES_RELEASE = ${TBB_LIBRARIES_RELEASE}")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
@ -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 ()
|
||||
|
Loading…
Reference in New Issue
Block a user