Skip to content

Commit

Permalink
feat: improve build system and environment handling
Browse files Browse the repository at this point in the history
* Enhance CMake configuration and build
  - Add OBJC_TAO_DEBUG_ENABLED option for debug builds
  - Update library linking with WHOLE_ARCHIVE support
  - Fix paths to use CMAKE_CURRENT_SOURCE_DIR consistently
  - Add config template for package installation

* Update VSCode integration
  - Use environment variables for include paths
  - Update debug configuration paths
  - Improve IntelliSense settings

* Environment and workflow improvements
  - Update GitHub Actions to use checkout@v4
  - Add workflow_dispatch support
  - Fix environment plugin handling
  - Update environment version to 5.3.0

* Other improvements
  - Enable include.h and include-private.h conditionals
  - Update trace environment variable name
  - Fix project version handling
  - Add mulle-clang-project dependency
  • Loading branch information
mulle-nat committed Nov 19, 2024
1 parent b364a02 commit 080fd7a
Show file tree
Hide file tree
Showing 30 changed files with 198 additions and 83 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dockerfile-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
if: ${{ ! env.ACT }}

- name: Build Docker image
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/mulle-sde-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ jobs:
- name: Dump Environment
run: env | sort

- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: mulle-sde/github-ci@v1

- uses: mulle-cc/github-ci@v4
- uses: mulle-cc/github-ci@v5

- name: List extensions
run: |
Expand Down
4 changes: 3 additions & 1 deletion .mulle/etc/project/formula-info.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .mulle/share/env/environment-plugin.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 14 additions & 13 deletions .mulle/share/env/environment.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .mulle/share/env/include-environment.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .mulle/share/env/tool-plugin

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .mulle/share/env/version

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .mulle/share/sde/version/mulle-sde/extension-cmake

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cmake_minimum_required( VERSION 3.14)

project( mulle-objc-developer NONE)
project( mulle-objc-developer VERSION 0.27.0 LANGUAGES NONE)

set( PROJECT_VERSION 0.26.1)
set( PROJECT_VERSION 0.27.0)


