Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix building iotjs with ninja+MSVC #1957

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ if(NOT DEFINED TARGET_OS)
"TARGET_OS not specified, using '${TARGET_OS}' from CMAKE_SYSTEM_NAME")
endif()

if(CMAKE_GENERATOR MATCHES "Visual Studio")
set(CONFIG_TYPE $<$<CONFIG:Debug>:Debug>)
set(CONFIG_TYPE ${CONFIG_TYPE}$<$<CONFIG:Release>:Release>)
set(CONFIG_TYPE ${CONFIG_TYPE}$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>)
set(CONFIG_TYPE ${CONFIG_TYPE}$<$<CONFIG:MinSizeRel>:MinSizeRel>)
endif()

if(NOT CMAKE_BUILD_TYPE)
message("CMAKE_BUILD_TYPE was not set! Configuring for Debug build!")
set(CMAKE_BUILD_TYPE Debug)
Expand Down Expand Up @@ -69,7 +76,6 @@ endmacro()

if(CMAKE_C_COMPILER_ID MATCHES "MSVC")
set(USING_MSVC 1)
set(CONFIG_TYPE $<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>)
# disable warning C4820: 'x' bytes padding added after construct 'membername'
iotjs_add_compile_flags(-wd4820)
# disable warning C4668: 'symbol' is not defined as preprocessor macro,
Expand Down
1 change: 1 addition & 0 deletions cmake/http-parser.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ ExternalProject_Add(http-parser
-DOS=${TARGET_OS}
${HTTPPARSER_NUTTX_ARG}
-DENABLE_MEMORY_CONSTRAINTS=ON
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/lib/${HTTPPARSER_NAME}
)
add_library(libhttp-parser STATIC IMPORTED)
add_dependencies(libhttp-parser http-parser)
Expand Down
40 changes: 27 additions & 13 deletions cmake/jerry.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ cmake_minimum_required(VERSION 2.8)

# Host jerry for snapshot generation
set(DEPS_HOST_JERRY deps/jerry-host)

set(JERRY_HOST_SNAPSHOT
${CMAKE_BINARY_DIR}/${DEPS_HOST_JERRY}/bin/jerry-snapshot)

set(JERRY_HOST_BUILD_BYPRODUCTS
${JERRY_HOST_SNAPSHOT}
)

