From 435846db9a4a8389ee8158c95805d202a9a97cef Mon Sep 17 00:00:00 2001 From: master-atul Date: Wed, 26 Feb 2020 23:06:23 +0100 Subject: [PATCH] Add compilation --- CMakeLists.txt | 20 +++++++++++-------- .../nodegui/core/Integration/qode-api.h | 14 +++++++++---- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d0524e0c9..a6fd545bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -172,6 +172,18 @@ target_include_directories(${CORE_WIDGETS_ADDON} PRIVATE "${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui" ) + +if (WIN32) + target_compile_definitions(${CORE_WIDGETS_ADDON} PRIVATE + ENABLE_DLL_EXPORT=1 + ) + target_link_libraries(${CORE_WIDGETS_ADDON} PRIVATE + "${PROJECT_SOURCE_DIR}/node_modules/@nodegui/qode/binaries/qode.lib" + ) + target_compile_options(${CORE_WIDGETS_ADDON} PRIVATE "/MP4") + +endif() + target_link_libraries(${CORE_WIDGETS_ADDON} PRIVATE "${CMAKE_JS_LIB}" Qt5::Widgets @@ -179,11 +191,3 @@ target_link_libraries(${CORE_WIDGETS_ADDON} PRIVATE Qt5::Gui ) - -if (WIN32) - target_compile_definitions(${CORE_WIDGETS_ADDON} PRIVATE - ENABLE_DLL_EXPORT=1 - ) - target_compile_options(${CORE_WIDGETS_ADDON} PRIVATE "/MP4") - -endif() \ No newline at end of file diff --git a/src/cpp/include/nodegui/core/Integration/qode-api.h b/src/cpp/include/nodegui/core/Integration/qode-api.h index f0f7d9b81..0d60bbc8c 100644 --- a/src/cpp/include/nodegui/core/Integration/qode-api.h +++ b/src/cpp/include/nodegui/core/Integration/qode-api.h @@ -1,8 +1,14 @@ +#ifdef _WIN32 +# define QODE_IMPORT __declspec(dllimport) +#else +# define QODE_IMPORT +#endif + #pragma once // From Qode headers namespace qode { -extern int qode_argc; -extern char **qode_argv; -typedef int (*QodeCustomRunLoopFunc)(); -extern void InjectCustomRunLoop(QodeCustomRunLoopFunc customRunLoop); +QODE_IMPORT extern int qode_argc; +QODE_IMPORT extern char **qode_argv; +QODE_IMPORT typedef int (*QodeCustomRunLoopFunc)(); +QODE_IMPORT extern void InjectCustomRunLoop(QodeCustomRunLoopFunc customRunLoop); } // namespace qode \ No newline at end of file