if( APPLE)
Expand Down
4 changes: 2 additions & 2 deletions CMakePackage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
set( CPACK_PACKAGE_NAME "${PROJECT_NAME}")
set( CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
set( CPACK_PACKAGE_CONTACT "[email protected]")
set( CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md")
set( CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "🎩 mulle-objc developer kit for mulle-sde")
set( CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
set( CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set( CPACK_STRIP_FILES false)


Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ RUN DEBIAN_FRONTEND=noninteractive \
&& chmod 755 installer-all \
&& ./installer-all /usr no \
\
&& wget "https://github.com/mulle-cc/mulle-clang-project/releases/download/17.0.6.0/mulle-clang-17.0.6.0-bookworm-amd64.deb" \
&& dpkg --install "mulle-clang-17.0.6.0-bookworm-amd64.deb"
&& wget "https://github.com/mulle-cc/mulle-clang-project/releases/download/17.0.6.2/mulle-clang-17.0.6.2-bookworm-amd64.deb" \
&& dpkg --install "mulle-clang-17.0.6.2-bookworm-amd64.deb"

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CI
on:
push:
branches:
- release
- master
pull_request:
workflow_dispatch:

Expand Down Expand Up @@ -33,11 +33,11 @@ jobs:
- name: Dump Environment
run: env | sort

- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: mulle-sde/github-ci@v1

- uses: mulle-cc/github-ci@v4
- uses: mulle-cc/github-ci@v5

- name: Dump Project Environment
run: |
Expand Down
2 changes: 1 addition & 1 deletion src/mulle-objc/github-actions/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.26.0
0.27.0
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,22 @@ if( NOT __COMPILER_FLAGS_OBJC_CMAKE__)
message( STATUS "# Include \"${CMAKE_CURRENT_LIST_FILE}\"" )
endif()

#
# only useful in mulle-objc
#
option( OBJC_TAO_DEBUG_ENABLED "Enable Objective-C TAO for debug builds" MULLE_OBJC)

set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OTHER_OBJC_FLAGS} ${UNWANTED_OBJC_WARNINGS}")
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OTHER_OBJC_FLAGS} ${UNWANTED_OBJC_WARNINGS}")

if( CMAKE_BUILD_TYPE)
if( NOT TMP_CONFIGURATION_NAME STREQUAL "DEBUG")
string( TOUPPER "${CMAKE_BUILD_TYPE}" TMP_CONFIGURATION_NAME)
if( TMP_CONFIGURATION_NAME STREQUAL "DEBUG")
if( OBJC_TAO_DEBUG_ENABLED)
message( STATUS "Objective-C TAO enabled")
add_definitions( "-fobjc-tao")
endif()
else()
add_definitions( "-DNS_BLOCK_ASSERTIONS" )
endif()
endif()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if( NOT LIBRARY_NAME)
endif()

if( NOT OBJC_LOADER_INC)
set( OBJC_LOADER_INC "${CMAKE_SOURCE_DIR}/<|PROJECT_SOURCE_DIR|>/reflect/objc-loader.inc")
set( OBJC_LOADER_INC "${CMAKE_CURRENT_SOURCE_DIR}/<|PROJECT_SOURCE_DIR|>/reflect/objc-loader.inc")
endif()

#
Expand Down Expand Up @@ -150,15 +150,15 @@ if( CREATE_OBJC_LOADER_INC)
# PROPERTIES GENERATED FALSE
# )

add_custom_target( "__objc_loader_inc__"
add_custom_target( "${LIBRARY_NAME}__objc_loader_inc__"
DEPENDS ${OBJC_LOADER_INC}
COMMENT "Target to build \"${OBJC_LOADER_INC}\""
)

if( TARGET "_2_${LIBRARY_NAME}")
add_dependencies( "_2_${LIBRARY_NAME}" "__objc_loader_inc__")
add_dependencies( "_2_${LIBRARY_NAME}" "${LIBRARY_NAME}__objc_loader_inc__")
else()
add_dependencies( "${LIBRARY_NAME}" "__objc_loader_inc__")
add_dependencies( "${LIBRARY_NAME}" "${LIBRARY_NAME}__objc_loader_inc__")
endif()

# seemingly needed
Expand All @@ -168,6 +168,5 @@ if( CREATE_OBJC_LOADER_INC)

endif()


include( CreateLoaderIncAuxObjC OPTIONAL)

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ set_target_properties( "${EXECUTABLE_NAME}"

#
# only for mulle-clang
# consider: set_target_properties(your_target PROPERTIES ENABLE_EXPORTS ON)
#
if( UNIX AND NOT (APPLE OR COSMOPOLITAN OR MUSL_STATIC_ONLY))
if( LINK_PHASE)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
### If you want to edit this, copy it from cmake/share to cmake. It will be
### picked up in preference over the one in cmake/share. And it will not get
### clobbered with the next upgrade.

# can be included multiple times


if( MULLE_TRACE_INCLUDE)
message( STATUS "# Include \"${CMAKE_CURRENT_LIST_FILE}\"" )
endif()

#
# the idea here is that this propagates up to the main project, if
# this project is added to another with add_subdirectory
#
# In your library's main CMakeLists.txt
if( CMAKE_VERSION VERSION_GREATER_EQUAL "3.24")
target_link_options( ${LIBRARY_NAME} INTERFACE "$<LINK_LIBRARY:WHOLE_ARCHIVE,${LIBRARY_NAME}>")
endif()

include( LibraryAuxObjC OPTIONAL)
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ if( NOT __OPTIMIZED_LINK_OBJC_CMAKE__)
# NORMAL_LOAD_LIBRARY # regular link this
#
if( NOT COVERAGE_DIR)
set( COVERAGE_DIR "${PROJECT_SOURCE_DIR}/coverage")
set( COVERAGE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/coverage")
endif()
if( NOT OPTIMIZE_DIR)
set( OPTIMIZE_DIR "${PROJECT_BINARY_DIR}/mulle-objc-optimize/optimize.d")
set( OPTIMIZE_DIR "${CMAKE_CURRENT_BINARY_DIR}/mulle-objc-optimize/optimize.d")
endif()
if( NOT OPTIMIZE_INFO_DIR)
set( OPTIMIZE_INFO_DIR "${PROJECT_SOURCE_DIR}/optimize")
set( OPTIMIZE_INFO_DIR "${CMAKE_CURRENT_SOURCE_DIR}/optimize")
endif()
if( NOT UNARCHIVE_DIR)
set( UNARCHIVE_DIR "${PROJECT_BINARY_DIR}/mulle-objc-optimize/unarchive.d")
set( UNARCHIVE_DIR "${CMAKE_CURRENT_BINARY_DIR}/mulle-objc-optimize/unarchive.d")
endif()

if( NOT EXISTS "${COVERAGE_DIR}/method-coverage.csv")
Expand All @@ -65,11 +65,11 @@ if( NOT __OPTIMIZED_LINK_OBJC_CMAKE__)
message( STATUS "OPTIMIZE_INFO_DIR is ${OPTIMIZE_INFO_DIR}")
message( STATUS "UNARCHIVE_DIR is ${UNARCHIVE_DIR}")
message( STATUS "DEPENDENCY_DIR is ${MULLE_SDK_DEPENDENCY_DIR}")
message( STATUS "PROJECT_BINARY_DIR is ${PROJECT_BINARY_DIR}")
message( STATUS "CMAKE_CURRENT_BINARY_DIR is ${CMAKE_CURRENT_BINARY_DIR}")

set( CUSTOM_OUTPUT
"${PROJECT_BINARY_DIR}/${OPTIMIZABLE_LOAD_NAME}"
"${PROJECT_BINARY_DIR}/${ALL_LOAD_NAME}"
"${CMAKE_CURRENT_BINARY_DIR}/${OPTIMIZABLE_LOAD_NAME}"
"${CMAKE_CURRENT_BINARY_DIR}/${ALL_LOAD_NAME}"
)

if( MSVC)
Expand Down Expand Up @@ -98,7 +98,7 @@ if( NOT __OPTIMIZED_LINK_OBJC_CMAKE__)
--dependency-dir "${MULLE_SDK_DEPENDENCY_DIR}"
--optimize-info-dir "${OPTIMIZE_INFO_DIR}"
--optimize-dir "${OPTIMIZE_DIR}"
--prefix "${PROJECT_BINARY_DIR}"
--prefix "${CMAKE_CURRENT_BINARY_DIR}"
--unarchive-dir "${UNARCHIVE_DIR}"
${ALL_LOAD_DEPENDENCY_LIBRARIES}
DEPENDS ${ALL_LOAD_DEPENDENCY_LIBRARIES}
Expand All @@ -112,17 +112,17 @@ if( NOT __OPTIMIZED_LINK_OBJC_CMAKE__)

# replace ALL_LOAD_DEPENDENCY_LIBRARIES with the non-optimzable stuff
set( ALL_LOAD_DEPENDENCY_LIBRARIES
"${PROJECT_BINARY_DIR}/${ALL_LOAD_NAME}"
"${CMAKE_CURRENT_BINARY_DIR}/${ALL_LOAD_NAME}"
)

#
# move the rest which are optimized into regular DEPENDENCY_LIBRARIES
# to pick up regular C symbols
#
set( DEPENDENCY_LIBRARIES
"${PROJECT_BINARY_DIR}/${OPTIMIZABLE_LOAD_NAME}"
"${CMAKE_CURRENT_BINARY_DIR}/${OPTIMIZABLE_LOAD_NAME}"
${DEPENDENCY_LIBRARIES}
"${PROJECT_BINARY_DIR}/${OPTIMIZABLE_LOAD_NAME}"
"${CMAKE_CURRENT_BINARY_DIR}/${OPTIMIZABLE_LOAD_NAME}"
)

add_dependencies( ${LIBRARY_NAME} "_${LIBRARY_NAME}_optimized_libraries")
Expand Down
Loading

0 comments on commit 080fd7a

Please sign in to comment.