diff options
-rw-r--r-- | src/boost-test.cmake | 14 | ||||
-rw-r--r-- | src/boost.mk | 13 | ||||
-rw-r--r-- | src/cmake/test/CMakeLists.txt | 18 | ||||
-rw-r--r-- | src/pthreads.mk | 16 | ||||
-rw-r--r-- | src/sdl-test.cmake | 15 | ||||
-rw-r--r-- | src/sdl.mk | 14 | ||||
-rw-r--r-- | src/winpthreads-test.cmake | 18 |
7 files changed, 79 insertions, 29 deletions
diff --git a/src/boost-test.cmake b/src/boost-test.cmake new file mode 100644 index 0000000..3875fec --- /dev/null +++ b/src/boost-test.cmake @@ -0,0 +1,14 @@ +# This file is part of MXE. +# See index.html for further information. + +# partial module - included by src/cmake/CMakeLists.txt + +set(TGT test-${PKG}-cmake) + +enable_language(CXX) +add_executable(${TGT} ${CMAKE_CURRENT_LIST_DIR}/${PKG}-test.cpp) + +find_package(Boost ${PKG_VERSION} EXACT COMPONENTS chrono serialization system thread REQUIRED) +target_link_libraries(${TGT} ${Boost_LIBRARIES}) + +install(TARGETS ${TGT} DESTINATION bin) diff --git a/src/boost.mk b/src/boost.mk index c6f72bc..1d3c060 100644 --- a/src/boost.mk +++ b/src/boost.mk @@ -74,14 +74,9 @@ define $(PKG)_BUILD # test cmake mkdir '$(1).test-cmake' - (echo 'cmake_minimum_required(VERSION 2.8.11)'; \ - echo 'project(test-$(PKG)-cmake)'; \ - echo 'find_package(Boost COMPONENTS chrono serialization system thread REQUIRED)'; \ - echo 'add_executable(test-$(PKG)-cmake $(PREFIX)/../src/$(PKG)-test.cpp)'; \ - echo 'target_link_libraries(test-$(PKG)-cmake $${Boost_LIBRARIES})'; \ - echo 'install(TARGETS test-$(PKG)-cmake DESTINATION bin)'; \ - ) > '$(1).test-cmake/CMakeLists.txt' - - cd '$(1).test-cmake' && '$(TARGET)-cmake' . + cd '$(1).test-cmake' && '$(TARGET)-cmake' \ + -DPKG=$(PKG) \ + -DPKG_VERSION=$($(PKG)_VERSION) \ + '$(PWD)/src/cmake/test' $(MAKE) -C '$(1).test-cmake' -j 1 install endef diff --git a/src/cmake/test/CMakeLists.txt b/src/cmake/test/CMakeLists.txt new file mode 100644 index 0000000..31d4af2 --- /dev/null +++ b/src/cmake/test/CMakeLists.txt @@ -0,0 +1,18 @@ +# This file is part of MXE. +# See index.html for further information. + +# 2.8.11 is recommended as a minimum for Qt5 +# http://doc.qt.io/qt-5/cmake-manual.html +cmake_minimum_required(VERSION 2.8.11) + +# set languages in individual modules +project(mxe LANGUAGES NONE) + +# see cmake --help-policy <cmp> for details +cmake_policy(SET CMP0017 NEW) +cmake_policy(SET CMP0020 NEW) + +# so we can find pkg-test.cmake files to include +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../.. ${CMAKE_MODULE_PATH}) + +include(${PKG}-test) diff --git a/src/pthreads.mk b/src/pthreads.mk index a15fe15..6010904 100644 --- a/src/pthreads.mk +++ b/src/pthreads.mk @@ -25,17 +25,13 @@ define PTHREADS_TEST '$(TARGET)-gcc' \ -W -Wall -Werror -ansi -pedantic \ - '$(TOP_DIR)/src/pthreads-test.c' -o '$(PREFIX)/$(TARGET)/bin/test-pthreads.exe' \ + '$(TOP_DIR)/src/pthreads-test.c' -o '$(PREFIX)/$(TARGET)/bin/test-$(PKG).exe' \ `'$(TARGET)-pkg-config' --libs pthreads` # test cmake - mkdir '$(1).cmake' - (echo 'find_package(Threads REQUIRED)'; \ - echo 'add_executable(test-pthreads-cmake $(PREFIX)/../src/pthreads-test.c)'; \ - echo 'target_link_libraries(test-pthreads-cmake $${CMAKE_THREAD_LIBS_INIT})'; \ - echo 'install(TARGETS test-pthreads-cmake DESTINATION bin)'; \ - ) > '$(1).cmake/CMakeLists.txt' - - cd '$(1).cmake' && '$(TARGET)-cmake' . - $(MAKE) -C '$(1).cmake' -j 1 install + mkdir '$(1).test-cmake' + cd '$(1).test-cmake' && '$(TARGET)-cmake' \ + -DPKG=$(PKG) \ + '$(PWD)/src/cmake/test' + $(MAKE) -C '$(1).test-cmake' -j 1 install endef diff --git a/src/sdl-test.cmake b/src/sdl-test.cmake new file mode 100644 index 0000000..0b9a937 --- /dev/null +++ b/src/sdl-test.cmake @@ -0,0 +1,15 @@ +# This file is part of MXE. +# See index.html for further information. + +# partial module - included by src/cmake/CMakeLists.txt + +set(TGT test-${PKG}-cmake) + +enable_language(C) +add_executable(${TGT} ${CMAKE_CURRENT_LIST_DIR}/${PKG}-test.c) + +find_package(SDL ${PKG_VERSION} EXACT REQUIRED) +include_directories(${SDL_INCLUDE_DIRS}) +target_link_libraries(${TGT} ${SDL_LIBRARIES}) + +install(TARGETS ${TGT} DESTINATION bin) @@ -36,15 +36,9 @@ define $(PKG)_BUILD # test cmake mkdir '$(1).test-cmake' - (echo 'cmake_minimum_required(VERSION 2.8.11)'; \ - echo 'project(test-$(PKG)-cmake)'; \ - echo 'find_package(SDL REQUIRED)'; \ - echo 'include_directories($${SDL_INCLUDE_DIRS})'; \ - echo 'add_executable(test-$(PKG)-cmake $(PREFIX)/../src/$(PKG)-test.c)'; \ - echo 'target_link_libraries(test-$(PKG)-cmake $${SDL_LIBRARIES})'; \ - echo 'install(TARGETS test-$(PKG)-cmake DESTINATION bin)'; \ - ) > '$(1).test-cmake/CMakeLists.txt' - - cd '$(1).test-cmake' && '$(TARGET)-cmake' . + cd '$(1).test-cmake' && '$(TARGET)-cmake' \ + -DPKG=$(PKG) \ + -DPKG_VERSION=$($(PKG)_VERSION) \ + '$(PWD)/src/cmake/test' $(MAKE) -C '$(1).test-cmake' -j 1 install endef diff --git a/src/winpthreads-test.cmake b/src/winpthreads-test.cmake new file mode 100644 index 0000000..f818d90 --- /dev/null +++ b/src/winpthreads-test.cmake @@ -0,0 +1,18 @@ +# This file is part of MXE. +# See index.html for further information. + +# partial module - included by src/cmake/CMakeLists.txt + +set(TGT test-${PKG}-cmake) + +enable_language(C) +add_executable(${TGT} ${CMAKE_CURRENT_LIST_DIR}/pthreads-test.c) + +find_package(Threads REQUIRED) +if(Threads::Threads) # cmake 3.1.0+ + target_link_libraries(${TGT} Threads::Threads) +else() + target_link_libraries(${TGT} ${CMAKE_THREAD_LIBS_INIT}) +endif() + +install(TARGETS ${TGT} DESTINATION bin) |