15 Jun 2017

Kompil dan Install QJson dengan Windows10, Cmake, MinGW untuk qt4.8

Assalamualaikum

Untuk melancarkan penggunaan webservices yang banyak menggunakan json dalam kod program qt4.8, adalah perlu untuk kita kompil dan rujuk fail librari ini secara manual.

Untuk lebih mudah, gunakan qt versi 5 keatas kerana sokongan untuk json ini telah sedia install.


Keperluan

1. Muat turun dan install

2. Muat turun / git clone kod sumber qjson daripada github
https://github.com/flavio/qjson
- unzipkan fail ke dalam satu folder


3. Setkan Environment Path dalam windows anda

    1. Select Start, select Control Panel. double click System, and select the Advanced tab.
    2. Click Environment Variables. ...
    3. In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. ...

masukkan dalam path:

  1. C:\Qt\4.8.6\bin
  2. C:\MinGW\bin
  3. C:\Program Files\CMake\bin


4. Buka Command Prompt sebagai administrator 
-> klik kanan pada butang windows start, pilih command prompt (Admin)

5. Selusur ke folder qjson yang telah di unzip
  • guna arahan cd untuk buka folder
6. bina satu folder baru bernama build
7. buka folder build 
  • cd build
8. Masukkan arahan berikut: 

cmake -G "MinGW Makefiles" ..
C:\Users\user2\qjson-master\build>cmake -G "MinGW Makefiles" ..
-- The C compiler identification is GNU 5.3.0
-- The CXX compiler identification is GNU 5.3.0
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Deprecation Warning at CMakeLists.txt:11 (cmake_policy):
  The OLD behavior for policy CMP0020 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


Qt5 not found, searching for Qt4
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - not found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - found
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - not found
-- Found Qt4: C:/Qt/4.8.6/bin/qmake.exe (found suitable version "4.8.6", minimum required is "4.5")
Enable QStringBuilder
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/user2/qjson-master/build

9. Setelah selesai, masukkan arahan berikut pula

make
C:\Users\user2\qjson-master\build>make
[  8%] Generating moc_serializerrunnable.cxx
[ 16%] Generating moc_parserrunnable.cxx
Scanning dependencies of target qjson
[ 25%] Building CXX object src/CMakeFiles/qjson.dir/parser.cpp.obj
[ 33%] Building CXX object src/CMakeFiles/qjson.dir/qobjecthelper.cpp.obj
[ 41%] Building CXX object src/CMakeFiles/qjson.dir/json_scanner.cpp.obj
[ 50%] Building CXX object src/CMakeFiles/qjson.dir/json_parser.cc.obj
[ 58%] Building CXX object src/CMakeFiles/qjson.dir/parserrunnable.cpp.obj
[ 66%] Building CXX object src/CMakeFiles/qjson.dir/serializer.cpp.obj
[ 75%] Building CXX object src/CMakeFiles/qjson.dir/serializerrunnable.cpp.obj
[ 83%] Building CXX object src/CMakeFiles/qjson.dir/moc_parserrunnable.cxx.obj
[ 91%] Building CXX object src/CMakeFiles/qjson.dir/moc_serializerrunnable.cxx.obj
[100%] Linking CXX shared library libqjson.dll
[100%] Built target qjson

10. Akhir sekali, masukkan arahan ini

make install
C:\Users\user2\qjson-master\build>make install
[100%] Built target qjson
Install the project...
-- Install configuration: ""
-- Installing: C:/Program Files (x86)/qjson/lib/cmake/qjson/QJSONTargets.cmake
-- Installing: C:/Program Files (x86)/qjson/lib/cmake/qjson/QJSONTargets-noconfig.cmake
-- Installing: C:/Program Files (x86)/qjson/lib/cmake/qjson/QJSONConfig.cmake
-- Installing: C:/Program Files (x86)/qjson/lib/cmake/qjson/QJSONConfigVersion.cmake
-- Installing: C:/Program Files (x86)/qjson/lib/libqjson.dll.a
-- Installing: C:/Program Files (x86)/qjson/bin/libqjson.dll
-- Installing: C:/Program Files (x86)/qjson/include/qjson/parser.h
-- Installing: C:/Program Files (x86)/qjson/include/qjson/parserrunnable.h
-- Installing: C:/Program Files (x86)/qjson/include/qjson/qobjecthelper.h
-- Installing: C:/Program Files (x86)/qjson/include/qjson/serializer.h
-- Installing: C:/Program Files (x86)/qjson/include/qjson/serializerrunnable.h
-- Installing: C:/Program Files (x86)/qjson/include/qjson/qjson_export.h


kompil selesai.. selamat mencoba..


Tiada ulasan:

Catat Ulasan

Demo sero guano?