This is my cmake mingw32 toolchain file:
set(CMAKE_SYSTEM_NAME Windows)
######################################################
# Compiler Flags
######################################################
set(COMMON_FLAGS "")
set(COMMON_FLAGS ${COMMON_FLAGS} -static)
set(COMMON_FLAGS ${COMMON_FLAGS} -static-libgcc)
set(COMMON_FLAGS ${COMMON_FLAGS} -static-libstdc++)
set(COMMON_FLAGS_DEBUG "")
set(COMMON_FLAGS_RELEASE "")
set(C_FLAGS "")
set(CXX_FLAGS "")
set(C_FLAGS_DEBUG ${COMMON_FLAGS} ${WARNING_FLAGS} ${COMMON_FLAGS_DEBUG} ${C_FLAGS})
set(C_FLAGS_RELEASE ${COMMON_FLAGS} ${WARNING_FLAGS} ${COMMON_FLAGS_RELEASE} ${C_FLAGS})
set(CXX_FLAGS_DEBUG ${COMMON_FLAGS} ${WARNING_FLAGS} ${COMMON_FLAGS_DEBUG} ${CXX_FLAGS})
set(CXX_FLAGS_RELEASE ${COMMON_FLAGS} ${WARNING_FLAGS} ${COMMON_FLAGS_RELEASE} ${CXX_FLAGS})
######################################################
# Linker flags
######################################################
string(REPLACE ";" " " LINKER_FLAGS_DEBUG "${COMMON_FLAGS_DEBUG}")
string(REPLACE ";" " " LINKER_FLAGS_RELEASE "${COMMON_FLAGS_RELEASE}")
string(REPLACE ";" " " LINKER_FLAGS "${COMMON_FLAGS}")
I can create with this toolchain file my makefiles.
And when I use the
i686-6.4.0-release-win32-dwarf-rt_v5-rev0
I don't need to add the compiler folder to the PATH to compile and link the project.
But when I use the
i686-6.4.0-release-posix-dwarf-rt_v5-rev0
I have to add the compiler to the PATH for compilation. If I don't add the posix version to the path I got an error message during compilation
The code execution cannot proceed because libwinpthread-1.dll was not
found. Reinstalling the program may fix this problem
Is it possible to use the posix version without adding to path? What do I have to add in my toolchain file?
Thanks for the help!
Related
hi I have a sgx project that compile and run with a makefile. The trsted part is compiled with c++ 11 while the untrusted part is compiled with c++ 17.
I am trying now to compile with cmake. I put all the flags I used in the Makefile.. (of course something is not right). It compile fine, but return a lot of linking errors:
[ 64%] Linking CXX executable cscore
/usr/local/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a(_muldi3.o): in function `__multi3':
(.text+0x0): multiple definition of `__multi3'; /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a(_muldi3.o):(.text+0x0): first defined here
/usr/local/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a(_negdi2.o): in function `__negti2':
(.text+0x0): multiple definition of `__negti2'; /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a(_negdi2.o):(.text+0x0): first defined here
/usr/local/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a(_lshrdi3.o): in function `__lshrti3':
(.text+0x0): multiple definition of `__lshrti3'; /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a(_lshrdi3.o):(.text+0x0): first defined here
/usr/local/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a(_ashldi3.o): in function `__ashlti3':
(.text+0x0): multiple definition of `__ashlti3'; /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a(_ashldi3.o):(.text+0x0): first defined here
/usr/local/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a(_ashrdi3.o): in function `__ashrti3':
(.text+0x0): multiple definition of `__ashrti3'; /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a(_ashrdi3.o):(.text+0x0): first defined here
here is the cmake code
# FindPackage cmake file for Intel SGX SDK
cmake_minimum_required(VERSION 2.8.11) # target_include_directories
include(CMakeParseArguments)
set(SGX_FOUND "NO")
if(EXISTS SGX_DIR)
set(SGX_PATH ${SGX_DIR})
elseif(EXISTS SGX_ROOT)
set(SGX_PATH ${SGX_ROOT})
elseif(EXISTS $ENV{SGX_SDK})
set(SGX_PATH $ENV{SGX_SDK})
elseif(EXISTS $ENV{SGX_DIR})
set(SGX_PATH $ENV{SGX_DIR})
elseif(EXISTS $ENV{SGX_ROOT})
set(SGX_PATH $ENV{SGX_ROOT})
else()
set(SGX_PATH "/opt/intel/sgxsdk")
endif()
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(SGX_COMMON_CFLAGS -m32)
set(SGX_LIBRARY_PATH ${SGX_PATH}/lib32)
set(SGX_ENCLAVE_SIGNER ${SGX_PATH}/bin/x86/sgx_sign)
set(SGX_EDGER8R ${SGX_PATH}/bin/x86/sgx_edger8r)
else()
set(SGX_COMMON_CFLAGS -m64)
set(SGX_LIBRARY_PATH ${SGX_PATH}/lib64)
set(SGX_ENCLAVE_SIGNER ${SGX_PATH}/bin/x64/sgx_sign)
set(SGX_EDGER8R ${SGX_PATH}/bin/x64/sgx_edger8r)
endif()
find_path(SGX_INCLUDE_DIR sgx.h "${SGX_PATH}/include" NO_DEFAULT_PATH)
find_path(SGX_LIBRARY_DIR libsgx_urts.so "${SGX_LIBRARY_PATH}" NO_DEFAULT_PATH)
if(SGX_INCLUDE_DIR AND SGX_LIBRARY_DIR)
set(SGX_FOUND "YES")
set(SGX_INCLUDE_DIR "${SGX_PATH}/include" CACHE PATH "Intel SGX include directory" FORCE)
set(SGX_TLIBC_INCLUDE_DIR "${SGX_INCLUDE_DIR}/tlibc" CACHE PATH "Intel SGX tlibc include directory" FORCE)
set(SGX_LIBCXX_INCLUDE_DIR "${SGX_INCLUDE_DIR}/libcxx" CACHE PATH "Intel SGX libcxx include directory" FORCE)
set(SGX_INCLUDE_DIRS ${SGX_INCLUDE_DIR} ${SGX_TLIBC_INCLUDE_DIR} ${SGX_LIBCXX_INCLUDE_DIR})
mark_as_advanced(SGX_INCLUDE_DIR SGX_TLIBC_INCLUDE_DIR SGX_LIBCXX_INCLUDE_DIR SGX_LIBRARY_DIR)
message(STATUS "Found Intel SGX SDK.")
endif()
if(SGX_FOUND)
set(SGX_HW OFF CACHE BOOL "Run SGX on hardware, OFF for simulation.")
set(SGX_MODE Debug CACHE STRING "SGX build mode: Debug; PreRelease; Release.")
if(SGX_HW)
set(SGX_URTS_LIB sgx_urts)
set(SGX_USVC_LIB sgx_uae_service)
set(SGX_TRTS_LIB sgx_trts)
set(SGX_TSVC_LIB sgx_tservice)
else()
set(SGX_URTS_LIB sgx_urts_sim)
set(SGX_USVC_LIB sgx_uae_service_sim)
set(SGX_TRTS_LIB sgx_trts_sim)
set(SGX_TSVC_LIB sgx_tservice_sim)
endif()
if(SGX_MODE STREQUAL "Debug")
set(SGX_COMMON_CFLAGS "${SGX_COMMON_CFLAGS} -O0 -g -DSGX_DEBUG -DDEBUG -UNDEBUG -UEDEBUG")
elseif(SGX_MODE STREQUAL "PreRelease")
set(SGX_COMMON_CFLAGS "${SGX_COMMON_CFLAGS} -O2 -UDEBUG -DNDEBUG -DEDEBUG")
elseif(SGX_MODE STREQUAL "Release")
set(SGX_COMMON_CFLAGS "${SGX_COMMON_CFLAGS} -O2 -UDEBUG -DNDEBUG -UEDEBUG")
else()
message(FATAL_ERROR "SGX_MODE ${SGX_MODE} is not Debug, PreRelease or Release.")
endif()
set(ENCLAVE_INC_DIRS "${SGX_INCLUDE_DIR}" "${SGX_TLIBC_INCLUDE_DIR}" "${SGX_LIBCXX_INCLUDE_DIR}")
set(ENCLAVE_C_FLAGS "${SGX_COMMON_CFLAGS} -nostdinc -fvisibility=hidden -fpie -fstack-protector-strong")
set(ENCLAVE_CXX_FLAGS "${ENCLAVE_C_FLAGS} -nostdinc++")
set(APP_INC_DIRS "${SGX_PATH}/include")
set(APP_C_FLAGS "${SGX_COMMON_CFLAGS} -fPIC -Wno-attributes ")
set(APP_CXX_FLAGS "${APP_C_FLAGS}")
function(_build_edl_obj edl edl_search_paths use_prefix)
set(oneValueArgs EXTRA_FLAGS)
set(multiValueArgs EXTRA_INCLUDE_DIRS)
cmake_parse_arguments(OBJ "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
get_filename_component(EDL_NAME ${edl} NAME_WE)
get_filename_component(EDL_ABSPATH ${edl} ABSOLUTE)
set(EDL_T_C "${CMAKE_CURRENT_BINARY_DIR}/${EDL_NAME}_t.c")
set(SEARCH_PATHS "")
foreach(path ${edl_search_paths})
get_filename_component(ABSPATH ${path} ABSOLUTE)
list(APPEND SEARCH_PATHS "${ABSPATH}")
endforeach()
list(APPEND SEARCH_PATHS "${SGX_PATH}/include")
string(REPLACE ";" ":" SEARCH_PATHS "${SEARCH_PATHS}")
if(${use_prefix})
set(USE_PREFIX "--use-prefix")
endif()
if(NOT "${OBJ_EXTRA_INCLUDE_DIRS}" STREQUAL "")
# message("OBJ_EXTRA_INCLUDE_DIRS: ${OBJ_EXTRA_INCLUDE_DIRS}")
endif()
add_custom_command(OUTPUT ${EDL_T_C}
COMMAND ${SGX_EDGER8R} ${USE_PREFIX} --trusted ${EDL_ABSPATH} --search-path ${SEARCH_PATHS}
MAIN_DEPENDENCY ${EDL_ABSPATH}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set( LIB_ENCLAVE_C_FLAGS "-std=c11 ${ENCLAVE_C_FLAGS} ${OBJ_EXTRA_FLAGS}")
add_library(${target}-edlobj OBJECT ${EDL_T_C})
set_target_properties(${target}-edlobj PROPERTIES COMPILE_FLAGS ${LIB_ENCLAVE_C_FLAGS})
target_include_directories(${target}-edlobj PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ENCLAVE_INC_DIRS} ${OBJ_EXTRA_INCLUDE_DIRS})
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/${EDL_NAME}_t.h")
endfunction()
# build enclave shared library
function(add_enclave_library target)
set(optionArgs USE_PREFIX)
set(oneValueArgs EDL LDSCRIPT OPENSSL_LIBRARY_PATH WOLFSSL_LIBRARY_PATH)
set(multiValueArgs SRCS TRUSTED_LIBS EDL_SEARCH_PATHS EXTRA_INCLUDE_DIRS EXTRA_OPTIONS_FLAGS)
cmake_parse_arguments("SGX" "${optionArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if("${SGX_EDL}" STREQUAL "")
message(FATAL_ERROR "${target}: SGX enclave edl file is not provided!")
endif()
if(NOT "${SGX_EXTRA_INCLUDE_DIRS}" STREQUAL "")
# message("SGX_EXTRA_INCLUDE_DIRS: ${SGX_EXTRA_INCLUDE_DIRS}")
endif()
if(NOT "${SGX_EXTRA_OPTIONS_FLAGS}" STREQUAL "")
# message("SGX_EXTRA_OPTIONS_FLAGS: ${SGX_EXTRA_OPTIONS_FLAGS}")
endif()
if("${SGX_EDL_SEARCH_PATHS}" STREQUAL "")
message("${target}: SGX enclave edl file search paths are not provided!")
endif()
if(NOT "${SGX_LDSCRIPT}" STREQUAL "")
# message("SGX_LDSCRIPT provided ${SGX_LDSCRIPT}")
get_filename_component(LDS_ABSPATH ${SGX_LDSCRIPT} ABSOLUTE)
set(LDSCRIPT_FLAG "-Wl,--version-script=${LDS_ABSPATH}")
endif()
if(NOT "${SGX_OPENSSL_LIBRARY_PATH}" STREQUAL "")
# message("SGX_OPENSSL_LIBRARY_PATH provided ${SGX_OPENSSL_LIBRARY_PATH}")
if(SGX_MODE STREQUAL "Debug")
set(OPENSSL_SGX_SSL_LIBRARY_NAME "sgx_tsgxssld")
set(OPENSSL_SGX_CRYPTO_LIBRARY_NAME "sgx_tsgxssl_cryptod")
else()
set(OPENSSL_SGX_SSL_LIBRARY_NAME "sgx_tsgxssl")
set(OPENSSL_SGX_CRYPTO_LIBRARY_NAME "sgx_tsgxssl_crypto")
endif()
set(OPENSSL_FLAGS "-L${SGX_OPENSSL_LIBRARY_PATH} -Wl,--whole-archive -l${OPENSSL_SGX_SSL_LIBRARY_NAME} -Wl,--no-whole-archive -l${OPENSSL_SGX_CRYPTO_LIBRARY_NAME}")
endif()
if(NOT "${SGX_WOLFSSL_LIBRARY_PATH}" STREQUAL "")
# message("SGX_WOLFSSL_LIBRARY_PATH provided ${SGX_WOLFSSL_LIBRARY_PATH}")
set(WOLFSSL_SGX_LIBRARY_NAME "wolfssl.sgx.static.lib")
set(WOLFSSL_FLAGS "-L${SGX_WOLFSSL_LIBRARY_PATH} -l${WOLFSSL_SGX_LIBRARY_NAME}")
# message("WOLFSSL_FLAGS provided ${WOLFSSL_FLAGS}")
endif()
_build_edl_obj(${SGX_EDL} "${SGX_EDL_SEARCH_PATHS}" ${SGX_USE_PREFIX} EXTRA_INCLUDE_DIRS ${SGX_EXTRA_INCLUDE_DIRS} EXTRA_FLAGS ${SGX_EXTRA_OPTIONS_FLAGS})
set( LIB_ENCLAVE_CPP_FLAGS "-std=c++11 ${ENCLAVE_CXX_FLAGS} ${SGX_EXTRA_OPTIONS_FLAGS}")
add_library(${target} SHARED ${SGX_SRCS} $<TARGET_OBJECTS:${target}-edlobj>)
set_target_properties(${target} PROPERTIES COMPILE_FLAGS ${LIB_ENCLAVE_CPP_FLAGS})
target_include_directories(${target} PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ENCLAVE_INC_DIRS} ${SGX_EXTRA_INCLUDE_DIRS})
set(TLIB_LIST "")
foreach(TLIB ${SGX_TRUSTED_LIBS})
string(APPEND TLIB_LIST "$<TARGET_FILE:${TLIB}> ")
add_dependencies(${target} ${TLIB})
endforeach()
set(SGX_COMPILER_OPTIONS "${SGX_COMMON_CFLAGS} -Wl,--no-undefined -nostdlib -nodefaultlibs -nostartfiles \
${OPENSSL_FLAGS} ${WOLFSSL_FLAGS} \
-L${SGX_LIBRARY_PATH} -Wl,--whole-archive -l${SGX_TRTS_LIB} -Wl,--no-whole-archive \
-Wl,--start-group ${TLIB_LIST} -lsgx_tstdc -lsgx_tcxx -lsgx_pthread -lsgx_tkey_exchange -lsgx_tcrypto -l${SGX_TSVC_LIB} -Wl,--end-group \
-Wl,-Bstatic -Wl,-Bsymbolic -Wl,--no-undefined \
-Wl,-pie,-eenclave_entry -Wl,--export-dynamic \
${LDSCRIPT_FLAG} -Wl,--defsym,__ImageBase=0")
# message("add_enclave_library SGX_COMPILER_OPTIONS: ${SGX_COMPILER_OPTIONS}")
target_link_libraries(${target} ${SGX_COMPILER_OPTIONS})
endfunction()
# sign the enclave, according to configurations one-step or two-step signing will be performed.
# default one-step signing output enclave name is target.signed.so, change it with OUTPUT option.
function(enclave_sign target)
set(optionArgs IGNORE_INIT IGNORE_REL)
set(oneValueArgs KEY CONFIG OUTPUT)
cmake_parse_arguments("SGX" "${optionArgs}" "${oneValueArgs}" "" ${ARGN})
if("${SGX_CONFIG}" STREQUAL "")
message("${target}: SGX enclave config is not provided!")
else()
get_filename_component(CONFIG_ABSPATH ${SGX_CONFIG} ABSOLUTE)
endif()
if("${SGX_KEY}" STREQUAL "")
if (NOT SGX_HW OR NOT SGX_MODE STREQUAL "Release")
message(FATAL_ERROR "${target}: Private key used to sign enclave is not provided!")
endif()
else()
get_filename_component(KEY_ABSPATH ${SGX_KEY} ABSOLUTE)
endif()
if("${SGX_OUTPUT}" STREQUAL "")
set(OUTPUT_NAME "${target}.signed.so")
else()
set(OUTPUT_NAME ${SGX_OUTPUT})
endif()
if(${SGX_IGNORE_INIT})
set(IGN_INIT "-ignore-init-sec-error")
endif()
if(${SGX_IGNORE_REL})
set(IGN_REL "-ignore-rel-error")
endif()
if(SGX_HW AND SGX_MODE STREQUAL "Release")
add_custom_target(${target}-sign ALL
COMMAND ${SGX_ENCLAVE_SIGNER} gendata
$<$<NOT:$<STREQUAL:${SGX_CONFIG},>>:-config> $<$<NOT:$<STREQUAL:${SGX_CONFIG},>>:${CONFIG_ABSPATH}>
-enclave $<TARGET_FILE:${target}> -out $<TARGET_FILE_DIR:${target}>/${target}_hash.hex ${IGN_INIT} ${IGN_REL}
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color
--cyan "SGX production enclave first step signing finished, \
use ${CMAKE_CURRENT_BINARY_DIR}/${target}_hash.hex for second step"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
else()
add_custom_target(${target}-sign ALL ${SGX_ENCLAVE_SIGNER} sign -key ${KEY_ABSPATH}
$<$<NOT:$<STREQUAL:${SGX_CONFIG},>>:-config> $<$<NOT:$<STREQUAL:${SGX_CONFIG},>>:${CONFIG_ABSPATH}>
-enclave $<TARGET_FILE:${target}>
-out $<TARGET_FILE_DIR:${target}>/${OUTPUT_NAME}
${IGN_INIT} ${IGN_REL}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif()
set(CLEAN_FILES "$<TARGET_FILE_DIR:${target}>/${OUTPUT_NAME};$<TARGET_FILE_DIR:${target}>/${target}_hash.hex")
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${CLEAN_FILES}")
endfunction()
function(add_untrusted_executable target)
set(optionArgs USE_PREFIX)
set(oneValueArgs OPENSSL_LIBRARY_PATH)
set(multiValueArgs SRCS EDL EDL_SEARCH_PATHS EXTRA_BUILD_OBJECTS EXTRA_INCLUDE_DIRS EXTRA_OPTIONS_FLAGS)
cmake_parse_arguments("SGX" "${optionArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if("${SGX_EDL}" STREQUAL "")
message(FATAL_ERROR "${target}: SGX enclave edl file is not provided!")
endif()
if("${SGX_EDL_SEARCH_PATHS}" STREQUAL "")
message("${target}: SGX enclave edl file search paths are not provided!")
endif()
if(NOT "${SGX_OPENSSL_LIBRARY_PATH}" STREQUAL "")
message("SGX_OPENSSL_LIBRARY_PATH provided ${SGX_OPENSSL_LIBRARY_PATH}")
if(SGX_MODE STREQUAL "Debug")
set(OPENSSL_SGX_SSL_LIBRARY_NAME "sgx_usgxssld")
else()
set(OPENSSL_SGX_SSL_LIBRARY_NAME "sgx_usgxssl")
endif()
set(OPENSSL_FLAGS "-L${SGX_OPENSSL_LIBRARY_PATH} -Wl,--whole-archive -l${OPENSSL_SGX_SSL_LIBRARY_NAME} ")
message("OPENSSL_FLAGS provided ${OPENSSL_FLAGS}")
endif()
if(NOT "${SGX_EXTRA_INCLUDE_DIRS}" STREQUAL "")
message("SGX_EXTRA_INCLUDE_DIRS: ${SGX_EXTRA_INCLUDE_DIRS}")
endif()
if(NOT "${SGX_EXTRA_OPTIONS_FLAGS}" STREQUAL "")
message("SGX_EXTRA_OPTIONS_FLAGS: ${SGX_EXTRA_OPTIONS_FLAGS}")
endif()
set(EDL_U_SRCS "")
foreach(EDL ${SGX_EDL})
get_filename_component(EDL_NAME ${EDL} NAME_WE)
get_filename_component(EDL_ABSPATH ${EDL} ABSOLUTE)
set(EDL_U_C "${CMAKE_CURRENT_BINARY_DIR}/${EDL_NAME}_u.c")
set(EDL_U_H "${CMAKE_CURRENT_BINARY_DIR}/${EDL_NAME}_u.h")
set(SEARCH_PATHS "")
foreach(path ${SGX_EDL_SEARCH_PATHS})
get_filename_component(ABSPATH ${path} ABSOLUTE)
list(APPEND SEARCH_PATHS "${ABSPATH}")
endforeach()
list(APPEND SEARCH_PATHS "${SGX_PATH}/include")
string(REPLACE ";" ":" SEARCH_PATHS "${SEARCH_PATHS}")
if(${SGX_USE_PREFIX})
set(USE_PREFIX "--use-prefix")
endif()
add_custom_command(OUTPUT ${EDL_U_C}
COMMAND ${SGX_EDGER8R} ${USE_PREFIX} --untrusted ${EDL_ABSPATH} --search-path ${SEARCH_PATHS}
MAIN_DEPENDENCY ${EDL_ABSPATH}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
list(APPEND EDL_U_SRCS ${EDL_U_C})
list(APPEND EDL_U_HDRS ${EDL_U_H})
endforeach()
set(EXTRA_BUILD_OBJECTS "")
foreach(EBOBJ ${SGX_EXTRA_BUILD_OBJECTS})
get_filename_component(EBOBJ_NAME ${EBOBJ} NAME_WE)
get_filename_component(EBOBJ_ABSPATH ${EBOBJ} ABSOLUTE)
set(EBOBJ_NAME "${EBOBJ_NAME}-ext-obj")
add_library(${EBOBJ_NAME} OBJECT IMPORTED GLOBAL)
set_target_properties(${EBOBJ_NAME} PROPERTIES IMPORTED_OBJECTS ${EBOBJ_ABSPATH})
list(APPEND EXTRA_BUILD_OBJECTS ${EBOBJ_NAME})
endforeach()
message("EXTRA_BUILD_OBJECTS ====== ${EXTRA_BUILD_OBJECTS}")
add_executable(${target} ${SGX_SRCS} ${EDL_U_SRCS} $<TARGET_OBJECTS:${EXTRA_BUILD_OBJECTS}>)
set( U_EXEC_CPP_FLAGS "-std=c++17 ${APP_CXX_FLAGS} ${SGX_EXTRA_OPTIONS_FLAGS} ")
message("U_EXEC_CPP_FLAGS : ${U_EXEC_CPP_FLAGS}")
set_target_properties(${target} PROPERTIES COMPILE_FLAGS ${U_EXEC_CPP_FLAGS})
target_include_directories(${target} PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${SGX_EXTRA_INCLUDE_DIRS} ${APP_INC_DIRS})
target_link_libraries(${target} "${SGX_COMMON_CFLAGS} \
${OPENSSL_FLAGS} \
-L${SGX_LIBRARY_PATH} \
-l${SGX_URTS_LIB} \
-l${SGX_USVC_LIB} \
-lcrypto -lwolfssl -lpthread")
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${EDL_U_HDRS})
endfunction()
else(SGX_FOUND)
message(WARNING "Intel SGX SDK not found!")
if(SGX_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find Intel SGX SDK!")
endif()
endif(SGX_FOUND)
that was called as
add_enclave_library(Enclave
SRCS ${T_SRCS} ${T_SRCS_Crypto} ${T_SRCS_HTTPS_Handlers} ${T_SRCS_DataUtils} ${T_SRCS_Agg}
EDL Enclave/Enclave.edl
EDL_SEARCH_PATHS ${EDL_SEARCH_PATHS}
USE_PREFIX
LDSCRIPT ${LDS}
OPENSSL_LIBRARY_PATH ${SGX_OPENSSL_LIB_DIR}
WOLFSSL_LIBRARY_PATH ${SGX_WOLFSSL_LIB_DIR}
EXTRA_INCLUDE_DIRS ${T_INCLUDE_DIRS}
EXTRA_OPTIONS_FLAGS ${WOLFSSL_ENCLAVE_EXTRA_FLAGS})
enclave_sign(Enclave KEY Enclave/Enclave_private.pem CONFIG Enclave/Enclave.config.xml)
set(WOLFSSL_APP_EXTRA_FLAGS "${WOLFSSL_C_EXTRA_FLAGS} -DWOLFSSL_SHA512 -DOPENSSL_EXTRA -DOPENSSL_ALL -DLWS_HAVE_SSL_CTX_load_verify_file \
-DLWS_WITH_SOCKS5 -DLWS_WITH_DETAILED_LATENCY -DLWS_WITH_SPAWN -DLWS_WITH_RANGES -DLWS_WITH_ACCESS_LOG -DCPPHTTPLIB_OPENSSL_SUPPORT -DHAVE_SUPPORTED_CURVES")
add_untrusted_executable(cscore SRCS ${U_SRCS} ${U_SRCS_Exchanges}
EDL Enclave/Enclave.edl
EDL_SEARCH_PATHS ${EDL_SEARCH_PATHS}
OPENSSL_LIBRARY_PATH ${SGX_OPENSSL_LIB_DIR}
EXTRA_INCLUDE_DIRS ${U_INCLUDE_DIRS}
EXTRA_OPTIONS_FLAGS ${WOLFSSL_APP_EXTRA_FLAGS}
EXTRA_BUILD_OBJECTS App/kdb/c.o
)
add_dependencies(cscore Enclave-sign)
Any help is appreciated.
I'm trying to build an opensource project on WSL using cmake.
I'm getting first these two errors which I don't understand :
CMake Error at /usr/share/cmake-3.16/Modules/CMakeDetermineSystem.cmake:185 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
The CXX compiler identification is GNU 9.3.0
CMake Error at /usr/share/cmake-3.16/Modules/CMakeDetermineCXXCompiler.cmake:210 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
and for X11:
Searching X11
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find X11 (missing: X11_X11_LIB)
Call Stack (most recent call first):
/usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.16/Modules/FindX11.cmake:366 (find_package_handle_standard_args)
CMakeLists.txt:18 (FIND_PACKAGE)
Here is the cmakelist.txt provided :
#CMake for the gard Project
project(GARD)
cmake_minimum_required(VERSION 2.4.0)
#Set the path to the Cmake Modules
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/")
MESSAGE("Path to Cmake Modules is " ${CMAKE_MODULE_PATH})
MESSAGE("The source directory of the project is " ${GARD_SOURCE_DIR})
MESSAGE("")
MESSAGE("STEP 1 : SEARCHING FOR NEEDED MODULES")
MESSAGE("")
MESSAGE("Searching X11")
FIND_PACKAGE(X11 REQUIRED)
IF(X11_FOUND)
MESSAGE(" X11 include path: " ${X11_INCLUDE_DIR})
MESSAGE(" X11 library path: " ${X11_LIBRARIES})
ENDIF(X11_FOUND)
MESSAGE("Searching LAPACK AND BLAS")
find_package(LAPACK)
IF(LAPACK_FOUND)
MESSAGE(" LAPACK library path: " ${LAPACK_LIBRARIES})
MESSAGE(" BLAS library path: " ${BLAS_LIBRARIES})
ENDIF(LAPACK_FOUND)
MESSAGE("Searching CIMG")
find_package(CImg)
IF(CIMG_FOUND)
MESSAGE(" CIMG include path: " ${CIMG_INCLUDE_DIR})
ENDIF(CIMG_FOUND)
MESSAGE("Searching pthread")
FIND_LIBRARY(PTHREADS_LIBRARY pthread
PATHS /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu
)
IF(PTHREADS_LIBRARY)
MESSAGE(" Pthread library path: " ${PTHREADS_LIBRARY})
ENDIF(PTHREADS_LIBRARY)
MESSAGE("Searching Graphviz")
find_package(GraphViz)
IF(GRAPHVIZ_FOUND)
MESSAGE(" Graphviz library path: " ${GRAPHVIZ_LIBRARIES})
MESSAGE(" Graphviz include path: " ${GRAPHVIZ_INCLUDE_DIRS})
SET(GRAPHVIZ_SUPPORT "#define GRAPHVIZ_SUPPORT")
ENDIF(GRAPHVIZ_FOUND)
CONFIGURE_FILE(GraphVizConfig.h.cmake ${CMAKE_SOURCE_DIR}/include/core/GraphVizConfig.h)
find_package(OpenMP)
if(OPENMP_FOUND)
message("openMP found")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
MESSAGE("Searching FLANN")
find_package(Flann)
IF(FLANN_FOUND)
MESSAGE(" FLANN include path: " ${FLANN_INCLUDE_DIR})
include_directories(${FLANN_INCLUDE_DIR})
SET(FLANN_SUPPORT "#define FLANN_SUPPORT")
ELSE(FLANN_FOUND)
MESSAGE(" FLANN include path not found")
SET(FLANN_SUPPORT "")
ENDIF(FLANN_FOUND)
include(ProcessorCount)
ProcessorCount(N)
if(NOT N EQUAL 0)
set(AVAILABLE_CORES "#define AVAILABLE_CORES ${N}")
else(NOT N EQUAL 0)
set(AVAILABLE_CORES "#define AVAILABLE_CORES 1")
endif()
CONFIGURE_FILE(FlannConfig.h.cmake ${CMAKE_SOURCE_DIR}/include/core/FlannConfig.h)
MESSAGE("")
MESSAGE("")
MESSAGE("STEP 2 : SET INCLUDE AND LIBRARY PATHS")
MESSAGE("")
SET(GARD_INCLUDE_DIR ${GARD_SOURCE_DIR}/include)
IF(LAPACK_FOUND)
SET(LINK_LIBRARIES ${X11_LIBRARIES} ${PTHREADS_LIBRARY} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} ${GRAPHVIZ_LIBRARIES})
SET(CIMG_USE_LAPACK "#define cimg_use_lapack")
ELSE()
SET(LINK_LIBRARIES ${X11_LIBRARIES} ${PTHREADS_LIBRARY} ${GRAPHVIZ_LIBRARIES})
ENDIF()
CONFIGURE_FILE(CimgConfig.h.cmake ${CMAKE_SOURCE_DIR}/include/core/CimgConfig.h)
MESSAGE("")
MESSAGE("STEP 3 : Documentation generation")
MESSAGE("")
MESSAGE("Searching DOXYGEN")
INCLUDE(${CMAKE_MODULE_PATH}/FindDoxygen.cmake)
IF(DOXYGEN_FOUND)
MESSAGE("DOXYGEN Dir " ${DOXYGEN_DIR})
MESSAGE("GENERATING DOCUMENTATION")
SET(ENV{GARD_INCLUDE_DIR} "${GARD_SOURCE_DIR}/include")
EXEC_PROGRAM("cd docs;${DOXYGEN_DIR}/doxygen doc.txt"
OUTPUT_VARIABLE MY_OUTPUT
)
ENDIF(DOXYGEN_FOUND)
MESSAGE(STATUS "Link libraries: ${LINK_LIBRARIES}")
MESSAGE("")
MESSAGE("STEP 4 : COMPILATION")
MESSAGE("")
add_subdirectory (${GARD_SOURCE_DIR}/examples)
# add_subdirectory (${GARD_SOURCE_DIR}/operators)
Can you help please? I'm new to cmake and WSL. I'm running WSL on Windows 10 and I've installed the X11 library with " sudo apt-get install libx11-dev " . The command 'cmake .' is running in the bash terminal and looks like :
ananass#DESKTOP-R1E6G2S:/mnt/c/Users/ananass/gard$
I am trying to create a custom cmake_configuration_type using the method as described here
The issue I am facing is the correct linking of 3rd party libraries. E.g., when I create a custom configuration the executable is not linking correctly to third party libraries for the Final configuration. Some libraries linked to are in release mode and others in debug. Would anybody point me to whether CMake gives a way to resolve this issue ?
Here is the code as requested :
CMakeLists.txt :
cmake_minimum_required(VERSION 3.5)
project(DisplayImage)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake)
# Add configurations
include(SetupConfiguration)
# if (WIN32)
# # Restrict the generated configuration to be what we configured above.
# # No point creating project files for build types that will not compile.
# # Note: it's set to FORCE so that both CMAKE_BUILD_TYPE and CMAKE_CONFIGURATION_TYPES match up.
# set(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE} CACHE STRING "Build configurations to generate." FORCE)
# mark_as_advanced(CMAKE_CONFIGURATION_TYPES)
# endif()
message("Generated with config types: ${CMAKE_CONFIGURATION_TYPES}")
######################################################################
# Choose C++ standard. Currently 11, as we try to support VS2013.
######################################################################
set(mp_CXX_STANDARD 11)
set(CMAKE_CXX_EXTENSIONS 0)
set(CMAKE_CXX_STANDARD ${mp_CXX_STANDARD})
set(CMAKE_CXX_STANDARD_REQUIRED ON)
######################################################################
# Add Optional Requirements
######################################################################
if(WIN32)
set(_library_sub_dir "bin")
else()
set(_library_sub_dir "lib")
endif()
find_package( OpenCV REQUIRED )
add_executable(DisplayImage main.cpp)
target_link_libraries(DisplayImage ${OpenCV_LIBS})
if (CMAKE_CONFIGURATION_TYPES MATCHES Release)
set_property(TARGET DisplayImage PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Release>:Release>")
set_target_properties(DisplayImage PROPERTIES RELEASE_POSTFIX "R")
elseif(CMAKE_CONFIGURATION_TYPES MATCHES Final)
set_property(TARGET DisplayImage PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Release>:Release>")
set_target_properties(DisplayImage PROPERTIES RELEASE_POSTFIX "F")
target_compile_definitions(DisplayImage PUBLIC -DFINAL)
elseif(CMAKE_CONFIGURATION_TYPES MATCHES Debug)
set_property(TARGET DisplayImage PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug")
set_target_properties(DisplayImage PROPERTIES DEBUG_POSTFIX "D")
endif()
The main.cpp
#include <stdio.h>
#include <opencv2/opencv.hpp>
using namespace cv;
int main(int argc, char** argv )
{
if ( argc != 2 )
{
printf("usage: DisplayImage.out <Image_Path>\n");
return -1;
}
Mat image;
image = imread( argv[1], 1 );
if ( !image.data )
{
printf("No image data \n");
return -1;
}
namedWindow("Display Image", WINDOW_AUTOSIZE );
imshow("Display Image", image);
waitKey(0);
return 0;
}
In the CMake folder in the project the following two files mpSetupMSVCRuntime.cmake
if(MSVC)
set(variables
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELEASE
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
)
add_definitions(/bigobj)
add_definitions(/MP)
endif()
and SetupConfiguration.cmake
if(NOT SET_UP_CONFIGURATIONS_DONE)
set(SET_UP_CONFIGURATIONS_DONE TRUE)
get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(isMultiConfig)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release;Final" CACHE STRING "" FORCE)
else()
if(NOT CMAKE_BUILD_TYPE)
message("Defaulting to release build.")
set(CMAKE_BUILD_TYPE Release CACHE STRING "" FORCE)
endif()
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY HELPTSTRING "Choose the type of build")
#set the valid options for cmake-gui drop-down list
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug;Release;Final")
endif()
# now set up the Final configuration
set(CMAKE_C_FLAGS_FINAL "${CMAKE_C_FLAGS_RELEASE}" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_FINAL "${CMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "" FORCE)
set(CMAKE_EXE_LINKER_FLAGS_FINAL "${CMAKE_EXE_LINKER_FLAGS_RELEASE}" CACHE STRING "" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_FINAL "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}" CACHE STRING "" FORCE)
set(CMAKE_MODULE_LINKER_FLAGS_FINAL "${CMAKE_MODULE_LINKER_FLAGS_RELEASE}" CACHE STRING "" FORCE)
endif()
Thanks for your help
So finally I was able to solve this with some changes to the CMakeLists.txt
cmake_minimum_required(VERSION 3.5)
project(DisplayImage)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake)
# Add configurations
include(SetupConfiguration)
# if (WIN32)
# # Restrict the generated configuration to be what we configured above.
# # No point creating project files for build types that will not compile.
# # Note: it's set to FORCE so that both CMAKE_BUILD_TYPE and CMAKE_CONFIGURATION_TYPES match up.
# set(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE} CACHE STRING "Build configurations to generate." FORCE)
# mark_as_advanced(CMAKE_CONFIGURATION_TYPES)
# endif()
message("Generated with config types: ${CMAKE_CONFIGURATION_TYPES}")
######################################################################
# Choose C++ standard. Currently 11, as we try to support VS2013.
######################################################################
set(mp_CXX_STANDARD 11)
set(CMAKE_CXX_EXTENSIONS 0)
set(CMAKE_CXX_STANDARD ${mp_CXX_STANDARD})
set(CMAKE_CXX_STANDARD_REQUIRED ON)
######################################################################
# Add Optional Requirements
######################################################################
if(WIN32)
set(_library_sub_dir "bin")
else()
set(_library_sub_dir "lib")
endif()
find_package( OpenCV REQUIRED )
foreach(_cvlib ${OpenCV_LIBS})
set_target_properties(${_cvlib} PROPERTIES MAP_IMPORTED_CONFIG_FINAL "RELEASE")
endforeach()
add_executable(DisplayImage main.cpp)
if (CMAKE_CONFIGURATION_TYPES MATCHES Release)
target_link_libraries(DisplayImage ${OpenCV_LIBS})
set_property(TARGET DisplayImage PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Release>:Release>")
set_target_properties(DisplayImage PROPERTIES RELEASE_POSTFIX "R")
elseif(CMAKE_CONFIGURATION_TYPES MATCHES Final)
target_link_libraries(DisplayImage ${OpenCV_LIBS})
set_property(TARGET DisplayImage PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Final>:Final>")
set_target_properties(DisplayImage PROPERTIES RELEASE_POSTFIX "F")
add_definitions(-DFINAL)
elseif(CMAKE_CONFIGURATION_TYPES MATCHES Debug)
target_link_libraries(DisplayImage ${OpenCV_LIBS})
set_property(TARGET DisplayImage PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug")
set_target_properties(DisplayImage PROPERTIES DEBUG_POSTFIX "D")
endif()
The key was to use the MAP_IMPORTED_CONFIG_<CONFIG> feature of CMake.
I'm getting the error: lib/libhrlLib.so: undefined reference to `hrlQseqDev::waiting(bool, int)' and some more ...
I'm trying to build my project with cmake (3.7.2) instead of with qmake (Qt5)
CMakeLists.txt:
project(${TARGET_NAME})
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 14)
set(POSITION_INDEPENDENT_CODE FALSE)
macro(NAMELIST erg in)
set(os "")
set(srcs ${in})
separate_arguments(srcs)
foreach(is ${srcs})
set(os ${os} ${is})
endforeach(is)
set(${erg} ${os})
endmacro(NAMELIST)
macro(FINDMODULES erg in)
set(os "")
set(srcs ${in})
separate_arguments(srcs)
foreach(is ${srcs})
find_package(Qt5${is} REQUIRED)
set(os ${os} Qt5::${is})
endforeach(is)
set(${erg} ${os})
endmacro(FINDMODULES)
NAMELIST(SRCS ${TARGET_SRCS})
FINDMODULES(QLIBS ${QMODULES})
if(INC_PATH)
NAMELIST(INCS ${INC_PATH})
set(INCLUDES ${INCS})
endif(INC_PATH)
if(TARGET_EXTLIBS)
NAMELIST(EXTRA_LIBS ${EXTRA_LIBS} "${TARGET_EXTLIBS}")
endif(TARGET_EXTLIBS)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
include_directories(${INCLUDES})
if(BUILD_LIB)
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-shared")
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "-shared")
add_library(${TARGET_NAME} SHARED ${SRCS})
target_link_libraries(${TARGET_NAME} ${QLIBS} ${EXTRA_LIBS})
set_property(TARGET ${TARGET_NAME} PROPERTY VERSION "1.0.0")
set_property(TARGET ${TARGET_NAME} PROPERTY SOVERSION 1 )
install(TARGETS ${TARGET_NAME} LIBRARY DESTINATION lib)
install(TARGETS ${TARGET_NAME} LIBRARY DESTINATION lib NAMELINK_ONLY)
else()
if(USE_LIB_PATH)
add_executable(${TARGET_NAME} ${SRCS})
target_link_libraries(${TARGET_NAME} -L${OUT_PATH}/lib lib${USE_LIB}.so.1
${QLIBS} ${EXTRA_LIBS})
else()
add_executable(${TARGET_NAME} ${SRCS})
target_link_libraries(${TARGET_NAME} ${QLIBS} ${EXTRA_LIBS})
endif(USE_LIB_PATH)
install(TARGETS ${TARGET_NAME} RUNTIME DESTINATION bin)
endif(BUILD_LIB)
The shared library is built with:
cmake -G "Unix Makefiles" -DINC_PATH:STRING="some includes" -DTARGET_EXTLIBS:STRING="sys libs" -DTARGET_NAME:STRING=LibName -DBUILD_LIB:BOOL=1 -DTARGET_SRCS:STRING="cpp- and c-file" -DQMODULES:STRING="Core Gui Widgets PrintSupport" -DOUT_PATH:STRING=InstallPath .. -DCMAKE_INSTALL_PREFIX=InstallPath >> /dev/null
When I try to build a program against this shared library with:
cmake -G "Unix Makefiles" -DINC_PATH:STRING="some includes" -DTARGET_EXTLIBS:STRING="sys libs" -DTARGET_NAME:STRING=ProgName -DBUILD_LIB:BOOL=0 -DTARGET_SRCS:STRING="cpp-file" -DQMODULES:STRING="Core Gui Widgets PrintSupport" -DOUT_PATH=InstallPath -DUSE_LIB:STRING="LibName" -DUSE_LIB_PATH:STRING="BuildPath of LibName" .. -DCMAKE_INSTALL_PREFIX=InstallPath >> /dev/null
I get the error 'lib/libhrlLib.so: undefined reference to ...'.
I do not get this error when the library was built with qmake.
How can I fix this?
I am trying to convert a rather simple CMakeLists.txt to a qmake project. The project compiles fine but I can't get the output I want (the program files are the same!).
It shouldn't be a big deal, but I have spent the whole day and can't seem to figure out the problem. Any help would be greatly appreciated.
Here's the CMakeLists.txt that I am trying to convert:
cmake_minimum_required (VERSION 2.6)
PROJECT (sdpwrapper)
#set the default path for built executables to the "bin" directory
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
FIND_PACKAGE(OpenCV REQUIRED)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
ADD_LIBRARY(objdettrack
./src/MyPipe.cpp
./src/SDPWrapper.cpp
./src/online_tracker.cpp
./src/BaseObjectTracker2D.cpp)
INCLUDE_DIRECTORIES(include
/usr/include/python2.7
../dep/NOMT/include/
../dep/NOMT/dep/eigen/
../dep/NOMT/dep/libDAI-0.3.2/include/)
TARGET_LINK_LIBRARIES(objdettrack
${PROJECT_SOURCE_DIR}/../dep/NOMT/lib/libcppmodule.so
python2.7
${OpenCV_LIBS})
ADD_EXECUTABLE(example ./src/main.cpp)
TARGET_LINK_LIBRARIES(example objdettrack)
FIND_PACKAGE(OpenMP)
IF(OPENMP_FOUND)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_C_FLAGS}")
ENDIF()
and here's the qmake project file I created:
QT += widgets
TARGET = ./build/DummyProject
#CONFIG += console
#CONFIG -= app_bundle
SOURCES += ./src/main.cpp \
./src/MyPipe.cpp \
./src/online_tracker.cpp \
./src/SDPWrapper.cpp \
./src/BaseObjectTracker2D.cpp
TEMPLATE = app
#TEMPLATE += lib
# ZEESHAN:INTEGRATION CODE
INCLUDEPATH += ./include
INCLUDEPATH += /usr/include/python2.7
INCLUDEPATH += /home/ma/zeeshan/code/Joint/KITTI_Jun2016/slam/app/faster-rcnn/dep/NOMT/include/
INCLUDEPATH += /home/ma/zeeshan/code/Joint/KITTI_Jun2016/slam/app/faster-rcnn/dep/NOMT/dep/eigen/
INCLUDEPATH += /home/ma/zeeshan/code/Joint/KITTI_Jun2016/slam/app/faster-rcnn/dep/NOMT/dep/libDAI-0.3.2/include/
QMAKE_LIBDIR += /home/ma/zeeshan/code/Joint/KITTI_Jun2016/slam/app/faster-rcnn/dep/NOMT/lib
LIBS += -lcppmodule
LIBS += -lpython2.7
LIBS += -lpynomt
QMAKE_LIBDIR += ../../faster-rcnn/cpp/lib
LIBS += -Lobjdettrack
CONFIG += link_pkgconfig
PKGCONFIG += opencv
QMAKE_CXXFLAGS+= -fopenmp
QMAKE_LFLAGS += -fopenmp
Any suggestions would be highly appreciated.
Zeeshan