ExternalProject_Add(hostjerry
PREFIX ${DEPS_HOST_JERRY}
SOURCE_DIR ${ROOT_DIR}/deps/jerry/
Expand Down Expand Up @@ -45,9 +53,8 @@ ExternalProject_Add(hostjerry
# can not be represented correctly in the JerryScript engine
# currently.
-DJERRY_SYSTEM_ALLOCATOR=OFF
BUILD_BYPRODUCTS ${JERRY_HOST_BUILD_BYPRODUCTS}
)
set(JERRY_HOST_SNAPSHOT
${CMAKE_BINARY_DIR}/${DEPS_HOST_JERRY}/bin/jerry-snapshot)
add_executable(jerry-snapshot IMPORTED)
add_dependencies(jerry-snapshot hostjerry)
set_property(TARGET jerry-snapshot PROPERTY
Expand Down Expand Up @@ -118,6 +125,22 @@ separate_arguments(EXTRA_JERRY_CMAKE_PARAMS)
build_lib_name(JERRY_CORE_NAME jerry-core)
build_lib_name(JERRY_LIBM_NAME jerry-libm)
build_lib_name(JERRY_EXT_NAME jerry-ext)
build_lib_name(JERRY_PORT_DEFAULT_NAME jerry-port-default)
build_lib_name(JERRY_PORT_DEFAULT_MINIMAL_NAME jerry-port-default-minimal)

set(JERRY_LIB_BUILD_BYPRODUCTS
${CMAKE_BINARY_DIR}/lib/${JERRY_CORE_NAME}
${CMAKE_BINARY_DIR}/lib/${JERRY_LIBM_NAME}
${CMAKE_BINARY_DIR}/lib/${JERRY_EXT_NAME}
)

if(NOT "${TARGET_OS}" MATCHES "NUTTX|TIZENRT")
list(APPEND JERRY_LIB_BUILD_BYPRODUCTS
${CMAKE_BINARY_DIR}/lib/${JERRY_PORT_DEFAULT_NAME}
${CMAKE_BINARY_DIR}/lib/${JERRY_PORT_DEFAULT_MINIMAL_NAME}
)
endif()


set(DEPS_LIB_JERRY deps/jerry)
set(DEPS_LIB_JERRY_SRC ${ROOT_DIR}/${DEPS_LIB_JERRY})
Expand Down Expand Up @@ -146,13 +169,11 @@ ExternalProject_Add(libjerry
-DENABLE_LTO=${ENABLE_LTO}
${DEPS_LIB_JERRY_ARGS}
${EXTRA_JERRY_CMAKE_PARAMS}
BUILD_BYPRODUCTS ${JERRY_LIB_BUILD_BYPRODUCTS}
)

set_property(DIRECTORY APPEND PROPERTY
ADDITIONAL_MAKE_CLEAN_FILES
${CMAKE_BINARY_DIR}/lib/${JERRY_CORE_NAME}
${CMAKE_BINARY_DIR}/lib/${JERRY_LIBM_NAME}
${CMAKE_BINARY_DIR}/lib/${JERRY_EXT_NAME}
ADDITIONAL_MAKE_CLEAN_FILES ${JERRY_LIB_BUILD_BYPRODUCTS}
)

# define external jerry-core target
Expand All @@ -174,13 +195,6 @@ set_property(TARGET jerry-ext PROPERTY
IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/lib/${JERRY_EXT_NAME})

if(NOT "${TARGET_OS}" MATCHES "NUTTX|TIZENRT")
build_lib_name(JERRY_PORT_NAME jerry-port)
build_lib_name(JERRY_PORT_DEFAULT_NAME jerry-port-default)
set_property(DIRECTORY APPEND PROPERTY
ADDITIONAL_MAKE_CLEAN_FILES
${CMAKE_BINARY_DIR}/lib/${JERRY_PORT_NAME}
)

# define external jerry-port-default target
add_library(jerry-port-default STATIC IMPORTED)
add_dependencies(jerry-port-default libjerry)
Expand Down
1 change: 1 addition & 0 deletions cmake/libtuv.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ ExternalProject_Add(libtuv
-DBUILDAPIEMULTESTER=NO
-DTARGET_SYSTEMROOT=${TARGET_SYSTEMROOT}
-DTARGET_BOARD=${TARGET_BOARD}
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/lib/${LIBTUV_NAME}
)
add_library(tuv STATIC IMPORTED)
add_dependencies(tuv libtuv)
Expand Down
10 changes: 7 additions & 3 deletions cmake/mbedtls.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ else()
build_lib_name(MBED_X509_NAME mbedx509)
build_lib_name(MBED_TLS_NAME mbedtls)
build_lib_name(MBED_CRYPTO_NAME mbedcrypto)
set(MBEDTLS_BUILD_BYPRODUCTS
${ARCHIVE_DIR}/${MBED_X509_NAME}
${ARCHIVE_DIR}/${MBED_TLS_NAME}
${ARCHIVE_DIR}/${MBED_CRYPTO_NAME}
)
ExternalProject_Add(mbedtls
PREFIX ${DEPS_MBEDTLS}
SOURCE_DIR ${DEPS_MBEDTLS_SRC}
Expand All @@ -68,6 +73,7 @@ else()
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DENABLE_PROGRAMS=OFF
-DENABLE_TESTING=OFF
BUILD_BYPRODUCTS ${MBEDTLS_BUILD_BYPRODUCTS}
)

# define external mbedtls target
Expand All @@ -90,9 +96,7 @@ else()

set_property(DIRECTORY APPEND PROPERTY
ADDITIONAL_MAKE_CLEAN_FILES
${ARCHIVE_DIR}/${MBED_X509_NAME}
${ARCHIVE_DIR}/${MBED_TLS_NAME}
${ARCHIVE_DIR}/${MBED_CRYPTO_NAME}
${MBEDTLS_BUILD_BYPRODUCTS}
)

set(MBEDTLS_LIBS libmbedtls libmbedx509 libmbedcrypto)
Expand Down