CMake & Arm Cross compilation based Windows systems

CMakeLists.txt

  1. cmake_minimum_required(VERSION 3.12)
  2. project(untitled1)
  3.  
  4. SET(CMAKE_SYSTEM_NAME Linux)
  5.  
  6. add_definitions("-std=c++17")
  7.  
  8. SET(CMAKE_C_COMPILER   arm-linux-gnueabihf-gcc)
  9. SET(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
  10.  
  11. if(${CMAKE_HOST_SYSTEM_NAME} MATCHES "Windows")
  12.     set(BOOST_ROOT "C:/MinGW/msys/1.0/home/d/boost_1_68_0")
  13. else()
  14.     set(BOOST_ROOT /root/Downloads/boost_1_68_0)
  15. endif()
  16.  
  17. set(Boost_USE_STATIC_LIBS ON)
  18. set(Boost_USE_MULTITHREADED ON)
  19.  
  20. find_package(Boost COMPONENTS regex system date_time timer REQUIRED)
  21. if(Boost_FOUND)
  22.     include_directories(${Boost_INCLUDE_DIRS})
  23.     link_directories("${Boost_INCLUDE_DIRS}/stage/lib")
  24.     include_directories(sdk/inc)
  25.     link_directories("sdk/lib")
  26.     MESSAGE( STATUS "Boost_INCLUDE_DIRS = ${Boost_INCLUDE_DIRS}.")
  27.     MESSAGE( STATUS "Boost_LIBRARIES = ${Boost_LIBRARIES}.")
  28.     MESSAGE( STATUS "Boost_LIB_VERSION = ${Boost_LIB_VERSION}.")
  29.  
  30.     add_executable(untitled1 main.cpp)
  31.  
  32.     TARGET_LINK_LIBRARIES(untitled1 ${Boost_LIBRARIES} "-lpthread" "-lpos" "-lrt" "-lpng" "-liconv" "-lfreetype" "-lz" "-l:libboost_system.a")
  33. endif()

GNUlinux_config.cmake

  1. set(GNULINUX_PLATFORM ON)
  2. set(CMAKE_SYSTEM_NAME "Linux")
  3. set(CMAKE_SYSTEM_PROCESSOR "arm")
  4.  
  5. if(NOT DEFINED ENV{NE10_LINUX_TARGET_ARCH})
  6.    set(NE10_LINUX_TARGET_ARCH "armv7")
  7. else()
  8.    set(NE10_LINUX_TARGET_ARCH $ENV{NE10_LINUX_TARGET_ARCH})
  9. endif()
  10.  
  11. if(NE10_LINUX_TARGET_ARCH STREQUAL "armv7")
  12.    set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
  13.    set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
  14.    set(CMAKE_ASM_COMPILER arm-linux-gnueabihf-as)
  15.    find_program(CMAKE_AR NAMES "arm-linux-gnueabihf-ar")
  16.    find_program(CMAKE_RANLIB NAMES "arm-linux-gnueabihf-ranlib")
  17. elseif(NE10_LINUX_TARGET_ARCH STREQUAL "aarch64")
  18.    set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
  19.    set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)
  20.    set(CMAKE_ASM_COMPILER aarch64-linux-gnu-as)
  21.    find_program(CMAKE_AR NAMES "aarch64-linux-gnu-ar")
  22.    find_program(CMAKE_RANLIB NAMES "aarch64-linux-gnu-ranlib")
  23. endif()
  24.  
  25. mark_as_advanced(CMAKE_AR)
  26. mark_as_advanced(CMAKE_RANLIB)

The Most Important Thing on Windows

cmake -DCMAKE_TOOLCHAIN_FILE=GNUlinux_config.cmake ..

Apache Axis2/C Installation Guide (Windows)

First

http://archive.apache.org/dist/ws/axis2/c/1_6_0/axis2c-bin-1.6.0-win32.zip
ftp://ftp.zlatkovic.com/libxml/libxml2-2.7.8.win32.zip
ftp://ftp.zlatkovic.com/libxml/iconv-1.9.2.win32.zip
ftp://ftp.zlatkovic.com/libxml/zlib-1.2.5.win32.zip
http://archive.apache.org/dist/httpd/binaries/win32/httpd-2.2.25-win32-x86-openssl-0.9.8y.msi

Install Axis2/C

  1. Extract the binary distribution to a folder of your choice.(example: C:\axis2c-bin-1.6.0-win32)
  2. Copy the iconv.dll, libxml2.dll and zlib1.dll to C:\axis2c-bin-1.6.0-win32\lib
  3. Set the variable AXIS2C_HOME to the deploy folder (C:\axis2c-bin-1.6.0-win32)
  4. Add the path to lib directory to the PATH variable (%AXIS2C_HOME%\lib)

Install Apache 2.2

  1. Copy C:\axis2c-bin-1.6.0-win32\lib\mod_axis2.dll C:\Apache22\modules\mod_axis2.so
  2. Edit the Apache2’s configuration file (generally httpd.conf) and add the following directives
  3. LoadModule axis2_module modules/mod_axis2.so
    Axis2RepoPath C:/axis2c-bin-1.6.0-win32
    Axis2LogFile C:/axis2c-bin-1.6.0-win32/logs
    Axis2MaxLogFileSize 40
    Axis2LogLevel warn
  4. Restart apache2 and test whether mod_axis2 module is loaded by typing the URL http://localhost/axis2/services in your Web browser

How to build Google’s protobuf in Windows using MinGW

CMAKE Config


mingw32-make & install

  1. c:\protobuf-3.5.1build>mingw32-make
  2. Scanning dependencies of target libprotobuf-lite
  3. [  0%] Building CXX object CMakeFiles/libprotobuf-lite.dir/C_/protobuf-3.5.1/src/google/protobuf/arena.cc.obj
  4. [  1%] Building CXX object CMakeFiles/libprotobuf-lite.dir/C_/protobuf-3.5.1/src/google/protobuf/arenastring.cc.obj
  5. [  1%] Building CXX object CMakeFiles/libprotobuf-lite.dir/C_/protobuf-3.5.1/src/google/protobuf/extension_set.cc.obj
  6. [  2%] Building CXX object CMakeFiles/libprotobuf-lite.dir/C_/protobuf-3.5.1/src/google/protobuf/generated_message_table_driven_lite.cc.obj
  7. ......
  8.  
  9. c:\protobuf-3.5.1build>mingw32-make install
  10. [ 12%] Built target libprotobuf-lite
  11. [ 52%] Built target libprotobuf
  12. [ 52%] Built target js_embed
  13. [ 99%] Built target libprotoc
  14. [100%] Built target protoc
  15. Install the project...
  16. -- Install configuration: ""
  17. -- Installing: C:/protobuf-3.5.1-qt5.9/lib/libprotobuf-lite.a
  18. -- Installing: C:/protobuf-3.5.1-qt5.9/lib/libprotobuf.a
  19. -- Installing: C:/protobuf-3.5.1-qt5.9/lib/libprotoc.a
  20. -- Installing: C:/protobuf-3.5.1-qt5.9/bin/protoc.exe
  21. ......